From 2ca25fdde9feff3109c9e9791baa5a8140315b7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 6 Jan 2023 17:04:51 +0000 Subject: [PATCH 1/8] b778: publish with github action --- .github/workflows/pr.yml | 12 ++++++++++++ .github/workflows/publish.yaml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..33d6aab --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: PR Build +on: pull_request +jobs: + code-quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - run: npm ci + - run: npm run lint diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..10c0e09 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,30 @@ +on: + push: + branches: + - main +jobs: + deploy: + name: Publish + runs-on: ubuntu-latest + environment: development + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install_token + id: install + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + shell: bash + - name: NPM_install + id: npm_install + run: | + npm ci + - name: publish npm module + if: github.ref == 'refs/heads/main' + run: npm publish + shell: bash From 036a80cf6bbf82bd466e69733558a16e2f8853c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 6 Jan 2023 17:05:29 +0000 Subject: [PATCH 2/8] 2.4.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 53de893..bd617f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "oops-error", - "version": "2.4.0", + "version": "2.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "oops-error", - "version": "2.4.0", + "version": "2.4.1", "license": "ISC", "dependencies": { "uuid": "^9.0.0" diff --git a/package.json b/package.json index 0eb7f61..0ce1466 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oops-error", - "version": "2.4.0", + "version": "2.4.1", "description": "", "main": "./dist/lib/index.js", "scripts": { From 26591770182b6d3e5bd88b8ca60658086a269e7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 6 Jan 2023 17:09:34 +0000 Subject: [PATCH 3/8] b778: publish when pushing to master branch --- .github/workflows/publish.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 10c0e09..435d3ca 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,7 +1,7 @@ on: push: branches: - - main + - master jobs: deploy: name: Publish @@ -25,6 +25,6 @@ jobs: run: | npm ci - name: publish npm module - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/master' run: npm publish shell: bash From 62ac0dec2bd68b7a3ba089055e05b30c0aa961a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 10 Feb 2023 14:10:02 +0000 Subject: [PATCH 4/8] add cause to Oops factory functions --- lib/index.ts | 14 ++++++++++++-- package-lock.json | 42 +++++++++++++++++++++--------------------- package.json | 6 +++--- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 4d98d6b..dabc9bb 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -94,11 +94,16 @@ export const assert = (value: any, message: string, context?: {}): void => { } } -export const newOperationalOops = (message: string, context?: {}) => { +export const newOperationalOops = ( + message: string, + context?: {}, + cause?: Error +) => { return new Oops({ message, category: constants.OperationalError, context, + cause, }) } @@ -109,11 +114,16 @@ export const operationalOops = (message: string, context?: {}) => { throw newOperationalOops(message, context) } -export const newProgrammerOops = (message: string, context?: {}) => { +export const newProgrammerOops = ( + message: string, + context?: {}, + cause?: Error +) => { return new Oops({ message, category: constants.ProgrammerError, context, + cause, }) } diff --git a/package-lock.json b/package-lock.json index bd617f8..0c40b9a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,17 +14,17 @@ "devDependencies": { "@types/chai": "^4.3.4", "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", + "@types/node": "^18.13.0", "chai": "^4.3.7", "husky": "^8.0.3", "mocha": "^10.2.0", - "prettier": "^2.8.1", + "prettier": "^2.8.4", "sinon": "^15.0.1", "ts-mocha": "^10.0.0", "ts-node": "^10.9.1", "tslint": "^6.1.3", "tslint-config-prettier": "^1.18.0", - "typescript": "^4.9.4" + "typescript": "^4.9.5" } }, "node_modules/@babel/code-frame": { @@ -178,9 +178,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "version": "18.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", + "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==", "dev": true }, "node_modules/acorn": { @@ -1185,9 +1185,9 @@ } }, "node_modules/prettier": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz", - "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==", + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true, "bin": { "prettier": "bin-prettier.js" @@ -1640,9 +1640,9 @@ } }, "node_modules/typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -1932,9 +1932,9 @@ "dev": true }, "@types/node": { - "version": "18.11.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", - "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", + "version": "18.13.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", + "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==", "dev": true }, "acorn": { @@ -2672,9 +2672,9 @@ "dev": true }, "prettier": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.1.tgz", - "integrity": "sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==", + "version": "2.8.4", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.4.tgz", + "integrity": "sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==", "dev": true }, "randombytes": { @@ -2993,9 +2993,9 @@ "dev": true }, "typescript": { - "version": "4.9.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", - "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", "dev": true }, "uuid": { diff --git a/package.json b/package.json index 0ce1466..e0ddff6 100644 --- a/package.json +++ b/package.json @@ -21,17 +21,17 @@ "devDependencies": { "@types/chai": "^4.3.4", "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", + "@types/node": "^18.13.0", "chai": "^4.3.7", "husky": "^8.0.3", "mocha": "^10.2.0", - "prettier": "^2.8.1", + "prettier": "^2.8.4", "sinon": "^15.0.1", "ts-mocha": "^10.0.0", "ts-node": "^10.9.1", "tslint": "^6.1.3", "tslint-config-prettier": "^1.18.0", - "typescript": "^4.9.4" + "typescript": "^4.9.5" }, "files": [ "dist/lib", From 248a84e23ed0c5d3cfaeabd708402c46ebf15edf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 10 Feb 2023 14:10:21 +0000 Subject: [PATCH 5/8] 2.4.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0c40b9a..0ced90c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "oops-error", - "version": "2.4.1", + "version": "2.4.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "oops-error", - "version": "2.4.1", + "version": "2.4.2", "license": "ISC", "dependencies": { "uuid": "^9.0.0" diff --git a/package.json b/package.json index e0ddff6..f525493 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oops-error", - "version": "2.4.1", + "version": "2.4.2", "description": "", "main": "./dist/lib/index.js", "scripts": { From a480da2eca1bb88ad0b8decd41f2a4352e908a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 10 Feb 2023 14:13:55 +0000 Subject: [PATCH 6/8] remove git workflow files --- .github/workflows/pr.yml | 12 ------------ .github/workflows/publish.yaml | 30 ------------------------------ 2 files changed, 42 deletions(-) delete mode 100644 .github/workflows/pr.yml delete mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 33d6aab..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: PR Build -on: pull_request -jobs: - code-quality: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: lts/* - - run: npm ci - - run: npm run lint diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml deleted file mode 100644 index 435d3ca..0000000 --- a/.github/workflows/publish.yaml +++ /dev/null @@ -1,30 +0,0 @@ -on: - push: - branches: - - master -jobs: - deploy: - name: Publish - runs-on: ubuntu-latest - environment: development - steps: - - uses: actions/checkout@v3 - - name: Setup Node.js environment - uses: actions/setup-node@v3 - with: - node-version: 16.x - - name: Install_token - id: install - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: | - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc - shell: bash - - name: NPM_install - id: npm_install - run: | - npm ci - - name: publish npm module - if: github.ref == 'refs/heads/master' - run: npm publish - shell: bash From 3f4ec695610831253a6e69e02abab281762f12c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 10 Feb 2023 14:15:56 +0000 Subject: [PATCH 7/8] add github workflow files again --- .github/workflows/pr.yml | 12 ++++++++++++ .github/workflows/publish.yml | 30 ++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..5eeadf4 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,12 @@ +name: PR Build +on: pull_request +jobs: + code-quality: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: lts/* + - run: npm ci + - run: npm run lint \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..dfcad4c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +on: + push: + branches: + - master +jobs: + deploy: + name: Publish + runs-on: ubuntu-latest + environment: development + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: 16.x + - name: Install_token + id: install + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + shell: bash + - name: NPM_install + id: npm_install + run: | + npm ci + - name: publish npm module + if: github.ref == 'refs/heads/master' + run: npm publish + shell: bash \ No newline at end of file From 46e18f7e0f472de3d9fdb4d88ac44f8faf9889cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20Torfi=20Yngvason?= Date: Fri, 10 Feb 2023 14:20:31 +0000 Subject: [PATCH 8/8] add newlines for to clean up history --- .github/workflows/pr.yml | 2 +- .github/workflows/publish.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5eeadf4..33d6aab 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,4 +9,4 @@ jobs: with: node-version: lts/* - run: npm ci - - run: npm run lint \ No newline at end of file + - run: npm run lint diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dfcad4c..435d3ca 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,4 +27,4 @@ jobs: - name: publish npm module if: github.ref == 'refs/heads/master' run: npm publish - shell: bash \ No newline at end of file + shell: bash