@orderly.network/cli 0.9.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -0
- package/bin/orderly.js +34 -0
- package/lib/resolve.js +64 -0
- package/package.json +23 -20
- package/bin/cli.js +0 -22
- package/commands/connect.js +0 -0
- package/commands/create.js +0 -23
- package/commands/intl.js +0 -0
- package/commands/login.js +0 -73
- package/commands/sign.js +0 -26
- package/commands/theme/pull.js +0 -16
- package/commands/theme/push.js +0 -0
- package/commands/theme.js +0 -10
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @orderly.network/cli
|
|
2
|
+
|
|
3
|
+
The Orderly Network CLI. Installs the native `orderly` binary for your platform
|
|
4
|
+
as an optional dependency — no install scripts, nothing downloaded at runtime.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install -g @orderly.network/cli
|
|
10
|
+
orderly --version
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or without installing:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
npx @orderly.network/cli auth-list
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Platforms
|
|
20
|
+
|
|
21
|
+
| OS | Architectures |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Linux (static musl) | x86_64, arm64 |
|
|
24
|
+
| macOS | x86_64, arm64 |
|
|
25
|
+
| Windows | x86_64, arm64 |
|
|
26
|
+
|
|
27
|
+
The binary lives in `@orderly.network/cli-<os>-<cpu>`. If your npm config skips
|
|
28
|
+
optional dependencies, reinstall with `--include=optional`.
|
|
29
|
+
|
|
30
|
+
## What it is not
|
|
31
|
+
|
|
32
|
+
- **Not a JavaScript API.** Programmatic request building and signing (browser,
|
|
33
|
+
Workers, Node) is [`@orderly.network/cli-wasm`](https://www.npmjs.com/package/@orderly.network/cli-wasm).
|
|
34
|
+
- **Not key storage in the package.** Wallet and API keys live in the OS keychain
|
|
35
|
+
(macOS Keychain, Windows Credential Manager, Linux Secret Service).
|
|
36
|
+
|
|
37
|
+
## Links
|
|
38
|
+
|
|
39
|
+
- Source: https://gitlab.com/orderlynetwork/orderly-fe/cli
|
|
40
|
+
- Installation, verification, building from source: `INSTALL.md` in the repository
|
package/bin/orderly.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher for the native Orderly CLI.
|
|
3
|
+
//
|
|
4
|
+
// npm installs this package plus one platform package (os/cpu filtered). This
|
|
5
|
+
// script replaces itself with that binary, inheriting stdio so TTY prompts,
|
|
6
|
+
// colours and exit codes behave exactly as with a direct install.
|
|
7
|
+
import { spawn } from 'node:child_process';
|
|
8
|
+
import { resolveBinary } from '../lib/resolve.js';
|
|
9
|
+
|
|
10
|
+
let binary;
|
|
11
|
+
try {
|
|
12
|
+
binary = resolveBinary();
|
|
13
|
+
} catch (error) {
|
|
14
|
+
process.stderr.write(`${error.message}\n`);
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const child = spawn(binary, process.argv.slice(2), {
|
|
19
|
+
stdio: 'inherit',
|
|
20
|
+
env: process.env,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
child.on('error', (error) => {
|
|
24
|
+
process.stderr.write(`orderly: failed to start ${binary}: ${error.message}\n`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
child.on('close', (code, signal) => {
|
|
29
|
+
if (signal) {
|
|
30
|
+
process.kill(process.pid, signal);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
process.exit(code ?? 1);
|
|
34
|
+
});
|
package/lib/resolve.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Native binaries ship as one npm package per platform. This map is the only
|
|
6
|
+
* place the launcher and the packer agree on which package holds which target;
|
|
7
|
+
* the packer's TARGETS list in scripts/npm-platforms.mjs must match.
|
|
8
|
+
*/
|
|
9
|
+
const PACKAGES = {
|
|
10
|
+
'linux-x64': '@orderly.network/cli-linux-x64',
|
|
11
|
+
'linux-arm64': '@orderly.network/cli-linux-arm64',
|
|
12
|
+
'darwin-x64': '@orderly.network/cli-darwin-x64',
|
|
13
|
+
'darwin-arm64': '@orderly.network/cli-darwin-arm64',
|
|
14
|
+
'win32-x64': '@orderly.network/cli-win32-x64',
|
|
15
|
+
'win32-arm64': '@orderly.network/cli-win32-arm64',
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
19
|
+
const defaultResolve = (id) => requireFromHere.resolve(id);
|
|
20
|
+
|
|
21
|
+
/** npm package that carries the binary for a platform/arch pair. */
|
|
22
|
+
export function packageForPlatform(platform, arch) {
|
|
23
|
+
return PACKAGES[`${platform}-${arch}`] ?? null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Executable file name inside the platform package. */
|
|
27
|
+
export function binaryName(platform) {
|
|
28
|
+
return platform === 'win32' ? 'orderly.exe' : 'orderly';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Absolute path of the native binary for this machine.
|
|
33
|
+
*
|
|
34
|
+
* `resolve` is injectable so the mapping and error paths are testable without
|
|
35
|
+
* a real install.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveBinary(
|
|
38
|
+
platform = process.platform,
|
|
39
|
+
arch = process.arch,
|
|
40
|
+
resolve = defaultResolve
|
|
41
|
+
) {
|
|
42
|
+
const pkg = packageForPlatform(platform, arch);
|
|
43
|
+
if (!pkg) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`orderly: no prebuilt CLI for ${platform}-${arch}.\n` +
|
|
46
|
+
'Supported platforms: linux (x64, arm64), macOS (x64, arm64), Windows (x64, arm64).\n' +
|
|
47
|
+
'Build from source instead: cargo install --path .'
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let manifest;
|
|
52
|
+
try {
|
|
53
|
+
manifest = resolve(`${pkg}/package.json`);
|
|
54
|
+
} catch {
|
|
55
|
+
throw new Error(
|
|
56
|
+
`orderly: ${pkg} is not installed.\n` +
|
|
57
|
+
'It is an optional dependency of @orderly.network/cli, so the install either\n' +
|
|
58
|
+
'skipped optional dependencies or filtered by platform. Reinstall with:\n' +
|
|
59
|
+
' npm install -g @orderly.network/cli --include=optional'
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return path.join(path.dirname(manifest), 'bin', binaryName(platform));
|
|
64
|
+
}
|
package/package.json
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orderly.network/cli",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "",
|
|
3
|
+
"version": "2.2.3",
|
|
4
|
+
"description": "Orderly Network CLI: the native binary is installed as an optional dependency",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://gitlab.com/orderlynetwork/orderly-fe/cli.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/OrderlyNetwork/cli",
|
|
11
|
+
"type": "module",
|
|
5
12
|
"bin": {
|
|
6
|
-
"orderly": "
|
|
13
|
+
"orderly": "bin/orderly.js"
|
|
14
|
+
},
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=18"
|
|
7
17
|
},
|
|
8
18
|
"files": [
|
|
9
19
|
"bin",
|
|
10
|
-
"
|
|
20
|
+
"lib",
|
|
21
|
+
"README.md"
|
|
11
22
|
],
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"@metamask/sdk": "^0.14.1",
|
|
20
|
-
"configstore": "^6.0.0",
|
|
21
|
-
"enquirer": "^2.4.1",
|
|
22
|
-
"yargs": "^17.7.2",
|
|
23
|
-
"@orderly.network/core": "2.6.2"
|
|
24
|
-
},
|
|
25
|
-
"scripts": {
|
|
26
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@orderly.network/cli-linux-x64": "2.2.3",
|
|
25
|
+
"@orderly.network/cli-linux-arm64": "2.2.3",
|
|
26
|
+
"@orderly.network/cli-darwin-x64": "2.2.3",
|
|
27
|
+
"@orderly.network/cli-darwin-arm64": "2.2.3",
|
|
28
|
+
"@orderly.network/cli-win32-x64": "2.2.3",
|
|
29
|
+
"@orderly.network/cli-win32-arm64": "2.2.3"
|
|
27
30
|
}
|
|
28
|
-
}
|
|
31
|
+
}
|
package/bin/cli.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// command:
|
|
4
|
-
// project create
|
|
5
|
-
// theme pull/push
|
|
6
|
-
// intl pull/push
|
|
7
|
-
|
|
8
|
-
const yargs = require("yargs");
|
|
9
|
-
const { hideBin } = require("yargs/helpers");
|
|
10
|
-
|
|
11
|
-
console.clear();
|
|
12
|
-
|
|
13
|
-
const create = require("../commands/create");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const argv = yargs(hideBin(process.argv))
|
|
18
|
-
// .command(create)
|
|
19
|
-
.commandDir("../commands")
|
|
20
|
-
.demandCommand(1,'You need at least one command before moving on')
|
|
21
|
-
// .example('$0 create -n my-project -t react', 'create a new project')
|
|
22
|
-
.help().argv;
|
package/commands/connect.js
DELETED
|
File without changes
|
package/commands/create.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
function handler(argv) {
|
|
2
|
-
console.log("create:::::", argv);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
command: "create",
|
|
7
|
-
describe: "create a new Orderly project",
|
|
8
|
-
builder: (yargs) => {
|
|
9
|
-
yargs.option("name", {
|
|
10
|
-
alias: "n",
|
|
11
|
-
describe: "project name",
|
|
12
|
-
type: "string",
|
|
13
|
-
demandOption: true,
|
|
14
|
-
});
|
|
15
|
-
yargs.option("template", {
|
|
16
|
-
alias: "t",
|
|
17
|
-
describe: "project template",
|
|
18
|
-
type: "string",
|
|
19
|
-
demandOption: true,
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
handler,
|
|
23
|
-
};
|
package/commands/intl.js
DELETED
|
File without changes
|
package/commands/login.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
const metaMaks = require("@metamask/sdk");
|
|
2
|
-
|
|
3
|
-
const qrcode = require("qrcode-terminal");
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function handler(argv) {
|
|
8
|
-
const options = {
|
|
9
|
-
shouldShimWeb3: false,
|
|
10
|
-
dappMetadata: {
|
|
11
|
-
name: "NodeJS example",
|
|
12
|
-
},
|
|
13
|
-
logging: {
|
|
14
|
-
sdk: false,
|
|
15
|
-
},
|
|
16
|
-
checkInstallationImmediately: false,
|
|
17
|
-
// Optional: customize modal text
|
|
18
|
-
modals: {
|
|
19
|
-
install: ({ link }) => {
|
|
20
|
-
qrcode.generate(link, { small: true }, (qr) => console.log(qr));
|
|
21
|
-
return {};
|
|
22
|
-
},
|
|
23
|
-
otp: () => {
|
|
24
|
-
return {
|
|
25
|
-
mount() {},
|
|
26
|
-
updateOTPValue: (otpValue) => {
|
|
27
|
-
if (otpValue !== "") {
|
|
28
|
-
console.debug(
|
|
29
|
-
`[CUSTOMIZE TEXT] Choose the following value on your metamask mobile wallet: ${otpValue}`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
const MMSDK = new metaMaks.MetaMaskSDK(options);
|
|
38
|
-
console.log("create:::::", argv);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// MMSDK.init();
|
|
43
|
-
|
|
44
|
-
// const ethereum = MMSDK.getProvider();
|
|
45
|
-
|
|
46
|
-
// ethereum.request({ method: "eth_requestAccounts" }).then((accounts) => {
|
|
47
|
-
// console.log(accounts);
|
|
48
|
-
// });
|
|
49
|
-
|
|
50
|
-
// MMSDK.connect().then((res) => {
|
|
51
|
-
// console.log(res)
|
|
52
|
-
// })
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
module.exports = {
|
|
56
|
-
command: "login",
|
|
57
|
-
describe: "Connect to your Orderly account",
|
|
58
|
-
builder: (yargs) => {
|
|
59
|
-
// yargs.option("name", {
|
|
60
|
-
// alias: "n",
|
|
61
|
-
// describe: "project name",
|
|
62
|
-
// type: "string",
|
|
63
|
-
// demandOption: true,
|
|
64
|
-
// });
|
|
65
|
-
// yargs.option("template", {
|
|
66
|
-
// alias: "t",
|
|
67
|
-
// describe: "project template",
|
|
68
|
-
// type: "string",
|
|
69
|
-
// demandOption: true,
|
|
70
|
-
// });
|
|
71
|
-
},
|
|
72
|
-
handler,
|
|
73
|
-
};
|
package/commands/sign.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// sign message
|
|
2
|
-
|
|
3
|
-
function handler(argv) {
|
|
4
|
-
console.log("create:::::", argv);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
command: "sign",
|
|
9
|
-
describe: "create a new Orderly project",
|
|
10
|
-
builder: (yargs) => {
|
|
11
|
-
yargs.option("name", {
|
|
12
|
-
alias: "n",
|
|
13
|
-
describe: "project name",
|
|
14
|
-
type: "string",
|
|
15
|
-
demandOption: true,
|
|
16
|
-
});
|
|
17
|
-
yargs.option("template", {
|
|
18
|
-
alias: "t",
|
|
19
|
-
describe: "project template",
|
|
20
|
-
type: "string",
|
|
21
|
-
demandOption: true,
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
handler,
|
|
25
|
-
};
|
|
26
|
-
|
package/commands/theme/pull.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
exports.command = "pull";
|
|
2
|
-
|
|
3
|
-
exports.describe = "Pull theme from the theming build portal";
|
|
4
|
-
|
|
5
|
-
exports.builder = (yargs) => {
|
|
6
|
-
yargs.option("themeId", {
|
|
7
|
-
alias: "id",
|
|
8
|
-
describe: "theme id",
|
|
9
|
-
type: "string",
|
|
10
|
-
demandOption: true,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports.handler = (argv) => {
|
|
15
|
-
console.log("pull:::::", argv);
|
|
16
|
-
};
|
package/commands/theme/push.js
DELETED
|
File without changes
|