瀏覽代碼

Moved postinstall script to a Grunt task to fix relative calls. npm scripts now use local grunt install.

n1474335 4 年之前
父節點
當前提交
6b10f61e11
共有 6 個文件被更改,包括 21 次插入17 次删除
  1. 2 1
      .eslintrc.json
  2. 1 0
      .github/workflows/releases.yml
  3. 1 1
      CHANGELOG.md
  4. 10 0
      Gruntfile.js
  5. 7 7
      package.json
  6. 0 8
      postinstall.sh

+ 2 - 1
.eslintrc.json

@@ -63,7 +63,8 @@
         }],
         }],
         "linebreak-style": ["error", "unix"],
         "linebreak-style": ["error", "unix"],
         "quotes": ["error", "double", {
         "quotes": ["error", "double", {
-            "avoidEscape": true
+            "avoidEscape": true,
+            "allowTemplateLiterals": true
         }],
         }],
         "camelcase": ["error", {
         "camelcase": ["error", {
             "properties": "always"
             "properties": "always"

+ 1 - 0
.github/workflows/releases.yml

@@ -47,6 +47,7 @@ jobs:
         tag: ${{ github.ref }}
         tag: ${{ github.ref }}
         overwrite: true
         overwrite: true
         file_glob: 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
     - name: Publish to NPM
       if: success()
       if: success()

+ 1 - 1
CHANGELOG.md

@@ -2,7 +2,7 @@
 
 
 ## Versioning
 ## 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>.<MINOR>.<PATCH>`.
 
 
 - 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.
 - 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.
 - MINOR version changes usually mean the addition of new operations or reasonably significant new features.

+ 10 - 0
Gruntfile.js

@@ -411,6 +411,16 @@ module.exports = function (grunt) {
                 ]),
                 ]),
                 stdout: false,
                 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
+            }
         },
         },
     });
     });
 };
 };

+ 7 - 7
package.json

@@ -164,15 +164,15 @@
     "zlibjs": "^0.3.1"
     "zlibjs": "^0.3.1"
   },
   },
   "scripts": {
   "scripts": {
-    "start": "grunt dev",
-    "build": "grunt prod",
+    "start": "npx grunt dev",
+    "build": "npx grunt prod",
     "repl": "node src/node/repl.js",
     "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",
     "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"
     "newop": "node --experimental-modules src/core/config/scripts/newOperation.mjs"
   }
   }
 }
 }

+ 0 - 8
postinstall.sh

@@ -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