From 6b10f61e11b357bc429753af2a9f11f4c7f68f2a Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 3 Feb 2021 19:07:39 +0000 Subject: [PATCH] Moved postinstall script to a Grunt task to fix relative calls. npm scripts now use local grunt install. --- .eslintrc.json | 3 ++- .github/workflows/releases.yml | 1 + CHANGELOG.md | 2 +- Gruntfile.js | 10 ++++++++++ package.json | 14 +++++++------- postinstall.sh | 8 -------- 6 files changed, 21 insertions(+), 17 deletions(-) delete mode 100755 postinstall.sh diff --git a/.eslintrc.json b/.eslintrc.json index 5d054f6a..0fd518d8 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -63,7 +63,8 @@ }], "linebreak-style": ["error", "unix"], "quotes": ["error", "double", { - "avoidEscape": true + "avoidEscape": true, + "allowTemplateLiterals": true }], "camelcase": ["error", { "properties": "always" diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml index c0920595..c58815f3 100644 --- a/.github/workflows/releases.yml +++ b/.github/workflows/releases.yml @@ -47,6 +47,7 @@ jobs: tag: ${{ github.ref }} overwrite: true file_glob: true + body: "See the [CHANGELOG](https://github.com/gchq/CyberChef/blob/master/CHANGELOG.md) and [commit messages](https://github.com/gchq/CyberChef/commits/master) for details." - name: Publish to NPM if: success() diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e8a5cc..555a4af3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## Versioning -CyberChef uses the [semver](https://semver.org/) system to manage versioning: MAJOR.MINOR.PATCH. +CyberChef uses the [semver](https://semver.org/) system to manage versioning: `..`. - MAJOR version changes represent a significant change to the fundamental architecture of CyberChef and may (but don't always) make breaking changes that are not backwards compatible. - MINOR version changes usually mean the addition of new operations or reasonably significant new features. diff --git a/Gruntfile.js b/Gruntfile.js index d49dc05f..0477fb92 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -411,6 +411,16 @@ module.exports = function (grunt) { ]), stdout: false, }, + fixCryptoApiImports: { + command: [ + `[[ "$OSTYPE" == "darwin"* ]]`, + "&&", + `find ./node_modules/crypto-api/src/ \\( -type d -name .git -prune \\) -o -type f -print0 | xargs -0 sed -i '' -e '/\\.mjs/!s/\\(from "\\.[^"]*\\)";/\\1.mjs";/g'`, + "||", + `find ./node_modules/crypto-api/src/ \\( -type d -name .git -prune \\) -o -type f -print0 | xargs -0 sed -i -e '/\\.mjs/!s/\\(from "\\.[^"]*\\)";/\\1.mjs";/g'` + ].join(" "), + stdout: false + } }, }); }; diff --git a/package.json b/package.json index c7ee2115..2dfb0ea3 100644 --- a/package.json +++ b/package.json @@ -164,15 +164,15 @@ "zlibjs": "^0.3.1" }, "scripts": { - "start": "grunt dev", - "build": "grunt prod", + "start": "npx grunt dev", + "build": "npx grunt prod", "repl": "node src/node/repl.js", - "test": "grunt configTests && node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs && node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs", - "test-node-consumer": "grunt testnodeconsumer", - "testui": "grunt testui", + "test": "npx grunt configTests && node --experimental-modules --no-warnings --no-deprecation tests/node/index.mjs && node --experimental-modules --no-warnings --no-deprecation tests/operations/index.mjs", + "test-node-consumer": "npx grunt testnodeconsumer", + "testui": "npx grunt testui", "testuidev": "npx nightwatch --env=dev", - "lint": "grunt lint", - "postinstall": "bash postinstall.sh", + "lint": "npx grunt lint", + "postinstall": "npx grunt exec:fixCryptoApiImports", "newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs" } } diff --git a/postinstall.sh b/postinstall.sh deleted file mode 100755 index e244070e..00000000 --- a/postinstall.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Add file extensions to Crypto-Api imports -if [[ "$OSTYPE" == "darwin"* ]]; then - find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i '' -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g' -else - find ./node_modules/crypto-api/src/ \( -type d -name .git -prune \) -o -type f -print0 | xargs -0 sed -i -e '/\.mjs/!s/\(from "\.[^"]*\)";/\1.mjs";/g' -fi \ No newline at end of file