@napi-rs/cli 3.0.0-alpha.3 → 3.0.0-alpha.30

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 (209) hide show
  1. package/dist/api/artifacts.js +23 -7
  2. package/dist/api/artifacts.js.map +1 -0
  3. package/dist/api/build.d.ts +1 -1
  4. package/dist/api/build.js +184 -32
  5. package/dist/api/build.js.map +1 -0
  6. package/dist/api/create-npm-dirs.js +43 -7
  7. package/dist/api/create-npm-dirs.js.map +1 -0
  8. package/dist/api/new.js +47 -20
  9. package/dist/api/new.js.map +1 -0
  10. package/dist/api/pre-publish.js +10 -7
  11. package/dist/api/pre-publish.js.map +1 -0
  12. package/dist/api/rename.js +10 -1
  13. package/dist/api/rename.js.map +1 -0
  14. package/dist/api/templates/.gitignore.d.ts +1 -1
  15. package/dist/api/templates/.gitignore.js +2 -0
  16. package/dist/api/templates/.gitignore.js.map +1 -0
  17. package/dist/api/templates/.npmignore.js +1 -0
  18. package/dist/api/templates/.npmignore.js.map +1 -0
  19. package/dist/api/templates/build.rs.js +1 -0
  20. package/dist/api/templates/build.rs.js.map +1 -0
  21. package/dist/api/templates/cargo.toml.js +1 -0
  22. package/dist/api/templates/cargo.toml.js.map +1 -0
  23. package/dist/api/templates/ci-template.d.ts +2 -1
  24. package/dist/api/templates/ci-template.js +156 -157
  25. package/dist/api/templates/ci-template.js.map +1 -0
  26. package/dist/api/templates/ci.yml.d.ts +2 -1
  27. package/dist/api/templates/ci.yml.js +19 -4
  28. package/dist/api/templates/ci.yml.js.map +1 -0
  29. package/dist/api/templates/index.js +1 -0
  30. package/dist/api/templates/index.js.map +1 -0
  31. package/dist/api/templates/js-binding.d.ts +1 -1
  32. package/dist/api/templates/js-binding.js +320 -107
  33. package/dist/api/templates/js-binding.js.map +1 -0
  34. package/dist/api/templates/lib.rs.js +2 -4
  35. package/dist/api/templates/lib.rs.js.map +1 -0
  36. package/dist/api/templates/load-wasi-template.d.ts +1 -0
  37. package/dist/api/templates/load-wasi-template.js +78 -0
  38. package/dist/api/templates/load-wasi-template.js.map +1 -0
  39. package/dist/api/templates/package.json.d.ts +9 -2
  40. package/dist/api/templates/package.json.js +55 -28
  41. package/dist/api/templates/package.json.js.map +1 -0
  42. package/dist/api/templates/wasi-worker-template.d.ts +1 -0
  43. package/dist/api/templates/wasi-worker-template.js +53 -0
  44. package/dist/api/templates/wasi-worker-template.js.map +1 -0
  45. package/dist/api/universalize.js +4 -3
  46. package/dist/api/universalize.js.map +1 -0
  47. package/dist/api/version.js +3 -2
  48. package/dist/api/version.js.map +1 -0
  49. package/dist/cli.js +1 -0
  50. package/dist/cli.js.map +1 -0
  51. package/dist/commands/artifacts.js +3 -2
  52. package/dist/commands/artifacts.js.map +1 -0
  53. package/dist/commands/build.js +2 -1
  54. package/dist/commands/build.js.map +1 -0
  55. package/dist/commands/create-npm-dirs.js +1 -0
  56. package/dist/commands/create-npm-dirs.js.map +1 -0
  57. package/dist/commands/help.js +1 -0
  58. package/dist/commands/help.js.map +1 -0
  59. package/dist/commands/new.js +15 -7
  60. package/dist/commands/new.js.map +1 -0
  61. package/dist/commands/pre-publish.js +1 -0
  62. package/dist/commands/pre-publish.js.map +1 -0
  63. package/dist/commands/rename.js +1 -0
  64. package/dist/commands/rename.js.map +1 -0
  65. package/dist/commands/universalize.js +1 -0
  66. package/dist/commands/universalize.js.map +1 -0
  67. package/dist/commands/version.js +1 -0
  68. package/dist/commands/version.js.map +1 -0
  69. package/dist/def/artifacts.d.ts +21 -1
  70. package/dist/def/artifacts.js +11 -2
  71. package/dist/def/artifacts.js.map +1 -0
  72. package/dist/def/build.d.ts +32 -2
  73. package/dist/def/build.js +23 -2
  74. package/dist/def/build.js.map +1 -0
  75. package/dist/def/create-npm-dirs.d.ts +10 -0
  76. package/dist/def/create-npm-dirs.js +5 -0
  77. package/dist/def/create-npm-dirs.js.map +1 -0
  78. package/dist/def/new.d.ts +24 -6
  79. package/dist/def/new.js +12 -1
  80. package/dist/def/new.js.map +1 -0
  81. package/dist/def/pre-publish.d.ts +10 -0
  82. package/dist/def/pre-publish.js +8 -3
  83. package/dist/def/pre-publish.js.map +1 -0
  84. package/dist/def/rename.d.ts +11 -1
  85. package/dist/def/rename.js +6 -1
  86. package/dist/def/rename.js.map +1 -0
  87. package/dist/def/universalize.d.ts +10 -0
  88. package/dist/def/universalize.js +5 -0
  89. package/dist/def/universalize.js.map +1 -0
  90. package/dist/def/version.d.ts +10 -0
  91. package/dist/def/version.js +5 -0
  92. package/dist/def/version.js.map +1 -0
  93. package/dist/index.cjs +6020 -8093
  94. package/dist/index.d.ts +1 -0
  95. package/dist/index.js +2 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/utils/__tests__/config.spec.d.ts +1 -0
  98. package/dist/utils/__tests__/config.spec.js +63 -0
  99. package/dist/utils/__tests__/config.spec.js.map +1 -0
  100. package/dist/utils/__tests__/target.spec.js +1 -0
  101. package/dist/utils/__tests__/target.spec.js.map +1 -0
  102. package/dist/utils/__tests__/typegen.spec.js +9 -4
  103. package/dist/utils/__tests__/typegen.spec.js.map +1 -0
  104. package/dist/utils/__tests__/version.spec.js +1 -0
  105. package/dist/utils/__tests__/version.spec.js.map +1 -0
  106. package/dist/utils/cargo.js +2 -1
  107. package/dist/utils/cargo.js.map +1 -0
  108. package/dist/utils/ci.js +10 -0
  109. package/dist/utils/ci.js.map +1 -0
  110. package/dist/utils/config.d.ts +24 -5
  111. package/dist/utils/config.js +39 -6
  112. package/dist/utils/config.js.map +1 -0
  113. package/dist/utils/index.js +1 -0
  114. package/dist/utils/index.js.map +1 -0
  115. package/dist/utils/log.js +1 -0
  116. package/dist/utils/log.js.map +1 -0
  117. package/dist/utils/metadata.js +3 -2
  118. package/dist/utils/metadata.js.map +1 -0
  119. package/dist/utils/misc.d.ts +1 -1
  120. package/dist/utils/misc.js +4 -3
  121. package/dist/utils/misc.js.map +1 -0
  122. package/dist/utils/target.d.ts +9 -5
  123. package/dist/utils/target.js +20 -1
  124. package/dist/utils/target.js.map +1 -0
  125. package/dist/utils/typegen.d.ts +4 -1
  126. package/dist/utils/typegen.js +27 -6
  127. package/dist/utils/typegen.js.map +1 -0
  128. package/dist/utils/version.d.ts +2 -1
  129. package/dist/utils/version.js +13 -10
  130. package/dist/utils/version.js.map +1 -0
  131. package/package.json +50 -15
  132. package/src/api/artifacts.ts +53 -9
  133. package/src/api/build.ts +289 -39
  134. package/src/api/create-npm-dirs.ts +51 -7
  135. package/src/api/new.ts +69 -33
  136. package/src/api/pre-publish.ts +21 -12
  137. package/src/api/rename.ts +10 -1
  138. package/src/api/templates/.gitignore.ts +1 -0
  139. package/src/api/templates/ci-template.ts +157 -157
  140. package/src/api/templates/ci.yml.ts +19 -4
  141. package/src/api/templates/js-binding.ts +312 -102
  142. package/src/api/templates/lib.rs.ts +1 -4
  143. package/src/api/templates/load-wasi-template.ts +81 -0
  144. package/src/api/templates/package.json.ts +78 -27
  145. package/src/api/templates/wasi-worker-template.ts +52 -0
  146. package/src/api/universalize.ts +6 -3
  147. package/src/api/version.ts +5 -2
  148. package/src/commands/artifacts.ts +2 -2
  149. package/src/commands/build.ts +1 -1
  150. package/src/commands/new.ts +14 -8
  151. package/src/def/artifacts.ts +22 -3
  152. package/src/def/build.ts +51 -4
  153. package/src/def/create-npm-dirs.ts +9 -0
  154. package/src/def/new.ts +28 -3
  155. package/src/def/pre-publish.ts +12 -3
  156. package/src/def/rename.ts +11 -2
  157. package/src/def/universalize.ts +9 -0
  158. package/src/def/version.ts +9 -0
  159. package/src/index.ts +2 -0
  160. package/src/utils/__tests__/__snapshots__/config.spec.ts.md +97 -0
  161. package/src/utils/__tests__/__snapshots__/config.spec.ts.snap +0 -0
  162. package/src/utils/__tests__/__snapshots__/target.spec.ts.md +14 -0
  163. package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
  164. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.md +555 -0
  165. package/src/utils/__tests__/__snapshots__/typegen.spec.ts.snap +0 -0
  166. package/src/utils/__tests__/__snapshots__/version.spec.ts.md +9 -8
  167. package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
  168. package/src/utils/__tests__/config.spec.ts +81 -0
  169. package/src/utils/__tests__/typegen.spec.ts +19 -4
  170. package/src/utils/cargo.ts +1 -1
  171. package/src/utils/ci.ts +9 -0
  172. package/src/utils/config.ts +84 -9
  173. package/src/utils/metadata.ts +2 -2
  174. package/src/utils/misc.ts +11 -3
  175. package/src/utils/target.ts +28 -7
  176. package/src/utils/typegen.ts +30 -5
  177. package/src/utils/version.ts +11 -9
  178. package/dist/def/commands/artifacts.d.ts +0 -15
  179. package/dist/def/commands/artifacts.js +0 -29
  180. package/dist/def/commands/build.d.ts +0 -53
  181. package/dist/def/commands/build.js +0 -105
  182. package/dist/def/commands/create-npm-dirs.d.ts +0 -15
  183. package/dist/def/commands/create-npm-dirs.js +0 -29
  184. package/dist/def/commands/new.d.ts +0 -27
  185. package/dist/def/commands/new.js +0 -53
  186. package/dist/def/commands/pre-publish.d.ts +0 -23
  187. package/dist/def/commands/pre-publish.js +0 -45
  188. package/dist/def/commands/rename.d.ts +0 -25
  189. package/dist/def/commands/rename.js +0 -49
  190. package/dist/def/commands/universalize.d.ts +0 -13
  191. package/dist/def/commands/universalize.js +0 -25
  192. package/dist/def/commands/version.d.ts +0 -13
  193. package/dist/def/commands/version.js +0 -25
  194. package/dist/def/options/artifacts.d.ts +0 -35
  195. package/dist/def/options/artifacts.js +0 -11
  196. package/dist/def/options/build.d.ts +0 -97
  197. package/dist/def/options/build.js +0 -3
  198. package/dist/def/options/create-npm-dirs.d.ts +0 -35
  199. package/dist/def/options/create-npm-dirs.js +0 -11
  200. package/dist/def/options/new.d.ts +0 -79
  201. package/dist/def/options/new.js +0 -15
  202. package/dist/def/options/pre-publish.d.ts +0 -65
  203. package/dist/def/options/pre-publish.js +0 -13
  204. package/dist/def/options/rename.d.ts +0 -75
  205. package/dist/def/options/rename.js +0 -11
  206. package/dist/def/options/universalize.d.ts +0 -28
  207. package/dist/def/options/universalize.js +0 -10
  208. package/dist/def/options/version.d.ts +0 -28
  209. package/dist/def/options/version.js +0 -10
@@ -1,15 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BaseCreateNpmDirsCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- cwd: string;
6
- packageJsonPath: string;
7
- npmDir: string;
8
- dryRun: boolean;
9
- getOptions(): {
10
- cwd: string;
11
- packageJsonPath: string;
12
- npmDir: string;
13
- dryRun: boolean;
14
- };
15
- }
@@ -1,29 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- export class BaseCreateNpmDirsCommand extends Command {
5
- static paths = [['create-npm-dirs']];
6
- static usage = Command.Usage({
7
- description: 'Create npm package dirs for different platforms',
8
- });
9
- cwd = Option.String('--cwd', process.cwd(), {
10
- description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
- });
12
- packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
- description: 'Path to `package.json`',
14
- });
15
- npmDir = Option.String('--npm-dir', 'npm', {
16
- description: 'Path to the folder where the npm packages put',
17
- });
18
- dryRun = Option.Boolean('--dry-run', false, {
19
- description: 'Dry run without touching file system',
20
- });
21
- getOptions() {
22
- return {
23
- cwd: this.cwd,
24
- packageJsonPath: this.packageJsonPath,
25
- npmDir: this.npmDir,
26
- dryRun: this.dryRun,
27
- };
28
- }
29
- }
@@ -1,27 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BaseNewCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- $$path: string;
6
- $$name?: string;
7
- minNodeApiVersion: number;
8
- license: string;
9
- targets: string[];
10
- enableDefaultTargets: boolean;
11
- enableAllTargets: boolean;
12
- enableTypeDef: boolean;
13
- enableGithubActions: boolean;
14
- dryRun: boolean;
15
- getOptions(): {
16
- path: string;
17
- name: string | undefined;
18
- minNodeApiVersion: number;
19
- license: string;
20
- targets: string[];
21
- enableDefaultTargets: boolean;
22
- enableAllTargets: boolean;
23
- enableTypeDef: boolean;
24
- enableGithubActions: boolean;
25
- dryRun: boolean;
26
- };
27
- }
@@ -1,53 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- import * as typanion from 'typanion';
5
- export class BaseNewCommand extends Command {
6
- static paths = [['new']];
7
- static usage = Command.Usage({
8
- description: 'Create a new project with pre-configured boilerplate',
9
- });
10
- $$path = Option.String({ required: true });
11
- $$name = Option.String('--name,-n', {
12
- description: 'The name of the project, default to the name of the directory if not provided',
13
- });
14
- minNodeApiVersion = Option.String('--min-node-api,-v', '4', {
15
- validator: typanion.isNumber(),
16
- description: 'The minimum Node-API version to support',
17
- });
18
- license = Option.String('--license,-l', 'MIT', {
19
- description: 'License for open-sourced project',
20
- });
21
- targets = Option.Array('--targets,-t', [], {
22
- description: 'All targets the crate will be compiled for.',
23
- });
24
- enableDefaultTargets = Option.Boolean('--enable-default-targets', true, {
25
- description: 'Whether enable default targets',
26
- });
27
- enableAllTargets = Option.Boolean('--enable-all-targets', false, {
28
- description: 'Whether enable all targets',
29
- });
30
- enableTypeDef = Option.Boolean('--enable-type-def', true, {
31
- description: 'Whether enable the `type-def` feature for typescript definitions auto-generation',
32
- });
33
- enableGithubActions = Option.Boolean('--enable-github-actions', true, {
34
- description: 'Whether generate preconfigured GitHub Actions workflow',
35
- });
36
- dryRun = Option.Boolean('--dry-run', false, {
37
- description: 'Whether to run the command in dry-run mode',
38
- });
39
- getOptions() {
40
- return {
41
- path: this.$$path,
42
- name: this.$$name,
43
- minNodeApiVersion: this.minNodeApiVersion,
44
- license: this.license,
45
- targets: this.targets,
46
- enableDefaultTargets: this.enableDefaultTargets,
47
- enableAllTargets: this.enableAllTargets,
48
- enableTypeDef: this.enableTypeDef,
49
- enableGithubActions: this.enableGithubActions,
50
- dryRun: this.dryRun,
51
- };
52
- }
53
- }
@@ -1,23 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BasePrePublishCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- cwd: string;
6
- packageJsonPath: string;
7
- npmDir: string;
8
- tagStyle: string;
9
- ghRelease: boolean;
10
- ghReleaseName?: string;
11
- ghReleaseId?: string;
12
- dryRun: boolean;
13
- getOptions(): {
14
- cwd: string;
15
- packageJsonPath: string;
16
- npmDir: string;
17
- tagStyle: string;
18
- ghRelease: boolean;
19
- ghReleaseName: string | undefined;
20
- ghReleaseId: string | undefined;
21
- dryRun: boolean;
22
- };
23
- }
@@ -1,45 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- export class BasePrePublishCommand extends Command {
5
- static paths = [['pre-publish']];
6
- static usage = Command.Usage({
7
- description: 'Update package.json and copy addons into per platform packages',
8
- });
9
- cwd = Option.String('--cwd', process.cwd(), {
10
- description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
- });
12
- packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
- description: 'Path to `package.json`',
14
- });
15
- npmDir = Option.String('--npm-dir', 'npm', {
16
- description: 'Path to the folder where the npm packages put',
17
- });
18
- tagStyle = Option.String('--tag-style', 'lerna', {
19
- description: 'git tag style, `npm` or `lerna`',
20
- });
21
- ghRelease = Option.Boolean('--gh-release', true, {
22
- description: 'Whether create GitHub release',
23
- });
24
- ghReleaseName = Option.String('--gh-release-name', {
25
- description: 'GitHub release name',
26
- });
27
- ghReleaseId = Option.String('--gh-release-id', {
28
- description: 'Existing GitHub release id',
29
- });
30
- dryRun = Option.Boolean('--dry-run', false, {
31
- description: 'Dry run without touching file system',
32
- });
33
- getOptions() {
34
- return {
35
- cwd: this.cwd,
36
- packageJsonPath: this.packageJsonPath,
37
- npmDir: this.npmDir,
38
- tagStyle: this.tagStyle,
39
- ghRelease: this.ghRelease,
40
- ghReleaseName: this.ghReleaseName,
41
- ghReleaseId: this.ghReleaseId,
42
- dryRun: this.dryRun,
43
- };
44
- }
45
- }
@@ -1,25 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BaseRenameCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- cwd: string;
6
- packageJsonPath: string;
7
- npmDir: string;
8
- $$name?: string;
9
- binaryName?: string;
10
- packageName?: string;
11
- manifestPath: string;
12
- repository?: string;
13
- description?: string;
14
- getOptions(): {
15
- cwd: string;
16
- packageJsonPath: string;
17
- npmDir: string;
18
- name: string | undefined;
19
- binaryName: string | undefined;
20
- packageName: string | undefined;
21
- manifestPath: string;
22
- repository: string | undefined;
23
- description: string | undefined;
24
- };
25
- }
@@ -1,49 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- export class BaseRenameCommand extends Command {
5
- static paths = [['rename']];
6
- static usage = Command.Usage({
7
- description: 'Rename the napi-rs project',
8
- });
9
- cwd = Option.String('--cwd', process.cwd(), {
10
- description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
- });
12
- packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
- description: 'Path to `package.json`',
14
- });
15
- npmDir = Option.String('--npm-dir', 'npm', {
16
- description: 'Path to the folder where the npm packages put',
17
- });
18
- $$name = Option.String('--name,-n', {
19
- description: 'The new name of the project',
20
- });
21
- binaryName = Option.String('--binary-name,-b', {
22
- description: 'The new binary name *.node files',
23
- });
24
- packageName = Option.String('--package-name', {
25
- description: 'The new package name of the project',
26
- });
27
- manifestPath = Option.String('--manifest-path', 'Cargo.toml', {
28
- description: 'Path to `Cargo.toml`',
29
- });
30
- repository = Option.String('--repository', {
31
- description: 'The new repository of the project',
32
- });
33
- description = Option.String('--description', {
34
- description: 'The new description of the project',
35
- });
36
- getOptions() {
37
- return {
38
- cwd: this.cwd,
39
- packageJsonPath: this.packageJsonPath,
40
- npmDir: this.npmDir,
41
- name: this.$$name,
42
- binaryName: this.binaryName,
43
- packageName: this.packageName,
44
- manifestPath: this.manifestPath,
45
- repository: this.repository,
46
- description: this.description,
47
- };
48
- }
49
- }
@@ -1,13 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BaseUniversalizeCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- cwd: string;
6
- packageJsonPath: string;
7
- outputDir: string;
8
- getOptions(): {
9
- cwd: string;
10
- packageJsonPath: string;
11
- outputDir: string;
12
- };
13
- }
@@ -1,25 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- export class BaseUniversalizeCommand extends Command {
5
- static paths = [['universalize']];
6
- static usage = Command.Usage({
7
- description: 'Combile built binaries into one universal binary',
8
- });
9
- cwd = Option.String('--cwd', process.cwd(), {
10
- description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
- });
12
- packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
- description: 'Path to `package.json`',
14
- });
15
- outputDir = Option.String('--output-dir,-o', './', {
16
- description: 'Path to the folder where all built `.node` files put, same as `--output-dir` of build command',
17
- });
18
- getOptions() {
19
- return {
20
- cwd: this.cwd,
21
- packageJsonPath: this.packageJsonPath,
22
- outputDir: this.outputDir,
23
- };
24
- }
25
- }
@@ -1,13 +0,0 @@
1
- import { Command } from 'clipanion';
2
- export declare abstract class BaseVersionCommand extends Command {
3
- static paths: string[][];
4
- static usage: import("clipanion").Usage;
5
- cwd: string;
6
- packageJsonPath: string;
7
- npmDir: string;
8
- getOptions(): {
9
- cwd: string;
10
- packageJsonPath: string;
11
- npmDir: string;
12
- };
13
- }
@@ -1,25 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- import { Command, Option } from 'clipanion';
4
- export class BaseVersionCommand extends Command {
5
- static paths = [['version']];
6
- static usage = Command.Usage({
7
- description: 'Update version in created npm packages',
8
- });
9
- cwd = Option.String('--cwd', process.cwd(), {
10
- description: 'The working directory of where napi command will be executed in, all other paths options are relative to this path',
11
- });
12
- packageJsonPath = Option.String('--package-json-path', 'package.json', {
13
- description: 'Path to `package.json`',
14
- });
15
- npmDir = Option.String('--npm-dir', 'npm', {
16
- description: 'Path to the folder where the npm packages put',
17
- });
18
- getOptions() {
19
- return {
20
- cwd: this.cwd,
21
- packageJsonPath: this.packageJsonPath,
22
- npmDir: this.npmDir,
23
- };
24
- }
25
- }
@@ -1,35 +0,0 @@
1
- /**
2
- * Copy artifacts from Github Actions into npm packages and ready to publish
3
- */
4
- export interface ArtifactsOptions {
5
- /**
6
- * The working directory of where napi command will be executed in, all other paths options are relative to this path
7
- *
8
- * @default process.cwd()
9
- */
10
- cwd?: string;
11
- /**
12
- * Path to `package.json`
13
- *
14
- * @default 'package.json'
15
- */
16
- packageJsonPath?: string;
17
- /**
18
- * Path to the folder where all built `.node` files put, same as `--output-dir` of build command
19
- *
20
- * @default './'
21
- */
22
- outputDir?: string;
23
- /**
24
- * Path to the folder where the npm packages put
25
- *
26
- * @default 'npm'
27
- */
28
- npmDir?: string;
29
- }
30
- export declare function applyDefaultArtifactsOptions(options: ArtifactsOptions): {
31
- cwd: string;
32
- packageJsonPath: string;
33
- outputDir: string;
34
- npmDir: string;
35
- };
@@ -1,11 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- export function applyDefaultArtifactsOptions(options) {
4
- return {
5
- cwd: process.cwd(),
6
- packageJsonPath: 'package.json',
7
- outputDir: './',
8
- npmDir: 'npm',
9
- ...options,
10
- };
11
- }
@@ -1,97 +0,0 @@
1
- /**
2
- * Build the napi-rs project
3
- */
4
- export interface BuildOptions {
5
- /**
6
- * Build for the target triple, bypassed to `cargo build --target`
7
- */
8
- target?: string;
9
- /**
10
- * The working directory of where napi command will be executed in, all other paths options are relative to this path
11
- */
12
- cwd?: string;
13
- /**
14
- * Path to `Cargo.toml`
15
- */
16
- manifestPath?: string;
17
- /**
18
- * Path to `package.json`
19
- */
20
- packageJsonPath?: string;
21
- /**
22
- * Directory for all crate generated artifacts, see `cargo build --target-dir`
23
- */
24
- targetDir?: string;
25
- /**
26
- * Path to where all the built files would be put. Default to the crate folder
27
- */
28
- outputDir?: string;
29
- /**
30
- * Add platform triple to the generated nodejs binding file, eg: `[name].linux-x64-gnu.node`
31
- */
32
- platform?: boolean;
33
- /**
34
- * Package name in generated js binding file. Only works with `--platform` flag
35
- */
36
- jsPackageName?: string;
37
- /**
38
- * Path and filename of generated JS binding file. Only works with `--platform` flag. Relative to `--output_dir`.
39
- */
40
- jsBinding?: string;
41
- /**
42
- * Whether to disable the generation JS binding file. Only works with `--platform` flag.
43
- */
44
- noJsBinding?: boolean;
45
- /**
46
- * Path and filename of generated type def file. Relative to `--output_dir`
47
- */
48
- dts?: string;
49
- /**
50
- * Custom file header for generated type def file. Only works when `typedef` feature enabled.
51
- */
52
- dtsHeader?: string;
53
- /**
54
- * Whether to disable the default file header for generated type def file. Only works when `typedef` feature enabled.
55
- */
56
- noDtsHeader?: boolean;
57
- /**
58
- * Whether strip the library to achieve the minimum file size
59
- */
60
- strip?: boolean;
61
- /**
62
- * Build in release mode
63
- */
64
- release?: boolean;
65
- /**
66
- * Verbosely log build command trace
67
- */
68
- verbose?: boolean;
69
- /**
70
- * Build only the specified binary
71
- */
72
- bin?: string;
73
- /**
74
- * Build the specified library or the one at cwd
75
- */
76
- package?: string;
77
- /**
78
- * [experimental] cross-compile for the specified target with `cargo-xwin` on windows and `cargo-zigbuild` on other platform
79
- */
80
- crossCompile?: boolean;
81
- /**
82
- * watch the crate changes and build continiously with `cargo-watch` crates
83
- */
84
- watch?: boolean;
85
- /**
86
- * Space-separated list of features to activate
87
- */
88
- features?: string[];
89
- /**
90
- * Activate all available features
91
- */
92
- allFeatures?: boolean;
93
- /**
94
- * Do not activate the `default` feature
95
- */
96
- noDefaultFeatures?: boolean;
97
- }
@@ -1,3 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- export {};
@@ -1,35 +0,0 @@
1
- /**
2
- * Create npm package dirs for different platforms
3
- */
4
- export interface CreateNpmDirsOptions {
5
- /**
6
- * The working directory of where napi command will be executed in, all other paths options are relative to this path
7
- *
8
- * @default process.cwd()
9
- */
10
- cwd?: string;
11
- /**
12
- * Path to `package.json`
13
- *
14
- * @default 'package.json'
15
- */
16
- packageJsonPath?: string;
17
- /**
18
- * Path to the folder where the npm packages put
19
- *
20
- * @default 'npm'
21
- */
22
- npmDir?: string;
23
- /**
24
- * Dry run without touching file system
25
- *
26
- * @default false
27
- */
28
- dryRun?: boolean;
29
- }
30
- export declare function applyDefaultCreateNpmDirsOptions(options: CreateNpmDirsOptions): {
31
- cwd: string;
32
- packageJsonPath: string;
33
- npmDir: string;
34
- dryRun: boolean;
35
- };
@@ -1,11 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- export function applyDefaultCreateNpmDirsOptions(options) {
4
- return {
5
- cwd: process.cwd(),
6
- packageJsonPath: 'package.json',
7
- npmDir: 'npm',
8
- dryRun: false,
9
- ...options,
10
- };
11
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * Create a new project with pre-configured boilerplate
3
- */
4
- export interface NewOptions {
5
- /**
6
- * The path where the napi-rs project will be created.
7
- */
8
- path: string;
9
- /**
10
- * The name of the project, default to the name of the directory if not provided
11
- */
12
- name?: string;
13
- /**
14
- * The minimum Node-API version to support
15
- *
16
- * @default 4
17
- */
18
- minNodeApiVersion?: number;
19
- /**
20
- * License for open-sourced project
21
- *
22
- * @default 'MIT'
23
- */
24
- license?: string;
25
- /**
26
- * All targets the crate will be compiled for.
27
- *
28
- * @default []
29
- */
30
- targets?: string[];
31
- /**
32
- * Whether enable default targets
33
- *
34
- * @default true
35
- */
36
- enableDefaultTargets?: boolean;
37
- /**
38
- * Whether enable all targets
39
- *
40
- * @default false
41
- */
42
- enableAllTargets?: boolean;
43
- /**
44
- * Whether enable the `type-def` feature for typescript definitions auto-generation
45
- *
46
- * @default true
47
- */
48
- enableTypeDef?: boolean;
49
- /**
50
- * Whether generate preconfigured GitHub Actions workflow
51
- *
52
- * @default true
53
- */
54
- enableGithubActions?: boolean;
55
- /**
56
- * Whether to run the command in dry-run mode
57
- *
58
- * @default false
59
- */
60
- dryRun?: boolean;
61
- }
62
- export declare function applyDefaultNewOptions(options: NewOptions): {
63
- /**
64
- * The path where the napi-rs project will be created.
65
- */
66
- path: string;
67
- /**
68
- * The name of the project, default to the name of the directory if not provided
69
- */
70
- name?: string | undefined;
71
- minNodeApiVersion: number;
72
- license: string;
73
- targets: string[];
74
- enableDefaultTargets: boolean;
75
- enableAllTargets: boolean;
76
- enableTypeDef: boolean;
77
- enableGithubActions: boolean;
78
- dryRun: boolean;
79
- };
@@ -1,15 +0,0 @@
1
- // This file is generated by codegen/index.ts
2
- // Do not edit this file manually
3
- export function applyDefaultNewOptions(options) {
4
- return {
5
- minNodeApiVersion: 4,
6
- license: 'MIT',
7
- targets: [],
8
- enableDefaultTargets: true,
9
- enableAllTargets: false,
10
- enableTypeDef: true,
11
- enableGithubActions: true,
12
- dryRun: false,
13
- ...options,
14
- };
15
- }