@napi-rs/cli 3.0.0-alpha.3 → 3.0.0-alpha.5
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/dist/api/build.js +34 -14
- package/dist/api/templates/ci-template.js +10 -11
- package/dist/api/templates/ci.yml.js +8 -2
- package/dist/api/templates/js-binding.d.ts +1 -1
- package/dist/api/templates/js-binding.js +243 -109
- package/dist/api/templates/package.json.js +29 -27
- package/dist/cli.js +0 -0
- package/dist/commands/new.js +1 -4
- package/dist/def/build.d.ts +12 -0
- package/dist/def/build.js +8 -0
- package/dist/index.cjs +2734 -7836
- package/dist/utils/__tests__/typegen.spec.js +1 -1
- package/dist/utils/ci.js +9 -0
- package/dist/utils/config.d.ts +9 -1
- package/dist/utils/target.d.ts +2 -2
- package/dist/utils/target.js +4 -0
- package/dist/utils/typegen.d.ts +4 -1
- package/dist/utils/typegen.js +20 -1
- package/dist/utils/version.js +2 -2
- package/package.json +13 -13
- package/src/api/artifacts.ts +2 -2
- package/src/api/build.ts +45 -18
- package/src/api/pre-publish.ts +8 -5
- package/src/api/templates/ci-template.ts +10 -11
- package/src/api/templates/ci.yml.ts +8 -2
- package/src/api/templates/js-binding.ts +236 -104
- package/src/api/templates/package.json.ts +31 -26
- package/src/commands/new.ts +1 -5
- package/src/def/build.ts +19 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.md +7 -0
- package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
- package/src/utils/__tests__/__snapshots__/version.spec.ts.md +7 -7
- package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
- package/src/utils/__tests__/typegen.spec.ts +1 -1
- package/src/utils/ci.ts +9 -0
- package/src/utils/config.ts +12 -1
- package/src/utils/target.ts +5 -0
- package/src/utils/typegen.ts +20 -1
- package/src/utils/version.ts +1 -1
- package/dist/def/commands/artifacts.d.ts +0 -15
- package/dist/def/commands/artifacts.js +0 -29
- package/dist/def/commands/build.d.ts +0 -53
- package/dist/def/commands/build.js +0 -105
- package/dist/def/commands/create-npm-dirs.d.ts +0 -15
- package/dist/def/commands/create-npm-dirs.js +0 -29
- package/dist/def/commands/new.d.ts +0 -27
- package/dist/def/commands/new.js +0 -53
- package/dist/def/commands/pre-publish.d.ts +0 -23
- package/dist/def/commands/pre-publish.js +0 -45
- package/dist/def/commands/rename.d.ts +0 -25
- package/dist/def/commands/rename.js +0 -49
- package/dist/def/commands/universalize.d.ts +0 -13
- package/dist/def/commands/universalize.js +0 -25
- package/dist/def/commands/version.d.ts +0 -13
- package/dist/def/commands/version.js +0 -25
- package/dist/def/options/artifacts.d.ts +0 -35
- package/dist/def/options/artifacts.js +0 -11
- package/dist/def/options/build.d.ts +0 -97
- package/dist/def/options/build.js +0 -3
- package/dist/def/options/create-npm-dirs.d.ts +0 -35
- package/dist/def/options/create-npm-dirs.js +0 -11
- package/dist/def/options/new.d.ts +0 -79
- package/dist/def/options/new.js +0 -15
- package/dist/def/options/pre-publish.d.ts +0 -65
- package/dist/def/options/pre-publish.js +0 -13
- package/dist/def/options/rename.d.ts +0 -75
- package/dist/def/options/rename.js +0 -11
- package/dist/def/options/universalize.d.ts +0 -28
- package/dist/def/options/universalize.js +0 -10
- package/dist/def/options/version.d.ts +0 -28
- package/dist/def/options/version.js +0 -10
package/dist/commands/new.js
CHANGED
|
@@ -75,9 +75,6 @@ export class NewCommand extends BaseNewCommand {
|
|
|
75
75
|
.then(({ minNodeApiVersion }) => minNodeApiVersion);
|
|
76
76
|
}
|
|
77
77
|
async fetchTargets() {
|
|
78
|
-
if (this.enableDefaultTargets) {
|
|
79
|
-
return DEFAULT_TARGETS.concat();
|
|
80
|
-
}
|
|
81
78
|
if (this.enableAllTargets) {
|
|
82
79
|
return AVAILABLE_TARGETS.concat();
|
|
83
80
|
}
|
|
@@ -86,7 +83,7 @@ export class NewCommand extends BaseNewCommand {
|
|
|
86
83
|
type: 'checkbox',
|
|
87
84
|
loop: false,
|
|
88
85
|
message: 'Choose target(s) your crate will be compiled to',
|
|
89
|
-
default: DEFAULT_TARGETS,
|
|
86
|
+
default: this.enableDefaultTargets ? DEFAULT_TARGETS : [],
|
|
90
87
|
choices: AVAILABLE_TARGETS,
|
|
91
88
|
});
|
|
92
89
|
return targets;
|
package/dist/def/build.d.ts
CHANGED
|
@@ -20,7 +20,9 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
20
20
|
verbose?: boolean;
|
|
21
21
|
bin?: string;
|
|
22
22
|
package?: string;
|
|
23
|
+
profile?: string;
|
|
23
24
|
crossCompile?: boolean;
|
|
25
|
+
useCross?: boolean;
|
|
24
26
|
watch?: boolean;
|
|
25
27
|
features?: string[];
|
|
26
28
|
allFeatures?: boolean;
|
|
@@ -44,7 +46,9 @@ export declare abstract class BaseBuildCommand extends Command {
|
|
|
44
46
|
verbose: boolean | undefined;
|
|
45
47
|
bin: string | undefined;
|
|
46
48
|
package: string | undefined;
|
|
49
|
+
profile: string | undefined;
|
|
47
50
|
crossCompile: boolean | undefined;
|
|
51
|
+
useCross: boolean | undefined;
|
|
48
52
|
watch: boolean | undefined;
|
|
49
53
|
features: string[] | undefined;
|
|
50
54
|
allFeatures: boolean | undefined;
|
|
@@ -127,10 +131,18 @@ export interface BuildOptions {
|
|
|
127
131
|
* Build the specified library or the one at cwd
|
|
128
132
|
*/
|
|
129
133
|
package?: string;
|
|
134
|
+
/**
|
|
135
|
+
* Build artifacts with the specified profile
|
|
136
|
+
*/
|
|
137
|
+
profile?: string;
|
|
130
138
|
/**
|
|
131
139
|
* [experimental] cross-compile for the specified target with `cargo-xwin` on windows and `cargo-zigbuild` on other platform
|
|
132
140
|
*/
|
|
133
141
|
crossCompile?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* [experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`
|
|
144
|
+
*/
|
|
145
|
+
useCross?: boolean;
|
|
134
146
|
/**
|
|
135
147
|
* watch the crate changes and build continiously with `cargo-watch` crates
|
|
136
148
|
*/
|
package/dist/def/build.js
CHANGED
|
@@ -60,9 +60,15 @@ export class BaseBuildCommand extends Command {
|
|
|
60
60
|
package = Option.String('--package,-p', {
|
|
61
61
|
description: 'Build the specified library or the one at cwd',
|
|
62
62
|
});
|
|
63
|
+
profile = Option.String('--profile', {
|
|
64
|
+
description: 'Build artifacts with the specified profile',
|
|
65
|
+
});
|
|
63
66
|
crossCompile = Option.Boolean('--cross-compile,-x', {
|
|
64
67
|
description: '[experimental] cross-compile for the specified target with `cargo-xwin` on windows and `cargo-zigbuild` on other platform',
|
|
65
68
|
});
|
|
69
|
+
useCross = Option.Boolean('--use-cross', {
|
|
70
|
+
description: '[experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`',
|
|
71
|
+
});
|
|
66
72
|
watch = Option.Boolean('--watch,-w', {
|
|
67
73
|
description: 'watch the crate changes and build continiously with `cargo-watch` crates',
|
|
68
74
|
});
|
|
@@ -95,7 +101,9 @@ export class BaseBuildCommand extends Command {
|
|
|
95
101
|
verbose: this.verbose,
|
|
96
102
|
bin: this.bin,
|
|
97
103
|
package: this.package,
|
|
104
|
+
profile: this.profile,
|
|
98
105
|
crossCompile: this.crossCompile,
|
|
106
|
+
useCross: this.useCross,
|
|
99
107
|
watch: this.watch,
|
|
100
108
|
features: this.features,
|
|
101
109
|
allFeatures: this.allFeatures,
|