@napi-rs/cli 3.0.0-alpha.2 → 3.0.0-alpha.4

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 (63) hide show
  1. package/cli.mjs +0 -0
  2. package/dist/api/build.js +8 -2
  3. package/dist/api/templates/ci-template.js +18 -17
  4. package/dist/api/templates/js-binding.js +242 -109
  5. package/dist/api/templates/package.json.js +1 -2
  6. package/dist/cli.js +0 -0
  7. package/dist/commands/artifacts.js +2 -1
  8. package/dist/commands/help.js +2 -1
  9. package/dist/def/artifacts.js +2 -1
  10. package/dist/def/build.d.ts +12 -0
  11. package/dist/def/build.js +10 -1
  12. package/dist/def/create-npm-dirs.js +2 -1
  13. package/dist/def/new.js +2 -1
  14. package/dist/def/pre-publish.js +2 -1
  15. package/dist/def/rename.js +2 -1
  16. package/dist/def/universalize.js +2 -1
  17. package/dist/def/version.js +2 -1
  18. package/dist/index.cjs +284 -127
  19. package/dist/utils/ci.js +9 -0
  20. package/dist/utils/target.d.ts +2 -2
  21. package/dist/utils/target.js +4 -0
  22. package/package.json +5 -5
  23. package/src/api/build.ts +11 -7
  24. package/src/api/templates/ci-template.ts +18 -17
  25. package/src/api/templates/js-binding.ts +231 -104
  26. package/src/api/templates/package.json.ts +1 -2
  27. package/src/def/build.ts +19 -0
  28. package/src/utils/__tests__/__snapshots__/target.spec.ts.md +7 -0
  29. package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
  30. package/src/utils/ci.ts +9 -0
  31. package/src/utils/target.ts +5 -0
  32. package/dist/def/commands/artifacts.d.ts +0 -15
  33. package/dist/def/commands/artifacts.js +0 -29
  34. package/dist/def/commands/build.d.ts +0 -53
  35. package/dist/def/commands/build.js +0 -105
  36. package/dist/def/commands/create-npm-dirs.d.ts +0 -15
  37. package/dist/def/commands/create-npm-dirs.js +0 -29
  38. package/dist/def/commands/new.d.ts +0 -27
  39. package/dist/def/commands/new.js +0 -53
  40. package/dist/def/commands/pre-publish.d.ts +0 -23
  41. package/dist/def/commands/pre-publish.js +0 -45
  42. package/dist/def/commands/rename.d.ts +0 -25
  43. package/dist/def/commands/rename.js +0 -49
  44. package/dist/def/commands/universalize.d.ts +0 -13
  45. package/dist/def/commands/universalize.js +0 -25
  46. package/dist/def/commands/version.d.ts +0 -13
  47. package/dist/def/commands/version.js +0 -25
  48. package/dist/def/options/artifacts.d.ts +0 -35
  49. package/dist/def/options/artifacts.js +0 -11
  50. package/dist/def/options/build.d.ts +0 -97
  51. package/dist/def/options/build.js +0 -3
  52. package/dist/def/options/create-npm-dirs.d.ts +0 -35
  53. package/dist/def/options/create-npm-dirs.js +0 -11
  54. package/dist/def/options/new.d.ts +0 -79
  55. package/dist/def/options/new.js +0 -15
  56. package/dist/def/options/pre-publish.d.ts +0 -65
  57. package/dist/def/options/pre-publish.js +0 -13
  58. package/dist/def/options/rename.d.ts +0 -75
  59. package/dist/def/options/rename.js +0 -11
  60. package/dist/def/options/universalize.d.ts +0 -28
  61. package/dist/def/options/universalize.js +0 -10
  62. package/dist/def/options/version.d.ts +0 -28
  63. package/dist/def/options/version.js +0 -10
package/dist/def/build.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BaseBuildCommand extends Command {
4
+ class BaseBuildCommand extends Command {
5
5
  static paths = [['build']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Build the napi-rs project',
@@ -60,9 +60,15 @@ export class BaseBuildCommand extends Command {
60
60
  package = Option.String('--package,-p', {
61
61
  description: 'Build the specified library or the one at cwd',
62
62
  });
63
+ profile = Option.String('--profile', {
64
+ description: 'Build artifacts with the specified profile',
65
+ });
63
66
  crossCompile = Option.Boolean('--cross-compile,-x', {
64
67
  description: '[experimental] cross-compile for the specified target with `cargo-xwin` on windows and `cargo-zigbuild` on other platform',
65
68
  });
69
+ useCross = Option.Boolean('--use-cross', {
70
+ description: '[experimental] use [cross](https://github.com/cross-rs/cross) instead of `cargo`',
71
+ });
66
72
  watch = Option.Boolean('--watch,-w', {
67
73
  description: 'watch the crate changes and build continiously with `cargo-watch` crates',
68
74
  });
@@ -95,7 +101,9 @@ export class BaseBuildCommand extends Command {
95
101
  verbose: this.verbose,
96
102
  bin: this.bin,
97
103
  package: this.package,
104
+ profile: this.profile,
98
105
  crossCompile: this.crossCompile,
106
+ useCross: this.useCross,
99
107
  watch: this.watch,
100
108
  features: this.features,
101
109
  allFeatures: this.allFeatures,
@@ -103,3 +111,4 @@ export class BaseBuildCommand extends Command {
103
111
  };
104
112
  }
105
113
  }
114
+ export { BaseBuildCommand };
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BaseCreateNpmDirsCommand extends Command {
4
+ class BaseCreateNpmDirsCommand extends Command {
5
5
  static paths = [['create-npm-dirs']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Create npm package dirs for different platforms',
@@ -27,6 +27,7 @@ export class BaseCreateNpmDirsCommand extends Command {
27
27
  };
28
28
  }
29
29
  }
30
+ export { BaseCreateNpmDirsCommand };
30
31
  export function applyDefaultCreateNpmDirsOptions(options) {
31
32
  return {
32
33
  cwd: process.cwd(),
package/dist/def/new.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
4
  import * as typanion from 'typanion';
5
- export class BaseNewCommand extends Command {
5
+ class BaseNewCommand extends Command {
6
6
  static paths = [['new']];
7
7
  static usage = Command.Usage({
8
8
  description: 'Create a new project with pre-configured boilerplate',
@@ -51,6 +51,7 @@ export class BaseNewCommand extends Command {
51
51
  };
52
52
  }
53
53
  }
54
+ export { BaseNewCommand };
54
55
  export function applyDefaultNewOptions(options) {
55
56
  return {
56
57
  minNodeApiVersion: 4,
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BasePrePublishCommand extends Command {
4
+ class BasePrePublishCommand extends Command {
5
5
  static paths = [['pre-publish']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Update package.json and copy addons into per platform packages',
@@ -43,6 +43,7 @@ export class BasePrePublishCommand extends Command {
43
43
  };
44
44
  }
45
45
  }
46
+ export { BasePrePublishCommand };
46
47
  export function applyDefaultPrePublishOptions(options) {
47
48
  return {
48
49
  cwd: process.cwd(),
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BaseRenameCommand extends Command {
4
+ class BaseRenameCommand extends Command {
5
5
  static paths = [['rename']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Rename the napi-rs project',
@@ -47,6 +47,7 @@ export class BaseRenameCommand extends Command {
47
47
  };
48
48
  }
49
49
  }
50
+ export { BaseRenameCommand };
50
51
  export function applyDefaultRenameOptions(options) {
51
52
  return {
52
53
  cwd: process.cwd(),
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BaseUniversalizeCommand extends Command {
4
+ class BaseUniversalizeCommand extends Command {
5
5
  static paths = [['universalize']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Combile built binaries into one universal binary',
@@ -23,6 +23,7 @@ export class BaseUniversalizeCommand extends Command {
23
23
  };
24
24
  }
25
25
  }
26
+ export { BaseUniversalizeCommand };
26
27
  export function applyDefaultUniversalizeOptions(options) {
27
28
  return {
28
29
  cwd: process.cwd(),
@@ -1,7 +1,7 @@
1
1
  // This file is generated by codegen/index.ts
2
2
  // Do not edit this file manually
3
3
  import { Command, Option } from 'clipanion';
4
- export class BaseVersionCommand extends Command {
4
+ class BaseVersionCommand extends Command {
5
5
  static paths = [['version']];
6
6
  static usage = Command.Usage({
7
7
  description: 'Update version in created npm packages',
@@ -23,6 +23,7 @@ export class BaseVersionCommand extends Command {
23
23
  };
24
24
  }
25
25
  }
26
+ export { BaseVersionCommand };
26
27
  export function applyDefaultVersionOptions(options) {
27
28
  return {
28
29
  cwd: process.cwd(),