@invarn/cibuild 1.7.0 → 1.8.0

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.
@@ -1,5 +1,48 @@
1
+ export interface SetupOptions {
2
+ keystore: boolean;
3
+ keystoreProperties: boolean;
4
+ googleServices: boolean;
5
+ googlePlayDeploy: boolean;
6
+ googlePlayPackageName: string;
7
+ /** Whether the release workflow should produce an AAB or APK. Defaults to 'apk'. */
8
+ artifactType: 'apk' | 'aab';
9
+ /** Resolved keystore file paths per workflow (relative to project root), if found on disk. */
10
+ keystorePaths: Record<string, string>;
11
+ }
12
+ export interface WorkflowVariantConfig {
13
+ /** Value for the VARIANT env var, e.g. "debug", "release", "stagingDebug". */
14
+ variant: string;
15
+ /** Capitalised build type for gradle-build inputs, e.g. "Debug", "Release", "StagingDebug". */
16
+ buildType: string;
17
+ /** Gradle assemble task, e.g. "assembleDebug", "assembleRelease", "assembleStagingDebug". */
18
+ gradleTask: string;
19
+ }
20
+ export interface WorkflowVariants {
21
+ primary: WorkflowVariantConfig;
22
+ pullRequest: WorkflowVariantConfig;
23
+ release: WorkflowVariantConfig;
24
+ }
25
+ export interface IosWorkflowSchemeConfig {
26
+ scheme: string;
27
+ configuration: string;
28
+ distributionMethod: string;
29
+ }
30
+ export interface IosWorkflowVariants {
31
+ primary: IosWorkflowSchemeConfig;
32
+ pullRequest: IosWorkflowSchemeConfig;
33
+ release: IosWorkflowSchemeConfig;
34
+ }
35
+ export interface IosSetupOptions {
36
+ cocoaPods: boolean;
37
+ codeSigning: boolean;
38
+ appStoreDeploy: boolean;
39
+ bundleId: string;
40
+ }
41
+ export declare function generateAndroidPipeline(javaVersion?: number, setup?: SetupOptions, variants?: WorkflowVariants, cacheTechnology?: "gradle" | "kmm", metaNamespace?: 'invarn' | 'cibuild.io'): string;
42
+ export declare function generateIosPipeline(projectPath: string, setup: IosSetupOptions, variants: IosWorkflowVariants, metaNamespace?: 'invarn' | 'cibuild.io'): string;
1
43
  export declare function handleBuildCommand(detectMobileProjectRoot: (dir: string) => "android" | "ios" | "kmm" | null, options?: {
2
44
  createPipelinesDir?: boolean;
3
45
  nonInteractive?: boolean;
46
+ metaNamespace?: 'invarn' | 'cibuild.io';
4
47
  }): Promise<void>;
5
48
  //# sourceMappingURL=build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAm8BA,wBAAsB,kBAAkB,CACtC,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,EAC1E,OAAO,GAAE;IAAE,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAO,GACvE,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/build.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oFAAoF;IACpF,YAAY,EAAE,KAAK,GAAG,KAAK,CAAC;IAC5B,8FAA8F;IAC9F,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,+FAA+F;IAC/F,SAAS,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,WAAW,EAAE,qBAAqB,CAAC;IACnC,OAAO,EAAE,qBAAqB,CAAC;CAChC;AAiBD,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,EAAE,uBAAuB,CAAC;IACrC,OAAO,EAAE,uBAAuB,CAAC;CAClC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAoJD,wBAAgB,uBAAuB,CACrC,WAAW,GAAE,MAAW,EACxB,KAAK,GAAE,YAAgL,EACvL,QAAQ,GAAE,gBAAmC,EAC7C,eAAe,GAAE,QAAQ,GAAG,KAAgB,EAC5C,aAAa,GAAE,QAAQ,GAAG,YAA2B,GACpD,MAAM,CA2NR;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,eAAe,EACtB,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,GAAE,QAAQ,GAAG,YAA2B,GACpD,MAAM,CA4LR;AAgVD,wBAAsB,kBAAkB,CACtC,uBAAuB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,EAC1E,OAAO,GAAE;IACP,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CACpC,GACL,OAAO,CAAC,IAAI,CAAC,CA4Bf"}
@@ -122,7 +122,7 @@ function detectSetupNeeds(warnings) {
122
122
  artifactType: 'apk',
123
123
  };
124
124
  }
125
- function generateAndroidPipeline(javaVersion = 17, setup = { keystore: false, keystoreProperties: false, googleServices: false, googlePlayDeploy: false, googlePlayPackageName: '', artifactType: 'apk', keystorePaths: {} }, variants = DEFAULT_VARIANTS, cacheTechnology = "gradle") {
125
+ export function generateAndroidPipeline(javaVersion = 17, setup = { keystore: false, keystoreProperties: false, googleServices: false, googlePlayDeploy: false, googlePlayPackageName: '', artifactType: 'apk', keystorePaths: {} }, variants = DEFAULT_VARIANTS, cacheTechnology = "gradle", metaNamespace = 'cibuild.io') {
126
126
  const keystoreStepFor = (wf) => {
127
127
  if (!setup.keystore)
128
128
  return "";
@@ -204,7 +204,7 @@ function generateAndroidPipeline(javaVersion = 17, setup = { keystore: false, ke
204
204
  return `format_version: '1'
205
205
 
206
206
  meta:
207
- cibuild.io:
207
+ ${metaNamespace}:
208
208
  stack: ${stack}
209
209
  machine_type: standard
210
210
  platform: ${platformMeta}
@@ -333,7 +333,7 @@ ${googlePlayStep}
333
333
  fi
334
334
  `;
335
335
  }
336
- function generateIosPipeline(projectPath, setup, variants) {
336
+ export function generateIosPipeline(projectPath, setup, variants, metaNamespace = 'cibuild.io') {
337
337
  const { primary: pv, pullRequest: prv, release: rv } = variants;
338
338
  // Global scheme is the primary scheme (used as default across workflows)
339
339
  const globalScheme = pv.scheme;
@@ -409,7 +409,7 @@ function generateIosPipeline(projectPath, setup, variants) {
409
409
  return `format_version: '1'
410
410
 
411
411
  meta:
412
- cibuild.io:
412
+ ${metaNamespace}:
413
413
  stack: macos-xcode-26.4
414
414
  machine_type: performance
415
415
  platform: ios
@@ -771,7 +771,7 @@ async function handleIosBuildCommand(cwd, options = {}) {
771
771
  }
772
772
  }
773
773
  // 7. Generate and write the pipeline
774
- const yaml = generateIosPipeline(iosScanResult.projectPath, iosSetupOptions, iosVariants);
774
+ const yaml = generateIosPipeline(iosScanResult.projectPath, iosSetupOptions, iosVariants, options.metaNamespace);
775
775
  writeFileSync(outputPath, yaml, "utf-8");
776
776
  console.log("\n✅ Generated .ci/pipelines/cibuild.yml");
777
777
  console.log(" Platform: iOS");
@@ -1042,7 +1042,7 @@ async function handleAndroidBuildCommand(cwd, options, cacheTechnology) {
1042
1042
  // that exact JDK — a newer JDK can cross-compile. Enforce a minimum of 17
1043
1043
  // since ubuntu-latest runners ship with JDK 17+ and JDK <17 is unavailable.
1044
1044
  const javaVersion = Math.max(scanResult.detectedJavaVersion ?? 17, 17);
1045
- const yaml = generateAndroidPipeline(javaVersion, setupOptions, variants, cacheTechnology);
1045
+ const yaml = generateAndroidPipeline(javaVersion, setupOptions, variants, cacheTechnology, options.metaNamespace);
1046
1046
  writeFileSync(outputPath, yaml, "utf-8");
1047
1047
  console.log("\n✅ Generated .ci/pipelines/cibuild.yml");
1048
1048
  console.log(` Platform: ${platformLabel}`);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Unit tests for the YAML scaffold generators in build.ts.
3
+ *
4
+ * `generateIosPipeline` and `generateAndroidPipeline` are pure
5
+ * functions today (input → YAML string), so we drive them directly
6
+ * rather than through the interactive `handleBuildCommand` shell.
7
+ *
8
+ * Focus is the meta-namespace flip: standalone `cibuild` callers get
9
+ * `meta.cibuild.io:` (default), while invarn-CLI-routed calls pass
10
+ * `metaNamespace: 'invarn'` and get `meta.invarn:`.
11
+ */
12
+ export {};
13
+ //# sourceMappingURL=build.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.test.d.ts","sourceRoot":"","sources":["../../../src/commands/build.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Unit tests for the YAML scaffold generators in build.ts.
3
+ *
4
+ * `generateIosPipeline` and `generateAndroidPipeline` are pure
5
+ * functions today (input → YAML string), so we drive them directly
6
+ * rather than through the interactive `handleBuildCommand` shell.
7
+ *
8
+ * Focus is the meta-namespace flip: standalone `cibuild` callers get
9
+ * `meta.cibuild.io:` (default), while invarn-CLI-routed calls pass
10
+ * `metaNamespace: 'invarn'` and get `meta.invarn:`.
11
+ */
12
+ import { describe, test, expect } from '@jest/globals';
13
+ import { generateIosPipeline, generateAndroidPipeline, } from './build.js';
14
+ const iosSetup = {
15
+ cocoaPods: false,
16
+ codeSigning: false,
17
+ appStoreDeploy: false,
18
+ bundleId: 'com.example.app',
19
+ };
20
+ const iosVariants = {
21
+ primary: { scheme: 'MyApp', configuration: 'Debug', distributionMethod: 'development' },
22
+ pullRequest: { scheme: 'MyApp', configuration: 'Debug', distributionMethod: 'development' },
23
+ release: { scheme: 'MyApp', configuration: 'Release', distributionMethod: 'app-store' },
24
+ };
25
+ describe('generateIosPipeline — meta namespace', () => {
26
+ test('emits meta.cibuild.io: by default (standalone cibuild path)', () => {
27
+ const yaml = generateIosPipeline('./MyApp', iosSetup, iosVariants);
28
+ expect(yaml).toContain('meta:\n cibuild.io:\n');
29
+ expect(yaml).not.toContain('meta:\n invarn:\n');
30
+ });
31
+ test('emits meta.cibuild.io: when explicitly passed "cibuild.io"', () => {
32
+ const yaml = generateIosPipeline('./MyApp', iosSetup, iosVariants, 'cibuild.io');
33
+ expect(yaml).toContain('meta:\n cibuild.io:\n');
34
+ expect(yaml).not.toContain('meta:\n invarn:\n');
35
+ });
36
+ test('emits meta.invarn: when explicitly passed "invarn" (invarn-CLI path)', () => {
37
+ const yaml = generateIosPipeline('./MyApp', iosSetup, iosVariants, 'invarn');
38
+ expect(yaml).toContain('meta:\n invarn:\n');
39
+ expect(yaml).not.toContain('meta:\n cibuild.io:\n');
40
+ });
41
+ });
42
+ describe('generateAndroidPipeline — meta namespace', () => {
43
+ test('emits meta.cibuild.io: by default (standalone cibuild path)', () => {
44
+ const yaml = generateAndroidPipeline();
45
+ expect(yaml).toContain('meta:\n cibuild.io:\n');
46
+ expect(yaml).not.toContain('meta:\n invarn:\n');
47
+ });
48
+ test('emits meta.cibuild.io: when explicitly passed "cibuild.io"', () => {
49
+ const yaml = generateAndroidPipeline(17, undefined, undefined, 'gradle', 'cibuild.io');
50
+ expect(yaml).toContain('meta:\n cibuild.io:\n');
51
+ expect(yaml).not.toContain('meta:\n invarn:\n');
52
+ });
53
+ test('emits meta.invarn: when explicitly passed "invarn" (invarn-CLI path)', () => {
54
+ const yaml = generateAndroidPipeline(17, undefined, undefined, 'gradle', 'invarn');
55
+ expect(yaml).toContain('meta:\n invarn:\n');
56
+ expect(yaml).not.toContain('meta:\n cibuild.io:\n');
57
+ });
58
+ });
59
+ //# sourceMappingURL=build.test.js.map
@@ -1,6 +1,13 @@
1
1
  export interface InitOptions {
2
2
  importPath?: string;
3
3
  create?: boolean;
4
+ /**
5
+ * Which namespace to emit in the generated `meta.<ns>` block of the new
6
+ * pipeline YAML. Defaults to `'cibuild.io'` so the standalone `cibuild`
7
+ * CLI keeps emitting the legacy namespace. Invarn-CLI-routed calls pass
8
+ * `'invarn'` so wrapped flows emit the canonical Invarn namespace.
9
+ */
10
+ metaNamespace?: 'invarn' | 'cibuild.io';
4
11
  }
5
12
  /**
6
13
  * Check dependencies, then either import an existing YAML pipeline or
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAUD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0Q7E"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/init.ts"],"names":[],"mappings":"AAYA,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;CACzC;AAUD;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2Q7E"}
@@ -189,6 +189,7 @@ export async function handleInitCommand(opts = {}) {
189
189
  await handleBuildCommand(detectMobileProjectRoot, {
190
190
  createPipelinesDir: true,
191
191
  nonInteractive: !!opts.create,
192
+ metaNamespace: opts.metaNamespace,
192
193
  });
193
194
  process.exit(0);
194
195
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invarn/cibuild",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "CI Build CLI — local pipeline orchestration and validation",
5
5
  "type": "module",
6
6
  "main": "dist/cli.cjs",