@napi-rs/cli 3.0.0-alpha.8 → 3.0.0-alpha.80

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 (161) hide show
  1. package/cli.mjs +1 -1
  2. package/dist/api/artifacts.js +28 -7
  3. package/dist/api/artifacts.js.map +1 -1
  4. package/dist/api/build.js +309 -64
  5. package/dist/api/build.js.map +1 -1
  6. package/dist/api/create-npm-dirs.js +46 -9
  7. package/dist/api/create-npm-dirs.js.map +1 -1
  8. package/dist/api/new.js +57 -20
  9. package/dist/api/new.js.map +1 -1
  10. package/dist/api/pre-publish.js +9 -7
  11. package/dist/api/pre-publish.js.map +1 -1
  12. package/dist/api/rename.js +9 -1
  13. package/dist/api/rename.js.map +1 -1
  14. package/dist/api/templates/cargo.toml.js +1 -0
  15. package/dist/api/templates/cargo.toml.js.map +1 -1
  16. package/dist/api/templates/ci-template.d.ts +3 -1
  17. package/dist/api/templates/ci-template.js +140 -125
  18. package/dist/api/templates/ci-template.js.map +1 -1
  19. package/dist/api/templates/ci.yml.d.ts +3 -1
  20. package/dist/api/templates/ci.yml.js +21 -5
  21. package/dist/api/templates/ci.yml.js.map +1 -1
  22. package/dist/api/templates/js-binding.d.ts +1 -0
  23. package/dist/api/templates/js-binding.js +141 -222
  24. package/dist/api/templates/js-binding.js.map +1 -1
  25. package/dist/api/templates/lib.rs.js +1 -4
  26. package/dist/api/templates/lib.rs.js.map +1 -1
  27. package/dist/api/templates/load-wasi-template.d.ts +2 -0
  28. package/dist/api/templates/load-wasi-template.js +168 -0
  29. package/dist/api/templates/load-wasi-template.js.map +1 -0
  30. package/dist/api/templates/package.json.d.ts +9 -2
  31. package/dist/api/templates/package.json.js +26 -4
  32. package/dist/api/templates/package.json.js.map +1 -1
  33. package/dist/api/templates/wasi-worker-template.d.ts +2 -0
  34. package/dist/api/templates/wasi-worker-template.js +122 -0
  35. package/dist/api/templates/wasi-worker-template.js.map +1 -0
  36. package/dist/api/universalize.js +5 -5
  37. package/dist/api/universalize.js.map +1 -1
  38. package/dist/api/version.js +2 -2
  39. package/dist/api/version.js.map +1 -1
  40. package/dist/commands/artifacts.js +2 -2
  41. package/dist/commands/artifacts.js.map +1 -1
  42. package/dist/commands/build.js +1 -1
  43. package/dist/commands/build.js.map +1 -1
  44. package/dist/commands/new.js +34 -34
  45. package/dist/commands/new.js.map +1 -1
  46. package/dist/def/artifacts.d.ts +21 -1
  47. package/dist/def/artifacts.js +10 -2
  48. package/dist/def/artifacts.js.map +1 -1
  49. package/dist/def/build.d.ts +155 -4
  50. package/dist/def/build.js +30 -4
  51. package/dist/def/build.js.map +1 -1
  52. package/dist/def/create-npm-dirs.d.ts +10 -0
  53. package/dist/def/create-npm-dirs.js +4 -0
  54. package/dist/def/create-npm-dirs.js.map +1 -1
  55. package/dist/def/new.d.ts +25 -7
  56. package/dist/def/new.js +11 -1
  57. package/dist/def/new.js.map +1 -1
  58. package/dist/def/pre-publish.d.ts +12 -2
  59. package/dist/def/pre-publish.js +7 -3
  60. package/dist/def/pre-publish.js.map +1 -1
  61. package/dist/def/rename.d.ts +16 -6
  62. package/dist/def/rename.js +5 -1
  63. package/dist/def/rename.js.map +1 -1
  64. package/dist/def/universalize.d.ts +10 -0
  65. package/dist/def/universalize.js +4 -0
  66. package/dist/def/universalize.js.map +1 -1
  67. package/dist/def/version.d.ts +10 -0
  68. package/dist/def/version.js +4 -0
  69. package/dist/def/version.js.map +1 -1
  70. package/dist/index.cjs +8706 -14649
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.js +1 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/utils/__tests__/config.spec.d.ts +1 -0
  75. package/dist/utils/__tests__/config.spec.js +63 -0
  76. package/dist/utils/__tests__/config.spec.js.map +1 -0
  77. package/dist/utils/__tests__/typegen.spec.js +8 -4
  78. package/dist/utils/__tests__/typegen.spec.js.map +1 -1
  79. package/dist/utils/cargo.js +2 -2
  80. package/dist/utils/cargo.js.map +1 -1
  81. package/dist/utils/config.d.ts +52 -4
  82. package/dist/utils/config.js +37 -5
  83. package/dist/utils/config.js.map +1 -1
  84. package/dist/utils/index.d.ts +0 -1
  85. package/dist/utils/index.js +0 -1
  86. package/dist/utils/index.js.map +1 -1
  87. package/dist/utils/metadata.d.ts +12 -0
  88. package/dist/utils/metadata.js +21 -10
  89. package/dist/utils/metadata.js.map +1 -1
  90. package/dist/utils/misc.d.ts +1 -2
  91. package/dist/utils/misc.js +3 -3
  92. package/dist/utils/misc.js.map +1 -1
  93. package/dist/utils/target.d.ts +7 -5
  94. package/dist/utils/target.js +17 -3
  95. package/dist/utils/target.js.map +1 -1
  96. package/dist/utils/typegen.d.ts +1 -1
  97. package/dist/utils/typegen.js +55 -20
  98. package/dist/utils/typegen.js.map +1 -1
  99. package/dist/utils/version.d.ts +2 -1
  100. package/dist/utils/version.js +10 -8
  101. package/dist/utils/version.js.map +1 -1
  102. package/package.json +27 -26
  103. package/src/api/artifacts.ts +81 -9
  104. package/src/api/build.ts +467 -87
  105. package/src/api/create-npm-dirs.ts +57 -9
  106. package/src/api/new.ts +89 -31
  107. package/src/api/pre-publish.ts +13 -7
  108. package/src/api/rename.ts +10 -1
  109. package/src/api/templates/cargo.toml.ts +1 -0
  110. package/src/api/templates/ci-template.ts +150 -125
  111. package/src/api/templates/ci.yml.ts +27 -6
  112. package/src/api/templates/js-binding.ts +147 -220
  113. package/src/api/templates/lib.rs.ts +1 -4
  114. package/src/api/templates/load-wasi-template.ts +182 -0
  115. package/src/api/templates/package.json.ts +47 -5
  116. package/src/api/templates/wasi-worker-template.ts +122 -0
  117. package/src/api/universalize.ts +13 -8
  118. package/src/api/version.ts +5 -2
  119. package/src/commands/artifacts.ts +2 -2
  120. package/src/commands/build.ts +1 -1
  121. package/src/commands/new.ts +46 -45
  122. package/src/def/artifacts.ts +22 -3
  123. package/src/def/build.ts +64 -8
  124. package/src/def/create-npm-dirs.ts +9 -0
  125. package/src/def/new.ts +28 -3
  126. package/src/def/pre-publish.ts +12 -3
  127. package/src/def/rename.ts +11 -2
  128. package/src/def/universalize.ts +9 -0
  129. package/src/def/version.ts +9 -0
  130. package/src/index.ts +2 -0
  131. package/src/utils/__tests__/__fixtures__/napi_type_def +130 -130
  132. package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
  133. package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
  134. package/src/utils/__tests__/__snapshots__/target.spec.ts.md +28 -0
  135. package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
  136. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +711 -158
  137. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
  138. package/src/utils/__tests__/__snapshots__/version.spec.ts.md +8 -7
  139. package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
  140. package/src/utils/__tests__/config.spec.ts +81 -0
  141. package/src/utils/__tests__/typegen.spec.ts +18 -3
  142. package/src/utils/cargo.ts +2 -2
  143. package/src/utils/config.ts +116 -10
  144. package/src/utils/index.ts +0 -1
  145. package/src/utils/metadata.ts +38 -13
  146. package/src/utils/misc.ts +11 -3
  147. package/src/utils/target.ts +22 -4
  148. package/src/utils/typegen.ts +98 -49
  149. package/src/utils/version.ts +10 -8
  150. package/dist/api/load-wasi-template.d.ts +0 -1
  151. package/dist/api/load-wasi-template.js +0 -64
  152. package/dist/api/load-wasi-template.js.map +0 -1
  153. package/dist/api/wasi-worker-template.d.ts +0 -1
  154. package/dist/api/wasi-worker-template.js +0 -53
  155. package/dist/api/wasi-worker-template.js.map +0 -1
  156. package/dist/utils/ci.d.ts +0 -11
  157. package/dist/utils/ci.js +0 -96
  158. package/dist/utils/ci.js.map +0 -1
  159. package/src/api/load-wasi-template.ts +0 -66
  160. package/src/api/wasi-worker-template.ts +0 -52
  161. package/src/utils/ci.ts +0 -111
@@ -5,16 +5,20 @@ export declare abstract class BaseBuildCommand extends Command {
5
5
  target?: string;
6
6
  cwd?: string;
7
7
  manifestPath?: string;
8
+ configPath?: string;
8
9
  packageJsonPath?: string;
9
10
  targetDir?: string;
10
11
  outputDir?: string;
11
12
  platform?: boolean;
12
13
  jsPackageName?: string;
14
+ constEnum?: boolean;
13
15
  jsBinding?: string;
14
16
  noJsBinding?: boolean;
15
17
  dts?: string;
16
18
  dtsHeader?: string;
17
19
  noDtsHeader?: boolean;
20
+ dtsCache: boolean;
21
+ esm?: boolean;
18
22
  strip?: boolean;
19
23
  release?: boolean;
20
24
  verbose?: boolean;
@@ -23,6 +27,7 @@ export declare abstract class BaseBuildCommand extends Command {
23
27
  profile?: string;
24
28
  crossCompile?: boolean;
25
29
  useCross?: boolean;
30
+ useNapiCross?: boolean;
26
31
  watch?: boolean;
27
32
  features?: string[];
28
33
  allFeatures?: boolean;
@@ -31,16 +36,20 @@ export declare abstract class BaseBuildCommand extends Command {
31
36
  target: string | undefined;
32
37
  cwd: string | undefined;
33
38
  manifestPath: string | undefined;
39
+ configPath: string | undefined;
34
40
  packageJsonPath: string | undefined;
35
41
  targetDir: string | undefined;
36
42
  outputDir: string | undefined;
37
43
  platform: boolean | undefined;
38
44
  jsPackageName: string | undefined;
45
+ constEnum: boolean | undefined;
39
46
  jsBinding: string | undefined;
40
47
  noJsBinding: boolean | undefined;
41
48
  dts: string | undefined;
42
49
  dtsHeader: string | undefined;
43
50
  noDtsHeader: boolean | undefined;
51
+ dtsCache: boolean;
52
+ esm: boolean | undefined;
44
53
  strip: boolean | undefined;
45
54
  release: boolean | undefined;
46
55
  verbose: boolean | undefined;
@@ -49,6 +58,7 @@ export declare abstract class BaseBuildCommand extends Command {
49
58
  profile: string | undefined;
50
59
  crossCompile: boolean | undefined;
51
60
  useCross: boolean | undefined;
61
+ useNapiCross: boolean | undefined;
52
62
  watch: boolean | undefined;
53
63
  features: string[] | undefined;
54
64
  allFeatures: boolean | undefined;
@@ -56,7 +66,7 @@ export declare abstract class BaseBuildCommand extends Command {
56
66
  };
57
67
  }
58
68
  /**
59
- * Build the napi-rs project
69
+ * Build the NAPI-RS project
60
70
  */
61
71
  export interface BuildOptions {
62
72
  /**
@@ -71,6 +81,10 @@ export interface BuildOptions {
71
81
  * Path to `Cargo.toml`
72
82
  */
73
83
  manifestPath?: string;
84
+ /**
85
+ * Path to `napi` config json file
86
+ */
87
+ configPath?: string;
74
88
  /**
75
89
  * Path to `package.json`
76
90
  */
@@ -92,7 +106,11 @@ export interface BuildOptions {
92
106
  */
93
107
  jsPackageName?: string;
94
108
  /**
95
- * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.
109
+ * Whether generate const enum for typescript bindings
110
+ */
111
+ constEnum?: boolean;
112
+ /**
113
+ * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output-dir`.
96
114
  */
97
115
  jsBinding?: string;
98
116
  /**
@@ -100,7 +118,7 @@ export interface BuildOptions {
100
118
  */
101
119
  noJsBinding?: boolean;
102
120
  /**
103
- * Path and filename of generated type def file. Relative to `--output_dir`
121
+ * Path and filename of generated type def file. Relative to `--output-dir`
104
122
  */
105
123
  dts?: string;
106
124
  /**
@@ -111,6 +129,16 @@ export interface BuildOptions {
111
129
  * Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.
112
130
  */
113
131
  noDtsHeader?: boolean;
132
+ /**
133
+ * Whether to enable the dts cache, default to true
134
+ *
135
+ * @default true
136
+ */
137
+ dtsCache?: boolean;
138
+ /**
139
+ * Whether to emit an ESM JS binding file instead of CJS format. Only works with `--platform` flag.
140
+ */
141
+ esm?: boolean;
114
142
  /**
115
143
  * Whether strip the library to achieve the minimum file size
116
144
  */
@@ -144,7 +172,11 @@ export interface BuildOptions {
144
172
  */
145
173
  useCross?: boolean;
146
174
  /**
147
- * watch the crate changes and build continiously with `cargo-watch` crates
175
+ * [experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.
176
+ */
177
+ useNapiCross?: boolean;
178
+ /**
179
+ * watch the crate changes and build continuously with `cargo-watch` crates
148
180
  */
149
181
  watch?: boolean;
150
182
  /**
@@ -160,3 +192,122 @@ export interface BuildOptions {
160
192
  */
161
193
  noDefaultFeatures?: boolean;
162
194
  }
195
+ export declare function applyDefaultBuildOptions(options: BuildOptions): {
196
+ /**
197
+ * Build for the target triple, bypassed to `cargo build --target`
198
+ */
199
+ target?: string;
200
+ /**
201
+ * The working directory of where napi command will be executed in, all other paths options are relative to this path
202
+ */
203
+ cwd?: string;
204
+ /**
205
+ * Path to `Cargo.toml`
206
+ */
207
+ manifestPath?: string;
208
+ /**
209
+ * Path to `napi` config json file
210
+ */
211
+ configPath?: string;
212
+ /**
213
+ * Path to `package.json`
214
+ */
215
+ packageJsonPath?: string;
216
+ /**
217
+ * Directory for all crate generated artifacts, see `cargo build --target-dir`
218
+ */
219
+ targetDir?: string;
220
+ /**
221
+ * Path to where all the built files would be put. Default to the crate folder
222
+ */
223
+ outputDir?: string;
224
+ /**
225
+ * Add platform triple to the generated nodejs binding file, eg: `[name].linux-x64-gnu.node`
226
+ */
227
+ platform?: boolean;
228
+ /**
229
+ * Package name in generated js binding file. Only works with `--platform` flag
230
+ */
231
+ jsPackageName?: string;
232
+ /**
233
+ * Whether generate const enum for typescript bindings
234
+ */
235
+ constEnum?: boolean;
236
+ /**
237
+ * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output-dir`.
238
+ */
239
+ jsBinding?: string;
240
+ /**
241
+ * Whether to disable the generation JS binding file. Only works with `--platform` flag.
242
+ */
243
+ noJsBinding?: boolean;
244
+ /**
245
+ * Path and filename of generated type def file. Relative to `--output-dir`
246
+ */
247
+ dts?: string;
248
+ /**
249
+ * Custom file header for generated type def file. Only works when `typedef` feature enabled.
250
+ */
251
+ dtsHeader?: string;
252
+ /**
253
+ * Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.
254
+ */
255
+ noDtsHeader?: boolean;
256
+ dtsCache: boolean;
257
+ /**
258
+ * Whether to emit an ESM JS binding file instead of CJS format. Only works with `--platform` flag.
259
+ */
260
+ esm?: boolean;
261
+ /**
262
+ * Whether strip the library to achieve the minimum file size
263
+ */
264
+ strip?: boolean;
265
+ /**
266
+ * Build in release mode
267
+ */
268
+ release?: boolean;
269
+ /**
270
+ * Verbosely log build command trace
271
+ */
272
+ verbose?: boolean;
273
+ /**
274
+ * Build only the specified binary
275
+ */
276
+ bin?: string;
277
+ /**
278
+ * Build the specified library or the one at cwd
279
+ */
280
+ package?: string;
281
+ /**
282
+ * Build artifacts with the specified profile
283
+ */
284
+ profile?: string;
285
+ /**
286
+ * [experimental] cross-compile for the specified target with `cargo-xwin` on windows and `cargo-zigbuild` on other platform
287
+ */
288
+ crossCompile?: boolean;
289
+ /**
290
+ * [experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`
291
+ */
292
+ useCross?: boolean;
293
+ /**
294
+ * [experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.
295
+ */
296
+ useNapiCross?: boolean;
297
+ /**
298
+ * watch the crate changes and build continuously with `cargo-watch` crates
299
+ */
300
+ watch?: boolean;
301
+ /**
302
+ * Space-separated list of features to activate
303
+ */
304
+ features?: string[];
305
+ /**
306
+ * Activate all available features
307
+ */
308
+ allFeatures?: boolean;
309
+ /**
310
+ * Do not activate the `default` feature
311
+ */
312
+ noDefaultFeatures?: boolean;
313
+ };
package/dist/def/build.js CHANGED
@@ -4,7 +4,7 @@ import { Command, Option } from 'clipanion';
4
4
  export class BaseBuildCommand extends Command {
5
5
  static paths = [['build']];
6
6
  static usage = Command.Usage({
7
- description: 'Build the napi-rs project',
7
+ description: 'Build the NAPI-RS project',
8
8
  });
9
9
  target = Option.String('--target,-t', {
10
10
  description: 'Build for the target triple, bypassed to `cargo build --target`',
@@ -15,6 +15,9 @@ export class BaseBuildCommand extends Command {
15
15
  manifestPath = Option.String('--manifest-path', {
16
16
  description: 'Path to `Cargo.toml`',
17
17
  });
18
+ configPath = Option.String('--config-path,-c', {
19
+ description: 'Path to `napi` config json file',
20
+ });
18
21
  packageJsonPath = Option.String('--package-json-path', {
19
22
  description: 'Path to `package.json`',
20
23
  });
@@ -30,14 +33,17 @@ export class BaseBuildCommand extends Command {
30
33
  jsPackageName = Option.String('--js-package-name', {
31
34
  description: 'Package name in generated js binding file. Only works with `--platform` flag',
32
35
  });
36
+ constEnum = Option.Boolean('--const-enum', {
37
+ description: 'Whether generate const enum for typescript bindings',
38
+ });
33
39
  jsBinding = Option.String('--js', {
34
- description: 'Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.',
40
+ description: 'Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output-dir`.',
35
41
  });
36
42
  noJsBinding = Option.Boolean('--no-js', {
37
43
  description: 'Whether to disable the generation JS binding file. Only works with `--platform` flag.',
38
44
  });
39
45
  dts = Option.String('--dts', {
40
- description: 'Path and filename of generated type def file. Relative to `--output_dir`',
46
+ description: 'Path and filename of generated type def file. Relative to `--output-dir`',
41
47
  });
42
48
  dtsHeader = Option.String('--dts-header', {
43
49
  description: 'Custom file header for generated type def file. Only works when `typedef` feature enabled.',
@@ -45,6 +51,12 @@ export class BaseBuildCommand extends Command {
45
51
  noDtsHeader = Option.Boolean('--no-dts-header', {
46
52
  description: 'Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.',
47
53
  });
54
+ dtsCache = Option.Boolean('--dts-cache', true, {
55
+ description: 'Whether to enable the dts cache, default to true',
56
+ });
57
+ esm = Option.Boolean('--esm', {
58
+ description: 'Whether to emit an ESM JS binding file instead of CJS format. Only works with `--platform` flag.',
59
+ });
48
60
  strip = Option.Boolean('--strip,-s', {
49
61
  description: 'Whether strip the library to achieve the minimum file size',
50
62
  });
@@ -69,8 +81,11 @@ export class BaseBuildCommand extends Command {
69
81
  useCross = Option.Boolean('--use-cross', {
70
82
  description: '[experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`',
71
83
  });
84
+ useNapiCross = Option.Boolean('--use-napi-cross', {
85
+ description: '[experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.',
86
+ });
72
87
  watch = Option.Boolean('--watch,-w', {
73
- description: 'watch the crate changes and build continiously with `cargo-watch` crates',
88
+ description: 'watch the crate changes and build continuously with `cargo-watch` crates',
74
89
  });
75
90
  features = Option.Array('--features,-F', {
76
91
  description: 'Space-separated list of features to activate',
@@ -86,16 +101,20 @@ export class BaseBuildCommand extends Command {
86
101
  target: this.target,
87
102
  cwd: this.cwd,
88
103
  manifestPath: this.manifestPath,
104
+ configPath: this.configPath,
89
105
  packageJsonPath: this.packageJsonPath,
90
106
  targetDir: this.targetDir,
91
107
  outputDir: this.outputDir,
92
108
  platform: this.platform,
93
109
  jsPackageName: this.jsPackageName,
110
+ constEnum: this.constEnum,
94
111
  jsBinding: this.jsBinding,
95
112
  noJsBinding: this.noJsBinding,
96
113
  dts: this.dts,
97
114
  dtsHeader: this.dtsHeader,
98
115
  noDtsHeader: this.noDtsHeader,
116
+ dtsCache: this.dtsCache,
117
+ esm: this.esm,
99
118
  strip: this.strip,
100
119
  release: this.release,
101
120
  verbose: this.verbose,
@@ -104,6 +123,7 @@ export class BaseBuildCommand extends Command {
104
123
  profile: this.profile,
105
124
  crossCompile: this.crossCompile,
106
125
  useCross: this.useCross,
126
+ useNapiCross: this.useNapiCross,
107
127
  watch: this.watch,
108
128
  features: this.features,
109
129
  allFeatures: this.allFeatures,
@@ -111,4 +131,10 @@ export class BaseBuildCommand extends Command {
111
131
  };
112
132
  }
113
133
  }
134
+ export function applyDefaultBuildOptions(options) {
135
+ return {
136
+ dtsCache: true,
137
+ ...options,
138
+ };
139
+ }
114
140
  //# sourceMappingURL=build.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/def/build.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,OAAgB,gBAAiB,SAAQ,OAAO;IAC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ACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAA;IACH,CAAC;;AAmIH,MAAM,UAAU,wBAAwB,CAAC,OAAqB;IAC5D,OAAO;QACL,QAAQ,EAAE,IAAI;QACd,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
@@ -3,11 +3,13 @@ export declare abstract class BaseCreateNpmDirsCommand extends Command {
3
3
  static paths: string[][];
4
4
  static usage: import("clipanion").Usage;
5
5
  cwd: string;
6
+ configPath?: string;
6
7
  packageJsonPath: string;
7
8
  npmDir: string;
8
9
  dryRun: boolean;
9
10
  getOptions(): {
10
11
  cwd: string;
12
+ configPath: string | undefined;
11
13
  packageJsonPath: string;
12
14
  npmDir: string;
13
15
  dryRun: boolean;
@@ -23,6 +25,10 @@ export interface CreateNpmDirsOptions {
23
25
  * @default process.cwd()
24
26
  */
25
27
  cwd?: string;
28
+ /**
29
+ * Path to `napi` config json file
30
+ */
31
+ configPath?: string;
26
32
  /**
27
33
  * Path to `package.json`
28
34
  *
@@ -44,6 +50,10 @@ export interface CreateNpmDirsOptions {
44
50
  }
45
51
  export declare function applyDefaultCreateNpmDirsOptions(options: CreateNpmDirsOptions): {
46
52
  cwd: string;
53
+ /**
54
+ * Path to `napi` config json file
55
+ */
56
+ configPath?: string;
47
57
  packageJsonPath: string;
48
58
  npmDir: string;
49
59
  dryRun: boolean;
@@ -9,6 +9,9 @@ export class BaseCreateNpmDirsCommand extends Command {
9
9
  cwd = Option.String('--cwd', process.cwd(), {
10
10
  description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
11
  });
12
+ configPath = Option.String('--config-path,-c', {
13
+ description: 'Path to `napi` config json file',
14
+ });
12
15
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
16
  description: 'Path to `package.json`',
14
17
  });
@@ -21,6 +24,7 @@ export class BaseCreateNpmDirsCommand extends Command {
21
24
  getOptions() {
22
25
  return {
23
26
  cwd: this.cwd,
27
+ configPath: this.configPath,
24
28
  packageJsonPath: this.packageJsonPath,
25
29
  npmDir: this.npmDir,
26
30
  dryRun: this.dryRun,
@@ -1 +1 @@
1
- {"version":3,"file":"create-npm-dirs.js","sourceRoot":"","sources":["../../src/def/create-npm-dirs.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAE3C,MAAM,OAAgB,wBAAyB,SAAQ,OAAO;IAC5D,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAEpC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,WAAW,EAAE,iDAAiD;KAC/D,CAAC,CAAA;IAEF,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE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,CAAC,GAAG,EAAE,EAAE;QAC1C,WAAW,EACT,oHAAoH;KACvH,CAAC,CAAA;IAEF,UAAU,GAAY,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;QACtD,WAAW,EAAE,iCAAiC;KAC/C,CAAC,CAAA;IAEF,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,cAAc,EAAE;QACrE,WAAW,EAAE,wBAAwB;KACtC,CAAC,CAAA;IAEF,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,EAAE;QACzC,WAAW,EAAE,+CAA+C;KAC7D,CAAC,CAAA;IAEF,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE;QAC1C,WAAW,EAAE,sCAAsC;KACpD,CAAC,CAAA;IAEF,UAAU;QACR,OAAO;YACL,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAA;IACH,CAAC;;AAqCH,MAAM,UAAU,gCAAgC,CAC9C,OAA6B;IAE7B,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,eAAe,EAAE,cAAc;QAC/B,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,KAAK;QACb,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
package/dist/def/new.d.ts CHANGED
@@ -2,26 +2,30 @@ import { Command } from 'clipanion';
2
2
  export declare abstract class BaseNewCommand extends Command {
3
3
  static paths: string[][];
4
4
  static usage: import("clipanion").Usage;
5
- $$path: string;
5
+ $$path: string | undefined;
6
6
  $$name?: string;
7
7
  minNodeApiVersion: number;
8
+ packageManager: string;
8
9
  license: string;
9
10
  targets: string[];
10
11
  enableDefaultTargets: boolean;
11
12
  enableAllTargets: boolean;
12
13
  enableTypeDef: boolean;
13
14
  enableGithubActions: boolean;
15
+ testFramework: string;
14
16
  dryRun: boolean;
15
17
  getOptions(): {
16
- path: string;
18
+ path: string | undefined;
17
19
  name: string | undefined;
18
20
  minNodeApiVersion: number;
21
+ packageManager: string;
19
22
  license: string;
20
23
  targets: string[];
21
24
  enableDefaultTargets: boolean;
22
25
  enableAllTargets: boolean;
23
26
  enableTypeDef: boolean;
24
27
  enableGithubActions: boolean;
28
+ testFramework: string;
25
29
  dryRun: boolean;
26
30
  };
27
31
  }
@@ -30,9 +34,9 @@ export declare abstract class BaseNewCommand extends Command {
30
34
  */
31
35
  export interface NewOptions {
32
36
  /**
33
- * The path where the napi-rs project will be created.
37
+ * The path where the NAPI-RS project will be created.
34
38
  */
35
- path: string;
39
+ path?: string;
36
40
  /**
37
41
  * The name of the project, default to the name of the directory if not provided
38
42
  */
@@ -43,6 +47,12 @@ export interface NewOptions {
43
47
  * @default 4
44
48
  */
45
49
  minNodeApiVersion?: number;
50
+ /**
51
+ * The package manager to use. Only support yarn 4.x for now.
52
+ *
53
+ * @default 'yarn'
54
+ */
55
+ packageManager?: string;
46
56
  /**
47
57
  * License for open-sourced project
48
58
  *
@@ -79,6 +89,12 @@ export interface NewOptions {
79
89
  * @default true
80
90
  */
81
91
  enableGithubActions?: boolean;
92
+ /**
93
+ * The JavaScript test framework to use, only support `ava` for now
94
+ *
95
+ * @default 'ava'
96
+ */
97
+ testFramework?: string;
82
98
  /**
83
99
  * Whether to run the command in dry-run mode
84
100
  *
@@ -88,19 +104,21 @@ export interface NewOptions {
88
104
  }
89
105
  export declare function applyDefaultNewOptions(options: NewOptions): {
90
106
  /**
91
- * The path where the napi-rs project will be created.
107
+ * The path where the NAPI-RS project will be created.
92
108
  */
93
- path: string;
109
+ path?: string;
94
110
  /**
95
111
  * The name of the project, default to the name of the directory if not provided
96
112
  */
97
- name?: string | undefined;
113
+ name?: string;
98
114
  minNodeApiVersion: number;
115
+ packageManager: string;
99
116
  license: string;
100
117
  targets: string[];
101
118
  enableDefaultTargets: boolean;
102
119
  enableAllTargets: boolean;
103
120
  enableTypeDef: boolean;
104
121
  enableGithubActions: boolean;
122
+ testFramework: string;
105
123
  dryRun: boolean;
106
124
  };
package/dist/def/new.js CHANGED
@@ -7,7 +7,7 @@ export class BaseNewCommand extends Command {
7
7
  static usage = Command.Usage({
8
8
  description: 'Create a new project with pre-configured boilerplate',
9
9
  });
10
- $$path = Option.String({ required: true });
10
+ $$path = Option.String({ required: false });
11
11
  $$name = Option.String('--name,-n', {
12
12
  description: 'The name of the project, default to the name of the directory if not provided',
13
13
  });
@@ -15,6 +15,9 @@ export class BaseNewCommand extends Command {
15
15
  validator: typanion.isNumber(),
16
16
  description: 'The minimum Node-API version to support',
17
17
  });
18
+ packageManager = Option.String('--package-manager', 'yarn', {
19
+ description: 'The package manager to use. Only support yarn 4.x for now.',
20
+ });
18
21
  license = Option.String('--license,-l', 'MIT', {
19
22
  description: 'License for open-sourced project',
20
23
  });
@@ -33,6 +36,9 @@ export class BaseNewCommand extends Command {
33
36
  enableGithubActions = Option.Boolean('--enable-github-actions', true, {
34
37
  description: 'Whether generate preconfigured GitHub Actions workflow',
35
38
  });
39
+ testFramework = Option.String('--test-framework', 'ava', {
40
+ description: 'The JavaScript test framework to use, only support `ava` for now',
41
+ });
36
42
  dryRun = Option.Boolean('--dry-run', false, {
37
43
  description: 'Whether to run the command in dry-run mode',
38
44
  });
@@ -41,12 +47,14 @@ export class BaseNewCommand extends Command {
41
47
  path: this.$$path,
42
48
  name: this.$$name,
43
49
  minNodeApiVersion: this.minNodeApiVersion,
50
+ packageManager: this.packageManager,
44
51
  license: this.license,
45
52
  targets: this.targets,
46
53
  enableDefaultTargets: this.enableDefaultTargets,
47
54
  enableAllTargets: this.enableAllTargets,
48
55
  enableTypeDef: this.enableTypeDef,
49
56
  enableGithubActions: this.enableGithubActions,
57
+ testFramework: this.testFramework,
50
58
  dryRun: this.dryRun,
51
59
  };
52
60
  }
@@ -54,12 +62,14 @@ export class BaseNewCommand extends Command {
54
62
  export function applyDefaultNewOptions(options) {
55
63
  return {
56
64
  minNodeApiVersion: 4,
65
+ packageManager: 'yarn',
57
66
  license: 'MIT',
58
67
  targets: [],
59
68
  enableDefaultTargets: true,
60
69
  enableAllTargets: false,
61
70
  enableTypeDef: true,
62
71
  enableGithubActions: true,
72
+ testFramework: 'ava',
63
73
  dryRun: false,
64
74
  ...options,
65
75
  };
@@ -1 +1 @@
1
- {"version":3,"file":"new.js","sourceRoot":"","sources":["../../src/def/new.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,iCAAiC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAA;AAEpC,MAAM,OAAgB,cAAe,SAAQ,OAAO;IAClD,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;IAExB,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,WAAW,EAAE,sDAAsD;KACpE,CAAC,CAAA;IAEF,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1C,MAAM,GAAY,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE;QAC3C,WAAW,EACT,+EAA+E;KAClF,CAAC,CAAA;IAEF,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC1D,SAAS,EAAE,QAAQ,CAAC,QAAQ,EAAE;QAC9B,WAAW,EAAE,yCAAyC;KACvD,CAAC,CAAA;IAEF,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,KAAK,EAAE;QAC7C,WAAW,EAAE,kCAAkC;KAChD,CAAC,CAAA;IAEF,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,EAAE,EAAE,EAAE;QACzC,WAAW,E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Ac,EAAE,MAAM;QACtB,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE;QACX,oBAAoB,EAAE,IAAI;QAC1B,gBAAgB,EAAE,KAAK;QACvB,aAAa,EAAE,IAAI;QACnB,mBAAmB,EAAE,IAAI;QACzB,aAAa,EAAE,KAAK;QACpB,MAAM,EAAE,KAAK;QACb,GAAG,OAAO;KACX,CAAA;AACH,CAAC"}
@@ -3,6 +3,7 @@ export declare abstract class BasePrePublishCommand extends Command {
3
3
  static paths: string[][];
4
4
  static usage: import("clipanion").Usage;
5
5
  cwd: string;
6
+ configPath?: string;
6
7
  packageJsonPath: string;
7
8
  npmDir: string;
8
9
  tagStyle: string;
@@ -12,6 +13,7 @@ export declare abstract class BasePrePublishCommand extends Command {
12
13
  dryRun: boolean;
13
14
  getOptions(): {
14
15
  cwd: string;
16
+ configPath: string | undefined;
15
17
  packageJsonPath: string;
16
18
  npmDir: string;
17
19
  tagStyle: string;
@@ -31,6 +33,10 @@ export interface PrePublishOptions {
31
33
  * @default process.cwd()
32
34
  */
33
35
  cwd?: string;
36
+ /**
37
+ * Path to `napi` config json file
38
+ */
39
+ configPath?: string;
34
40
  /**
35
41
  * Path to `package.json`
36
42
  *
@@ -72,6 +78,10 @@ export interface PrePublishOptions {
72
78
  }
73
79
  export declare function applyDefaultPrePublishOptions(options: PrePublishOptions): {
74
80
  cwd: string;
81
+ /**
82
+ * Path to `napi` config json file
83
+ */
84
+ configPath?: string;
75
85
  packageJsonPath: string;
76
86
  npmDir: string;
77
87
  tagStyle: string;
@@ -79,10 +89,10 @@ export declare function applyDefaultPrePublishOptions(options: PrePublishOptions
79
89
  /**
80
90
  * GitHub release name
81
91
  */
82
- ghReleaseName?: string | undefined;
92
+ ghReleaseName?: string;
83
93
  /**
84
94
  * Existing GitHub release id
85
95
  */
86
- ghReleaseId?: string | undefined;
96
+ ghReleaseId?: string;
87
97
  dryRun: boolean;
88
98
  };