From 2443bd4a0857c7ce41ff9f884844d3b2321e1d89 Mon Sep 17 00:00:00 2001 From: Kurtis Rainbolt-Greene Date: Tue, 29 Dec 2020 19:46:03 -0800 Subject: [PATCH] Updating the repository based on a modern look at libraries --- .github/workflows/cd.yml | 44 +++++++++++++++++++--------------------- .github/workflows/ci.yml | 32 +++++++++++++++++++++++++++-- .gitignore | 1 + babel.config.js | 16 ++++++++++----- jest.config.js | 1 - package-lock.json | 31 ++++++++++++++++++++++------ package.json | 7 ++++--- tsconfig.json | 1 - 8 files changed, 92 insertions(+), 41 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 21cefbf..ef856d8 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -6,35 +6,33 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 14 + - uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- - run: npm install + - uses: actions/cache@v2 + with: + path: "*.js" + key: ${{ runner.OS }}-build-${{ hashFiles('*.js') }} + restore-keys: | + ${{ runner.OS }}-build- - run: npm run build - test: - needs: build - runs-on: ubuntu-latest - steps: - - run: npm run test - lint: - needs: build - runs-on: ubuntu-latest - steps: - - run: npm run lint - typecheck: - needs: build - runs-on: ubuntu-latest - steps: - - run: npm run typecheck publish-npm: - needs: [test, lint, typecheck] + needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 14 registry-url: https://registry.npmjs.org/ - run: npm publish env: @@ -43,12 +41,12 @@ jobs: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 14 registry-url: https://npm.pkg.github.com/ - scope: '@unctionjs' + scope: "@unction" - run: npm publish env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3a04b5..1a9fe77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,24 +4,52 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: - node-version: 12 + node-version: 14 + - uses: actions/cache@v2 + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- - run: npm install + - uses: actions/cache@v2 + with: + path: "*.js" + key: ${{ runner.OS }}-build-${{ hashFiles('*.js') }} + restore-keys: | + ${{ runner.OS }}-build- - run: npm run build test: needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + - run: npm install - run: npm run test lint: needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + - run: npm install - run: npm run lint typecheck: needs: build runs-on: ubuntu-latest steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + - run: npm install - run: npm run typecheck diff --git a/.gitignore b/.gitignore index db9187c..62655aa 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /.nyc_output/ browser.js main.js +module.js # Log files *.log diff --git a/babel.config.js b/babel.config.js index 4efa64b..5d4c2c5 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,28 +1,34 @@ module.exports = { - "sourceMaps": "inline", presets: [ "@babel/preset-typescript" ], plugins: [ "@babel/plugin-proposal-object-rest-spread", + ["@babel/plugin-proposal-pipeline-operator", {"proposal": "fsharp"}] ], env: { main: { presets: [ - ["@babel/preset-env", {useBuiltIns: "usage", corejs: "3.6", targets: {"node": 10}}], + ["@babel/preset-env", {"modules": "cjs", useBuiltIns: "usage", corejs: 3, targets: {"node": 14}}], + "minify" + ] + }, + module: { + presets: [ + ["@babel/preset-env", {"modules": false, useBuiltIns: "usage", corejs: 3, targets: {"node": 14}}], "minify" ] }, browser: { + sourceMaps: "inline", presets: [ - ["@babel/preset-env", {useBuiltIns: "usage", corejs: "3.6"}], + ["@babel/preset-env", {useBuiltIns: "usage", corejs: 3}], "minify" ] }, test:{ presets: [ - ["@babel/preset-env", {useBuiltIns: "usage", corejs: "3.6", targets: {"node": "current"}}], - "minify" + ["@babel/preset-env", {useBuiltIns: "usage", corejs: 3, targets: {"node": "current"}}] ], "plugins": [ "annotate-console-log" diff --git a/jest.config.js b/jest.config.js index 40689b2..57743fd 100644 --- a/jest.config.js +++ b/jest.config.js @@ -4,4 +4,3 @@ module.exports = { "./index.ts", ], }; - diff --git a/package-lock.json b/package-lock.json index ebe758f..1f7c842 100644 --- a/package-lock.json +++ b/package-lock.json @@ -822,6 +822,16 @@ "@babel/plugin-syntax-optional-chaining": "^7.8.0" } }, + "@babel/plugin-proposal-pipeline-operator": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-pipeline-operator/-/plugin-proposal-pipeline-operator-7.12.1.tgz", + "integrity": "sha512-iloNp4xu8YV8e/mZgGjePg9be1VkJSxQWIplRwgQtQPtF26ar3cHXL4sV8Fujlm2mm/Tu/WiA+FU+Fp7QVP7/g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4", + "@babel/plugin-syntax-pipeline-operator": "^7.12.1" + } + }, "@babel/plugin-proposal-private-methods": { "version": "7.12.1", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.12.1.tgz", @@ -959,6 +969,15 @@ "@babel/helper-plugin-utils": "^7.8.0" } }, + "@babel/plugin-syntax-pipeline-operator": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-pipeline-operator/-/plugin-syntax-pipeline-operator-7.12.1.tgz", + "integrity": "sha512-NazCTl1P9Kp+790g7gDRQEvhU0+OYbZVsuW45ThfgVCdUyhtxzFJeFrzY6BX/u/NfFyXWbKAIl6wR0PhJWwyDA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, "@babel/plugin-syntax-top-level-await": { "version": "7.12.1", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.12.1.tgz", @@ -3251,9 +3270,9 @@ } }, "@types/jest": { - "version": "26.0.15", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.15.tgz", - "integrity": "sha512-s2VMReFXRg9XXxV+CW9e5Nz8fH2K1aEhwgjUqPPbQd7g95T0laAcvLv032EhFHIa5GHsZ8W7iJEQVaJq6k3Gog==", + "version": "26.0.19", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.19.tgz", + "integrity": "sha512-jqHoirTG61fee6v6rwbnEuKhpSKih0tuhqeFbCmMmErhtu3BYlOZaXWjffgOstMM4S/3iQD31lI5bGLTrs97yQ==", "dev": true, "requires": { "jest-diff": "^26.0.0", @@ -3283,9 +3302,9 @@ } }, "@types/yargs": { - "version": "15.0.11", - "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.11.tgz", - "integrity": "sha512-jfcNBxHFYJ4nPIacsi3woz1+kvUO6s1CyeEhtnDHBjHUMNj5UlW2GynmnSgiJJEdNg9yW5C8lfoNRZrHGv5EqA==", + "version": "15.0.12", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.12.tgz", + "integrity": "sha512-f+fD/fQAo3BCbCDlrUpznF1A5Zp9rB0noS5vnoormHSIPFKL0Z2DcUJ3Gxp5ytH4uLRNxy7AwYUC9exZzqGMAw==", "dev": true, "requires": { "@types/yargs-parser": "*" diff --git a/package.json b/package.json index ca6fb9a..04bf2b1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ } ], "main": "main.js", - "module": "main.js", + "module": "module.js", "browser": "browser.js", "types": "index.ts", "files": [ @@ -45,7 +45,7 @@ "@babel/plugin-proposal-object-rest-spread": "^7.12.1", "@babel/preset-env": "^7.12.7", "@babel/preset-typescript": "^7.12.7", - "@types/jest": "^26.0.15", + "@types/jest": "^26.0.19", "@types/node": "^14.14.10", "@typescript-eslint/eslint-plugin": "^4.8.2", "@typescript-eslint/parser": "^4.8.2", @@ -63,7 +63,8 @@ "eslint-plugin-unicorn": "^23.0.0", "jest": "^26.6.3", "jest-extended": "^0.11.5", - "typescript": "^4.1.2" + "typescript": "^4.1.2", + "@babel/plugin-proposal-pipeline-operator": "^7.12.1" }, "dependencies": {} } diff --git a/tsconfig.json b/tsconfig.json index 1292937..a02da94 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,4 +8,3 @@ "strict": true } } -