diff --git a/.babelrc b/.babelrc.json similarity index 100% rename from .babelrc rename to .babelrc.json diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 596bcaa..da6c006 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -6,36 +6,9 @@ on: - master pull_request: -env: - NODE_VERSION: 16.x - jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Install dependencies - run: npm install - - name: Run ESLint - run: npm run eslint - test: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [12.x, 14.x, 16.x] - fail-fast: false - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: npm install - - name: Run tests - run: npm run test-coverage - - name: Send coverage report to Codecov - uses: codecov/codecov-action@v2 + nodejs: + # Documentation: https://github.com/zakodium/workflows#nodejs-ci + uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1 + with: + node-version-matrix: "[12, 14, 16]" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d59b13b..29735ef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,33 +5,12 @@ on: branches: - master -env: - NODE_VERSION: 16.x - jobs: - release-please: - runs-on: ubuntu-latest - steps: - - name: Get package name - run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV - - uses: GoogleCloudPlatform/release-please-action@v2 - id: release - with: - token: ${{ secrets.BOT_TOKEN }} - release-type: node - package-name: ${{ env.PACKAGE_NAME }} - bump-minor-pre-major: Yes - - uses: actions/checkout@v2 - # These if statements ensure that a publication only occurs when a new release is created - if: ${{ steps.release.outputs.release_created }} - - uses: actions/setup-node@v2 - with: - node-version: ${{ env.NODE_VERSION }} - registry-url: 'https://registry.npmjs.org' - if: ${{ steps.release.outputs.release_created }} - - run: npm install - if: ${{ steps.release.outputs.release_created }} - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_TOKEN }} - if: ${{ steps.release.outputs.release_created }} + release: + # Documentation: https://github.com/zakodium/workflows#release + uses: zakodium/workflows/.github/workflows/release.yml@release-v1 + with: + npm: true + secrets: + github-token: ${{ secrets.BOT_TOKEN }} + npm-token: ${{ secrets.NPM_BOT_TOKEN }} diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..04ff376 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "arrowParens": "always", + "tabWidth": 2, + "singleQuote": true, + "semi": true, + "trailingComma": "all" +} diff --git a/package.json b/package.json index ac5f78f..392f05c 100644 --- a/package.json +++ b/package.json @@ -14,10 +14,11 @@ "compile": "rollup -c", "eslint": "eslint src", "eslint-fix": "npm run eslint -- --fix", - "prepublishOnly": "npm run compile", - "test": "npm run test-coverage && npm run eslint", - "test-only": "jest", - "test-coverage": "jest --coverage" + "prepack": "npm run compile", + "prettier": "prettier --check src", + "prettier-write": "prettier --write src", + "test": "npm run test-only && npm run eslint && npm run prettier", + "test-only": "jest --coverage" }, "repository": { "type": "git", @@ -46,8 +47,6 @@ "@types/jest": "^26.0.20", "eslint": "^7.21.0", "eslint-config-cheminfo": "^5.2.3", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jest": "^24.1.5", "esm": "^3.2.25", "jcampconverter": "^7.7.0", "jest": "^26.6.3",