diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d923f5f..69a4405 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,104 +3,51 @@ on: push: branches: - 'master' - - 'develop' - - 'release/**' - - 'hotfix/**' - - 'ci/**' jobs: - compile: + deploy: + if: startsWith(github.repository, 'noeppi-noeppi/') # don't run this in forks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 12.x - - - name: Cache node_modules - id: cache_node_modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} - - if: steps.cache_node_modules.outputs.cache-hit != 'true' - run: yarn install - - - run: yarn run compile - - test: - needs: compile - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Cache node_modules - id: cache_node_modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} - - if: steps.cache_node_modules.outputs.cache-hit != 'true' - run: yarn install - - - run: yarn run test_coverage - - lint: - if: contains(github.ref, 'refs/heads/develop') || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/heads/hotfix') || contains(github.ref, 'refs/heads/ci') - needs: [compile,test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Cache node_modules - id: cache_node_modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} - - if: steps.cache_node_modules.outputs.cache-hit != 'true' - run: yarn install - - - run: yarn run lint - - run: yarn run test - - run: | - npx @siliconjungles/rn-scripts commit_all " - repo=https://$GITHUB_ACTOR:${{secrets.GITHUB_TOKEN}}@github.com/$GITHUB_REPOSITORY.git - branch=${GITHUB_REF:11} - message=Automated Linting" - - publish: - if: contains(github.ref, 'refs/heads/master') - needs: [compile, test] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: '12' - - - name: Cache node_modules - id: cache_node_modules - uses: actions/cache@v1 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} - - if: steps.cache_node_modules.outputs.cache-hit != 'true' - run: yarn install - - - run: npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} - - run: npm publish --access public - - - run: echo ::set-env name=VERSION_NAME::$(npx @siliconjungles/rn-scripts get_version_name) - - - run: | - npx @siliconjungles/rn-scripts commit_tag " - tag=${{env.VERSION_NAME}} - repo=https://$GITHUB_ACTOR:${{secrets.GITHUB_TOKEN}}@github.com/$GITHUB_REPOSITORY.git - message=${{env.VERSION_NAME}}" + - name: 'Checkout' + uses: actions/checkout@v2 + with: + path: base + + - name: 'Remove dist from gitignore' + shell: bash + working-directory: base + run: | + perl -i -ne 'print$_ unless/\/?dist\s*/' .gitignore + + - name: 'Setup node' + uses: actions/setup-node@v2 + with: + node-version: '16' + + - name: 'Setup yarn' + shell: bash + run: sudo npm install -g yarn + + - name: 'Installing dependencies' + shell: bash + working-directory: base + run: npx yarn install + + - name: 'Compiling' + shell: bash + working-directory: base + run: | + npx yarn run compile + npx yarn run prepublish + + - name: 'Push' + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_user_name: github-actions[bot] + commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com + commit_message: Deploy + repository: base + branch: 'build' + skip_checkout: true + push_options: '--force' diff --git a/.gitignore b/.gitignore index 3ec4f8e..774cf20 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -node_modules +node_modules dist .idea package-lock.json diff --git a/package.json b/package.json index 0148d97..743430d 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,10 @@ "jest": "^24.9.0", "prettier": "^1.19.1", "ts-jest": "^24.2.0", - "typescript": "^3.7.4" + "typescript": "^4.5.5" }, "meta": { "npm_template_version": "0.1.5" } } + diff --git a/src/Http.ts b/src/Http.ts index 4228e25..22ce571 100644 --- a/src/Http.ts +++ b/src/Http.ts @@ -1,5 +1,5 @@ import axios, { AxiosInstance, AxiosResponse } from 'axios' -import qs from 'querystring' +import * as qs from 'querystring' import { OAuth2Token } from './Token' // TODO: Immutability diff --git a/src/Token.ts b/src/Token.ts index 82cf2df..dadec9c 100644 --- a/src/Token.ts +++ b/src/Token.ts @@ -53,7 +53,7 @@ export class OAuth2Token { this.token = { ...data, ...{ expires_on: DateUtil.add(data.expires_in * 1000) } } } catch (e) { - rethrow(new Error('Unable to obtain O2A token'), e) + rethrow(new Error('Unable to obtain O2A token'), e instanceof Error ? e : new Error(String(e))) } } diff --git a/tsconfig.json b/tsconfig.json index 8aa5947..d869f88 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -65,6 +65,8 @@ /* Advanced Options */ "skipLibCheck": true, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */ + "resolveJsonModule": true, + "noUncheckedIndexedAccess": true } } diff --git a/yarn.lock b/yarn.lock index eef58cc..cb64661 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3966,10 +3966,10 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -typescript@^3.7.4: - version "3.7.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae" - integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw== +typescript@^4.5.5: + version "4.5.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.5.tgz#d8c953832d28924a9e3d37c73d729c846c5896f3" + integrity sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA== uglify-js@^3.1.4: version "3.7.2"