git.delta.rocks / unique-network / refs/commits / ba5a87350f03

difftreelog

test fix shared command references

Yaroslav Bolyukin2023-11-16parent: #6d1c846.patch.diff
in: master

5 files changed

modifiedjs-packages/.yarnrc.ymldiffbeforeafterboth
--- a/js-packages/.yarnrc.yml
+++ b/js-packages/.yarnrc.yml
@@ -1,3 +1,6 @@
 nodeLinker: node-modules
 
 yarnPath: .yarn/releases/yarn-3.6.1.cjs
+
+plugins:
+- ./scripts/plugins/shared.cjs
modifiedjs-packages/scripts/package.jsondiffbeforeafterboth
--- a/js-packages/scripts/package.json
+++ b/js-packages/scripts/package.json
@@ -9,15 +9,11 @@
   "type": "module",
   "version": "1.0.0",
   "main": "",
-  "dependencies": {
-    "rxjs": "^7.8.1",
-    "tslib": "^2.6.2"
-  },
   "scripts": {
-    "benchMintingFee": "ts-node benchmarks/mintFee/benchmark.ts",
-    "loadTransfer": "ts-node transfer.nload.ts",
-    "generateEnv": "ts-node --esm ./generateEnv.ts",
-    "propose-upgrade": "ts-node --esm ./proposeupgrade.ts",
-    "propose-fast-track": "ts-node --esm ./proposefasttrack.ts"
+    "benchMintingFee": "yarn ts-node benchmarks/mintFee/benchmark.ts",
+    "loadTransfer": "yarn ts-node transfer.nload.ts",
+    "generateEnv": "yarn ts-node --esm ./generateEnv.ts",
+    "propose-upgrade": "yarn ts-node --esm ./proposeupgrade.ts",
+    "propose-fast-track": "yarn ts-node --esm ./proposefasttrack.ts"
   }
 }
addedjs-packages/scripts/plugins/shared.cjsdiffbeforeafterboth
after · js-packages/scripts/plugins/shared.cjs
1const npmBinsToPackageName = {2  'ts-node': 'ts-node',3  'eslint': 'eslint',4  'tsc': 'typescript',5  'mocha': 'mocha',6};78const paths = [];9for(const k of Object.keys(npmBinsToPackageName)) {10  paths.push([k], ['run', k]);11}1213module.exports = {14  name: 'plugin-root-bin',15  factory: require => {16    const {BaseCommand} = require('@yarnpkg/cli');17    const {Option} = require('clipanion');1819    class ExecuteBinFromRootCommand extends BaseCommand {20      static paths = paths;2122      args = Option.Proxy();2324      async execute() {25        const fs = require('fs');26        const path = require('path');2728        const ownPackageJson = JSON.parse(await fs.promises.readFile('package.json', 'utf-8'));29        const cmd = this.path[this.path.length - 1];3031        if(ownPackageJson.scripts?.[cmd]) {32          throw new Error(`'${cmd}' is defined in package.json but the 'plugin-root-bin' also defined it. To avoid unexpected results, please rename the script in package.json`);33        }3435        const dir = await this.getBinaryPackageDirectory(fs, path, cmd, ownPackageJson);36        const pkg = JSON.parse(await fs.promises.readFile(path.join(dir, 'package.json'), 'utf-8'));3738        const packageRelativeBinPath = typeof pkg.bin === 'object'39          ? pkg.bin[cmd]40          : pkg.bin;4142        const binPath = path.join(dir, packageRelativeBinPath);4344        process.exitCode = await this.cli.run(['node', binPath, ...this.args]);4546        // seems something in yarn resets the exit code, so force exit47        process.exit();48      }4950      async getBinaryPackageDirectory(_fs, path, cmd, _ownPackageJson) {51        const res = path.resolve(__dirname, '../../node_modules', npmBinsToPackageName[cmd]);52        console.error(res);53        return res;54      }55    }5657    return {58      commands: [59        ExecuteBinFromRootCommand,60      ],61    };62  },63};
modifiedjs-packages/tests/package.jsondiffbeforeafterboth
--- a/js-packages/tests/package.json
+++ b/js-packages/tests/package.json
@@ -9,22 +9,15 @@
     "type": "module",
     "version": "1.0.0",
     "main": "",
-    "dependencies": {
-        "rxjs": "^7.8.1",
-        "tslib": "^2.6.2"
-    },
     "devDependencies": {
-        "@types/node": "^20.8.10",
-        "mocha": "^10.1.0",
-        "ts-node": "^10.9.1",
-        "typescript": "^5.1.6"
+        "mocha": "^10.1.0"
     },
     "scripts": {
-        "setup": "ts-node --esm ./util/globalSetup.ts",
-        "setIdentities": "ts-node --esm ./util/identitySetter.ts",
-        "checkRelayIdentities": "ts-node --esm ./util/relayIdentitiesChecker.ts",
-        "_test": "yarn setup && mocha --timeout 9999999 --loader=ts-node/esm.mjs",
-        "_testParallel": "yarn setup && mocha --timeout 9999999 --parallel --loader=ts-node/esm.mjs",
+        "setup": "yarn ts-node --esm ./util/globalSetup.ts",
+        "setIdentities": "yarn ts-node --esm ./util/identitySetter.ts",
+        "checkRelayIdentities": "yarn ts-node --esm ./util/relayIdentitiesChecker.ts",
+        "_test": "yarn setup && yarn mocha --timeout 9999999 --loader=ts-node/esm.mjs",
+        "_testParallel": "yarn setup && yarn mocha --timeout 9999999 --parallel --loader=ts-node/esm.mjs",
         "test": "yarn _test './**/*.*test.ts'",
         "testParallel": "yarn _testParallel './**/*.test.ts'",
         "testSequential": "yarn _test './**/*.seqtest.ts'",
modifiedjs-packages/yarn.lockdiffbeforeafterboth
--- a/js-packages/yarn.lock
+++ b/js-packages/yarn.lock
@@ -1266,9 +1266,6 @@
 "@unique/scripts@workspace:scripts":
   version: 0.0.0-use.local
   resolution: "@unique/scripts@workspace:scripts"
-  dependencies:
-    rxjs: ^7.8.1
-    tslib: ^2.6.2
   languageName: unknown
   linkType: soft