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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/api/build.js +34 -14
  2. package/dist/api/templates/ci-template.js +10 -11
  3. package/dist/api/templates/ci.yml.js +8 -2
  4. package/dist/api/templates/js-binding.d.ts +1 -1
  5. package/dist/api/templates/js-binding.js +243 -109
  6. package/dist/api/templates/package.json.js +29 -27
  7. package/dist/cli.js +0 -0
  8. package/dist/commands/new.js +1 -4
  9. package/dist/def/build.d.ts +12 -0
  10. package/dist/def/build.js +8 -0
  11. package/dist/index.cjs +2734 -7836
  12. package/dist/utils/__tests__/typegen.spec.js +1 -1
  13. package/dist/utils/ci.js +9 -0
  14. package/dist/utils/config.d.ts +9 -1
  15. package/dist/utils/target.d.ts +2 -2
  16. package/dist/utils/target.js +4 -0
  17. package/dist/utils/typegen.d.ts +4 -1
  18. package/dist/utils/typegen.js +20 -1
  19. package/dist/utils/version.js +2 -2
  20. package/package.json +13 -13
  21. package/src/api/artifacts.ts +2 -2
  22. package/src/api/build.ts +45 -18
  23. package/src/api/pre-publish.ts +8 -5
  24. package/src/api/templates/ci-template.ts +10 -11
  25. package/src/api/templates/ci.yml.ts +8 -2
  26. package/src/api/templates/js-binding.ts +236 -104
  27. package/src/api/templates/package.json.ts +31 -26
  28. package/src/commands/new.ts +1 -5
  29. package/src/def/build.ts +19 -0
  30. package/src/utils/__tests__/__snapshots__/target.spec.ts.md +7 -0
  31. package/src/utils/__tests__/__snapshots__/target.spec.ts.snap +0 -0
  32. package/src/utils/__tests__/__snapshots__/version.spec.ts.md +7 -7
  33. package/src/utils/__tests__/__snapshots__/version.spec.ts.snap +0 -0
  34. package/src/utils/__tests__/typegen.spec.ts +1 -1
  35. package/src/utils/ci.ts +9 -0
  36. package/src/utils/config.ts +12 -1
  37. package/src/utils/target.ts +5 -0
  38. package/src/utils/typegen.ts +20 -1
  39. package/src/utils/version.ts +1 -1
  40. package/dist/def/commands/artifacts.d.ts +0 -15
  41. package/dist/def/commands/artifacts.js +0 -29
  42. package/dist/def/commands/build.d.ts +0 -53
  43. package/dist/def/commands/build.js +0 -105
  44. package/dist/def/commands/create-npm-dirs.d.ts +0 -15
  45. package/dist/def/commands/create-npm-dirs.js +0 -29
  46. package/dist/def/commands/new.d.ts +0 -27
  47. package/dist/def/commands/new.js +0 -53
  48. package/dist/def/commands/pre-publish.d.ts +0 -23
  49. package/dist/def/commands/pre-publish.js +0 -45
  50. package/dist/def/commands/rename.d.ts +0 -25
  51. package/dist/def/commands/rename.js +0 -49
  52. package/dist/def/commands/universalize.d.ts +0 -13
  53. package/dist/def/commands/universalize.js +0 -25
  54. package/dist/def/commands/version.d.ts +0 -13
  55. package/dist/def/commands/version.js +0 -25
  56. package/dist/def/options/artifacts.d.ts +0 -35
  57. package/dist/def/options/artifacts.js +0 -11
  58. package/dist/def/options/build.d.ts +0 -97
  59. package/dist/def/options/build.js +0 -3
  60. package/dist/def/options/create-npm-dirs.d.ts +0 -35
  61. package/dist/def/options/create-npm-dirs.js +0 -11
  62. package/dist/def/options/new.d.ts +0 -79
  63. package/dist/def/options/new.js +0 -15
  64. package/dist/def/options/pre-publish.d.ts +0 -65
  65. package/dist/def/options/pre-publish.js +0 -13
  66. package/dist/def/options/rename.d.ts +0 -75
  67. package/dist/def/options/rename.js +0 -11
  68. package/dist/def/options/universalize.d.ts +0 -28
  69. package/dist/def/options/universalize.js +0 -10
  70. package/dist/def/options/version.d.ts +0 -28
  71. package/dist/def/options/version.js +0 -10
@@ -32,6 +32,6 @@ test('should ident string correctly', (t) => {
32
32
  t.snapshot(correctStringIdent(input, 2), 'original ident is 2');
33
33
  });
34
34
  test('should process type def correctly', async (t) => {
35
- const dts = await processTypeDef(join(fileURLToPath(import.meta.url), '../', '__fixtures__', 'napi_type_def'));
35
+ const { dts } = await processTypeDef(join(fileURLToPath(import.meta.url), '../', '__fixtures__', 'napi_type_def'));
36
36
  t.snapshot(dts);
37
37
  });
package/dist/utils/ci.js CHANGED
@@ -83,4 +83,13 @@ export const CIConfig = {
83
83
  ],
84
84
  test: false,
85
85
  },
86
+ 'riscv64gc-unknown-linux-gnu': {
87
+ host: 'ubuntu-latest',
88
+ build_setup: [
89
+ 'sudo apt-get update',
90
+ 'sudo apt-get install g++-riscv64-linux-gnu gcc-riscv64-linux-gnu -y',
91
+ ],
92
+ // No official nodejs docker image for riscv64
93
+ test: false,
94
+ },
86
95
  };
@@ -42,7 +42,7 @@ interface UserNapiConfig {
42
42
  additional?: string[];
43
43
  };
44
44
  }
45
- interface CommonPackageJsonFields {
45
+ export interface CommonPackageJsonFields {
46
46
  name: string;
47
47
  version: string;
48
48
  description?: string;
@@ -56,6 +56,14 @@ interface CommonPackageJsonFields {
56
56
  publishConfig?: any;
57
57
  bugs?: any;
58
58
  napi?: UserNapiConfig;
59
+ type?: 'module' | 'commonjs';
60
+ scripts?: Record<string, string>;
61
+ main?: string;
62
+ module?: string;
63
+ types?: string;
64
+ exports?: any;
65
+ dependencies?: Record<string, string>;
66
+ devDependencies?: Record<string, string>;
59
67
  }
60
68
  export type NapiConfig = Required<Pick<UserNapiConfig, 'binaryName' | 'packageName' | 'npmClient'>> & {
61
69
  targets: Target[];
@@ -1,9 +1,9 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
- export declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-linux-androideabi", "universal-apple-darwin"];
2
+ export declare const AVAILABLE_TARGETS: readonly ["aarch64-apple-darwin", "aarch64-linux-android", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "aarch64-pc-windows-msvc", "x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-unknown-freebsd", "i686-pc-windows-msvc", "armv7-unknown-linux-gnueabihf", "armv7-linux-androideabi", "universal-apple-darwin", "riscv64gc-unknown-linux-gnu"];
3
3
  export type TargetTriple = (typeof AVAILABLE_TARGETS)[number];
4
4
  export declare const DEFAULT_TARGETS: readonly ["x86_64-apple-darwin", "x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"];
5
5
  export declare const TARGET_LINKER: Record<string, string>;
6
- type NodeJSArch = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 's390' | 's390x' | 'x32' | 'x64' | 'universal';
6
+ type NodeJSArch = 'arm' | 'arm64' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 'riscv64' | 's390' | 's390x' | 'x32' | 'x64' | 'universal';
7
7
  export declare const NodeArchToCpu: Record<string, string>;
8
8
  export declare const UniArchsByPlatform: Partial<Record<NodeJS.Platform, NodeJSArch[]>>;
9
9
  export interface Target {
@@ -14,6 +14,7 @@ export const AVAILABLE_TARGETS = [
14
14
  'armv7-unknown-linux-gnueabihf',
15
15
  'armv7-linux-androideabi',
16
16
  'universal-apple-darwin',
17
+ 'riscv64gc-unknown-linux-gnu',
17
18
  ];
18
19
  export const DEFAULT_TARGETS = [
19
20
  'x86_64-apple-darwin',
@@ -22,18 +23,21 @@ export const DEFAULT_TARGETS = [
22
23
  ];
23
24
  export const TARGET_LINKER = {
24
25
  'aarch64-unknown-linux-musl': 'aarch64-linux-musl-gcc',
26
+ 'riscv64gc-unknown-linux-gnu': 'riscv64-linux-gnu-gcc',
25
27
  };
26
28
  const CpuToNodeArch = {
27
29
  x86_64: 'x64',
28
30
  aarch64: 'arm64',
29
31
  i686: 'ia32',
30
32
  armv7: 'arm',
33
+ riscv64gc: 'riscv64',
31
34
  };
32
35
  export const NodeArchToCpu = {
33
36
  x64: 'x86_64',
34
37
  arm64: 'aarch64',
35
38
  ia32: 'i686',
36
39
  arm: 'armv7',
40
+ riscv64: 'riscv64gc',
37
41
  };
38
42
  const SysToNodePlatform = {
39
43
  linux: 'linux',
@@ -1,3 +1,6 @@
1
1
  export declare const DEFAULT_TYPE_DEF_HEADER = "/* auto-generated by NAPI-RS */\n/* eslint-disable */\n";
2
- export declare function processTypeDef(intermediateTypeFile: string, header?: string): Promise<string>;
2
+ export declare function processTypeDef(intermediateTypeFile: string, header?: string): Promise<{
3
+ dts: string;
4
+ exports: string[];
5
+ }>;
3
6
  export declare function correctStringIdent(src: string, ident: number): string;
@@ -34,6 +34,7 @@ function prettyPrint(line, ident) {
34
34
  return correctStringIdent(s, ident);
35
35
  }
36
36
  export async function processTypeDef(intermediateTypeFile, header) {
37
+ const exports = [];
37
38
  const defs = await readIntermediateTypeFile(intermediateTypeFile);
38
39
  const groupedDefs = preprocessTypeDef(defs);
39
40
  header = header ? header + '\n' : '';
@@ -42,9 +43,24 @@ export async function processTypeDef(intermediateTypeFile, header) {
42
43
  if (namespace === TOP_LEVEL_NAMESPACE) {
43
44
  for (const def of defs) {
44
45
  dts += prettyPrint(def, 0) + '\n\n';
46
+ switch (def.kind) {
47
+ case TypeDefKind.Const:
48
+ case TypeDefKind.Enum:
49
+ case TypeDefKind.Fn:
50
+ case TypeDefKind.Struct: {
51
+ exports.push(def.name);
52
+ if (def.original_name && def.original_name !== def.name) {
53
+ exports.push(def.original_name);
54
+ }
55
+ break;
56
+ }
57
+ default:
58
+ break;
59
+ }
45
60
  }
46
61
  }
47
62
  else {
63
+ exports.push(namespace);
48
64
  dts += `export namespace ${namespace} {\n`;
49
65
  for (const def of defs) {
50
66
  dts += prettyPrint(def, 2) + '\n';
@@ -62,7 +78,10 @@ export class ExternalObject<T> {
62
78
  }
63
79
  `;
64
80
  }
65
- return header + dts;
81
+ return {
82
+ dts: header + dts,
83
+ exports,
84
+ };
66
85
  }
67
86
  async function readIntermediateTypeFile(file) {
68
87
  const content = await readFileAsync(file, 'utf8');
@@ -8,7 +8,7 @@ export var NapiVersion;
8
8
  NapiVersion[NapiVersion["Napi6"] = 6] = "Napi6";
9
9
  NapiVersion[NapiVersion["Napi7"] = 7] = "Napi7";
10
10
  NapiVersion[NapiVersion["Napi8"] = 8] = "Napi8";
11
- })(NapiVersion = NapiVersion || (NapiVersion = {}));
11
+ })(NapiVersion || (NapiVersion = {}));
12
12
  /// because node support new napi version in some minor version updates, so we might meet such situation:
13
13
  /// `node v10.20.0` supports `napi5` and `napi6`, but `node v12.0.0` only support `napi4`,
14
14
  /// by which, we can not tell directly napi version supportness from node version directly.
@@ -52,7 +52,7 @@ function toEngineRequirement(versions) {
52
52
  req += `${i === 0 ? '' : ' || '}>= ${v.major}.${v.minor}.${v.patch}`;
53
53
  requirements.push(req);
54
54
  });
55
- return requirements.join(' && ');
55
+ return requirements.join(' ');
56
56
  }
57
57
  export function napiEngineRequirement(napiVersion) {
58
58
  return toEngineRequirement(requiredNodeVersions(napiVersion));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@napi-rs/cli",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.5",
4
4
  "description": "Cli tools for napi-rs",
5
5
  "author": "LongYinan <lynweklm@gmail.com>",
6
6
  "homepage": "https://github.com/napi-rs/napi-rs",
@@ -67,24 +67,24 @@
67
67
  "url": "https://github.com/napi-rs/napi-rs/issues"
68
68
  },
69
69
  "dependencies": {
70
- "@octokit/rest": "^19.0.7",
71
- "clipanion": "^3.2.0",
72
- "colorette": "^2.0.19",
70
+ "@octokit/rest": "^20.0.1",
71
+ "clipanion": "^3.2.1",
72
+ "colorette": "^2.0.20",
73
73
  "debug": "^4.3.4",
74
- "inquirer": "^9.1.5",
74
+ "inquirer": "^9.2.8",
75
75
  "js-yaml": "^4.1.0",
76
76
  "lodash-es": "^4.17.21",
77
- "typanion": "^3.12.1"
77
+ "typanion": "^3.13.0"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@types/inquirer": "^9.0.3",
81
81
  "@types/js-yaml": "^4.0.5",
82
- "@types/lodash-es": "^4.17.6",
83
- "ava": "^5.2.0",
84
- "esbuild": "^0.17.14",
85
- "prettier": "^2.8.7",
82
+ "@types/lodash-es": "^4.17.8",
83
+ "ava": "^5.3.1",
84
+ "esbuild": "^0.18.13",
85
+ "prettier": "^3.0.0",
86
86
  "ts-node": "^10.9.1",
87
- "typescript": "^4.9.4"
87
+ "typescript": "^5.1.6"
88
88
  },
89
89
  "funding": {
90
90
  "type": "github",
@@ -94,7 +94,7 @@
94
94
  "codegen": "node --loader ts-node/esm/transpile-only ./codegen/index.ts",
95
95
  "build": "tsc && yarn build:cjs",
96
96
  "build:cjs": "node ./esbuild.mjs",
97
- "test": "ava"
97
+ "test": "node --loader ts-node/esm/transpile-only ../node_modules/ava/entrypoints/cli.mjs"
98
98
  },
99
- "gitHead": "b5c3c0575559f9c99d7747f3163476afe7e89a6c"
99
+ "gitHead": "cbed8fceb2996af195085aa13a94ff779879b999"
100
100
  }
@@ -30,8 +30,8 @@ export async function collectArtifacts(userOptions: ArtifactsOptions) {
30
30
  const universalSourceBins = new Set(
31
31
  targets
32
32
  .filter((platform) => platform.arch === 'universal')
33
- .flatMap((p) =>
34
- UniArchsByPlatform[p.platform]?.map((a) => `${p.platform}-${a}`),
33
+ .flatMap(
34
+ (p) => UniArchsByPlatform[p.platform]?.map((a) => `${p.platform}-${a}`),
35
35
  )
36
36
  .filter(Boolean) as string[],
37
37
  )
package/src/api/build.ts CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  writeFileAsync,
29
29
  } from '../utils/index.js'
30
30
 
31
- import { createJsBinding } from './templates/index.js'
31
+ import { createCjsBinding } from './templates/index.js'
32
32
 
33
33
  const debug = debugFactory('build')
34
34
 
@@ -149,13 +149,16 @@ class Builder {
149
149
 
150
150
  const controller = new AbortController()
151
151
 
152
+ const watch = this.options.watch
152
153
  const buildTask = new Promise<void>((resolve, reject) => {
153
- const buildProcess = spawn('cargo', this.args, {
154
+ const command =
155
+ process.env.CARGO ?? (this.options.useCross ? 'cross' : 'cargo')
156
+ const buildProcess = spawn(command, this.args, {
154
157
  env: {
155
158
  ...process.env,
156
159
  ...this.envs,
157
160
  },
158
- stdio: 'inherit',
161
+ stdio: watch ? ['inherit', 'inherit', 'pipe'] : 'inherit',
159
162
  cwd: this.cwd,
160
163
  signal: controller.signal,
161
164
  })
@@ -176,6 +179,15 @@ class Builder {
176
179
  }),
177
180
  )
178
181
  })
182
+
183
+ // watch mode only, they are piped through stderr
184
+ buildProcess.stderr?.on('data', (data) => {
185
+ const output = data.toString()
186
+ console.error(output)
187
+ if (/Finished\s(dev|release)/.test(output)) {
188
+ this.postBuild().catch(() => {})
189
+ }
190
+ })
179
191
  })
180
192
 
181
193
  return {
@@ -205,6 +217,7 @@ class Builder {
205
217
  this.crateDir,
206
218
  '--',
207
219
  'cargo',
220
+ 'build',
208
221
  )
209
222
  set = true
210
223
  }
@@ -401,6 +414,10 @@ class Builder {
401
414
  this.args.push('--target-dir', this.options.targetDir)
402
415
  }
403
416
 
417
+ if (this.options.profile) {
418
+ this.args.push('--profile', this.options.profile)
419
+ }
420
+
404
421
  if (this.options.cargoOptions?.length) {
405
422
  this.args.push(...this.options.cargoOptions)
406
423
  }
@@ -446,8 +463,8 @@ class Builder {
446
463
 
447
464
  // only for cdylib
448
465
  if (this.cdyLibName) {
449
- await this.generateTypeDef()
450
- await this.writeJsBinding()
466
+ const idents = await this.generateTypeDef()
467
+ await this.writeJsBinding(idents)
451
468
  }
452
469
 
453
470
  return this.outputs
@@ -459,12 +476,10 @@ class Builder {
459
476
  return
460
477
  }
461
478
 
462
- const src = join(
463
- this.targetDir,
464
- this.target.triple,
465
- this.options.release ? 'release' : 'debug',
466
- srcName,
467
- )
479
+ const profile =
480
+ this.options.profile ?? (this.options.release ? 'release' : 'debug')
481
+ const src = join(this.targetDir, this.target.triple, profile, srcName)
482
+ debug(`Copy artifact from: [${src}]`)
468
483
  const dest = join(this.outputDir, destName)
469
484
 
470
485
  try {
@@ -519,12 +534,12 @@ class Builder {
519
534
 
520
535
  private async generateTypeDef() {
521
536
  if (!(await fileExists(this.envs.TYPE_DEF_TMP_PATH))) {
522
- return
537
+ return []
523
538
  }
524
539
 
525
540
  const dest = join(this.outputDir, this.options.dts ?? 'index.d.ts')
526
541
 
527
- const dts = await processTypeDef(
542
+ const { dts, exports } = await processTypeDef(
528
543
  this.envs.TYPE_DEF_TMP_PATH,
529
544
  !this.options.noDtsHeader
530
545
  ? this.options.dtsHeader ?? DEFAULT_TYPE_DEF_HEADER
@@ -543,21 +558,33 @@ class Builder {
543
558
  debug.error('Failed to write type def file')
544
559
  debug.error(e as Error)
545
560
  }
561
+
562
+ return exports
546
563
  }
547
564
 
548
- private async writeJsBinding() {
549
- if (!this.options.platform || this.options.noJsBinding) {
565
+ private async writeJsBinding(idents: string[]) {
566
+ if (
567
+ !this.options.platform ||
568
+ // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
569
+ this.options.noJsBinding ||
570
+ idents.length === 0
571
+ ) {
550
572
  return
551
573
  }
552
574
 
553
- const dest = join(this.outputDir, this.options.jsBinding ?? 'index.js')
575
+ const name = parse(this.options.jsBinding ?? 'index.js').name
554
576
 
555
- const js = createJsBinding(this.config.binaryName, this.config.packageName)
577
+ const cjs = createCjsBinding(
578
+ this.config.binaryName,
579
+ this.config.packageName,
580
+ idents,
581
+ )
556
582
 
557
583
  try {
584
+ const dest = join(this.outputDir, `${name}.js`)
558
585
  debug('Writing js binding to:')
559
586
  debug(' %i', dest)
560
- await writeFileAsync(dest, js, 'utf-8')
587
+ await writeFileAsync(dest, cjs, 'utf-8')
561
588
  this.outputs.push({
562
589
  kind: 'js',
563
590
  path: dest,
@@ -129,11 +129,14 @@ export async function prePublish(userOptions: PrePublishOptions) {
129
129
  if (!options.dryRun) {
130
130
  await version(userOptions)
131
131
  await updatePackageJson(packageJsonPath, {
132
- optionalDependencies: targets.reduce((deps, target) => {
133
- deps[`${packageName}-${target.platformArchABI}`] = packageJson.version
134
-
135
- return deps
136
- }, {} as Record<string, string>),
132
+ optionalDependencies: targets.reduce(
133
+ (deps, target) => {
134
+ deps[`${packageName}-${target.platformArchABI}`] = packageJson.version
135
+
136
+ return deps
137
+ },
138
+ {} as Record<string, string>,
139
+ ),
137
140
  })
138
141
  }
139
142
 
@@ -94,6 +94,14 @@ jobs:
94
94
  - host: windows-latest
95
95
  target: 'aarch64-pc-windows-msvc'
96
96
  build: yarn build --platform --target aarch64-pc-windows-msvc
97
+ - host: ubuntu-latest
98
+ target: 'riscv64gc-unknown-linux-gnu'
99
+ setup: |
100
+ sudo apt-get update
101
+ sudo apt-get install gcc-riscv64-linux-gnu -y
102
+ build: |
103
+ yarn build --platform --target riscv64gc-unknown-linux-gnu
104
+ riscv64-linux-gnu-strip *.node
97
105
 
98
106
  name: stable - \${{ matrix.settings.target }} - node@18
99
107
  runs-on: \${{ matrix.settings.host }}
@@ -106,7 +114,6 @@ jobs:
106
114
  if: \${{ !matrix.settings.docker }}
107
115
  with:
108
116
  node-version: 18
109
- check-latest: true
110
117
  cache: yarn
111
118
 
112
119
  - name: Install
@@ -150,7 +157,6 @@ jobs:
150
157
  if: matrix.settings.target == 'i686-pc-windows-msvc'
151
158
  with:
152
159
  node-version: 18
153
- check-latest: true
154
160
  cache: yarn
155
161
  architecture: x86
156
162
 
@@ -192,9 +198,7 @@ jobs:
192
198
  usesh: true
193
199
  mem: 3000
194
200
  prepare: |
195
- pkg install -y -f curl node libnghttp2
196
- curl -qL https://www.npmjs.com/install.sh | sh
197
- npm install --location=global --ignore-scripts yarn
201
+ pkg install -y -f curl node libnghttp2 npm yarn
198
202
  curl https://sh.rustup.rs -sSf --output rustup.sh
199
203
  sh rustup.sh -y --profile minimal --default-toolchain beta
200
204
  export PATH="/usr/local/cargo/bin:$PATH"
@@ -247,7 +251,6 @@ jobs:
247
251
  uses: actions/setup-node@v3
248
252
  with:
249
253
  node-version: \${{ matrix.node }}
250
- check-latest: true
251
254
  cache: 'yarn'
252
255
 
253
256
  - name: 'Install dependencies'
@@ -283,7 +286,6 @@ jobs:
283
286
  uses: actions/setup-node@v3
284
287
  with:
285
288
  node-version: \${{ matrix.node }}
286
- check-latest: true
287
289
  cache: 'yarn'
288
290
 
289
291
  - name: 'Install dependencies'
@@ -319,7 +321,6 @@ jobs:
319
321
  uses: actions/setup-node@v3
320
322
  with:
321
323
  node-version: \${{ matrix.node }}
322
- check-latest: true
323
324
  cache: 'yarn'
324
325
 
325
326
  - name: 'Install dependencies'
@@ -368,7 +369,7 @@ jobs:
368
369
  yarn config set supportedArchitectures.cpu "arm64"
369
370
  yarn config set supportedArchitectures.libc "glibc"
370
371
  yarn install
371
-
372
+
372
373
  - name: Set up QEMU
373
374
  uses: docker/setup-qemu-action@v2
374
375
  with:
@@ -483,7 +484,6 @@ jobs:
483
484
  uses: actions/setup-node@v3
484
485
  with:
485
486
  node-version: 18
486
- check-latest: true
487
487
  cache: yarn
488
488
 
489
489
  - name: 'Install dependencies'
@@ -529,7 +529,6 @@ jobs:
529
529
  uses: actions/setup-node@v3
530
530
  with:
531
531
  node-version: 18
532
- check-latest: true
533
532
  cache: 'yarn'
534
533
 
535
534
  - name: 'Install dependencies'
@@ -63,10 +63,16 @@ export const createGithubActionsCIYml = (
63
63
  if (!enableWindowsX86 && !enableMacOSX86) {
64
64
  delete fullTemplate.jobs[TEST_MACOS_WINDOWS]
65
65
  } else {
66
- const filterTarget = enableWindowsX86 ? 'macos-latest' : 'windows-latest'
66
+ const filterTargets = new Set<string>()
67
+ if (enableWindowsX86) {
68
+ filterTargets.add('windows-latest')
69
+ }
70
+ if (enableMacOSUni || enableMacOSX86) {
71
+ filterTargets.add('macos-latest')
72
+ }
67
73
  fullTemplate.jobs[TEST_MACOS_WINDOWS].strategy.matrix.settings =
68
74
  fullTemplate.jobs[TEST_MACOS_WINDOWS].strategy.matrix.settings.filter(
69
- ({ host }: { host: string; target: string }) => host !== filterTarget,
75
+ ({ host }: { host: string; target: string }) => filterTargets.has(host),
70
76
  )
71
77
 
72
78
  requiredSteps.push(TEST_MACOS_WINDOWS)