@napi-rs/cli 3.0.0-alpha.10 → 3.0.0-alpha.100

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 (199) hide show
  1. package/cli.mjs +1 -1
  2. package/dist/api/__tests__/create-npm-dirs.spec.d.ts +1 -0
  3. package/dist/api/__tests__/new.spec.d.ts +1 -0
  4. package/dist/api/build.d.ts +1 -1
  5. package/dist/api/create-npm-dirs.d.ts +5 -0
  6. package/dist/api/templates/index.d.ts +0 -7
  7. package/dist/api/templates/js-binding.d.ts +1 -0
  8. package/dist/api/templates/load-wasi-template.d.ts +2 -0
  9. package/dist/api/templates/wasi-worker-template.d.ts +2 -0
  10. package/dist/cli.js +3961 -15
  11. package/dist/def/artifacts.d.ts +21 -1
  12. package/dist/def/build.d.ts +149 -4
  13. package/dist/def/create-npm-dirs.d.ts +10 -0
  14. package/dist/def/new.d.ts +25 -7
  15. package/dist/def/pre-publish.d.ts +21 -2
  16. package/dist/def/rename.d.ts +16 -6
  17. package/dist/def/universalize.d.ts +10 -0
  18. package/dist/def/version.d.ts +10 -0
  19. package/dist/index.cjs +10052 -15662
  20. package/dist/index.js +3712 -32
  21. package/dist/utils/__tests__/config.spec.d.ts +1 -0
  22. package/dist/utils/config.d.ts +56 -4
  23. package/dist/utils/index.d.ts +1 -1
  24. package/dist/utils/metadata.d.ts +13 -1
  25. package/dist/utils/misc.d.ts +3 -3
  26. package/dist/utils/read-config.d.ts +7 -0
  27. package/dist/utils/target.d.ts +8 -6
  28. package/dist/utils/typegen.d.ts +1 -1
  29. package/dist/utils/version.d.ts +2 -1
  30. package/package.json +38 -34
  31. package/src/api/__tests__/create-npm-dirs.spec.ts +210 -0
  32. package/src/api/__tests__/new.spec.ts +429 -0
  33. package/src/api/artifacts.ts +81 -9
  34. package/src/api/build.ts +595 -183
  35. package/src/api/create-npm-dirs.ts +64 -13
  36. package/src/api/new.ts +389 -122
  37. package/src/api/pre-publish.ts +19 -11
  38. package/src/api/rename.ts +103 -17
  39. package/src/api/templates/index.ts +0 -7
  40. package/src/api/templates/js-binding.ts +159 -220
  41. package/src/api/templates/load-wasi-template.ts +216 -0
  42. package/src/api/templates/wasi-worker-template.ts +122 -0
  43. package/src/api/universalize.ts +13 -8
  44. package/src/api/version.ts +5 -2
  45. package/src/commands/artifacts.ts +2 -2
  46. package/src/commands/build.ts +1 -1
  47. package/src/commands/new.ts +46 -45
  48. package/src/def/artifacts.ts +22 -3
  49. package/src/def/build.ts +55 -8
  50. package/src/def/create-npm-dirs.ts +9 -0
  51. package/src/def/new.ts +28 -3
  52. package/src/def/pre-publish.ts +24 -3
  53. package/src/def/rename.ts +11 -2
  54. package/src/def/universalize.ts +9 -0
  55. package/src/def/version.ts +9 -0
  56. package/src/utils/__tests__/__fixtures__/napi_type_def +130 -130
  57. package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
  58. package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
  59. package/src/utils/__tests__/__snapshots__/target.spec.ts.md +49 -0
  60. package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
  61. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +316 -332
  62. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
  63. package/src/utils/__tests__/__snapshots__/version.spec.ts.md +8 -7
  64. package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
  65. package/src/utils/__tests__/config.spec.ts +81 -0
  66. package/src/utils/cargo.ts +2 -2
  67. package/src/utils/config.ts +127 -9
  68. package/src/utils/index.ts +1 -1
  69. package/src/utils/log.ts +1 -1
  70. package/src/utils/metadata.ts +52 -14
  71. package/src/utils/misc.ts +21 -12
  72. package/src/utils/read-config.ts +20 -0
  73. package/src/utils/target.ts +37 -5
  74. package/src/utils/typegen.ts +87 -52
  75. package/src/utils/version.ts +10 -8
  76. package/dist/api/artifacts.js +0 -53
  77. package/dist/api/artifacts.js.map +0 -1
  78. package/dist/api/build.js +0 -498
  79. package/dist/api/build.js.map +0 -1
  80. package/dist/api/create-npm-dirs.js +0 -64
  81. package/dist/api/create-npm-dirs.js.map +0 -1
  82. package/dist/api/load-wasi-template.d.ts +0 -1
  83. package/dist/api/load-wasi-template.js +0 -60
  84. package/dist/api/load-wasi-template.js.map +0 -1
  85. package/dist/api/new.js +0 -155
  86. package/dist/api/new.js.map +0 -1
  87. package/dist/api/pre-publish.js +0 -158
  88. package/dist/api/pre-publish.js.map +0 -1
  89. package/dist/api/rename.js +0 -29
  90. package/dist/api/rename.js.map +0 -1
  91. package/dist/api/templates/.gitignore.d.ts +0 -1
  92. package/dist/api/templates/.gitignore.js +0 -200
  93. package/dist/api/templates/.gitignore.js.map +0 -1
  94. package/dist/api/templates/.npmignore.d.ts +0 -1
  95. package/dist/api/templates/.npmignore.js +0 -15
  96. package/dist/api/templates/.npmignore.js.map +0 -1
  97. package/dist/api/templates/build.rs.d.ts +0 -1
  98. package/dist/api/templates/build.rs.js +0 -5
  99. package/dist/api/templates/build.rs.js.map +0 -1
  100. package/dist/api/templates/cargo.toml.d.ts +0 -6
  101. package/dist/api/templates/cargo.toml.js +0 -26
  102. package/dist/api/templates/cargo.toml.js.map +0 -1
  103. package/dist/api/templates/ci-template.d.ts +0 -1
  104. package/dist/api/templates/ci-template.js +0 -578
  105. package/dist/api/templates/ci-template.js.map +0 -1
  106. package/dist/api/templates/ci.yml.d.ts +0 -1
  107. package/dist/api/templates/ci.yml.js +0 -99
  108. package/dist/api/templates/ci.yml.js.map +0 -1
  109. package/dist/api/templates/index.js +0 -9
  110. package/dist/api/templates/index.js.map +0 -1
  111. package/dist/api/templates/js-binding.js +0 -293
  112. package/dist/api/templates/js-binding.js.map +0 -1
  113. package/dist/api/templates/lib.rs.d.ts +0 -1
  114. package/dist/api/templates/lib.rs.js +0 -8
  115. package/dist/api/templates/lib.rs.js.map +0 -1
  116. package/dist/api/templates/package.json.d.ts +0 -8
  117. package/dist/api/templates/package.json.js +0 -32
  118. package/dist/api/templates/package.json.js.map +0 -1
  119. package/dist/api/universalize.js +0 -39
  120. package/dist/api/universalize.js.map +0 -1
  121. package/dist/api/version.js +0 -17
  122. package/dist/api/version.js.map +0 -1
  123. package/dist/api/wasi-worker-template.d.ts +0 -1
  124. package/dist/api/wasi-worker-template.js +0 -53
  125. package/dist/api/wasi-worker-template.js.map +0 -1
  126. package/dist/cli.js.map +0 -1
  127. package/dist/commands/artifacts.js +0 -20
  128. package/dist/commands/artifacts.js.map +0 -1
  129. package/dist/commands/build.js +0 -35
  130. package/dist/commands/build.js.map +0 -1
  131. package/dist/commands/create-npm-dirs.js +0 -8
  132. package/dist/commands/create-npm-dirs.js.map +0 -1
  133. package/dist/commands/help.js +0 -13
  134. package/dist/commands/help.js.map +0 -1
  135. package/dist/commands/new.js +0 -110
  136. package/dist/commands/new.js.map +0 -1
  137. package/dist/commands/pre-publish.js +0 -9
  138. package/dist/commands/pre-publish.js.map +0 -1
  139. package/dist/commands/rename.js +0 -8
  140. package/dist/commands/rename.js.map +0 -1
  141. package/dist/commands/universalize.js +0 -8
  142. package/dist/commands/universalize.js.map +0 -1
  143. package/dist/commands/version.js +0 -8
  144. package/dist/commands/version.js.map +0 -1
  145. package/dist/def/artifacts.js +0 -39
  146. package/dist/def/artifacts.js.map +0 -1
  147. package/dist/def/build.js +0 -118
  148. package/dist/def/build.js.map +0 -1
  149. package/dist/def/create-npm-dirs.js +0 -39
  150. package/dist/def/create-npm-dirs.js.map +0 -1
  151. package/dist/def/new.js +0 -67
  152. package/dist/def/new.js.map +0 -1
  153. package/dist/def/pre-publish.js +0 -57
  154. package/dist/def/pre-publish.js.map +0 -1
  155. package/dist/def/rename.js +0 -59
  156. package/dist/def/rename.js.map +0 -1
  157. package/dist/def/universalize.js +0 -34
  158. package/dist/def/universalize.js.map +0 -1
  159. package/dist/def/version.js +0 -34
  160. package/dist/def/version.js.map +0 -1
  161. package/dist/index.js.map +0 -1
  162. package/dist/utils/__tests__/target.spec.js +0 -11
  163. package/dist/utils/__tests__/target.spec.js.map +0 -1
  164. package/dist/utils/__tests__/typegen.spec.js +0 -42
  165. package/dist/utils/__tests__/typegen.spec.js.map +0 -1
  166. package/dist/utils/__tests__/version.spec.js +0 -6
  167. package/dist/utils/__tests__/version.spec.js.map +0 -1
  168. package/dist/utils/cargo.js +0 -34
  169. package/dist/utils/cargo.js.map +0 -1
  170. package/dist/utils/ci.d.ts +0 -11
  171. package/dist/utils/ci.js +0 -96
  172. package/dist/utils/ci.js.map +0 -1
  173. package/dist/utils/config.js +0 -43
  174. package/dist/utils/config.js.map +0 -1
  175. package/dist/utils/index.js +0 -10
  176. package/dist/utils/index.js.map +0 -1
  177. package/dist/utils/log.js +0 -15
  178. package/dist/utils/log.js.map +0 -1
  179. package/dist/utils/metadata.js +0 -20
  180. package/dist/utils/metadata.js.map +0 -1
  181. package/dist/utils/misc.js +0 -41
  182. package/dist/utils/misc.js.map +0 -1
  183. package/dist/utils/target.js +0 -121
  184. package/dist/utils/target.js.map +0 -1
  185. package/dist/utils/typegen.js +0 -179
  186. package/dist/utils/typegen.js.map +0 -1
  187. package/dist/utils/version.js +0 -60
  188. package/dist/utils/version.js.map +0 -1
  189. package/src/api/load-wasi-template.ts +0 -62
  190. package/src/api/templates/.gitignore.ts +0 -199
  191. package/src/api/templates/.npmignore.ts +0 -14
  192. package/src/api/templates/build.rs.ts +0 -4
  193. package/src/api/templates/cargo.toml.ts +0 -35
  194. package/src/api/templates/ci-template.ts +0 -577
  195. package/src/api/templates/ci.yml.ts +0 -119
  196. package/src/api/templates/lib.rs.ts +0 -7
  197. package/src/api/templates/package.json.ts +0 -48
  198. package/src/api/wasi-worker-template.ts +0 -52
  199. package/src/utils/ci.ts +0 -111
package/src/def/build.ts CHANGED
@@ -6,7 +6,7 @@ export abstract class BaseBuildCommand extends Command {
6
6
  static paths = [['build']]
7
7
 
8
8
  static usage = Command.Usage({
9
- description: 'Build the napi-rs project',
9
+ description: 'Build the NAPI-RS project',
10
10
  })
11
11
 
12
12
  target?: string = Option.String('--target,-t', {
@@ -23,6 +23,10 @@ export abstract class BaseBuildCommand extends Command {
23
23
  description: 'Path to `Cargo.toml`',
24
24
  })
25
25
 
26
+ configPath?: string = Option.String('--config-path,-c', {
27
+ description: 'Path to `napi` config json file',
28
+ })
29
+
26
30
  packageJsonPath?: string = Option.String('--package-json-path', {
27
31
  description: 'Path to `package.json`',
28
32
  })
@@ -53,7 +57,7 @@ export abstract class BaseBuildCommand extends Command {
53
57
 
54
58
  jsBinding?: string = Option.String('--js', {
55
59
  description:
56
- 'Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.',
60
+ 'Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output-dir`.',
57
61
  })
58
62
 
59
63
  noJsBinding?: boolean = Option.Boolean('--no-js', {
@@ -63,7 +67,7 @@ export abstract class BaseBuildCommand extends Command {
63
67
 
64
68
  dts?: string = Option.String('--dts', {
65
69
  description:
66
- 'Path and filename of generated type def file. Relative to `--output_dir`',
70
+ 'Path and filename of generated type def file. Relative to `--output-dir`',
67
71
  })
68
72
 
69
73
  dtsHeader?: string = Option.String('--dts-header', {
@@ -76,6 +80,15 @@ export abstract class BaseBuildCommand extends Command {
76
80
  'Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.',
77
81
  })
78
82
 
83
+ dtsCache = Option.Boolean('--dts-cache', true, {
84
+ description: 'Whether to enable the dts cache, default to true',
85
+ })
86
+
87
+ esm?: boolean = Option.Boolean('--esm', {
88
+ description:
89
+ 'Whether to emit an ESM JS binding file instead of CJS format. Only works with `--platform` flag.',
90
+ })
91
+
79
92
  strip?: boolean = Option.Boolean('--strip,-s', {
80
93
  description: 'Whether strip the library to achieve the minimum file size',
81
94
  })
@@ -110,9 +123,14 @@ export abstract class BaseBuildCommand extends Command {
110
123
  '[experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`',
111
124
  })
112
125
 
126
+ useNapiCross?: boolean = Option.Boolean('--use-napi-cross', {
127
+ description:
128
+ '[experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.',
129
+ })
130
+
113
131
  watch?: boolean = Option.Boolean('--watch,-w', {
114
132
  description:
115
- 'watch the crate changes and build continiously with `cargo-watch` crates',
133
+ 'watch the crate changes and build continuously with `cargo-watch` crates',
116
134
  })
117
135
 
118
136
  features?: string[] = Option.Array('--features,-F', {
@@ -132,6 +150,7 @@ export abstract class BaseBuildCommand extends Command {
132
150
  target: this.target,
133
151
  cwd: this.cwd,
134
152
  manifestPath: this.manifestPath,
153
+ configPath: this.configPath,
135
154
  packageJsonPath: this.packageJsonPath,
136
155
  targetDir: this.targetDir,
137
156
  outputDir: this.outputDir,
@@ -143,6 +162,8 @@ export abstract class BaseBuildCommand extends Command {
143
162
  dts: this.dts,
144
163
  dtsHeader: this.dtsHeader,
145
164
  noDtsHeader: this.noDtsHeader,
165
+ dtsCache: this.dtsCache,
166
+ esm: this.esm,
146
167
  strip: this.strip,
147
168
  release: this.release,
148
169
  verbose: this.verbose,
@@ -151,6 +172,7 @@ export abstract class BaseBuildCommand extends Command {
151
172
  profile: this.profile,
152
173
  crossCompile: this.crossCompile,
153
174
  useCross: this.useCross,
175
+ useNapiCross: this.useNapiCross,
154
176
  watch: this.watch,
155
177
  features: this.features,
156
178
  allFeatures: this.allFeatures,
@@ -160,7 +182,7 @@ export abstract class BaseBuildCommand extends Command {
160
182
  }
161
183
 
162
184
  /**
163
- * Build the napi-rs project
185
+ * Build the NAPI-RS project
164
186
  */
165
187
  export interface BuildOptions {
166
188
  /**
@@ -175,6 +197,10 @@ export interface BuildOptions {
175
197
  * Path to `Cargo.toml`
176
198
  */
177
199
  manifestPath?: string
200
+ /**
201
+ * Path to `napi` config json file
202
+ */
203
+ configPath?: string
178
204
  /**
179
205
  * Path to `package.json`
180
206
  */
@@ -200,7 +226,7 @@ export interface BuildOptions {
200
226
  */
201
227
  constEnum?: boolean
202
228
  /**
203
- * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.
229
+ * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output-dir`.
204
230
  */
205
231
  jsBinding?: string
206
232
  /**
@@ -208,7 +234,7 @@ export interface BuildOptions {
208
234
  */
209
235
  noJsBinding?: boolean
210
236
  /**
211
- * Path and filename of generated type def file. Relative to `--output_dir`
237
+ * Path and filename of generated type def file. Relative to `--output-dir`
212
238
  */
213
239
  dts?: string
214
240
  /**
@@ -219,6 +245,16 @@ export interface BuildOptions {
219
245
  * Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.
220
246
  */
221
247
  noDtsHeader?: boolean
248
+ /**
249
+ * Whether to enable the dts cache, default to true
250
+ *
251
+ * @default true
252
+ */
253
+ dtsCache?: boolean
254
+ /**
255
+ * Whether to emit an ESM JS binding file instead of CJS format. Only works with `--platform` flag.
256
+ */
257
+ esm?: boolean
222
258
  /**
223
259
  * Whether strip the library to achieve the minimum file size
224
260
  */
@@ -252,7 +288,11 @@ export interface BuildOptions {
252
288
  */
253
289
  useCross?: boolean
254
290
  /**
255
- * watch the crate changes and build continiously with `cargo-watch` crates
291
+ * [experimental] use @napi-rs/cross-toolchain to cross-compile Linux arm/arm64/x64 gnu targets.
292
+ */
293
+ useNapiCross?: boolean
294
+ /**
295
+ * watch the crate changes and build continuously with `cargo-watch` crates
256
296
  */
257
297
  watch?: boolean
258
298
  /**
@@ -268,3 +308,10 @@ export interface BuildOptions {
268
308
  */
269
309
  noDefaultFeatures?: boolean
270
310
  }
311
+
312
+ export function applyDefaultBuildOptions(options: BuildOptions) {
313
+ return {
314
+ dtsCache: true,
315
+ ...options,
316
+ }
317
+ }
@@ -14,6 +14,10 @@ export abstract class BaseCreateNpmDirsCommand extends Command {
14
14
  'The working directory of where napi command will be executed in, all other paths options are relative to this path',
15
15
  })
16
16
 
17
+ configPath?: string = Option.String('--config-path,-c', {
18
+ description: 'Path to `napi` config json file',
19
+ })
20
+
17
21
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
18
22
  description: 'Path to `package.json`',
19
23
  })
@@ -29,6 +33,7 @@ export abstract class BaseCreateNpmDirsCommand extends Command {
29
33
  getOptions() {
30
34
  return {
31
35
  cwd: this.cwd,
36
+ configPath: this.configPath,
32
37
  packageJsonPath: this.packageJsonPath,
33
38
  npmDir: this.npmDir,
34
39
  dryRun: this.dryRun,
@@ -46,6 +51,10 @@ export interface CreateNpmDirsOptions {
46
51
  * @default process.cwd()
47
52
  */
48
53
  cwd?: string
54
+ /**
55
+ * Path to `napi` config json file
56
+ */
57
+ configPath?: string
49
58
  /**
50
59
  * Path to `package.json`
51
60
  *
package/src/def/new.ts CHANGED
@@ -10,7 +10,7 @@ export abstract class BaseNewCommand extends Command {
10
10
  description: 'Create a new project with pre-configured boilerplate',
11
11
  })
12
12
 
13
- $$path = Option.String({ required: true })
13
+ $$path = Option.String({ required: false })
14
14
 
15
15
  $$name?: string = Option.String('--name,-n', {
16
16
  description:
@@ -22,6 +22,10 @@ export abstract class BaseNewCommand extends Command {
22
22
  description: 'The minimum Node-API version to support',
23
23
  })
24
24
 
25
+ packageManager = Option.String('--package-manager', 'yarn', {
26
+ description: 'The package manager to use. Only support yarn 4.x for now.',
27
+ })
28
+
25
29
  license = Option.String('--license,-l', 'MIT', {
26
30
  description: 'License for open-sourced project',
27
31
  })
@@ -47,6 +51,11 @@ export abstract class BaseNewCommand extends Command {
47
51
  description: 'Whether generate preconfigured GitHub Actions workflow',
48
52
  })
49
53
 
54
+ testFramework = Option.String('--test-framework', 'ava', {
55
+ description:
56
+ 'The JavaScript test framework to use, only support `ava` for now',
57
+ })
58
+
50
59
  dryRun = Option.Boolean('--dry-run', false, {
51
60
  description: 'Whether to run the command in dry-run mode',
52
61
  })
@@ -56,12 +65,14 @@ export abstract class BaseNewCommand extends Command {
56
65
  path: this.$$path,
57
66
  name: this.$$name,
58
67
  minNodeApiVersion: this.minNodeApiVersion,
68
+ packageManager: this.packageManager,
59
69
  license: this.license,
60
70
  targets: this.targets,
61
71
  enableDefaultTargets: this.enableDefaultTargets,
62
72
  enableAllTargets: this.enableAllTargets,
63
73
  enableTypeDef: this.enableTypeDef,
64
74
  enableGithubActions: this.enableGithubActions,
75
+ testFramework: this.testFramework,
65
76
  dryRun: this.dryRun,
66
77
  }
67
78
  }
@@ -72,9 +83,9 @@ export abstract class BaseNewCommand extends Command {
72
83
  */
73
84
  export interface NewOptions {
74
85
  /**
75
- * The path where the napi-rs project will be created.
86
+ * The path where the NAPI-RS project will be created.
76
87
  */
77
- path: string
88
+ path?: string
78
89
  /**
79
90
  * The name of the project, default to the name of the directory if not provided
80
91
  */
@@ -85,6 +96,12 @@ export interface NewOptions {
85
96
  * @default 4
86
97
  */
87
98
  minNodeApiVersion?: number
99
+ /**
100
+ * The package manager to use. Only support yarn 4.x for now.
101
+ *
102
+ * @default 'yarn'
103
+ */
104
+ packageManager?: string
88
105
  /**
89
106
  * License for open-sourced project
90
107
  *
@@ -121,6 +138,12 @@ export interface NewOptions {
121
138
  * @default true
122
139
  */
123
140
  enableGithubActions?: boolean
141
+ /**
142
+ * The JavaScript test framework to use, only support `ava` for now
143
+ *
144
+ * @default 'ava'
145
+ */
146
+ testFramework?: string
124
147
  /**
125
148
  * Whether to run the command in dry-run mode
126
149
  *
@@ -132,12 +155,14 @@ export interface NewOptions {
132
155
  export function applyDefaultNewOptions(options: NewOptions) {
133
156
  return {
134
157
  minNodeApiVersion: 4,
158
+ packageManager: 'yarn',
135
159
  license: 'MIT',
136
160
  targets: [],
137
161
  enableDefaultTargets: true,
138
162
  enableAllTargets: false,
139
163
  enableTypeDef: true,
140
164
  enableGithubActions: true,
165
+ testFramework: 'ava',
141
166
  dryRun: false,
142
167
  ...options,
143
168
  }
@@ -3,7 +3,7 @@
3
3
  import { Command, Option } from 'clipanion'
4
4
 
5
5
  export abstract class BasePrePublishCommand extends Command {
6
- static paths = [['pre-publish']]
6
+ static paths = [['pre-publish'], ['prepublish']]
7
7
 
8
8
  static usage = Command.Usage({
9
9
  description:
@@ -15,15 +15,19 @@ export abstract class BasePrePublishCommand extends Command {
15
15
  'The working directory of where napi command will be executed in, all other paths options are relative to this path',
16
16
  })
17
17
 
18
+ configPath?: string = Option.String('--config-path,-c', {
19
+ description: 'Path to `napi` config json file',
20
+ })
21
+
18
22
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
19
23
  description: 'Path to `package.json`',
20
24
  })
21
25
 
22
- npmDir = Option.String('--npm-dir', 'npm', {
26
+ npmDir = Option.String('--npm-dir,-p', 'npm', {
23
27
  description: 'Path to the folder where the npm packages put',
24
28
  })
25
29
 
26
- tagStyle = Option.String('--tag-style', 'lerna', {
30
+ tagStyle = Option.String('--tag-style,--tagstyle,-t', 'lerna', {
27
31
  description: 'git tag style, `npm` or `lerna`',
28
32
  })
29
33
 
@@ -39,6 +43,10 @@ export abstract class BasePrePublishCommand extends Command {
39
43
  description: 'Existing GitHub release id',
40
44
  })
41
45
 
46
+ skipOptionalPublish = Option.Boolean('--skip-optional-publish', false, {
47
+ description: 'Whether skip optionalDependencies packages publish',
48
+ })
49
+
42
50
  dryRun = Option.Boolean('--dry-run', false, {
43
51
  description: 'Dry run without touching file system',
44
52
  })
@@ -46,12 +54,14 @@ export abstract class BasePrePublishCommand extends Command {
46
54
  getOptions() {
47
55
  return {
48
56
  cwd: this.cwd,
57
+ configPath: this.configPath,
49
58
  packageJsonPath: this.packageJsonPath,
50
59
  npmDir: this.npmDir,
51
60
  tagStyle: this.tagStyle,
52
61
  ghRelease: this.ghRelease,
53
62
  ghReleaseName: this.ghReleaseName,
54
63
  ghReleaseId: this.ghReleaseId,
64
+ skipOptionalPublish: this.skipOptionalPublish,
55
65
  dryRun: this.dryRun,
56
66
  }
57
67
  }
@@ -67,6 +77,10 @@ export interface PrePublishOptions {
67
77
  * @default process.cwd()
68
78
  */
69
79
  cwd?: string
80
+ /**
81
+ * Path to `napi` config json file
82
+ */
83
+ configPath?: string
70
84
  /**
71
85
  * Path to `package.json`
72
86
  *
@@ -99,6 +113,12 @@ export interface PrePublishOptions {
99
113
  * Existing GitHub release id
100
114
  */
101
115
  ghReleaseId?: string
116
+ /**
117
+ * Whether skip optionalDependencies packages publish
118
+ *
119
+ * @default false
120
+ */
121
+ skipOptionalPublish?: boolean
102
122
  /**
103
123
  * Dry run without touching file system
104
124
  *
@@ -114,6 +134,7 @@ export function applyDefaultPrePublishOptions(options: PrePublishOptions) {
114
134
  npmDir: 'npm',
115
135
  tagStyle: 'lerna',
116
136
  ghRelease: true,
137
+ skipOptionalPublish: false,
117
138
  dryRun: false,
118
139
  ...options,
119
140
  }
package/src/def/rename.ts CHANGED
@@ -6,7 +6,7 @@ export abstract class BaseRenameCommand extends Command {
6
6
  static paths = [['rename']]
7
7
 
8
8
  static usage = Command.Usage({
9
- description: 'Rename the napi-rs project',
9
+ description: 'Rename the NAPI-RS project',
10
10
  })
11
11
 
12
12
  cwd = Option.String('--cwd', process.cwd(), {
@@ -14,6 +14,10 @@ export abstract class BaseRenameCommand extends Command {
14
14
  'The working directory of where napi command will be executed in, all other paths options are relative to this path',
15
15
  })
16
16
 
17
+ configPath?: string = Option.String('--config-path,-c', {
18
+ description: 'Path to `napi` config json file',
19
+ })
20
+
17
21
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
18
22
  description: 'Path to `package.json`',
19
23
  })
@@ -49,6 +53,7 @@ export abstract class BaseRenameCommand extends Command {
49
53
  getOptions() {
50
54
  return {
51
55
  cwd: this.cwd,
56
+ configPath: this.configPath,
52
57
  packageJsonPath: this.packageJsonPath,
53
58
  npmDir: this.npmDir,
54
59
  name: this.$$name,
@@ -62,7 +67,7 @@ export abstract class BaseRenameCommand extends Command {
62
67
  }
63
68
 
64
69
  /**
65
- * Rename the napi-rs project
70
+ * Rename the NAPI-RS project
66
71
  */
67
72
  export interface RenameOptions {
68
73
  /**
@@ -71,6 +76,10 @@ export interface RenameOptions {
71
76
  * @default process.cwd()
72
77
  */
73
78
  cwd?: string
79
+ /**
80
+ * Path to `napi` config json file
81
+ */
82
+ configPath?: string
74
83
  /**
75
84
  * Path to `package.json`
76
85
  *
@@ -14,6 +14,10 @@ export abstract class BaseUniversalizeCommand extends Command {
14
14
  'The working directory of where napi command will be executed in, all other paths options are relative to this path',
15
15
  })
16
16
 
17
+ configPath?: string = Option.String('--config-path,-c', {
18
+ description: 'Path to `napi` config json file',
19
+ })
20
+
17
21
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
18
22
  description: 'Path to `package.json`',
19
23
  })
@@ -26,6 +30,7 @@ export abstract class BaseUniversalizeCommand extends Command {
26
30
  getOptions() {
27
31
  return {
28
32
  cwd: this.cwd,
33
+ configPath: this.configPath,
29
34
  packageJsonPath: this.packageJsonPath,
30
35
  outputDir: this.outputDir,
31
36
  }
@@ -42,6 +47,10 @@ export interface UniversalizeOptions {
42
47
  * @default process.cwd()
43
48
  */
44
49
  cwd?: string
50
+ /**
51
+ * Path to `napi` config json file
52
+ */
53
+ configPath?: string
45
54
  /**
46
55
  * Path to `package.json`
47
56
  *
@@ -14,6 +14,10 @@ export abstract class BaseVersionCommand extends Command {
14
14
  'The working directory of where napi command will be executed in, all other paths options are relative to this path',
15
15
  })
16
16
 
17
+ configPath?: string = Option.String('--config-path,-c', {
18
+ description: 'Path to `napi` config json file',
19
+ })
20
+
17
21
  packageJsonPath = Option.String('--package-json-path', 'package.json', {
18
22
  description: 'Path to `package.json`',
19
23
  })
@@ -25,6 +29,7 @@ export abstract class BaseVersionCommand extends Command {
25
29
  getOptions() {
26
30
  return {
27
31
  cwd: this.cwd,
32
+ configPath: this.configPath,
28
33
  packageJsonPath: this.packageJsonPath,
29
34
  npmDir: this.npmDir,
30
35
  }
@@ -41,6 +46,10 @@ export interface VersionOptions {
41
46
  * @default process.cwd()
42
47
  */
43
48
  cwd?: string
49
+ /**
50
+ * Path to `napi` config json file
51
+ */
52
+ configPath?: string
44
53
  /**
45
54
  * Path to `package.json`
46
55
  *