eitri-cli 1.8.0-beta.2 → 1.9.0-beta.1

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.
Files changed (53) hide show
  1. package/.vscode/settings.json +2 -1
  2. package/bitbucket-pipelines.yml +34 -0
  3. package/config/dev.js +1 -1
  4. package/config/k8s-eitri.js +1 -1
  5. package/config/loc-eitri.js +1 -1
  6. package/eitri-cli-v2/Cargo.lock +2500 -0
  7. package/eitri-cli-v2/Cargo.toml +22 -0
  8. package/eitri-cli-v2/README.md +119 -0
  9. package/eitri-cli-v2/index.js +2 -0
  10. package/eitri-cli-v2/index.unix.node +0 -0
  11. package/eitri-cli-v2/index.win32.node +0 -0
  12. package/eitri-cli-v2/node_modules/.yarn-integrity +16 -0
  13. package/eitri-cli-v2/node_modules/cargo-cp-artifact/LICENSE +21 -0
  14. package/eitri-cli-v2/node_modules/cargo-cp-artifact/README.md +93 -0
  15. package/eitri-cli-v2/node_modules/cargo-cp-artifact/bin/cargo-cp-artifact.js +6 -0
  16. package/eitri-cli-v2/node_modules/cargo-cp-artifact/package.json +34 -0
  17. package/eitri-cli-v2/node_modules/cargo-cp-artifact/src/args.js +131 -0
  18. package/eitri-cli-v2/node_modules/cargo-cp-artifact/src/index.js +164 -0
  19. package/eitri-cli-v2/package-lock.json +26 -0
  20. package/eitri-cli-v2/package.json +21 -0
  21. package/eitri-cli-v2/src/commands/mod.rs +1 -0
  22. package/eitri-cli-v2/src/commands/publish.rs +67 -0
  23. package/eitri-cli-v2/src/config/mod.rs +1 -0
  24. package/eitri-cli-v2/src/config/user_credentials.rs +38 -0
  25. package/eitri-cli-v2/src/infra/async_runtime.rs +9 -0
  26. package/eitri-cli-v2/src/infra/http_client.rs +484 -0
  27. package/eitri-cli-v2/src/infra/mod.rs +2 -0
  28. package/eitri-cli-v2/src/lib.rs +41 -0
  29. package/eitri-cli-v2/src/model/auth_response.rs +8 -0
  30. package/eitri-cli-v2/src/model/credentials.rs +8 -0
  31. package/eitri-cli-v2/src/model/eitri_conf.rs +43 -0
  32. package/eitri-cli-v2/src/model/mod.rs +4 -0
  33. package/eitri-cli-v2/src/model/revision.rs +14 -0
  34. package/eitri-cli-v2/src/services/blind_guardian.rs +87 -0
  35. package/eitri-cli-v2/src/services/eitri_manager.rs +78 -0
  36. package/eitri-cli-v2/src/services/mod.rs +3 -0
  37. package/eitri-cli-v2/src/services/workspace.rs +46 -0
  38. package/eitri-cli-v2/src/utils/convert_eitri_conf.rs +98 -0
  39. package/eitri-cli-v2/src/utils/mod.rs +1 -0
  40. package/eitri-cli-v2/yarn.lock +8 -0
  41. package/index.js +16 -0
  42. package/install-dev.bat +1 -1
  43. package/install-dev.sh +1 -1
  44. package/package.json +1 -1
  45. package/src/cmd/push-version.js +20 -9
  46. package/src/cmd/start.js +5 -2
  47. package/src/cmd/validate.js +1 -1
  48. package/src/modules/vegvisir/VegvisirService.js +2 -2
  49. package/src/service/MiniLog.js +1 -1
  50. package/src/service/QRCodeFactory.js +1 -1
  51. package/src/service/Workspace.js +9 -8
  52. package/src/util/LogUtil.js +14 -0
  53. package/test/e2e/cli.test.js +54 -0
@@ -0,0 +1,22 @@
1
+ [package]
2
+ name = "eitri-cli-v2"
3
+ version = "0.1.0"
4
+ license = "ISC"
5
+ edition = "2021"
6
+ exclude = ["index.node"]
7
+
8
+ [lib]
9
+ crate-type = ["cdylib"]
10
+
11
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
12
+
13
+ [dependencies]
14
+ homedir = "0.2.1"
15
+ httpmock = "0.7.0"
16
+ neon = "1"
17
+ once_cell = "1.19.0"
18
+ reqwest = { version = "0.11.24", features = ["json", "multipart", "cookies"] }
19
+ serde = { version = "1.0.197", features = ["derive"] }
20
+ serde_derive = "1.0.197"
21
+ serde_json = "1.0.114"
22
+ tokio = { version = "1.36.0", features = ["full"] }
@@ -0,0 +1,119 @@
1
+ # eitri-cli-v2
2
+
3
+ This project was bootstrapped by [create-neon](https://www.npmjs.com/package/create-neon).
4
+
5
+ ## Installing eitri-cli-v2
6
+
7
+ Installing eitri-cli-v2 requires a [supported version of Node and Rust](https://github.com/neon-bindings/neon#platform-support).
8
+
9
+ You can install the project with npm. In the project directory, run:
10
+
11
+ ```sh
12
+ $ npm install
13
+ ```
14
+
15
+ This fully installs the project, including installing any dependencies and running the build.
16
+
17
+ ## Building eitri-cli-v2
18
+
19
+ If you have already installed the project and only want to run the build, run:
20
+
21
+ ```sh
22
+ $ npm run build
23
+ ```
24
+
25
+ This command uses the [cargo-cp-artifact](https://github.com/neon-bindings/cargo-cp-artifact) utility to run the Rust build and copy the built library into `./index.node`.
26
+
27
+ ## Exploring eitri-cli-v2
28
+
29
+ After building eitri-cli-v2, you can explore its exports at the Node REPL:
30
+
31
+ ```sh
32
+ $ npm install
33
+ $ node
34
+ > require('.').hello()
35
+ "hello node"
36
+ ```
37
+
38
+ ## Available Scripts
39
+
40
+ In the project directory, you can run:
41
+
42
+ ### `npm install`
43
+
44
+ Installs the project, including running `npm run build`.
45
+
46
+ ### `npm build`
47
+
48
+ Builds the Node addon (`index.node`) from source.
49
+
50
+ Additional [`cargo build`](https://doc.rust-lang.org/cargo/commands/cargo-build.html) arguments may be passed to `npm build` and `npm build-*` commands. For example, to enable a [cargo feature](https://doc.rust-lang.org/cargo/reference/features.html):
51
+
52
+ ```
53
+ npm run build -- --feature=beetle
54
+ ```
55
+
56
+ #### `npm build-debug`
57
+
58
+ Alias for `npm build`.
59
+
60
+ #### `npm build-release`
61
+
62
+ Same as [`npm build`](#npm-build) but, builds the module with the [`release`](https://doc.rust-lang.org/cargo/reference/profiles.html#release) profile. Release builds will compile slower, but run faster.
63
+
64
+ ### `npm test`
65
+
66
+ Runs the unit tests by calling `cargo test`. You can learn more about [adding tests to your Rust code](https://doc.rust-lang.org/book/ch11-01-writing-tests.html) from the [Rust book](https://doc.rust-lang.org/book/).
67
+
68
+ ## Project Layout
69
+
70
+ The directory structure of this project is:
71
+
72
+ ```
73
+ eitri-cli-v2/
74
+ ├── Cargo.toml
75
+ ├── README.md
76
+ ├── index.node
77
+ ├── package.json
78
+ ├── src/
79
+ | └── lib.rs
80
+ └── target/
81
+ ```
82
+
83
+ ### Cargo.toml
84
+
85
+ The Cargo [manifest file](https://doc.rust-lang.org/cargo/reference/manifest.html), which informs the `cargo` command.
86
+
87
+ ### README.md
88
+
89
+ This file.
90
+
91
+ ### index.node
92
+
93
+ The Node addon—i.e., a binary Node module—generated by building the project. This is the main module for this package, as dictated by the `"main"` key in `package.json`.
94
+
95
+ Under the hood, a [Node addon](https://nodejs.org/api/addons.html) is a [dynamically-linked shared object](https://en.wikipedia.org/wiki/Library_(computing)#Shared_libraries). The `"build"` script produces this file by copying it from within the `target/` directory, which is where the Rust build produces the shared object.
96
+
97
+ ### package.json
98
+
99
+ The npm [manifest file](https://docs.npmjs.com/cli/v7/configuring-npm/package-json), which informs the `npm` command.
100
+
101
+ ### src/
102
+
103
+ The directory tree containing the Rust source code for the project.
104
+
105
+ ### src/lib.rs
106
+
107
+ The Rust library's main module.
108
+
109
+ ### target/
110
+
111
+ Binary artifacts generated by the Rust build.
112
+
113
+ ## Learn More
114
+
115
+ To learn more about Neon, see the [Neon documentation](https://neon-bindings.com).
116
+
117
+ To learn more about Rust, see the [Rust documentation](https://www.rust-lang.org).
118
+
119
+ To learn more about Node, see the [Node documentation](https://nodejs.org).
@@ -0,0 +1,2 @@
1
+ const os = require('os')
2
+ module.exports = os.platform() === 'win32' ? require('./index.win32.node'): require('./index.unix.node')
Binary file
Binary file
@@ -0,0 +1,16 @@
1
+ {
2
+ "systemParams": "linux-x64-108",
3
+ "modulesFolders": [
4
+ "node_modules"
5
+ ],
6
+ "flags": [],
7
+ "linkedModules": [],
8
+ "topLevelPatterns": [
9
+ "cargo-cp-artifact@^0.1"
10
+ ],
11
+ "lockfileEntries": {
12
+ "cargo-cp-artifact@^0.1": "https://registry.yarnpkg.com/cargo-cp-artifact/-/cargo-cp-artifact-0.1.8.tgz#353814f49f6aa76601a4bcb3ea5f3071180b90de"
13
+ },
14
+ "files": [],
15
+ "artifacts": {}
16
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 The Neon Project
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,93 @@
1
+ # cargo-cp-artifact
2
+
3
+ `cargo-cp-artifact` is a small command line utility for parsing cargo metadata output and copying a compiler artifact to a desired location.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install -g cargo-cp-artifact
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ cargo-cp-artifact --artifact artifact-kind crate-name output-file -- wrapped-command
15
+ ```
16
+
17
+ `cargo-cp-artifact` accepts a list of crate name and artifact kind to output file mappings and a command to wrap.`cargo-cp-artifact` will read `stdout` of the wrapped command and parse it as [cargo metadata](https://doc.rust-lang.org/cargo/reference/external-tools.html#json-messages). Compiler artifacts that match arguments provided will be copied to the target destination.
18
+
19
+ When wrapping a `cargo` command, it is necessary to include a `json` format to `--message-format`.
20
+
21
+ ### Arguments
22
+
23
+ Multiple arguments are allowed to copy multiple build artifacts.
24
+
25
+ #### `--artifact`
26
+
27
+ _Alias: `-a`_
28
+
29
+ Followed by *three* arguments: `artifact-kind crate-name output-file`
30
+
31
+ #### `--npm`
32
+
33
+ _Alias: `-n`_
34
+
35
+ Followed by *two* arguments: `artifact-kind output-file`
36
+
37
+ The crate name will be read from the `npm_package_name` environment variable. If the package name includes a namespace (`@namespace/package`), the namespace will be removed when matching the crate name (`package`).
38
+
39
+ ### Artifact Kind
40
+
41
+ Valid artifact kinds are `bin`, `cdylib`, and `dylib`. They may be abbreviated as `b`, `c`, and `d` respectively.
42
+
43
+ For example, `-ac` is the equivalent of `--artifact cdylib`.
44
+
45
+ ## Examples
46
+
47
+ ### Wrapping cargo
48
+
49
+ ```sh
50
+ cargo-cp-artifact -a cdylib my-crate lib/index.node -- cargo build --message-format=json-render-diagnostics
51
+ ```
52
+
53
+ ### Parsing a file
54
+
55
+ ```sh
56
+ cargo-cp-artifact -a cdylib my-crate lib/index.node -- cat build-output.txt
57
+ ```
58
+
59
+ ### `npm` script
60
+
61
+ `package.json`
62
+ ```json
63
+ {
64
+ "name": "my-crate",
65
+ "scripts": {
66
+ "build": "cargo-cp-artifact -nc lib/index.node -- cargo build --message-format=json-render-diagnostics"
67
+ }
68
+ }
69
+ ```
70
+
71
+ ```sh
72
+ npm run build
73
+
74
+ # Additional arguments may be passed
75
+ npm run build -- --feature=serde
76
+ ```
77
+
78
+ ## Why does this exist?
79
+
80
+ At the time of writing, `cargo` does not include a configuration for outputting a library or binary to a specified location. An `--out-dir` option [exists on nightly](https://github.com/rust-lang/cargo/issues/6790), but does not allow specifying the name of the file.
81
+
82
+ It surprisingly difficult to reliably find the location of a cargo compiler artifact. It is impacted by many parameters, including:
83
+
84
+ * Build profile
85
+ * Target, default or specified
86
+ * Crate name and name transforms
87
+
88
+ However, `cargo` can emit metadata on `stdout` while continuing to provide human readable diagnostics on `stderr`. The metadata may be parsed to more easily and reliably find the location of compiler artifacts.
89
+
90
+ `cargo-cp-artifact` chooses to wrap a command as a child process instead of reading `stdin` for two reasons:
91
+
92
+ 1. Removes the need for `-o pipefile` when integrating with build tooling which may need to be platform agnostic.
93
+ 2. Allows additional arguments to be provided when used in an [`npm` script](https://docs.npmjs.com/cli/v6/using-npm/scripts).
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const run = require("..");
5
+
6
+ run(process.argv.slice(2), process.env);
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "cargo-cp-artifact",
3
+ "version": "0.1.8",
4
+ "description": "Copies compiler artifacts emitted by rustc by parsing Cargo metadata",
5
+ "main": "src/index.js",
6
+ "files": [
7
+ "bin",
8
+ "src"
9
+ ],
10
+ "bin": {
11
+ "cargo-cp-artifact": "bin/cargo-cp-artifact.js"
12
+ },
13
+ "scripts": {
14
+ "test": "mocha test"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/neon-bindings/neon.git"
19
+ },
20
+ "keywords": [
21
+ "cargo",
22
+ "rust",
23
+ "neon"
24
+ ],
25
+ "author": "K.J. Valencik",
26
+ "license": "MIT",
27
+ "bugs": {
28
+ "url": "https://github.com/neon-bindings/neon/issues"
29
+ },
30
+ "homepage": "https://github.com/neon-bindings/neon/tree/main/pkgs/cargo-cp-artifact",
31
+ "devDependencies": {
32
+ "mocha": "^10.0.0"
33
+ }
34
+ }
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+
3
+ class ParseError extends Error {}
4
+
5
+ const NPM_ENV = "npm_package_name";
6
+ const EXPECTED_COMMAND = [
7
+ "Missing command to execute.",
8
+ [
9
+ "cargo-cp-artifct -a cdylib my-crate index.node",
10
+ "--",
11
+ "cargo build --message-format=json-render-diagnostics",
12
+ ].join(" "),
13
+ ].join("\n");
14
+
15
+ function validateArtifactType(artifactType) {
16
+ switch (artifactType) {
17
+ case "b":
18
+ case "bin":
19
+ return "bin";
20
+ case "c":
21
+ case "cdylib":
22
+ return "cdylib";
23
+ case "d":
24
+ case "dylib":
25
+ return "dylib";
26
+ default:
27
+ }
28
+
29
+ throw new ParseError(`Unexpected artifact type: ${artifactType}`);
30
+ }
31
+
32
+ function getArtifactName({ artifactType, crateName }) {
33
+ return `${artifactType}:${crateName}`;
34
+ }
35
+
36
+ function getCrateNameFromEnv(env) {
37
+ if (!env.hasOwnProperty(NPM_ENV)) {
38
+ throw new ParseError(
39
+ [
40
+ `Could not find the \`${NPM_ENV}\` environment variable.`,
41
+ "Expected to be executed from an `npm` command.",
42
+ ].join(" ")
43
+ );
44
+ }
45
+
46
+ const name = env[NPM_ENV];
47
+ const firstSlash = name.indexOf("/");
48
+
49
+ // This is a namespaced package; assume the crate is the un-namespaced version
50
+ if (name[0] === "@" && firstSlash > 0) {
51
+ return name.slice(firstSlash + 1);
52
+ }
53
+
54
+ return name;
55
+ }
56
+
57
+ function parse(argv, env) {
58
+ const artifacts = {};
59
+ let tokens = argv;
60
+
61
+ function getNext() {
62
+ if (!tokens.length) {
63
+ throw new ParseError(EXPECTED_COMMAND);
64
+ }
65
+
66
+ const next = tokens[0];
67
+ tokens = tokens.slice(1);
68
+ return next;
69
+ }
70
+
71
+ function getArtifactType(token) {
72
+ if (token[1] !== "-" && token.length === 3) {
73
+ return validateArtifactType(token[2]);
74
+ }
75
+
76
+ return validateArtifactType(getNext());
77
+ }
78
+
79
+ function pushArtifact(artifact) {
80
+ const name = getArtifactName(artifact);
81
+
82
+ artifacts[name] = artifacts[name] || [];
83
+ artifacts[name].push(artifact.outputFile);
84
+ }
85
+
86
+ while (tokens.length) {
87
+ const token = getNext();
88
+
89
+ // End of CLI arguments
90
+ if (token === "--") {
91
+ break;
92
+ }
93
+
94
+ if (
95
+ token === "--artifact" ||
96
+ (token.length <= 3 && token.startsWith("-a"))
97
+ ) {
98
+ const artifactType = getArtifactType(token);
99
+ const crateName = getNext();
100
+ const outputFile = getNext();
101
+
102
+ pushArtifact({ artifactType, crateName, outputFile });
103
+ continue;
104
+ }
105
+
106
+ if (token === "--npm" || (token.length <= 3 && token.startsWith("-n"))) {
107
+ const artifactType = getArtifactType(token);
108
+ const crateName = getCrateNameFromEnv(env);
109
+ const outputFile = getNext();
110
+
111
+ pushArtifact({ artifactType, crateName, outputFile });
112
+ continue;
113
+ }
114
+
115
+ throw new ParseError(`Unexpected option: ${token}`);
116
+ }
117
+
118
+ if (!tokens.length) {
119
+ throw new ParseError(EXPECTED_COMMAND);
120
+ }
121
+
122
+ const cmd = getNext();
123
+
124
+ return {
125
+ artifacts,
126
+ cmd,
127
+ args: tokens,
128
+ };
129
+ }
130
+
131
+ module.exports = { ParseError, getArtifactName, parse };
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ const { spawn } = require("child_process");
4
+ const {
5
+ promises: { copyFile, mkdir, stat, unlink },
6
+ } = require("fs");
7
+ const { dirname, extname } = require("path");
8
+ const readline = require("readline");
9
+
10
+ const { ParseError, getArtifactName, parse } = require("./args");
11
+
12
+ function run(argv, env) {
13
+ const options = parseArgs(argv, env);
14
+ const copied = {};
15
+
16
+ const cp = spawn(options.cmd, options.args, {
17
+ stdio: ["inherit", "pipe", "inherit"],
18
+ shell: process.platform === "win32",
19
+ });
20
+
21
+ const rl = readline.createInterface({ input: cp.stdout });
22
+
23
+ cp.on("error", (err) => {
24
+ if (options.cmd === "cargo" && err.code === "ENOENT") {
25
+ console.error(`Error: could not find the \`cargo\` executable.
26
+
27
+ You can find instructions for installing Rust and Cargo at:
28
+
29
+ https://www.rust-lang.org/tools/install
30
+
31
+ `);
32
+ } else {
33
+ console.error(err);
34
+ }
35
+ process.exitCode = 1;
36
+ });
37
+
38
+ cp.on("exit", (code) => {
39
+ if (!process.exitCode) {
40
+ process.exitCode = code;
41
+ }
42
+ });
43
+
44
+ rl.on("line", (line) => {
45
+ try {
46
+ processCargoBuildLine(options, copied, line);
47
+ } catch (err) {
48
+ console.error(err);
49
+ process.exitCode = 1;
50
+ }
51
+ });
52
+
53
+ process.on("exit", () => {
54
+ Object.keys(options.artifacts).forEach((name) => {
55
+ if (!copied[name]) {
56
+ console.error(`Did not copy "${name}"`);
57
+
58
+ if (!process.exitCode) {
59
+ process.exitCode = 1;
60
+ }
61
+ }
62
+ });
63
+ });
64
+ }
65
+
66
+ function processCargoBuildLine(options, copied, line) {
67
+ const data = JSON.parse(line);
68
+ const { filenames, reason, target } = data;
69
+
70
+ if (!data || reason !== "compiler-artifact" || !target) {
71
+ return;
72
+ }
73
+
74
+ const { kind: kinds, name } = data.target;
75
+
76
+ if (!Array.isArray(kinds) || !Array.isArray(filenames)) {
77
+ return;
78
+ }
79
+
80
+ // `kind` and `filenames` zip up as key/value pairs
81
+ kinds.forEach((kind, i) => {
82
+ const filename = filenames[i];
83
+ const key = getArtifactName({ artifactType: kind, crateName: name });
84
+ const outputFiles = options.artifacts[key];
85
+
86
+ if (!outputFiles || !filename) {
87
+ return;
88
+ }
89
+
90
+ Promise.all(
91
+ outputFiles.map((outputFile) => copyArtifact(filename, outputFile))
92
+ )
93
+ .then(() => {
94
+ copied[key] = true;
95
+ })
96
+ .catch((err) => {
97
+ process.exitCode = 1;
98
+ console.error(err);
99
+ });
100
+ });
101
+ }
102
+
103
+ async function isNewer(filename, outputFile) {
104
+ try {
105
+ const prevStats = await stat(outputFile);
106
+ const nextStats = await stat(filename);
107
+
108
+ return nextStats.mtime > prevStats.mtime;
109
+ } catch (_err) {}
110
+
111
+ return true;
112
+ }
113
+
114
+ async function copyArtifact(filename, outputFile) {
115
+ if (!(await isNewer(filename, outputFile))) {
116
+ return;
117
+ }
118
+
119
+ const outputDir = dirname(outputFile);
120
+
121
+ // Don't try to create the current directory
122
+ if (outputDir && outputDir !== ".") {
123
+ await mkdir(outputDir, { recursive: true });
124
+ }
125
+
126
+ // Apple Silicon (M1, etc.) requires shared libraries to be signed. However,
127
+ // the macOS code signing cache isn't cleared when overwriting a file.
128
+ // Deleting the file before copying works around the issue.
129
+ //
130
+ // Unfortunately, this workaround is incomplete because the file must be
131
+ // deleted from the location it is loaded. If further steps in the user's
132
+ // build process copy or move the file in place, the code signing cache
133
+ // will not be cleared.
134
+ //
135
+ // https://github.com/neon-bindings/neon/issues/911
136
+ if (extname(outputFile) === ".node") {
137
+ try {
138
+ await unlink(outputFile);
139
+ } catch (_e) {
140
+ // Ignore errors; the file might not exist
141
+ }
142
+ }
143
+
144
+ await copyFile(filename, outputFile);
145
+ }
146
+
147
+ function parseArgs(argv, env) {
148
+ try {
149
+ return parse(argv, env);
150
+ } catch (err) {
151
+ if (err instanceof ParseError) {
152
+ quitError(err.message);
153
+ } else {
154
+ throw err;
155
+ }
156
+ }
157
+ }
158
+
159
+ function quitError(msg) {
160
+ console.error(msg);
161
+ process.exit(1);
162
+ }
163
+
164
+ module.exports = run;
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "eitri-cli-v2",
3
+ "version": "0.1.0",
4
+ "lockfileVersion": 3,
5
+ "requires": true,
6
+ "packages": {
7
+ "": {
8
+ "name": "eitri-cli-v2",
9
+ "version": "0.1.0",
10
+ "hasInstallScript": true,
11
+ "license": "ISC",
12
+ "devDependencies": {
13
+ "cargo-cp-artifact": "^0.1"
14
+ }
15
+ },
16
+ "node_modules/cargo-cp-artifact": {
17
+ "version": "0.1.8",
18
+ "resolved": "https://registry.npmjs.org/cargo-cp-artifact/-/cargo-cp-artifact-0.1.8.tgz",
19
+ "integrity": "sha512-3j4DaoTrsCD1MRkTF2Soacii0Nx7UHCce0EwUf4fHnggwiE4fbmF2AbnfzayR36DF8KGadfh7M/Yfy625kgPlA==",
20
+ "dev": true,
21
+ "bin": {
22
+ "cargo-cp-artifact": "bin/cargo-cp-artifact.js"
23
+ }
24
+ }
25
+ }
26
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "eitri-cli-v2",
3
+ "version": "0.1.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "cargo-cp-artifact -nc index.unix.node -- cargo build --message-format=json-render-diagnostics",
8
+ "build:win32": "cargo-cp-artifact -nc index.win32.node -- cargo build --message-format=json-render-diagnostics --target x86_64-pc-windows-gnu",
9
+ "build-debug": "npm run build --",
10
+ "build-release": "npm run build -- --release",
11
+ "build-release:win32": "npm run build:win32 -- --release",
12
+ "install": "npm run build-release",
13
+ "install:win32": "npm run build-release:win32",
14
+ "test": "cargo test"
15
+ },
16
+ "author": "",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "cargo-cp-artifact": "^0.1"
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ pub mod publish;