@catladder/cli 0.0.0-next-31a23584 → 0.0.0-next-41642e39

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 (41) hide show
  1. package/dist/apps/cli/src/publish/npmPublishJob.js +17 -12
  2. package/dist/apps/cli/src/publish/npmPublishJob.js.map +1 -1
  3. package/dist/bundles/catci/index.js +2 -2
  4. package/dist/bundles/catenv/index.js +140 -43
  5. package/dist/bundles/cli/index.js +140 -43
  6. package/dist/bundles/skills/catladder-deploys/SKILL.md +31 -2
  7. package/dist/bundles/skills/catladder-deploys/references/deploy-types.md +10 -0
  8. package/dist/packages/pipeline/src/build/node/cache.js +33 -36
  9. package/dist/packages/pipeline/src/build/node/cache.js.map +1 -1
  10. package/dist/packages/pipeline/src/deploy/base/deploy.js +5 -3
  11. package/dist/packages/pipeline/src/deploy/base/deploy.js.map +1 -1
  12. package/dist/packages/pipeline/src/deploy/custom/deployJob.js +3 -0
  13. package/dist/packages/pipeline/src/deploy/custom/deployJob.js.map +1 -1
  14. package/dist/packages/pipeline/src/deploy/index.d.ts +1 -0
  15. package/dist/packages/pipeline/src/deploy/index.js +3 -0
  16. package/dist/packages/pipeline/src/deploy/index.js.map +1 -1
  17. package/dist/packages/pipeline/src/deploy/npmPackage/index.js +4 -4
  18. package/dist/packages/pipeline/src/deploy/npmPackage/index.js.map +1 -1
  19. package/dist/packages/pipeline/src/deploy/pages/deployJob.d.ts +3 -0
  20. package/dist/packages/pipeline/src/deploy/pages/deployJob.js +55 -0
  21. package/dist/packages/pipeline/src/deploy/pages/deployJob.js.map +1 -0
  22. package/dist/packages/pipeline/src/deploy/pages/index.d.ts +2 -0
  23. package/dist/packages/pipeline/src/deploy/pages/index.js +12 -0
  24. package/dist/packages/pipeline/src/deploy/pages/index.js.map +1 -0
  25. package/dist/packages/pipeline/src/deploy/types/base.d.ts +5 -0
  26. package/dist/packages/pipeline/src/deploy/types/custom.d.ts +4 -0
  27. package/dist/packages/pipeline/src/deploy/types/index.d.ts +7 -3
  28. package/dist/packages/pipeline/src/deploy/types/index.js +1 -0
  29. package/dist/packages/pipeline/src/deploy/types/index.js.map +1 -1
  30. package/dist/packages/pipeline/src/deploy/types/pages.d.ts +37 -0
  31. package/dist/packages/pipeline/src/deploy/types/pages.js +3 -0
  32. package/dist/packages/pipeline/src/deploy/types/pages.js.map +1 -0
  33. package/dist/packages/pipeline/src/types/gitlab-types.d.ts +3 -0
  34. package/dist/packages/pipeline/src/types/jobDefinition.d.ts +1 -1
  35. package/dist/packages/pipeline/src/types/jobs.d.ts +8 -0
  36. package/dist/packages/pipeline/src/types/jobs.js.map +1 -1
  37. package/dist/skills/catladder-deploys/SKILL.md +31 -2
  38. package/dist/skills/catladder-deploys/references/deploy-types.md +10 -0
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +2 -3
  41. package/src/publish/npmPublishJob.ts +19 -14
@@ -5203,7 +5203,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5203
5203
  };
5204
5204
  Object.defineProperty(exports, "__esModule", ({ value: true }));
5205
5205
  exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
5206
- const lodash_es_1 = __nccwpck_require__(50866);
5207
5206
  const path_1 = __nccwpck_require__(16928);
5208
5207
  const slugify_1 = __importDefault(__nccwpck_require__(21396));
5209
5208
  /**
@@ -5212,15 +5211,37 @@ const slugify_1 = __importDefault(__nccwpck_require__(21396));
5212
5211
  * exact-lockfile hit (github skips the ~0.6GB download on warm runs)
5213
5212
  */
5214
5213
  const NODE_MODULES_CACHE_ID = "node-modules";
5215
- const getYarnCache = async (context, policy = "pull-push") => {
5214
+ /**
5215
+ * the directory whose caches this job uses. Components that are part of
5216
+ * a shared workspace use the workspace root's caches: the install
5217
+ * operates on the whole workspace, and the workspace build job is the
5218
+ * one that populates the slots. Historically these component jobs
5219
+ * (verify, docker) read a separate key family that no job ever saved,
5220
+ * so they always started cold. Standalone components and the workspace
5221
+ * jobs themselves keep using their own build dir (unchanged keys).
5222
+ */
5223
+ const getCacheBaseDir = async (context) => {
5224
+ var _a;
5216
5225
  const packageManagerInfo = await context.packageManagerInfo;
5217
5226
  const componentIsInWorkspace = context.type === "component" &&
5218
5227
  "componentIsInWorkspace" in packageManagerInfo &&
5219
5228
  packageManagerInfo.componentIsInWorkspace;
5229
+ if (!componentIsInWorkspace)
5230
+ return context.build.dir;
5231
+ // the workspace build's dir when the component references one,
5232
+ // otherwise the repo root (packageManager.ts resolves workspace
5233
+ // membership against the root)
5234
+ return context.build.type === "fromWorkspace"
5235
+ ? ((_a = context.build.workspaceBuildConfig.dir) !== null && _a !== void 0 ? _a : ".")
5236
+ : ".";
5237
+ };
5238
+ const getYarnCache = async (context, policy = "pull-push") => {
5239
+ const baseDir = await getCacheBaseDir(context);
5220
5240
  return [
5221
5241
  {
5222
- scope: componentIsInWorkspace ? "global" : "buildDir",
5223
- pathMode: componentIsInWorkspace ? "absolute" : "relative",
5242
+ scope: "buildDir",
5243
+ pathMode: "relative",
5244
+ buildDir: baseDir,
5224
5245
  key: "yarn",
5225
5246
  policy,
5226
5247
  paths: [".yarn"],
@@ -5237,52 +5258,28 @@ const getYarnCache = async (context, policy = "pull-push") => {
5237
5258
  };
5238
5259
  exports.getYarnCache = getYarnCache;
5239
5260
  const getNodeModulesCache = async (context, policy = "pull-push") => {
5240
- var _a, _b;
5241
5261
  const packageManagerInfo = await context.packageManagerInfo;
5242
- const componentIsInWorkspace = context.type === "component" &&
5243
- "componentIsInWorkspace" in packageManagerInfo &&
5244
- packageManagerInfo.componentIsInWorkspace;
5245
- const { isClassic, workspaces } = packageManagerInfo;
5262
+ const baseDir = await getCacheBaseDir(context);
5263
+ const { isClassic } = packageManagerInfo;
5246
5264
  // We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
5247
5265
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
5248
5266
  return [
5249
5267
  {
5250
5268
  scope: "global",
5251
5269
  pathMode: "absolute",
5252
- // if component is in a shared workspace, use workspace cache. use individual cache else
5253
- key: componentIsInWorkspace
5254
- ? "node-modules-workspace"
5255
- : (0, slugify_1.default)(context.build.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
5270
+ // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
5271
+ key: (0, slugify_1.default)(baseDir) + "-node-modules",
5256
5272
  // content-key for immutable-cache backends (github); the lockfile
5257
5273
  // decides whether the cached content could have changed (absolute
5258
- // pathMode: resolve the standalone component's lockfile explicitly)
5259
- keyFiles: [
5260
- componentIsInWorkspace
5261
- ? "yarn.lock"
5262
- : (0, path_1.join)(context.build.dir, "yarn.lock"),
5263
- ],
5274
+ // pathMode: resolve the lockfile explicitly)
5275
+ keyFiles: [(0, path_1.join)(baseDir, "yarn.lock")],
5264
5276
  // referenced by the yarn cache: an exact hit here makes the yarn
5265
5277
  // zips unnecessary (see redundantOnExactHitOf on getYarnCache)
5266
5278
  cacheId: NODE_MODULES_CACHE_ID,
5267
5279
  policy,
5268
5280
  paths: [
5269
- ...(componentIsInWorkspace
5270
- ? (0, lodash_es_1.uniq)([
5271
- "node_modules",
5272
- ...((_a = workspaces.map((w) => (0, path_1.join)(w.location, "node_modules"))) !== null && _a !== void 0 ? _a : []),
5273
- ...(!isClassic
5274
- ? [
5275
- ".yarn/install-state.gz",
5276
- ...((_b = workspaces.map((w) => (0, path_1.join)(w.location, ".yarn/install-state.gz"))) !== null && _b !== void 0 ? _b : []),
5277
- ]
5278
- : []),
5279
- ])
5280
- : [
5281
- (0, path_1.join)(context.build.dir, "node_modules"),
5282
- ...(!isClassic
5283
- ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")]
5284
- : []),
5285
- ]),
5281
+ (0, path_1.join)(baseDir, "node_modules"),
5282
+ ...(!isClassic ? [(0, path_1.join)(baseDir, ".yarn/install-state.gz")] : []),
5286
5283
  ],
5287
5284
  },
5288
5285
  ];
@@ -7047,7 +7044,7 @@ const variables_1 = __nccwpck_require__(98885);
7047
7044
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
7048
7045
  class DeployJob extends jobs_1.CatladderJob {
7049
7046
  constructor(context, jobDefinition) {
7050
- var _a, _b, _c, _d, _e, _f;
7047
+ var _a, _b, _c, _d, _e, _f, _g;
7051
7048
  const hasDocker = (0, docker_1.requiresDockerBuild)(context);
7052
7049
  const isStoppable = (0, utils_1.contextIsStoppable)(context);
7053
7050
  const autoStop = context.environment.envType === "review"
@@ -7125,6 +7122,8 @@ class DeployJob extends jobs_1.CatladderJob {
7125
7122
  caches: jobDefinition.cache,
7126
7123
  artifacts: jobDefinition.artifacts,
7127
7124
  services: jobDefinition.services,
7125
+ pages: jobDefinition.pages,
7126
+ allow_failure: (_e = jobDefinition.allow_failure) !== null && _e !== void 0 ? _e : deployConfig === null || deployConfig === void 0 ? void 0 : deployConfig.allowFailure,
7128
7127
  envMode: "stagePerEnv", // makes it easier to run manual tasks er env
7129
7128
  needs: [],
7130
7129
  requires: [
@@ -7144,8 +7143,8 @@ class DeployJob extends jobs_1.CatladderJob {
7144
7143
  },
7145
7144
  runnerVariables: {
7146
7145
  ...variables_1.DEPLOY_RUNNER_VARIABLES,
7147
- ...((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}),
7148
- ...(deployConfig ? ((_f = deployConfig.runnerVariables) !== null && _f !== void 0 ? _f : {}) : {}),
7146
+ ...((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {}),
7147
+ ...(deployConfig ? ((_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {}) : {}),
7149
7148
  },
7150
7149
  environment: isStoppable
7151
7150
  ? {
@@ -8723,6 +8722,9 @@ const createCustomDeployJobs = async (context) => {
8723
8722
  deploy: {
8724
8723
  image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
8725
8724
  cache: (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, deployConfig),
8725
+ artifacts: deployConfig.artifactsPaths
8726
+ ? { paths: deployConfig.artifactsPaths }
8727
+ : undefined,
8726
8728
  script: [
8727
8729
  `cd ${context.build.dir}`,
8728
8730
  ...(deployConfig.requiresYarnInstall ? yarnInstall : []),
@@ -8843,9 +8845,11 @@ const custom_1 = __nccwpck_require__(36394);
8843
8845
  const dockerTag_1 = __nccwpck_require__(59231);
8844
8846
  const kubernetes_1 = __nccwpck_require__(94469);
8845
8847
  const npmPackage_1 = __nccwpck_require__(79462);
8848
+ const pages_1 = __nccwpck_require__(66387);
8846
8849
  __exportStar(__nccwpck_require__(2691), exports);
8847
8850
  __exportStar(__nccwpck_require__(94469), exports);
8848
8851
  __exportStar(__nccwpck_require__(79462), exports);
8852
+ __exportStar(__nccwpck_require__(66387), exports);
8849
8853
  __exportStar(__nccwpck_require__(71446), exports);
8850
8854
  __exportStar(__nccwpck_require__(3537), exports);
8851
8855
  exports.DEPLOY_TYPES = {
@@ -8854,6 +8858,7 @@ exports.DEPLOY_TYPES = {
8854
8858
  dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
8855
8859
  "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
8856
8860
  npmPackage: npmPackage_1.NPM_PACKAGE_DEPLOY_TYPE,
8861
+ pages: pages_1.PAGES_DEPLOY_TYPE,
8857
8862
  };
8858
8863
  //# sourceMappingURL=index.js.map
8859
8864
 
@@ -9387,10 +9392,91 @@ exports.NPM_PACKAGE_DEPLOY_TYPE = {
9387
9392
  jobs: deployJob_1.createNpmPackageDeployJobs,
9388
9393
  defaults: () => ({}),
9389
9394
  additionalSecretKeys: (ctx) =>
9390
- // publish credentials don't exist for the local env
9391
- ctx.envType !== "local"
9392
- ? [{ key: exports.NPM_TOKEN_SECRET_KEY, hidden: true }]
9393
- : [],
9395
+ // publish credentials don't exist for the local env. Not hidden:
9396
+ // the user sets the token via `catladder project secrets-set`
9397
+ // (hidden is for machine-provisioned credentials)
9398
+ ctx.envType !== "local" ? [{ key: exports.NPM_TOKEN_SECRET_KEY }] : [],
9399
+ getAdditionalEnvVars: () => ({}),
9400
+ };
9401
+ //# sourceMappingURL=index.js.map
9402
+
9403
+ /***/ }),
9404
+
9405
+ /***/ 56173:
9406
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9407
+
9408
+ "use strict";
9409
+
9410
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9411
+ exports.createPagesDeployJobs = void 0;
9412
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
9413
+ const yarn_1 = __nccwpck_require__(59874);
9414
+ const runner_1 = __nccwpck_require__(71065);
9415
+ const base_1 = __nccwpck_require__(93664);
9416
+ const types_1 = __nccwpck_require__(71446);
9417
+ const createPagesDeployJobs = async (context) => {
9418
+ var _a, _b, _c;
9419
+ const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
9420
+ if (!(0, types_1.isOfDeployType)(deployConfig, "pages")) {
9421
+ // should not happen
9422
+ throw new Error("deploy config is not pages");
9423
+ }
9424
+ if (context.pipelineType === "github") {
9425
+ // don't fail the whole github generation of a multi-backend project
9426
+ console.warn(`component "${context.name}": the pages deploy type is not yet supported on the github backend — no deploy jobs generated`);
9427
+ return [];
9428
+ }
9429
+ // review environments publish under their own path prefix (gitlab
9430
+ // parallel deployments) — every merge request gets a site preview
9431
+ const pathPrefix = context.environment.envType === "review" ? "mr-$CI_MERGE_REQUEST_IID" : "";
9432
+ const publishDir = (_b = deployConfig.publishDir) !== null && _b !== void 0 ? _b : "public";
9433
+ const yarnInstall = await (0, yarn_1.getYarnInstall)(context, {
9434
+ noCustomPostInstall: true,
9435
+ });
9436
+ return (0, base_1.createDeployementJobs)(context, {
9437
+ deploy: {
9438
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
9439
+ cache: (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, deployConfig),
9440
+ artifacts: { paths: [publishDir] },
9441
+ pages: { path_prefix: pathPrefix },
9442
+ script: [
9443
+ `cd ${context.build.dir}`,
9444
+ ...(deployConfig.requiresYarnInstall ? yarnInstall : []),
9445
+ ...deployConfig.script,
9446
+ // the gitlab environment url should point at the published site
9447
+ // (the base deploy job reports $ROOT_URL as environment url)
9448
+ `export ROOT_URL="$CI_PAGES_URL${pathPrefix ? `/${pathPrefix}` : ""}"`,
9449
+ ],
9450
+ variables: {},
9451
+ runnerVariables: {
9452
+ // exposed so build scripts can adjust e.g. their base url
9453
+ PAGES_PREFIX: pathPrefix,
9454
+ // a pages deploy runs a full site build — the generic deploy-job
9455
+ // resources (200Mi/400Mi) OOM on any real yarn install + build
9456
+ KUBERNETES_MEMORY_REQUEST: "1Gi",
9457
+ KUBERNETES_MEMORY_LIMIT: "4Gi",
9458
+ },
9459
+ },
9460
+ });
9461
+ };
9462
+ exports.createPagesDeployJobs = createPagesDeployJobs;
9463
+ //# sourceMappingURL=deployJob.js.map
9464
+
9465
+ /***/ }),
9466
+
9467
+ /***/ 66387:
9468
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9469
+
9470
+ "use strict";
9471
+
9472
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9473
+ exports.PAGES_DEPLOY_TYPE = void 0;
9474
+ const deployJob_1 = __nccwpck_require__(56173);
9475
+ exports.PAGES_DEPLOY_TYPE = {
9476
+ jobs: deployJob_1.createPagesDeployJobs,
9477
+ // a broken site publish should not block the rest of the pipeline
9478
+ defaults: () => ({ allowFailure: true }),
9479
+ additionalSecretKeys: () => [],
9394
9480
  getAdditionalEnvVars: () => ({}),
9395
9481
  };
9396
9482
  //# sourceMappingURL=index.js.map
@@ -9469,6 +9555,7 @@ __exportStar(__nccwpck_require__(72025), exports);
9469
9555
  __exportStar(__nccwpck_require__(12152), exports);
9470
9556
  __exportStar(__nccwpck_require__(8030), exports);
9471
9557
  __exportStar(__nccwpck_require__(14571), exports);
9558
+ __exportStar(__nccwpck_require__(88510), exports);
9472
9559
  const isOfDeployType = (t, ...types) => {
9473
9560
  return t && types.includes(t.type) ? true : false;
9474
9561
  };
@@ -9503,6 +9590,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
9503
9590
 
9504
9591
  /***/ }),
9505
9592
 
9593
+ /***/ 88510:
9594
+ /***/ ((__unused_webpack_module, exports) => {
9595
+
9596
+ "use strict";
9597
+
9598
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9599
+ //# sourceMappingURL=pages.js.map
9600
+
9601
+ /***/ }),
9602
+
9506
9603
  /***/ 3537:
9507
9604
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9508
9605
 
@@ -11196,7 +11196,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11196
11196
  };
11197
11197
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11198
11198
  exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
11199
- const lodash_es_1 = __nccwpck_require__(50866);
11200
11199
  const path_1 = __nccwpck_require__(16928);
11201
11200
  const slugify_1 = __importDefault(__nccwpck_require__(21396));
11202
11201
  /**
@@ -11205,15 +11204,37 @@ const slugify_1 = __importDefault(__nccwpck_require__(21396));
11205
11204
  * exact-lockfile hit (github skips the ~0.6GB download on warm runs)
11206
11205
  */
11207
11206
  const NODE_MODULES_CACHE_ID = "node-modules";
11208
- const getYarnCache = async (context, policy = "pull-push") => {
11207
+ /**
11208
+ * the directory whose caches this job uses. Components that are part of
11209
+ * a shared workspace use the workspace root's caches: the install
11210
+ * operates on the whole workspace, and the workspace build job is the
11211
+ * one that populates the slots. Historically these component jobs
11212
+ * (verify, docker) read a separate key family that no job ever saved,
11213
+ * so they always started cold. Standalone components and the workspace
11214
+ * jobs themselves keep using their own build dir (unchanged keys).
11215
+ */
11216
+ const getCacheBaseDir = async (context) => {
11217
+ var _a;
11209
11218
  const packageManagerInfo = await context.packageManagerInfo;
11210
11219
  const componentIsInWorkspace = context.type === "component" &&
11211
11220
  "componentIsInWorkspace" in packageManagerInfo &&
11212
11221
  packageManagerInfo.componentIsInWorkspace;
11222
+ if (!componentIsInWorkspace)
11223
+ return context.build.dir;
11224
+ // the workspace build's dir when the component references one,
11225
+ // otherwise the repo root (packageManager.ts resolves workspace
11226
+ // membership against the root)
11227
+ return context.build.type === "fromWorkspace"
11228
+ ? ((_a = context.build.workspaceBuildConfig.dir) !== null && _a !== void 0 ? _a : ".")
11229
+ : ".";
11230
+ };
11231
+ const getYarnCache = async (context, policy = "pull-push") => {
11232
+ const baseDir = await getCacheBaseDir(context);
11213
11233
  return [
11214
11234
  {
11215
- scope: componentIsInWorkspace ? "global" : "buildDir",
11216
- pathMode: componentIsInWorkspace ? "absolute" : "relative",
11235
+ scope: "buildDir",
11236
+ pathMode: "relative",
11237
+ buildDir: baseDir,
11217
11238
  key: "yarn",
11218
11239
  policy,
11219
11240
  paths: [".yarn"],
@@ -11230,52 +11251,28 @@ const getYarnCache = async (context, policy = "pull-push") => {
11230
11251
  };
11231
11252
  exports.getYarnCache = getYarnCache;
11232
11253
  const getNodeModulesCache = async (context, policy = "pull-push") => {
11233
- var _a, _b;
11234
11254
  const packageManagerInfo = await context.packageManagerInfo;
11235
- const componentIsInWorkspace = context.type === "component" &&
11236
- "componentIsInWorkspace" in packageManagerInfo &&
11237
- packageManagerInfo.componentIsInWorkspace;
11238
- const { isClassic, workspaces } = packageManagerInfo;
11255
+ const baseDir = await getCacheBaseDir(context);
11256
+ const { isClassic } = packageManagerInfo;
11239
11257
  // We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
11240
11258
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
11241
11259
  return [
11242
11260
  {
11243
11261
  scope: "global",
11244
11262
  pathMode: "absolute",
11245
- // if component is in a shared workspace, use workspace cache. use individual cache else
11246
- key: componentIsInWorkspace
11247
- ? "node-modules-workspace"
11248
- : (0, slugify_1.default)(context.build.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
11263
+ // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
11264
+ key: (0, slugify_1.default)(baseDir) + "-node-modules",
11249
11265
  // content-key for immutable-cache backends (github); the lockfile
11250
11266
  // decides whether the cached content could have changed (absolute
11251
- // pathMode: resolve the standalone component's lockfile explicitly)
11252
- keyFiles: [
11253
- componentIsInWorkspace
11254
- ? "yarn.lock"
11255
- : (0, path_1.join)(context.build.dir, "yarn.lock"),
11256
- ],
11267
+ // pathMode: resolve the lockfile explicitly)
11268
+ keyFiles: [(0, path_1.join)(baseDir, "yarn.lock")],
11257
11269
  // referenced by the yarn cache: an exact hit here makes the yarn
11258
11270
  // zips unnecessary (see redundantOnExactHitOf on getYarnCache)
11259
11271
  cacheId: NODE_MODULES_CACHE_ID,
11260
11272
  policy,
11261
11273
  paths: [
11262
- ...(componentIsInWorkspace
11263
- ? (0, lodash_es_1.uniq)([
11264
- "node_modules",
11265
- ...((_a = workspaces.map((w) => (0, path_1.join)(w.location, "node_modules"))) !== null && _a !== void 0 ? _a : []),
11266
- ...(!isClassic
11267
- ? [
11268
- ".yarn/install-state.gz",
11269
- ...((_b = workspaces.map((w) => (0, path_1.join)(w.location, ".yarn/install-state.gz"))) !== null && _b !== void 0 ? _b : []),
11270
- ]
11271
- : []),
11272
- ])
11273
- : [
11274
- (0, path_1.join)(context.build.dir, "node_modules"),
11275
- ...(!isClassic
11276
- ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")]
11277
- : []),
11278
- ]),
11274
+ (0, path_1.join)(baseDir, "node_modules"),
11275
+ ...(!isClassic ? [(0, path_1.join)(baseDir, ".yarn/install-state.gz")] : []),
11279
11276
  ],
11280
11277
  },
11281
11278
  ];
@@ -13040,7 +13037,7 @@ const variables_1 = __nccwpck_require__(98885);
13040
13037
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
13041
13038
  class DeployJob extends jobs_1.CatladderJob {
13042
13039
  constructor(context, jobDefinition) {
13043
- var _a, _b, _c, _d, _e, _f;
13040
+ var _a, _b, _c, _d, _e, _f, _g;
13044
13041
  const hasDocker = (0, docker_1.requiresDockerBuild)(context);
13045
13042
  const isStoppable = (0, utils_1.contextIsStoppable)(context);
13046
13043
  const autoStop = context.environment.envType === "review"
@@ -13118,6 +13115,8 @@ class DeployJob extends jobs_1.CatladderJob {
13118
13115
  caches: jobDefinition.cache,
13119
13116
  artifacts: jobDefinition.artifacts,
13120
13117
  services: jobDefinition.services,
13118
+ pages: jobDefinition.pages,
13119
+ allow_failure: (_e = jobDefinition.allow_failure) !== null && _e !== void 0 ? _e : deployConfig === null || deployConfig === void 0 ? void 0 : deployConfig.allowFailure,
13121
13120
  envMode: "stagePerEnv", // makes it easier to run manual tasks er env
13122
13121
  needs: [],
13123
13122
  requires: [
@@ -13137,8 +13136,8 @@ class DeployJob extends jobs_1.CatladderJob {
13137
13136
  },
13138
13137
  runnerVariables: {
13139
13138
  ...variables_1.DEPLOY_RUNNER_VARIABLES,
13140
- ...((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}),
13141
- ...(deployConfig ? ((_f = deployConfig.runnerVariables) !== null && _f !== void 0 ? _f : {}) : {}),
13139
+ ...((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {}),
13140
+ ...(deployConfig ? ((_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {}) : {}),
13142
13141
  },
13143
13142
  environment: isStoppable
13144
13143
  ? {
@@ -14716,6 +14715,9 @@ const createCustomDeployJobs = async (context) => {
14716
14715
  deploy: {
14717
14716
  image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
14718
14717
  cache: (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, deployConfig),
14718
+ artifacts: deployConfig.artifactsPaths
14719
+ ? { paths: deployConfig.artifactsPaths }
14720
+ : undefined,
14719
14721
  script: [
14720
14722
  `cd ${context.build.dir}`,
14721
14723
  ...(deployConfig.requiresYarnInstall ? yarnInstall : []),
@@ -14836,9 +14838,11 @@ const custom_1 = __nccwpck_require__(36394);
14836
14838
  const dockerTag_1 = __nccwpck_require__(59231);
14837
14839
  const kubernetes_1 = __nccwpck_require__(94469);
14838
14840
  const npmPackage_1 = __nccwpck_require__(79462);
14841
+ const pages_1 = __nccwpck_require__(66387);
14839
14842
  __exportStar(__nccwpck_require__(2691), exports);
14840
14843
  __exportStar(__nccwpck_require__(94469), exports);
14841
14844
  __exportStar(__nccwpck_require__(79462), exports);
14845
+ __exportStar(__nccwpck_require__(66387), exports);
14842
14846
  __exportStar(__nccwpck_require__(71446), exports);
14843
14847
  __exportStar(__nccwpck_require__(3537), exports);
14844
14848
  exports.DEPLOY_TYPES = {
@@ -14847,6 +14851,7 @@ exports.DEPLOY_TYPES = {
14847
14851
  dockerTag: dockerTag_1.DOCKER_TAG_DEPLOY_TYPE,
14848
14852
  "google-cloudrun": cloudRun_1.GCLOUD_RUN_DEPLOY_TYPE,
14849
14853
  npmPackage: npmPackage_1.NPM_PACKAGE_DEPLOY_TYPE,
14854
+ pages: pages_1.PAGES_DEPLOY_TYPE,
14850
14855
  };
14851
14856
  //# sourceMappingURL=index.js.map
14852
14857
 
@@ -15380,10 +15385,91 @@ exports.NPM_PACKAGE_DEPLOY_TYPE = {
15380
15385
  jobs: deployJob_1.createNpmPackageDeployJobs,
15381
15386
  defaults: () => ({}),
15382
15387
  additionalSecretKeys: (ctx) =>
15383
- // publish credentials don't exist for the local env
15384
- ctx.envType !== "local"
15385
- ? [{ key: exports.NPM_TOKEN_SECRET_KEY, hidden: true }]
15386
- : [],
15388
+ // publish credentials don't exist for the local env. Not hidden:
15389
+ // the user sets the token via `catladder project secrets-set`
15390
+ // (hidden is for machine-provisioned credentials)
15391
+ ctx.envType !== "local" ? [{ key: exports.NPM_TOKEN_SECRET_KEY }] : [],
15392
+ getAdditionalEnvVars: () => ({}),
15393
+ };
15394
+ //# sourceMappingURL=index.js.map
15395
+
15396
+ /***/ }),
15397
+
15398
+ /***/ 56173:
15399
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
15400
+
15401
+ "use strict";
15402
+
15403
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15404
+ exports.createPagesDeployJobs = void 0;
15405
+ const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
15406
+ const yarn_1 = __nccwpck_require__(59874);
15407
+ const runner_1 = __nccwpck_require__(71065);
15408
+ const base_1 = __nccwpck_require__(93664);
15409
+ const types_1 = __nccwpck_require__(71446);
15410
+ const createPagesDeployJobs = async (context) => {
15411
+ var _a, _b, _c;
15412
+ const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
15413
+ if (!(0, types_1.isOfDeployType)(deployConfig, "pages")) {
15414
+ // should not happen
15415
+ throw new Error("deploy config is not pages");
15416
+ }
15417
+ if (context.pipelineType === "github") {
15418
+ // don't fail the whole github generation of a multi-backend project
15419
+ console.warn(`component "${context.name}": the pages deploy type is not yet supported on the github backend — no deploy jobs generated`);
15420
+ return [];
15421
+ }
15422
+ // review environments publish under their own path prefix (gitlab
15423
+ // parallel deployments) — every merge request gets a site preview
15424
+ const pathPrefix = context.environment.envType === "review" ? "mr-$CI_MERGE_REQUEST_IID" : "";
15425
+ const publishDir = (_b = deployConfig.publishDir) !== null && _b !== void 0 ? _b : "public";
15426
+ const yarnInstall = await (0, yarn_1.getYarnInstall)(context, {
15427
+ noCustomPostInstall: true,
15428
+ });
15429
+ return (0, base_1.createDeployementJobs)(context, {
15430
+ deploy: {
15431
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
15432
+ cache: (0, getAllCacheConfigsFromConfig_1.getAllCacheConfigsFromConfig)(context, deployConfig),
15433
+ artifacts: { paths: [publishDir] },
15434
+ pages: { path_prefix: pathPrefix },
15435
+ script: [
15436
+ `cd ${context.build.dir}`,
15437
+ ...(deployConfig.requiresYarnInstall ? yarnInstall : []),
15438
+ ...deployConfig.script,
15439
+ // the gitlab environment url should point at the published site
15440
+ // (the base deploy job reports $ROOT_URL as environment url)
15441
+ `export ROOT_URL="$CI_PAGES_URL${pathPrefix ? `/${pathPrefix}` : ""}"`,
15442
+ ],
15443
+ variables: {},
15444
+ runnerVariables: {
15445
+ // exposed so build scripts can adjust e.g. their base url
15446
+ PAGES_PREFIX: pathPrefix,
15447
+ // a pages deploy runs a full site build — the generic deploy-job
15448
+ // resources (200Mi/400Mi) OOM on any real yarn install + build
15449
+ KUBERNETES_MEMORY_REQUEST: "1Gi",
15450
+ KUBERNETES_MEMORY_LIMIT: "4Gi",
15451
+ },
15452
+ },
15453
+ });
15454
+ };
15455
+ exports.createPagesDeployJobs = createPagesDeployJobs;
15456
+ //# sourceMappingURL=deployJob.js.map
15457
+
15458
+ /***/ }),
15459
+
15460
+ /***/ 66387:
15461
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
15462
+
15463
+ "use strict";
15464
+
15465
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15466
+ exports.PAGES_DEPLOY_TYPE = void 0;
15467
+ const deployJob_1 = __nccwpck_require__(56173);
15468
+ exports.PAGES_DEPLOY_TYPE = {
15469
+ jobs: deployJob_1.createPagesDeployJobs,
15470
+ // a broken site publish should not block the rest of the pipeline
15471
+ defaults: () => ({ allowFailure: true }),
15472
+ additionalSecretKeys: () => [],
15387
15473
  getAdditionalEnvVars: () => ({}),
15388
15474
  };
15389
15475
  //# sourceMappingURL=index.js.map
@@ -15462,6 +15548,7 @@ __exportStar(__nccwpck_require__(72025), exports);
15462
15548
  __exportStar(__nccwpck_require__(12152), exports);
15463
15549
  __exportStar(__nccwpck_require__(8030), exports);
15464
15550
  __exportStar(__nccwpck_require__(14571), exports);
15551
+ __exportStar(__nccwpck_require__(88510), exports);
15465
15552
  const isOfDeployType = (t, ...types) => {
15466
15553
  return t && types.includes(t.type) ? true : false;
15467
15554
  };
@@ -15496,6 +15583,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
15496
15583
 
15497
15584
  /***/ }),
15498
15585
 
15586
+ /***/ 88510:
15587
+ /***/ ((__unused_webpack_module, exports) => {
15588
+
15589
+ "use strict";
15590
+
15591
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15592
+ //# sourceMappingURL=pages.js.map
15593
+
15594
+ /***/ }),
15595
+
15499
15596
  /***/ 3537:
15500
15597
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
15501
15598
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: catladder-deploys
3
- description: Configuring how a component is deployed in a catladder project — the `deploy` config in catladder.ts (deploy types kubernetes / google-cloudrun / npmPackage / dockerTag / custom, manual vs auto deploy, resources, autoscaling, health checks, CloudSQL/MongoDB, Cloud Run services/jobs/worker pools, cron jobs). Use when adding or changing a component's deploy, choosing a deploy target, setting resources/replicas/autoscaling, wiring a database, adding cron/scheduled jobs, publishing a component as an npm package, or making a deploy manual. Triggers on "deploy config", "deploy type", "kubernetes", "cloud run", "cloudrun", "autoscale", "resources", "replicas", "cloudsql", "mongodb", "cronjob", "manual deploy", "npm package", "npm publish", "publish to npm".
3
+ description: Configuring how a component is deployed in a catladder project — the `deploy` config in catladder.ts (deploy types kubernetes / google-cloudrun / npmPackage / pages / dockerTag / custom, manual vs auto deploy, resources, autoscaling, health checks, CloudSQL/MongoDB, Cloud Run services/jobs/worker pools, cron jobs). Use when adding or changing a component's deploy, choosing a deploy target, setting resources/replicas/autoscaling, wiring a database, adding cron/scheduled jobs, publishing a component as an npm package, publishing a site on gitlab pages, or making a deploy manual. Triggers on "deploy config", "deploy type", "kubernetes", "cloud run", "cloudrun", "autoscale", "resources", "replicas", "cloudsql", "mongodb", "cronjob", "manual deploy", "npm package", "npm publish", "publish to npm", "gitlab pages", "static site", "docs site", "site preview".
4
4
  ---
5
5
 
6
6
  # Component deploys with catladder
@@ -18,7 +18,7 @@ components: {
18
18
  dir: "backend",
19
19
  build: { /* see catladder-builds */ },
20
20
  deploy: {
21
- type: "kubernetes", // kubernetes | google-cloudrun | npmPackage | dockerTag | custom
21
+ type: "kubernetes", // kubernetes | google-cloudrun | npmPackage | pages | dockerTag | custom
22
22
  cluster: { type: "gcloud", name: "…", projectId: "…", region: "…" },
23
23
  values: { application: { replicas: 2 } },
24
24
  },
@@ -33,6 +33,7 @@ components: {
33
33
  | `kubernetes` | a GKE cluster via Helm | `cluster` |
34
34
  | `google-cloudrun` | Google Cloud Run | `projectId`, `region` |
35
35
  | `npmPackage` | publishes the component to an npm registry | nothing — see below |
36
+ | `pages` | publishes a static site on gitlab pages | `script` — see below |
36
37
  | `dockerTag` | tags an image (no runtime) | `tag` — rarely used, not generally recommended |
37
38
  | `custom` | your own script | `requiresDocker`, `script` |
38
39
 
@@ -103,6 +104,34 @@ catladder secret, see `catladder-secrets`). Disable the stage
103
104
  environment as shown — a tagged release then publishes `latest`
104
105
  directly from the auto-deploying prod env.
105
106
 
107
+ ## GitLab pages sites
108
+
109
+ `type: "pages"` publishes a static site (docs, storybook, coverage
110
+ report) on gitlab pages: the deploy job runs your build `script` and
111
+ publishes `publishDir` (default `"public"`). Review environments
112
+ automatically publish under an `mr-<iid>` path prefix — every merge
113
+ request gets its own site preview (the prefix is exposed to the build
114
+ as `$PAGES_PREFIX`). The gitlab environment url points at the
115
+ published site. GitLab-only for now.
116
+
117
+ ```ts
118
+ docs: {
119
+ dir: "docs",
120
+ env: { stage: false, prod: false }, // pages exist on main + MRs
121
+ build: false,
122
+ deploy: {
123
+ type: "pages",
124
+ requiresYarnInstall: true,
125
+ script: ["yarn workspace docs build"],
126
+ },
127
+ },
128
+ ```
129
+
130
+ Pages deploys default to `allowFailure: true` (a broken site publish
131
+ should not block the pipeline). `allowFailure` is also available on
132
+ every other deploy type, and custom deploys can now declare
133
+ `artifactsPaths` for output they produce.
134
+
106
135
  ## Full option reference
107
136
 
108
137
  See [references/deploy-types.md](references/deploy-types.md) for every
@@ -56,6 +56,16 @@ resources with `yarn catladder project setup`; detect drift with
56
56
  - Version/dist-tag derivation: tagged release (`prod`) → tag version under `latest`; branch/MR → `0.0.0-<branch-slug>-<sha>` under `canary` (branches `next`/`beta` publish under their own dist-tag).
57
57
  - Requires the `NPM_TOKEN` secret (managed like any catladder secret). Disable staging on the component (`env: { stage: false }`) so tagged releases publish directly.
58
58
 
59
+ ## `pages`
60
+
61
+ - `type: "pages"` — **required**. Publishes a static site on gitlab pages (not yet supported on the github backend).
62
+ - `script: string[]` — **required**; produces the site.
63
+ - `publishDir?: string` — output directory relative to the repo root, default `"public"`.
64
+ - `requiresYarnInstall?: boolean` — run `yarn install` first.
65
+ - `jobImage?: GitlabJobImage`; also accepts `cache`.
66
+ - Review envs publish under an `mr-<iid>` path prefix (parallel deployments → MR previews; exposed as `$PAGES_PREFIX`); other envs publish at the root. The environment url is the published pages url.
67
+ - Defaults to `allowFailure: true`.
68
+
59
69
  ## `dockerTag`
60
70
 
61
71
  - `type: "dockerTag"`, `tag: string` — **required**. Adds a custom tag on the image repo to deploy it. Only used in one project historically; not generally recommended (runtime env vars must be coordinated manually).