Skip to content

Commit 2974075

Browse files
committed
fix: backport scripts/link-cli.js
Fixes #661 We avoid Promises to allow this script to run under older system versions of node.
1 parent d5df315 commit 2974075

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"check-dependencies": "node ./scripts/check-mismatched-dependencies.js",
5757
"prettier": "yarn workspaces run prettier",
5858
"lerna": "lerna",
59-
"link-cli": "node ./scripts/link-cli.js",
59+
"link-cli": "node ./scripts/link-cli.cjs",
6060
"lint-fix": "yarn workspaces run lint-fix",
6161
"lint-check": "yarn workspaces run lint-check",
6262
"test": "yarn workspaces run test",

scripts/link-cli.cjs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#! /usr/bin/env node
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
6+
try {
7+
const script = process.argv[2] || '/usr/local/bin/agoric';
8+
const cli = path.resolve(__dirname, '../packages/agoric-cli/bin/agoric');
9+
const content = `\
10+
#! /bin/sh
11+
# AUTOMATICALLY GENERATED by ${process.argv[1]}
12+
# Always execute the checked-out Agoric CLI with the --sdk flag.
13+
exec ${cli} --sdk \${1+"\$@"}
14+
`;
15+
console.log(`creating ${script}`);
16+
fs.writeFileSync(script, content);
17+
fs.chmodSync(script, '0755');
18+
} catch (e) {
19+
console.error(err);
20+
process.exit(1);
21+
}
22+
23+
process.exit(0);

scripts/link-cli.js

-21
This file was deleted.

0 commit comments

Comments
 (0)