Skip to content

Commit

Permalink
Rewrite using TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
GoneTone committed Jun 1, 2022
1 parent 319540d commit 475648f
Show file tree
Hide file tree
Showing 19 changed files with 118,647 additions and 3,992 deletions.
16 changes: 12 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
module.exports = {
env: {
commonjs: true,
browser: true,
es2021: true,
node: true,
jest: true
},
extends: [
'standard'
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 12
ecmaVersion: 13,
sourceType: 'module'
},
rules: {
}
ignorePatterns: [
'**/dist/*',
'**/proto/*'
],
plugins: [
'@typescript-eslint'
],
rules: {}
}
7 changes: 5 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ on:
types: [ published ]

jobs:
test:
npm-publish:
runs-on: ${{ matrix.operating-system }}

strategy:
fail-fast: false

matrix:
operating-system: [ ubuntu-latest ]
node-version: [ 16.x ]
node-version: [ 14.x ]

name: NPM Publish
steps:
Expand All @@ -29,6 +29,9 @@ jobs:
- name: Install Dependencies
run: npm install

- name: TypeScript Compiler
run: npm run build

- name: Publish
run: npm publish --access public
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/node_modules/
/.env
/.idea/
/dist/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Please note:
## Examples

```javascript
const GooglePlayAPI = require('@gonetone/google-play-api')
const { GooglePlayAPI } = require('@gonetone/google-play-api')
```

### Using GooglePlayAPI
Expand Down
2 changes: 1 addition & 1 deletion README_ZH-TW.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ npm install @gonetone/google-play-api
## 使用方法

```javascript
const GooglePlayAPI = require('@gonetone/google-play-api')
const { GooglePlayAPI } = require('@gonetone/google-play-api')
```

### 使用 GooglePlayAPI 物件
Expand Down
17 changes: 8 additions & 9 deletions tests/GooglePlayAPI.test.js → __tests__/GooglePlayAPI.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2021 GoneTone
* Copyright 2022 GoneTone
*
* Google Play API (Unofficial Node.js Library)
* https://github.com/GoneToneStudio/node-google-play-api
Expand All @@ -10,22 +10,21 @@
* GooglePlayAPI Test
*/

'use strict'
import dotenv from 'dotenv'
import { GooglePlayAPI } from '../src'

require('dotenv').config()
dotenv.config()

const GooglePlayAPI = require('..')

let gpAPI
let gpAPI: GooglePlayAPI
test('Init', () => {
gpAPI = new GooglePlayAPI(process.env.GOOGLE_TEST_EMAIL, process.env.GOOGLE_TEST_GFS_ID)
gpAPI = new GooglePlayAPI(process.env.GOOGLE_TEST_EMAIL as string, process.env.GOOGLE_TEST_GFS_ID as string)
})

test('Google Auth', async () => {
await gpAPI.googleAuth(process.env.GOOGLE_TEST_AUTH_TOKEN)
await gpAPI.googleAuth(process.env.GOOGLE_TEST_AUTH_TOKEN as string)
})

let details
let details: any
test('Get App Details', async () => {
details = await gpAPI.appDetails('com.github.android')
expect(typeof details).toBe('object')
Expand Down
42 changes: 0 additions & 42 deletions index.js

This file was deleted.

6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
coverageDirectory: 'coverage',
preset: 'ts-jest',
testEnvironment: 'node'
}
Loading

0 comments on commit 475648f

Please sign in to comment.