@catladder/cli 0.0.0-next-d71e41ba → 0.0.0-next-b3e567e8
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.
- package/dist/apps/cli/src/scripts/generateCliSkillReference.js +3 -2
- package/dist/apps/cli/src/scripts/generateCliSkillReference.js.map +1 -1
- package/dist/bundles/catenv/index.js +546 -205
- package/dist/bundles/cli/index.js +546 -205
- package/dist/bundles/runner-images/docker-build/scripts/ensureNodeDockerfile +8 -1
- package/dist/bundles/runner-images/jobs-default/Dockerfile +4 -0
- package/dist/bundles/skills/catladder-builds/SKILL.md +19 -3
- package/dist/bundles/skills/catladder-builds/references/build-types.md +6 -4
- package/dist/bundles/skills/catladder-cli/references/commands.md +3 -2
- package/dist/bundles/skills/catladder-config/SKILL.md +5 -0
- package/dist/bundles/skills/catladder-deploys/SKILL.md +1 -1
- package/dist/bundles/skills/catladder-deploys/references/deploy-types.md +2 -2
- package/dist/bundles/skills/catladder-pipelines/SKILL.md +3 -1
- package/dist/packages/pipeline/src/build/base/createAppBuildJob.js +2 -2
- package/dist/packages/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
- package/dist/packages/pipeline/src/build/index.d.ts +3 -3
- package/dist/packages/pipeline/src/build/index.js +16 -11
- package/dist/packages/pipeline/src/build/index.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/buildJob.js +49 -8
- package/dist/packages/pipeline/src/build/node/buildJob.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/cache.d.ts +5 -0
- package/dist/packages/pipeline/src/build/node/cache.js +58 -19
- package/dist/packages/pipeline/src/build/node/cache.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/meteor.js +9 -4
- package/dist/packages/pipeline/src/build/node/meteor.js.map +1 -1
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.d.ts +14 -0
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js +145 -0
- package/dist/packages/pipeline/src/build/node/packageManagerInstall.js.map +1 -0
- package/dist/packages/pipeline/src/build/node/testJob.js +9 -11
- package/dist/packages/pipeline/src/build/node/testJob.js.map +1 -1
- package/dist/packages/pipeline/src/context/createComponentContext.js +3 -2
- package/dist/packages/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/packages/pipeline/src/context/createWorkspaceContext.js +3 -2
- package/dist/packages/pipeline/src/context/createWorkspaceContext.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/custom/deployJob.js +7 -6
- package/dist/packages/pipeline/src/deploy/custom/deployJob.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/pages/deployJob.js +6 -4
- package/dist/packages/pipeline/src/deploy/pages/deployJob.js.map +1 -1
- package/dist/packages/pipeline/src/deploy/types/custom.d.ts +7 -1
- package/dist/packages/pipeline/src/deploy/types/pages.d.ts +7 -1
- package/dist/packages/pipeline/src/pipeline/detectPackageManager.d.ts +18 -0
- package/dist/packages/pipeline/src/pipeline/detectPackageManager.js +76 -0
- package/dist/packages/pipeline/src/pipeline/detectPackageManager.js.map +1 -0
- package/dist/packages/pipeline/src/pipeline/packageManager.d.ts +1 -1
- package/dist/packages/pipeline/src/pipeline/packageManager.js +43 -9
- package/dist/packages/pipeline/src/pipeline/packageManager.js.map +1 -1
- package/dist/packages/pipeline/src/pipeline/pnpm/pnpmUtils.d.ts +14 -0
- package/dist/packages/pipeline/src/pipeline/pnpm/pnpmUtils.js +93 -0
- package/dist/packages/pipeline/src/pipeline/pnpm/pnpmUtils.js.map +1 -0
- package/dist/packages/pipeline/src/types/config.d.ts +8 -1
- package/dist/packages/pipeline/src/types/context.d.ts +11 -3
- package/dist/packages/pipeline/src/types/context.js.map +1 -1
- package/dist/packages/pipeline/src/verify/createVerifyJobs.js +5 -5
- package/dist/packages/pipeline/src/verify/createVerifyJobs.js.map +1 -1
- package/dist/runner-images/docker-build/scripts/ensureNodeDockerfile +8 -1
- package/dist/runner-images/jobs-default/Dockerfile +4 -0
- package/dist/skills/catladder-builds/SKILL.md +19 -3
- package/dist/skills/catladder-builds/references/build-types.md +6 -4
- package/dist/skills/catladder-cli/references/commands.md +3 -2
- package/dist/skills/catladder-config/SKILL.md +5 -0
- package/dist/skills/catladder-deploys/SKILL.md +1 -1
- package/dist/skills/catladder-deploys/references/deploy-types.md +2 -2
- package/dist/skills/catladder-pipelines/SKILL.md +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/scripts/generateCliSkillReference.ts +3 -2
- package/dist/packages/pipeline/src/build/node/yarn.d.ts +0 -8
- package/dist/packages/pipeline/src/build/node/yarn.js +0 -78
- package/dist/packages/pipeline/src/build/node/yarn.js.map +0 -1
|
@@ -4428,7 +4428,7 @@ const jobs_1 = __nccwpck_require__(28006);
|
|
|
4428
4428
|
const utils_1 = __nccwpck_require__(24516);
|
|
4429
4429
|
const removeUndefined_1 = __nccwpck_require__(54420);
|
|
4430
4430
|
const createBuildJobArtifact_1 = __nccwpck_require__(98820);
|
|
4431
|
-
const
|
|
4431
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
4432
4432
|
const constants_1 = __nccwpck_require__(69302);
|
|
4433
4433
|
const writeBuildInfo_1 = __nccwpck_require__(92254);
|
|
4434
4434
|
const writeDotEnv_1 = __nccwpck_require__(76670);
|
|
@@ -4468,7 +4468,7 @@ class AppBuildJob extends jobs_1.CatladderJob {
|
|
|
4468
4468
|
.flatMap((c) => (0, writeDotEnv_1.writeDotEnv)(c))
|
|
4469
4469
|
: []),
|
|
4470
4470
|
...(context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : []),
|
|
4471
|
-
...(0,
|
|
4471
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context), // in pure node repos, we might want to have the nvmrc file in top-level
|
|
4472
4472
|
`cd ${context.build.dir}`,
|
|
4473
4473
|
...(0, utils_1.ensureArray)(script),
|
|
4474
4474
|
],
|
|
@@ -5165,27 +5165,32 @@ const node_1 = __nccwpck_require__(23114);
|
|
|
5165
5165
|
const rails_1 = __nccwpck_require__(42427);
|
|
5166
5166
|
__exportStar(__nccwpck_require__(23114), exports);
|
|
5167
5167
|
__exportStar(__nccwpck_require__(40632), exports);
|
|
5168
|
+
/**
|
|
5169
|
+
* run a package.json script with the project's package manager
|
|
5170
|
+
* (`yarn build` / `pnpm build`)
|
|
5171
|
+
*/
|
|
5172
|
+
const runScript = (packageManager, script) => `${packageManager} ${script}`;
|
|
5168
5173
|
exports.BUILD_TYPES = {
|
|
5169
5174
|
node: {
|
|
5170
5175
|
jobs: node_1.createNodeJobs,
|
|
5171
|
-
defaults: () => ({
|
|
5172
|
-
buildCommand: "
|
|
5173
|
-
startCommand: "
|
|
5176
|
+
defaults: (_, pm) => ({
|
|
5177
|
+
buildCommand: runScript(pm, "build"),
|
|
5178
|
+
startCommand: runScript(pm, "start"),
|
|
5174
5179
|
artifactsPaths: ["dist", ".next"],
|
|
5175
5180
|
artifactsExcludePaths: [".next/cache/**/*"],
|
|
5176
5181
|
}),
|
|
5177
5182
|
},
|
|
5178
5183
|
"node-static": {
|
|
5179
5184
|
jobs: node_1.createNodeJobs,
|
|
5180
|
-
defaults: () => ({
|
|
5181
|
-
buildCommand: "
|
|
5185
|
+
defaults: (_, pm) => ({
|
|
5186
|
+
buildCommand: runScript(pm, "build"),
|
|
5182
5187
|
artifactsPaths: ["dist"],
|
|
5183
5188
|
}),
|
|
5184
5189
|
},
|
|
5185
5190
|
storybook: {
|
|
5186
5191
|
jobs: node_1.createStorybookJobs,
|
|
5187
|
-
defaults: () => ({
|
|
5188
|
-
buildCommand: ["
|
|
5192
|
+
defaults: (_, pm) => ({
|
|
5193
|
+
buildCommand: [runScript(pm, "build-storybook --quiet -o ./dist")],
|
|
5189
5194
|
artifactsPaths: ["dist"],
|
|
5190
5195
|
}),
|
|
5191
5196
|
},
|
|
@@ -5215,13 +5220,13 @@ exports.BUILD_TYPES = {
|
|
|
5215
5220
|
exports.WORKSPACE_BUILD_TYPES = {
|
|
5216
5221
|
node: {
|
|
5217
5222
|
jobs: node_1.createNodeJobs,
|
|
5218
|
-
defaults: () => ({
|
|
5219
|
-
buildCommand: "
|
|
5223
|
+
defaults: (pm) => ({
|
|
5224
|
+
buildCommand: runScript(pm, "build"),
|
|
5220
5225
|
lint: {
|
|
5221
|
-
command: "
|
|
5226
|
+
command: runScript(pm, "lint"),
|
|
5222
5227
|
},
|
|
5223
5228
|
test: {
|
|
5224
|
-
command: "
|
|
5229
|
+
command: runScript(pm, "test"),
|
|
5225
5230
|
},
|
|
5226
5231
|
}),
|
|
5227
5232
|
},
|
|
@@ -5242,7 +5247,7 @@ const base_1 = __nccwpck_require__(61619);
|
|
|
5242
5247
|
const createBuildJobDefinition_1 = __nccwpck_require__(88685);
|
|
5243
5248
|
const docker_1 = __nccwpck_require__(83777);
|
|
5244
5249
|
const cache_1 = __nccwpck_require__(21100);
|
|
5245
|
-
const
|
|
5250
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
5246
5251
|
const createNodeBuildJobs = async (context) => {
|
|
5247
5252
|
if (context.type === "workspace") {
|
|
5248
5253
|
return (0, base_1.createWorkspaceBuildJobs)(context, {
|
|
@@ -5259,18 +5264,17 @@ const createNodeBuildJobs = async (context) => {
|
|
|
5259
5264
|
exports.createNodeBuildJobs = createNodeBuildJobs;
|
|
5260
5265
|
const createNodeBuildJobDefinition = async (context) => {
|
|
5261
5266
|
const buildConfig = context.build.config;
|
|
5262
|
-
const [
|
|
5263
|
-
(0,
|
|
5267
|
+
const [packageManagerInstall, nodeCache] = await Promise.all([
|
|
5268
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
5264
5269
|
(0, cache_1.getNodeCache)(context),
|
|
5265
5270
|
]);
|
|
5266
5271
|
return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
|
|
5267
|
-
prescript:
|
|
5272
|
+
prescript: packageManagerInstall,
|
|
5268
5273
|
cache: nodeCache,
|
|
5269
5274
|
});
|
|
5270
5275
|
};
|
|
5271
5276
|
exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
|
|
5272
5277
|
const createNodeDockerJobDefinition = async (context) => {
|
|
5273
|
-
var _a;
|
|
5274
5278
|
// get the default docker built-in type based on the build type
|
|
5275
5279
|
const dockerDefaultBuiltIn = context.build.buildType === "node-static" ||
|
|
5276
5280
|
context.build.buildType === "storybook"
|
|
@@ -5278,16 +5282,58 @@ const createNodeDockerJobDefinition = async (context) => {
|
|
|
5278
5282
|
: "node";
|
|
5279
5283
|
const [yarnCache, dockerAppCopyAndBuildScript, packageManagerInfo] = await Promise.all([
|
|
5280
5284
|
(0, cache_1.getYarnCache)(context, "pull"),
|
|
5281
|
-
(0,
|
|
5285
|
+
(0, packageManagerInstall_1.getDockerAppCopyAndBuildScript)(context),
|
|
5282
5286
|
context.packageManagerInfo,
|
|
5283
5287
|
]);
|
|
5288
|
+
// the pnpm store (pulled via the cache above) is copied into the
|
|
5289
|
+
// image so the prod install works offline — like the yarn zip cache,
|
|
5290
|
+
// which travels inside the copied `.yarn` config folder
|
|
5291
|
+
const copyPnpmStore = packageManagerInfo.type === "pnpm" &&
|
|
5292
|
+
packageManagerInfo.componentIsInWorkspace;
|
|
5293
|
+
// pnpm copies every workspace manifest into the image — as individual
|
|
5294
|
+
// COPY instructions that many layers exceed docker's depth limit, so
|
|
5295
|
+
// the job tars them up and a single ADD extracts them
|
|
5296
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
5297
|
+
const WORKSPACE_FILES_TAR = ".catladder-workspace-files.tar";
|
|
5284
5298
|
return {
|
|
5285
|
-
script:
|
|
5299
|
+
script: [
|
|
5300
|
+
// the COPY source must exist even when the cache was cold
|
|
5301
|
+
...(copyPnpmStore ? ["mkdir -p .pnpm-store"] : []),
|
|
5302
|
+
...(isPnpm
|
|
5303
|
+
? [
|
|
5304
|
+
`tar -cf ${WORKSPACE_FILES_TAR} ${packageManagerInfo.pathsToCopyInDocker.join(" ")}`,
|
|
5305
|
+
]
|
|
5306
|
+
: []),
|
|
5307
|
+
...(0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
|
|
5308
|
+
],
|
|
5286
5309
|
cache: [...yarnCache],
|
|
5287
5310
|
variables: {
|
|
5288
5311
|
// only required for non static
|
|
5289
5312
|
DOCKER_COPY_AND_INSTALL_APP: dockerAppCopyAndBuildScript,
|
|
5290
|
-
DOCKER_COPY_WORKSPACE_FILES:
|
|
5313
|
+
DOCKER_COPY_WORKSPACE_FILES: isPnpm
|
|
5314
|
+
? [
|
|
5315
|
+
`ADD ${WORKSPACE_FILES_TAR} /app/`,
|
|
5316
|
+
// ADD does not apply --chown to extracted tars, and parent
|
|
5317
|
+
// dirs of the entries come out root-owned — fix ownership
|
|
5318
|
+
// while the stage still runs as root (store not copied yet,
|
|
5319
|
+
// so this only touches the small manifest tree). Custom
|
|
5320
|
+
// base images without a node user run as root and don't
|
|
5321
|
+
// need it, hence the fallback
|
|
5322
|
+
`RUN chown -R node:node /app || true`,
|
|
5323
|
+
...(copyPnpmStore
|
|
5324
|
+
? [`COPY --chown=node:node .pnpm-store /app/.pnpm-store`]
|
|
5325
|
+
: []),
|
|
5326
|
+
].join("\n")
|
|
5327
|
+
: packageManagerInfo.pathsToCopyInDocker
|
|
5328
|
+
.map((dir) => `COPY --chown=node:node ${dir} /app/${dir}`)
|
|
5329
|
+
.join("\n"),
|
|
5330
|
+
// pnpm is not preinstalled in the node base images; installed as
|
|
5331
|
+
// root before the image switches to the node user
|
|
5332
|
+
...(isPnpm
|
|
5333
|
+
? {
|
|
5334
|
+
DOCKER_SETUP_PACKAGE_MANAGER: `RUN npm install -g pnpm@${packageManagerInfo.version}`,
|
|
5335
|
+
}
|
|
5336
|
+
: {}),
|
|
5291
5337
|
},
|
|
5292
5338
|
};
|
|
5293
5339
|
};
|
|
@@ -5306,12 +5352,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5306
5352
|
};
|
|
5307
5353
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5308
5354
|
exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
5355
|
+
const lodash_es_1 = __nccwpck_require__(50866);
|
|
5309
5356
|
const path_1 = __nccwpck_require__(16928);
|
|
5310
5357
|
const slugify_1 = __importDefault(__nccwpck_require__(21396));
|
|
5311
5358
|
/**
|
|
5312
|
-
* stable reference between the two node caches: the
|
|
5313
|
-
* declares itself redundant when the
|
|
5314
|
-
* exact-lockfile hit (github skips the
|
|
5359
|
+
* stable reference between the two node caches: the package-manager
|
|
5360
|
+
* (yarn zip / pnpm store) cache declares itself redundant when the
|
|
5361
|
+
* node_modules cache scored an exact-lockfile hit (github skips the
|
|
5362
|
+
* ~0.6GB download on warm runs)
|
|
5315
5363
|
*/
|
|
5316
5364
|
const NODE_MODULES_CACHE_ID = "node-modules";
|
|
5317
5365
|
/**
|
|
@@ -5338,23 +5386,37 @@ const getCacheBaseDir = async (context) => {
|
|
|
5338
5386
|
? ((_a = context.build.workspaceBuildConfig.dir) !== null && _a !== void 0 ? _a : ".")
|
|
5339
5387
|
: ".";
|
|
5340
5388
|
};
|
|
5389
|
+
/**
|
|
5390
|
+
* the package manager's download cache: yarn's `.yarn` zip cache, or
|
|
5391
|
+
* pnpm's content-addressable store (which catladder points at a
|
|
5392
|
+
* project-local `.pnpm-store`, see the install script)
|
|
5393
|
+
*/
|
|
5341
5394
|
const getYarnCache = async (context, policy = "pull-push") => {
|
|
5395
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
5396
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
5342
5397
|
const baseDir = await getCacheBaseDir(context);
|
|
5398
|
+
// pnpm keeps its store in a format-versioned subdir (v10, v11, ...)
|
|
5399
|
+
// and never cleans old ones up — scope the cache slot by major so a
|
|
5400
|
+
// pnpm upgrade starts a fresh slot instead of dragging the dead old
|
|
5401
|
+
// store tree along in every cache transfer (formats change only on
|
|
5402
|
+
// majors)
|
|
5403
|
+
const pnpmStoreKey = `pnpm-v${packageManagerInfo.version.split(".")[0]}`;
|
|
5343
5404
|
return [
|
|
5344
5405
|
{
|
|
5345
5406
|
scope: "buildDir",
|
|
5346
5407
|
pathMode: "relative",
|
|
5347
5408
|
buildDir: baseDir,
|
|
5348
|
-
key: "yarn",
|
|
5409
|
+
key: isPnpm ? pnpmStoreKey : "yarn",
|
|
5349
5410
|
policy,
|
|
5350
|
-
paths: [".yarn"],
|
|
5411
|
+
paths: [isPnpm ? ".pnpm-store" : ".yarn"],
|
|
5351
5412
|
// content-key for immutable-cache backends (github); the lockfile
|
|
5352
5413
|
// decides whether the cached content could have changed
|
|
5353
|
-
keyFiles: ["yarn.lock"],
|
|
5354
|
-
// the
|
|
5355
|
-
//
|
|
5356
|
-
// same lockfile, install verifies
|
|
5357
|
-
//
|
|
5414
|
+
keyFiles: [isPnpm ? "pnpm-lock.yaml" : "yarn.lock"],
|
|
5415
|
+
// the package manager's download cache (~hundreds of MB) is only
|
|
5416
|
+
// read when packages have to be (re)installed. When the
|
|
5417
|
+
// node_modules cache hit for the same lockfile, install verifies
|
|
5418
|
+
// its state file and never touches the store — so github skips
|
|
5419
|
+
// downloading this cache entirely
|
|
5358
5420
|
redundantOnExactHitOf: NODE_MODULES_CACHE_ID,
|
|
5359
5421
|
},
|
|
5360
5422
|
];
|
|
@@ -5363,27 +5425,50 @@ exports.getYarnCache = getYarnCache;
|
|
|
5363
5425
|
const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
5364
5426
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
5365
5427
|
const baseDir = await getCacheBaseDir(context);
|
|
5366
|
-
const {
|
|
5367
|
-
|
|
5428
|
+
const { workspaces } = packageManagerInfo;
|
|
5429
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
5430
|
+
const lockFileName = isPnpm ? "pnpm-lock.yaml" : "yarn.lock";
|
|
5431
|
+
// yarn berry tracks install state in .yarn/install-state.gz (pnpm's
|
|
5432
|
+
// equivalent lives inside node_modules and is covered by the paths)
|
|
5433
|
+
const hasInstallState = packageManagerInfo.type === "yarn" && !packageManagerInfo.isClassic;
|
|
5434
|
+
// We intentionally do not use the contents of the lockfile as a cache key, as 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.
|
|
5368
5435
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
5369
5436
|
return [
|
|
5370
5437
|
{
|
|
5371
5438
|
scope: "global",
|
|
5372
5439
|
pathMode: "absolute",
|
|
5373
5440
|
// 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
|
|
5374
|
-
|
|
5441
|
+
//
|
|
5442
|
+
// pnpm gets its own, lockfile-keyed cache: node_modules layouts
|
|
5443
|
+
// are not compatible between package managers (a migrating
|
|
5444
|
+
// project must not inherit the yarn slot), and unlike yarn, a
|
|
5445
|
+
// pnpm install on top of a node_modules from a different lockfile
|
|
5446
|
+
// leaves orphaned .pnpm dirs behind that break type identity —
|
|
5447
|
+
// so the slot changes whenever the lockfile changes
|
|
5448
|
+
key: isPnpm
|
|
5449
|
+
? {
|
|
5450
|
+
prefix: "pnpm-" + (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
5451
|
+
files: [(0, path_1.join)(baseDir, "pnpm-lock.yaml")],
|
|
5452
|
+
}
|
|
5453
|
+
: (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
5375
5454
|
// content-key for immutable-cache backends (github); the lockfile
|
|
5376
5455
|
// decides whether the cached content could have changed (absolute
|
|
5377
5456
|
// pathMode: resolve the lockfile explicitly)
|
|
5378
|
-
keyFiles: [(0, path_1.join)(baseDir,
|
|
5379
|
-
// referenced by the
|
|
5380
|
-
//
|
|
5457
|
+
keyFiles: [(0, path_1.join)(baseDir, lockFileName)],
|
|
5458
|
+
// referenced by the package-manager cache: an exact hit here makes
|
|
5459
|
+
// it unnecessary (see redundantOnExactHitOf on getYarnCache)
|
|
5381
5460
|
cacheId: NODE_MODULES_CACHE_ID,
|
|
5382
5461
|
policy,
|
|
5383
|
-
paths: [
|
|
5462
|
+
paths: (0, lodash_es_1.uniq)([
|
|
5384
5463
|
(0, path_1.join)(baseDir, "node_modules"),
|
|
5385
|
-
|
|
5386
|
-
|
|
5464
|
+
// pnpm's per-package node_modules are symlink farms worth
|
|
5465
|
+
// keeping warm (yarn hoists into the root, so root-only
|
|
5466
|
+
// matches its historical behavior)
|
|
5467
|
+
...(isPnpm
|
|
5468
|
+
? workspaces.map((w) => (0, path_1.join)(w.location, "node_modules"))
|
|
5469
|
+
: []),
|
|
5470
|
+
...(hasInstallState ? [(0, path_1.join)(baseDir, ".yarn/install-state.gz")] : []),
|
|
5471
|
+
]),
|
|
5387
5472
|
},
|
|
5388
5473
|
];
|
|
5389
5474
|
};
|
|
@@ -5462,7 +5547,7 @@ const base_1 = __nccwpck_require__(61619);
|
|
|
5462
5547
|
const docker_1 = __nccwpck_require__(83777);
|
|
5463
5548
|
const types_1 = __nccwpck_require__(40632);
|
|
5464
5549
|
const cache_1 = __nccwpck_require__(21100);
|
|
5465
|
-
const
|
|
5550
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
5466
5551
|
const getMeteorCache = (context) => [
|
|
5467
5552
|
{
|
|
5468
5553
|
key: "meteor-build-cache",
|
|
@@ -5477,6 +5562,11 @@ const getMeteorCache = (context) => [
|
|
|
5477
5562
|
];
|
|
5478
5563
|
const getMeteorDockerInstallScripts = async (context) => {
|
|
5479
5564
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
5565
|
+
if (packageManagerInfo.type === "pnpm") {
|
|
5566
|
+
// not a meteor limitation — catladder's meteor docker install path
|
|
5567
|
+
// is only implemented for yarn so far
|
|
5568
|
+
throw new Error("the meteor build type is only implemented for yarn in catladder");
|
|
5569
|
+
}
|
|
5480
5570
|
if (packageManagerInfo.isClassic) {
|
|
5481
5571
|
return new bash_1.BashExpression(`
|
|
5482
5572
|
COPY $APP_DIR/package.json $APP_DIR/yarn.lock ./
|
|
@@ -5503,8 +5593,8 @@ const createMeteorBuildJobs = async (context) => {
|
|
|
5503
5593
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
5504
5594
|
throw new Error("deploy config is not meteor");
|
|
5505
5595
|
}
|
|
5506
|
-
const [
|
|
5507
|
-
(0,
|
|
5596
|
+
const [packageManagerInstall, nodeCache, meteorInstallScripts] = await Promise.all([
|
|
5597
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
5508
5598
|
(0, cache_1.getNodeCache)(context),
|
|
5509
5599
|
buildConfig.installScripts
|
|
5510
5600
|
? getMeteorDockerInstallScripts(context)
|
|
@@ -5519,7 +5609,7 @@ const createMeteorBuildJobs = async (context) => {
|
|
|
5519
5609
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
5520
5610
|
},
|
|
5521
5611
|
script: [
|
|
5522
|
-
...
|
|
5612
|
+
...packageManagerInstall,
|
|
5523
5613
|
'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory',
|
|
5524
5614
|
"cp ./__build_info.json ./dist/bundle/programs/server",
|
|
5525
5615
|
],
|
|
@@ -5538,6 +5628,158 @@ exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
|
5538
5628
|
|
|
5539
5629
|
/***/ }),
|
|
5540
5630
|
|
|
5631
|
+
/***/ 18600:
|
|
5632
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5633
|
+
|
|
5634
|
+
"use strict";
|
|
5635
|
+
|
|
5636
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5637
|
+
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = void 0;
|
|
5638
|
+
const bash_1 = __nccwpck_require__(92390);
|
|
5639
|
+
const utils_1 = __nccwpck_require__(24516);
|
|
5640
|
+
const gitlab_1 = __nccwpck_require__(37393);
|
|
5641
|
+
const YARN_INSTALL_CLASSIC = `yarn install --frozen-lockfile`;
|
|
5642
|
+
const YARN_BERRY_PROD_INSTALL = `yarn workspaces focus --production`;
|
|
5643
|
+
// FIXME: check why and when rebuild is needed
|
|
5644
|
+
const YARN_BERRY_PROD_REBUILD = `yarn rebuild`;
|
|
5645
|
+
const getYarnInstallCommand = (packageManagerInfo) => {
|
|
5646
|
+
if (packageManagerInfo.isClassic) {
|
|
5647
|
+
return YARN_INSTALL_CLASSIC;
|
|
5648
|
+
}
|
|
5649
|
+
// inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
|
|
5650
|
+
return `yarn install --immutable --inline-builds`;
|
|
5651
|
+
};
|
|
5652
|
+
const isInWorkspace = (context, packageManagerInfo) => context.type === "workspace" ||
|
|
5653
|
+
("componentIsInWorkspace" in packageManagerInfo &&
|
|
5654
|
+
packageManagerInfo.componentIsInWorkspace);
|
|
5655
|
+
/**
|
|
5656
|
+
* make sure pnpm is available (job images ship it, older/custom images
|
|
5657
|
+
* fall back to corepack or a pinned global install)
|
|
5658
|
+
*/
|
|
5659
|
+
const getEnsurePnpmCommand = (version) => `if ! command -v pnpm &> /dev/null; then corepack enable pnpm 2>/dev/null || npm install -g pnpm@${version}; fi`;
|
|
5660
|
+
/**
|
|
5661
|
+
* pnpm's store is global by default; point it at a project-local
|
|
5662
|
+
* directory so CI can cache it (the pnpm equivalent of the `.yarn`
|
|
5663
|
+
* zip cache). Passed as the --store-dir flag: pnpm 11 stopped reading
|
|
5664
|
+
* the npm_config_store_dir env var (settings only come from
|
|
5665
|
+
* pnpm-workspace.yaml / global config / CLI flags), the flag works on
|
|
5666
|
+
* v10 and v11
|
|
5667
|
+
*/
|
|
5668
|
+
const getPnpmStoreDirExpression = (inWorkspace) => inWorkspace
|
|
5669
|
+
? `"$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.pnpm-store"`
|
|
5670
|
+
: `"$PWD/.pnpm-store"`;
|
|
5671
|
+
const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
5672
|
+
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
5673
|
+
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
5674
|
+
];
|
|
5675
|
+
/**
|
|
5676
|
+
* default `audit` job command per package manager. Exhaustive on the
|
|
5677
|
+
* package-manager type and throws for anything unsupported, so adding a
|
|
5678
|
+
* new package manager surfaces every place that needs a command here.
|
|
5679
|
+
*/
|
|
5680
|
+
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
5681
|
+
switch (packageManagerInfo.type) {
|
|
5682
|
+
case "pnpm":
|
|
5683
|
+
return "pnpm audit --prod --audit-level critical";
|
|
5684
|
+
case "yarn":
|
|
5685
|
+
return packageManagerInfo.isClassic
|
|
5686
|
+
? "yarn audit --level critical"
|
|
5687
|
+
: "yarn npm audit --environment production --severity critical"; // yarn 2+
|
|
5688
|
+
default:
|
|
5689
|
+
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
5690
|
+
}
|
|
5691
|
+
};
|
|
5692
|
+
exports.getDefaultAuditCommand = getDefaultAuditCommand;
|
|
5693
|
+
const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")([
|
|
5694
|
+
// github actions overrides HOME in container jobs, so also look
|
|
5695
|
+
// for nvm where the catladder images install it (/root/.nvm)
|
|
5696
|
+
'if [ -f "$HOME/.nvm/nvm.sh" ]; then source "$HOME/.nvm/nvm.sh"; elif [ -f /root/.nvm/nvm.sh ]; then export NVM_DIR=/root/.nvm; source /root/.nvm/nvm.sh; fi',
|
|
5697
|
+
"if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi",
|
|
5698
|
+
]);
|
|
5699
|
+
exports.ensureNodeVersion = ensureNodeVersion;
|
|
5700
|
+
const getPackageManagerInstall = async (context, options) => {
|
|
5701
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
5702
|
+
const postInstall = context.type !== "workspace" &&
|
|
5703
|
+
context.build.type !== "disabled" &&
|
|
5704
|
+
"postInstall" in context.build.config
|
|
5705
|
+
? context.build.config.postInstall
|
|
5706
|
+
: null;
|
|
5707
|
+
const installSection = packageManagerInfo.type === "pnpm"
|
|
5708
|
+
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(context, packageManagerInfo))
|
|
5709
|
+
: (0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(packageManagerInfo)]);
|
|
5710
|
+
return [
|
|
5711
|
+
...(0, exports.ensureNodeVersion)(context),
|
|
5712
|
+
...installSection,
|
|
5713
|
+
...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
5714
|
+
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
|
|
5715
|
+
: []),
|
|
5716
|
+
];
|
|
5717
|
+
};
|
|
5718
|
+
exports.getPackageManagerInstall = getPackageManagerInstall;
|
|
5719
|
+
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
5720
|
+
const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
5721
|
+
// the store was copied into the image (like the yarn zip cache), so
|
|
5722
|
+
// the prod install links from it instead of hitting the registry
|
|
5723
|
+
const storeDir = packageManagerInfo.componentIsInWorkspace
|
|
5724
|
+
? "/app/.pnpm-store"
|
|
5725
|
+
: "/app/$APP_DIR/.pnpm-store";
|
|
5726
|
+
// in a workspace, only install the component (and its workspace
|
|
5727
|
+
// dependencies) — the pnpm equivalent of `yarn workspaces focus`.
|
|
5728
|
+
// npm package names are shell-safe unquoted (the whole script is
|
|
5729
|
+
// embedded in a double-quoted bash export, so inner quotes would nest)
|
|
5730
|
+
const filter = packageManagerInfo.componentIsInWorkspace &&
|
|
5731
|
+
packageManagerInfo.currentWorkspace
|
|
5732
|
+
? ` --filter ${packageManagerInfo.currentWorkspace.name}...`
|
|
5733
|
+
: "";
|
|
5734
|
+
return new bash_1.BashExpression(`
|
|
5735
|
+
${DOCKER_COPY_FILES}
|
|
5736
|
+
RUN command -v pnpm >/dev/null 2>&1 || npm install -g pnpm@${packageManagerInfo.version}
|
|
5737
|
+
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter}
|
|
5738
|
+
`.trim());
|
|
5739
|
+
};
|
|
5740
|
+
const getDockerAppCopyAndBuildScript = async (context) => {
|
|
5741
|
+
var _a, _b, _c;
|
|
5742
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
5743
|
+
if (packageManagerInfo.type === "pnpm") {
|
|
5744
|
+
return getPnpmDockerAppCopyAndBuildScript(packageManagerInfo);
|
|
5745
|
+
}
|
|
5746
|
+
if (packageManagerInfo.isClassic) {
|
|
5747
|
+
return new bash_1.BashExpression(`
|
|
5748
|
+
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
5749
|
+
${DOCKER_COPY_FILES}
|
|
5750
|
+
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
5751
|
+
`.trim());
|
|
5752
|
+
}
|
|
5753
|
+
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
5754
|
+
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
5755
|
+
: true;
|
|
5756
|
+
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
5757
|
+
context.build.config.docker &&
|
|
5758
|
+
"yarnRebuildEnabled" in context.build.config.docker
|
|
5759
|
+
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
5760
|
+
: yarnRebuildEnabledDefault;
|
|
5761
|
+
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
5762
|
+
// trying to import those fail on this version
|
|
5763
|
+
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => packageManagerInfo.version.startsWith(v));
|
|
5764
|
+
const maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins
|
|
5765
|
+
? "RUN yarn plugin import workspace-tools"
|
|
5766
|
+
: "";
|
|
5767
|
+
// copy first everything and then install
|
|
5768
|
+
// rebuild first does not work as it will run postinstall and that might require files in the app
|
|
5769
|
+
return new bash_1.BashExpression(`
|
|
5770
|
+
ENV YARN_ENABLE_INLINE_BUILDS=1
|
|
5771
|
+
${DOCKER_COPY_FILES}
|
|
5772
|
+
${maybeAddWorkspaceToolsCommand}
|
|
5773
|
+
RUN ${YARN_BERRY_PROD_INSTALL}
|
|
5774
|
+
${yarnRebuildEnabled ? `RUN ${YARN_BERRY_PROD_REBUILD}` : ""}
|
|
5775
|
+
|
|
5776
|
+
`.trim());
|
|
5777
|
+
};
|
|
5778
|
+
exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
5779
|
+
//# sourceMappingURL=packageManagerInstall.js.map
|
|
5780
|
+
|
|
5781
|
+
/***/ }),
|
|
5782
|
+
|
|
5541
5783
|
/***/ 79769:
|
|
5542
5784
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5543
5785
|
|
|
@@ -5552,7 +5794,7 @@ const utils_1 = __nccwpck_require__(24516);
|
|
|
5552
5794
|
const createArtifactsConfig_1 = __nccwpck_require__(24494);
|
|
5553
5795
|
const cache_1 = __nccwpck_require__(21100);
|
|
5554
5796
|
const constants_1 = __nccwpck_require__(97627);
|
|
5555
|
-
const
|
|
5797
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
5556
5798
|
const createNodeTestJobs = async (context) => {
|
|
5557
5799
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
5558
5800
|
// don't run tests after release
|
|
@@ -5579,8 +5821,8 @@ const createNodeTestJobs = async (context) => {
|
|
|
5579
5821
|
needs: [],
|
|
5580
5822
|
};
|
|
5581
5823
|
const buildConfig = context.build.config;
|
|
5582
|
-
const [
|
|
5583
|
-
(0,
|
|
5824
|
+
const [packageManagerInstall, packageManagerInfo, nodeCache] = await Promise.all([
|
|
5825
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
5584
5826
|
context.packageManagerInfo,
|
|
5585
5827
|
// pull-only: the build job is the designated cache writer — lint and
|
|
5586
5828
|
// test produce equivalent content from the same lockfile, so their
|
|
@@ -5596,13 +5838,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
5596
5838
|
...((_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
|
|
5597
5839
|
},
|
|
5598
5840
|
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
5599
|
-
caches: undefined, // audit does not need
|
|
5841
|
+
caches: undefined, // audit does not need an install and no cache
|
|
5600
5842
|
script: [
|
|
5601
5843
|
`cd ${context.build.dir}`,
|
|
5602
5844
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
5603
|
-
packageManagerInfo
|
|
5604
|
-
? "yarn audit --level critical"
|
|
5605
|
-
: "yarn npm audit --environment production --severity critical", // yarn 2
|
|
5845
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
5606
5846
|
]),
|
|
5607
5847
|
],
|
|
5608
5848
|
allow_failure: (_h = (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.allowFailure) !== null && _h !== void 0 ? _h : true,
|
|
@@ -5620,9 +5860,9 @@ const createNodeTestJobs = async (context) => {
|
|
|
5620
5860
|
image: (_p = (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
|
|
5621
5861
|
caches: nodeCache,
|
|
5622
5862
|
script: [
|
|
5623
|
-
...(0,
|
|
5863
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
5624
5864
|
`cd ${context.build.dir}`,
|
|
5625
|
-
...
|
|
5865
|
+
...packageManagerInstall,
|
|
5626
5866
|
...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"]),
|
|
5627
5867
|
],
|
|
5628
5868
|
allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure,
|
|
@@ -5640,9 +5880,9 @@ const createNodeTestJobs = async (context) => {
|
|
|
5640
5880
|
image: (_y = (_x = buildConfig.test) === null || _x === void 0 ? void 0 : _x.jobImage) !== null && _y !== void 0 ? _y : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
5641
5881
|
caches: nodeCache,
|
|
5642
5882
|
script: [
|
|
5643
|
-
...(0,
|
|
5883
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
5644
5884
|
`cd ${context.build.dir}`,
|
|
5645
|
-
...
|
|
5885
|
+
...packageManagerInstall,
|
|
5646
5886
|
...((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"]),
|
|
5647
5887
|
],
|
|
5648
5888
|
allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure,
|
|
@@ -5656,91 +5896,6 @@ exports.createNodeTestJobs = createNodeTestJobs;
|
|
|
5656
5896
|
|
|
5657
5897
|
/***/ }),
|
|
5658
5898
|
|
|
5659
|
-
/***/ 59874:
|
|
5660
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5661
|
-
|
|
5662
|
-
"use strict";
|
|
5663
|
-
|
|
5664
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5665
|
-
exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
|
|
5666
|
-
const bash_1 = __nccwpck_require__(92390);
|
|
5667
|
-
const utils_1 = __nccwpck_require__(24516);
|
|
5668
|
-
const gitlab_1 = __nccwpck_require__(37393);
|
|
5669
|
-
const YARN_INSTALL_CLASSIC = `yarn install --frozen-lockfile`;
|
|
5670
|
-
const YARN_BERRY_PROD_INSTALL = `yarn workspaces focus --production`;
|
|
5671
|
-
// FIXME: check why and when rebuild is needed
|
|
5672
|
-
const YARN_BERRY_PROD_REBUILD = `yarn rebuild`;
|
|
5673
|
-
const getYarnInstallCommand = async (context) => {
|
|
5674
|
-
const packageManagerInfo = await context.packageManagerInfo;
|
|
5675
|
-
if (packageManagerInfo.isClassic) {
|
|
5676
|
-
return YARN_INSTALL_CLASSIC;
|
|
5677
|
-
}
|
|
5678
|
-
// inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
|
|
5679
|
-
return `yarn install --immutable --inline-builds`;
|
|
5680
|
-
};
|
|
5681
|
-
const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")([
|
|
5682
|
-
// github actions overrides HOME in container jobs, so also look
|
|
5683
|
-
// for nvm where the catladder images install it (/root/.nvm)
|
|
5684
|
-
'if [ -f "$HOME/.nvm/nvm.sh" ]; then source "$HOME/.nvm/nvm.sh"; elif [ -f /root/.nvm/nvm.sh ]; then export NVM_DIR=/root/.nvm; source /root/.nvm/nvm.sh; fi',
|
|
5685
|
-
"if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi",
|
|
5686
|
-
]);
|
|
5687
|
-
exports.ensureNodeVersion = ensureNodeVersion;
|
|
5688
|
-
const getYarnInstall = async (context, options) => {
|
|
5689
|
-
const postInstall = context.type !== "workspace" &&
|
|
5690
|
-
context.build.type !== "disabled" &&
|
|
5691
|
-
"postInstall" in context.build.config
|
|
5692
|
-
? context.build.config.postInstall
|
|
5693
|
-
: null;
|
|
5694
|
-
return [
|
|
5695
|
-
...(0, exports.ensureNodeVersion)(context),
|
|
5696
|
-
...(0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([await getYarnInstallCommand(context)]),
|
|
5697
|
-
...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
5698
|
-
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
|
|
5699
|
-
: []),
|
|
5700
|
-
];
|
|
5701
|
-
};
|
|
5702
|
-
exports.getYarnInstall = getYarnInstall;
|
|
5703
|
-
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
5704
|
-
const getDockerAppCopyAndBuildScript = async (context) => {
|
|
5705
|
-
var _a, _b, _c;
|
|
5706
|
-
const packageManagerInfo = await context.packageManagerInfo;
|
|
5707
|
-
if (packageManagerInfo.isClassic) {
|
|
5708
|
-
return new bash_1.BashExpression(`
|
|
5709
|
-
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
5710
|
-
${DOCKER_COPY_FILES}
|
|
5711
|
-
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
5712
|
-
`.trim());
|
|
5713
|
-
}
|
|
5714
|
-
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
5715
|
-
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
5716
|
-
: true;
|
|
5717
|
-
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
5718
|
-
context.build.config.docker &&
|
|
5719
|
-
"yarnRebuildEnabled" in context.build.config.docker
|
|
5720
|
-
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
5721
|
-
: yarnRebuildEnabledDefault;
|
|
5722
|
-
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
5723
|
-
// trying to import those fail on this version
|
|
5724
|
-
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => packageManagerInfo.version.startsWith(v));
|
|
5725
|
-
const maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins
|
|
5726
|
-
? "RUN yarn plugin import workspace-tools"
|
|
5727
|
-
: "";
|
|
5728
|
-
// copy first everything and then install
|
|
5729
|
-
// rebuild first does not work as it will run postinstall and that might require files in the app
|
|
5730
|
-
return new bash_1.BashExpression(`
|
|
5731
|
-
ENV YARN_ENABLE_INLINE_BUILDS=1
|
|
5732
|
-
${DOCKER_COPY_FILES}
|
|
5733
|
-
${maybeAddWorkspaceToolsCommand}
|
|
5734
|
-
RUN ${YARN_BERRY_PROD_INSTALL}
|
|
5735
|
-
${yarnRebuildEnabled ? `RUN ${YARN_BERRY_PROD_REBUILD}` : ""}
|
|
5736
|
-
|
|
5737
|
-
`.trim());
|
|
5738
|
-
};
|
|
5739
|
-
exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
5740
|
-
//# sourceMappingURL=yarn.js.map
|
|
5741
|
-
|
|
5742
|
-
/***/ }),
|
|
5743
|
-
|
|
5744
5899
|
/***/ 50663:
|
|
5745
5900
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5746
5901
|
|
|
@@ -6206,6 +6361,7 @@ const createComponentContext = async (ctx) => {
|
|
|
6206
6361
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
6207
6362
|
}
|
|
6208
6363
|
const packageManagerInfoPromise = (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName);
|
|
6364
|
+
const { type: packageManagerType } = await packageManagerInfoPromise;
|
|
6209
6365
|
const envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
6210
6366
|
const componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
6211
6367
|
const resolvedBuildType = componentConfigWithoutDefaults.build === false
|
|
@@ -6219,12 +6375,12 @@ const createComponentContext = async (ctx) => {
|
|
|
6219
6375
|
const defaults = componentConfigWithoutDefaults.deploy
|
|
6220
6376
|
? {
|
|
6221
6377
|
build: resolvedBuildType &&
|
|
6222
|
-
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
6378
|
+
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext, packageManagerType),
|
|
6223
6379
|
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
|
|
6224
6380
|
}
|
|
6225
6381
|
: {
|
|
6226
6382
|
build: resolvedBuildType &&
|
|
6227
|
-
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
6383
|
+
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext, packageManagerType),
|
|
6228
6384
|
deploy: {},
|
|
6229
6385
|
};
|
|
6230
6386
|
const componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
@@ -6321,7 +6477,8 @@ async function createWorkspaceContext({ env, components, workspaceName, config,
|
|
|
6321
6477
|
if (!workspaceConfigRaw) {
|
|
6322
6478
|
throw new Error(`Workspace ${workspaceName} not found in config`);
|
|
6323
6479
|
}
|
|
6324
|
-
const
|
|
6480
|
+
const packageManagerInfo = (0, packageManager_1.getPackageManagerInfoBase)(config);
|
|
6481
|
+
const defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults((await packageManagerInfo).type);
|
|
6325
6482
|
const workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw);
|
|
6326
6483
|
return {
|
|
6327
6484
|
name: workspaceName,
|
|
@@ -6332,7 +6489,7 @@ async function createWorkspaceContext({ env, components, workspaceName, config,
|
|
|
6332
6489
|
env,
|
|
6333
6490
|
components,
|
|
6334
6491
|
fullConfig: config,
|
|
6335
|
-
packageManagerInfo
|
|
6492
|
+
packageManagerInfo,
|
|
6336
6493
|
build: {
|
|
6337
6494
|
type: "workspace",
|
|
6338
6495
|
dir: (_b = workspaceConfig.dir) !== null && _b !== void 0 ? _b : ".",
|
|
@@ -8806,19 +8963,18 @@ exports.getFullDbName = getFullDbName;
|
|
|
8806
8963
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8807
8964
|
exports.createCustomDeployJobs = void 0;
|
|
8808
8965
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
|
|
8809
|
-
const
|
|
8966
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
8810
8967
|
const runner_1 = __nccwpck_require__(71065);
|
|
8811
8968
|
const base_1 = __nccwpck_require__(93664);
|
|
8812
8969
|
const types_1 = __nccwpck_require__(71446);
|
|
8813
8970
|
const createCustomDeployJobs = async (context) => {
|
|
8814
|
-
var _a, _b, _c;
|
|
8971
|
+
var _a, _b, _c, _d;
|
|
8815
8972
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
8816
8973
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
8817
8974
|
// should not happen
|
|
8818
8975
|
throw new Error("deploy config is not custom");
|
|
8819
8976
|
}
|
|
8820
|
-
|
|
8821
|
-
const yarnInstall = await (0, yarn_1.getYarnInstall)(context, {
|
|
8977
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
8822
8978
|
noCustomPostInstall: true,
|
|
8823
8979
|
});
|
|
8824
8980
|
const result = (0, base_1.createDeployementJobs)(context, {
|
|
@@ -8830,14 +8986,16 @@ const createCustomDeployJobs = async (context) => {
|
|
|
8830
8986
|
: undefined,
|
|
8831
8987
|
script: [
|
|
8832
8988
|
`cd ${context.build.dir}`,
|
|
8833
|
-
...(deployConfig.
|
|
8989
|
+
...(((_c = deployConfig.requiresInstall) !== null && _c !== void 0 ? _c : deployConfig.requiresYarnInstall)
|
|
8990
|
+
? packageManagerInstall
|
|
8991
|
+
: []),
|
|
8834
8992
|
...deployConfig.script,
|
|
8835
8993
|
],
|
|
8836
8994
|
variables: {},
|
|
8837
8995
|
},
|
|
8838
8996
|
stop: deployConfig.stopScript
|
|
8839
8997
|
? {
|
|
8840
|
-
image: (
|
|
8998
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
8841
8999
|
script: [...deployConfig.stopScript],
|
|
8842
9000
|
variables: {},
|
|
8843
9001
|
}
|
|
@@ -9513,12 +9671,12 @@ exports.NPM_PACKAGE_DEPLOY_TYPE = {
|
|
|
9513
9671
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9514
9672
|
exports.createPagesDeployJobs = void 0;
|
|
9515
9673
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
|
|
9516
|
-
const
|
|
9674
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
9517
9675
|
const runner_1 = __nccwpck_require__(71065);
|
|
9518
9676
|
const base_1 = __nccwpck_require__(93664);
|
|
9519
9677
|
const types_1 = __nccwpck_require__(71446);
|
|
9520
9678
|
const createPagesDeployJobs = async (context) => {
|
|
9521
|
-
var _a, _b, _c;
|
|
9679
|
+
var _a, _b, _c, _d;
|
|
9522
9680
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
9523
9681
|
if (!(0, types_1.isOfDeployType)(deployConfig, "pages")) {
|
|
9524
9682
|
// should not happen
|
|
@@ -9533,7 +9691,7 @@ const createPagesDeployJobs = async (context) => {
|
|
|
9533
9691
|
// parallel deployments) — every merge request gets a site preview
|
|
9534
9692
|
const pathPrefix = context.environment.envType === "review" ? "mr-$CI_MERGE_REQUEST_IID" : "";
|
|
9535
9693
|
const publishDir = (_b = deployConfig.publishDir) !== null && _b !== void 0 ? _b : "public";
|
|
9536
|
-
const
|
|
9694
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
9537
9695
|
noCustomPostInstall: true,
|
|
9538
9696
|
});
|
|
9539
9697
|
return (0, base_1.createDeployementJobs)(context, {
|
|
@@ -9544,7 +9702,9 @@ const createPagesDeployJobs = async (context) => {
|
|
|
9544
9702
|
pages: { path_prefix: pathPrefix },
|
|
9545
9703
|
script: [
|
|
9546
9704
|
`cd ${context.build.dir}`,
|
|
9547
|
-
...(deployConfig.
|
|
9705
|
+
...(((_d = deployConfig.requiresInstall) !== null && _d !== void 0 ? _d : deployConfig.requiresYarnInstall)
|
|
9706
|
+
? packageManagerInstall
|
|
9707
|
+
: []),
|
|
9548
9708
|
...deployConfig.script,
|
|
9549
9709
|
// the gitlab environment url should point at the published site
|
|
9550
9710
|
// (the base deploy job reports $ROOT_URL as environment url)
|
|
@@ -10421,6 +10581,89 @@ exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
|
10421
10581
|
|
|
10422
10582
|
/***/ }),
|
|
10423
10583
|
|
|
10584
|
+
/***/ 7633:
|
|
10585
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
10586
|
+
|
|
10587
|
+
"use strict";
|
|
10588
|
+
|
|
10589
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10590
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10591
|
+
};
|
|
10592
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10593
|
+
exports.detectPackageManager = void 0;
|
|
10594
|
+
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
10595
|
+
const fs_1 = __nccwpck_require__(79896);
|
|
10596
|
+
const promises_1 = __nccwpck_require__(91943);
|
|
10597
|
+
const path_1 = __nccwpck_require__(16928);
|
|
10598
|
+
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
10599
|
+
const readPackageManagerField = async (dir) => {
|
|
10600
|
+
try {
|
|
10601
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
|
|
10602
|
+
const match = /^(yarn|pnpm)@(.+)$/.exec(pkg.packageManager);
|
|
10603
|
+
if (!match)
|
|
10604
|
+
return null;
|
|
10605
|
+
return { type: match[1], version: match[2] };
|
|
10606
|
+
}
|
|
10607
|
+
catch (_a) {
|
|
10608
|
+
return null;
|
|
10609
|
+
}
|
|
10610
|
+
};
|
|
10611
|
+
const detectByLockfile = (dir) => {
|
|
10612
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "pnpm-lock.yaml")))
|
|
10613
|
+
return "pnpm";
|
|
10614
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "yarn.lock")))
|
|
10615
|
+
return "yarn";
|
|
10616
|
+
return null;
|
|
10617
|
+
};
|
|
10618
|
+
const getGitRoot = async () => {
|
|
10619
|
+
try {
|
|
10620
|
+
return (await (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")).stdout.trim();
|
|
10621
|
+
}
|
|
10622
|
+
catch (_a) {
|
|
10623
|
+
return null;
|
|
10624
|
+
}
|
|
10625
|
+
};
|
|
10626
|
+
const getInstalledVersion = async (type) => {
|
|
10627
|
+
try {
|
|
10628
|
+
return (await (0, child_process_promise_1.exec)(`${type} --version`)).stdout.trim();
|
|
10629
|
+
}
|
|
10630
|
+
catch (_a) {
|
|
10631
|
+
return "";
|
|
10632
|
+
}
|
|
10633
|
+
};
|
|
10634
|
+
/**
|
|
10635
|
+
* detect which package manager the project uses (and its version).
|
|
10636
|
+
*
|
|
10637
|
+
* Order: the `packageManager` field in package.json (cwd, then git root)
|
|
10638
|
+
* wins, then the lockfile present (pnpm-lock.yaml → pnpm, yarn.lock →
|
|
10639
|
+
* yarn), then falling back to yarn (the historical default).
|
|
10640
|
+
*
|
|
10641
|
+
* An `explicitType` (from `packageManager` in catladder.ts) overrides the
|
|
10642
|
+
* detected type; the version is still taken from the `packageManager`
|
|
10643
|
+
* field when it pins the same manager, otherwise from the installed CLI.
|
|
10644
|
+
*/
|
|
10645
|
+
exports.detectPackageManager = (0, memoizee_1.default)(async (explicitType) => {
|
|
10646
|
+
var _a, _b;
|
|
10647
|
+
const roots = [process.cwd()];
|
|
10648
|
+
const gitRoot = await getGitRoot();
|
|
10649
|
+
if (gitRoot && gitRoot !== process.cwd())
|
|
10650
|
+
roots.push(gitRoot);
|
|
10651
|
+
let fromField = null;
|
|
10652
|
+
for (const root of roots) {
|
|
10653
|
+
fromField = await readPackageManagerField(root);
|
|
10654
|
+
if (fromField)
|
|
10655
|
+
break;
|
|
10656
|
+
}
|
|
10657
|
+
const detectedType = (_b = (_a = explicitType !== null && explicitType !== void 0 ? explicitType : fromField === null || fromField === void 0 ? void 0 : fromField.type) !== null && _a !== void 0 ? _a : roots.map(detectByLockfile).find(Boolean)) !== null && _b !== void 0 ? _b : "yarn";
|
|
10658
|
+
const version = (fromField === null || fromField === void 0 ? void 0 : fromField.type) === detectedType
|
|
10659
|
+
? fromField.version
|
|
10660
|
+
: await getInstalledVersion(detectedType);
|
|
10661
|
+
return { type: detectedType, version };
|
|
10662
|
+
}, { promise: true });
|
|
10663
|
+
//# sourceMappingURL=detectPackageManager.js.map
|
|
10664
|
+
|
|
10665
|
+
/***/ }),
|
|
10666
|
+
|
|
10424
10667
|
/***/ 43249:
|
|
10425
10668
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
10426
10669
|
|
|
@@ -10528,12 +10771,23 @@ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent =
|
|
|
10528
10771
|
const fs_1 = __nccwpck_require__(79896);
|
|
10529
10772
|
const path_1 = __nccwpck_require__(16928);
|
|
10530
10773
|
const path_equal_1 = __nccwpck_require__(43882);
|
|
10774
|
+
const detectPackageManager_1 = __nccwpck_require__(7633);
|
|
10775
|
+
const pnpmUtils_1 = __nccwpck_require__(3497);
|
|
10531
10776
|
const yarnUtils_1 = __nccwpck_require__(94191);
|
|
10532
10777
|
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
10778
|
+
const PACKAGE_MANAGER_FILES = {
|
|
10779
|
+
yarn: {
|
|
10780
|
+
lockFile: "yarn.lock",
|
|
10781
|
+
configFiles: [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"], // ".yarn" is yarn 2 folder
|
|
10782
|
+
},
|
|
10783
|
+
pnpm: {
|
|
10784
|
+
lockFile: "pnpm-lock.yaml",
|
|
10785
|
+
configFiles: ["pnpm-workspace.yaml", ".npmrc", ".pnpmfile.cjs"],
|
|
10786
|
+
},
|
|
10787
|
+
};
|
|
10533
10788
|
const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
10534
|
-
const baseInfo = await (0, exports.getPackageManagerInfoBase)();
|
|
10789
|
+
const baseInfo = await (0, exports.getPackageManagerInfoBase)(config);
|
|
10535
10790
|
const { workspaces } = baseInfo;
|
|
10536
|
-
// currently only supports yarn
|
|
10537
10791
|
const component = config.components[componentName];
|
|
10538
10792
|
const currentWorkspace = workspaces.find((w) => (0, path_equal_1.pathEqual)(component.dir, w.location));
|
|
10539
10793
|
const componentIsInWorkspace = Boolean(currentWorkspace);
|
|
@@ -10542,10 +10796,10 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
10542
10796
|
const workspacePackageJson = componentIsInWorkspace
|
|
10543
10797
|
? (0, path_1.join)(workspaceRoot, "package.json")
|
|
10544
10798
|
: null;
|
|
10799
|
+
const { lockFile: lockFileName, configFiles } = PACKAGE_MANAGER_FILES[baseInfo.type];
|
|
10545
10800
|
const lockFile = componentIsInWorkspace
|
|
10546
|
-
? (0, path_1.join)(workspaceRoot,
|
|
10547
|
-
: (0, path_1.join)(component.dir,
|
|
10548
|
-
const configFiles = [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"]; // ".yarn" is yarn 2 folder
|
|
10801
|
+
? (0, path_1.join)(workspaceRoot, lockFileName)
|
|
10802
|
+
: (0, path_1.join)(component.dir, lockFileName);
|
|
10549
10803
|
// copy all those configFiles from workspace root and/or component folder
|
|
10550
10804
|
const configFilePaths = [
|
|
10551
10805
|
...configFiles,
|
|
@@ -10556,12 +10810,27 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
10556
10810
|
const currentWorkspaceDependencies = currentWorkspace
|
|
10557
10811
|
? (0, yarnUtils_1.getWorkspaceDependencies)(currentWorkspace, workspaces)
|
|
10558
10812
|
: [];
|
|
10813
|
+
// pnpm's --frozen-lockfile check requires every importer of the
|
|
10814
|
+
// lockfile to exist on disk, so all workspace manifests (not just the
|
|
10815
|
+
// dependency workspaces, which are copied entirely) go into the image
|
|
10816
|
+
const allWorkspaceManifests = baseInfo.type === "pnpm" && componentIsInWorkspace
|
|
10817
|
+
? workspaces
|
|
10818
|
+
.map((w) => (0, path_1.join)(w.location, "package.json"))
|
|
10819
|
+
.filter((f) => (0, fs_1.existsSync)(f))
|
|
10820
|
+
: [];
|
|
10821
|
+
// patch files referenced by patchedDependencies must exist in the
|
|
10822
|
+
// image, or pnpm's frozen install fails verifying them
|
|
10823
|
+
const patchFiles = baseInfo.type === "pnpm"
|
|
10824
|
+
? (0, pnpmUtils_1.getPnpmPatchFiles)(componentIsInWorkspace ? workspaceRoot : component.dir)
|
|
10825
|
+
: [];
|
|
10559
10826
|
const pathsToCopyInDocker = [
|
|
10560
10827
|
...new Set([
|
|
10561
10828
|
packageJson,
|
|
10562
10829
|
...(workspacePackageJson ? [workspacePackageJson] : []),
|
|
10563
10830
|
lockFile,
|
|
10564
10831
|
...configFilePaths,
|
|
10832
|
+
...allWorkspaceManifests,
|
|
10833
|
+
...patchFiles,
|
|
10565
10834
|
...currentWorkspaceDependencies,
|
|
10566
10835
|
]),
|
|
10567
10836
|
];
|
|
@@ -10574,11 +10843,17 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
10574
10843
|
};
|
|
10575
10844
|
};
|
|
10576
10845
|
exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
|
|
10577
|
-
const _getPackageManagerInfoBase = async () => {
|
|
10578
|
-
|
|
10579
|
-
const version = await (0, yarnUtils_1.getYarnVersion)();
|
|
10846
|
+
const _getPackageManagerInfoBase = async (config) => {
|
|
10847
|
+
const { type, version } = await (0, detectPackageManager_1.detectPackageManager)(config === null || config === void 0 ? void 0 : config.packageManager);
|
|
10580
10848
|
if (!version)
|
|
10581
|
-
throw new Error(
|
|
10849
|
+
throw new Error(`could not get ${type} version`);
|
|
10850
|
+
if (type === "pnpm") {
|
|
10851
|
+
return {
|
|
10852
|
+
type: "pnpm",
|
|
10853
|
+
workspaces: await (0, pnpmUtils_1.getPnpmWorkspaces)(),
|
|
10854
|
+
version,
|
|
10855
|
+
};
|
|
10856
|
+
}
|
|
10582
10857
|
const isClassic = version.startsWith("1");
|
|
10583
10858
|
const workspaces = await (0, yarnUtils_1.getWorkspaces)(isClassic);
|
|
10584
10859
|
return {
|
|
@@ -10590,11 +10865,113 @@ const _getPackageManagerInfoBase = async () => {
|
|
|
10590
10865
|
};
|
|
10591
10866
|
exports.getPackageManagerInfoBase = (0, memoizee_1.default)(_getPackageManagerInfoBase, {
|
|
10592
10867
|
promise: true,
|
|
10868
|
+
// memoize per explicit packageManager choice, not per config identity
|
|
10869
|
+
normalizer: ([config]) => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.packageManager) !== null && _a !== void 0 ? _a : ""; },
|
|
10593
10870
|
});
|
|
10594
10871
|
//# sourceMappingURL=packageManager.js.map
|
|
10595
10872
|
|
|
10596
10873
|
/***/ }),
|
|
10597
10874
|
|
|
10875
|
+
/***/ 3497:
|
|
10876
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
10877
|
+
|
|
10878
|
+
"use strict";
|
|
10879
|
+
|
|
10880
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10881
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10882
|
+
};
|
|
10883
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10884
|
+
exports.getPnpmWorkspaces = exports.getPnpmPatchFiles = void 0;
|
|
10885
|
+
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
10886
|
+
const fs_1 = __nccwpck_require__(79896);
|
|
10887
|
+
const promises_1 = __nccwpck_require__(91943);
|
|
10888
|
+
const path_1 = __nccwpck_require__(16928);
|
|
10889
|
+
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
10890
|
+
const yaml_1 = __nccwpck_require__(33483);
|
|
10891
|
+
const jsonParse_1 = __nccwpck_require__(99461);
|
|
10892
|
+
const readWorkspaceDependencyLocations = async (location, locationByName) => {
|
|
10893
|
+
var _a, _b, _c;
|
|
10894
|
+
try {
|
|
10895
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(location, "package.json"), "utf-8"));
|
|
10896
|
+
const depNames = [
|
|
10897
|
+
...Object.keys((_a = pkg.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
10898
|
+
...Object.keys((_b = pkg.devDependencies) !== null && _b !== void 0 ? _b : {}),
|
|
10899
|
+
...Object.keys((_c = pkg.optionalDependencies) !== null && _c !== void 0 ? _c : {}),
|
|
10900
|
+
];
|
|
10901
|
+
return [
|
|
10902
|
+
...new Set(depNames
|
|
10903
|
+
.map((name) => locationByName.get(name))
|
|
10904
|
+
.filter((l) => Boolean(l) && l !== location)),
|
|
10905
|
+
];
|
|
10906
|
+
}
|
|
10907
|
+
catch (_d) {
|
|
10908
|
+
return [];
|
|
10909
|
+
}
|
|
10910
|
+
};
|
|
10911
|
+
/**
|
|
10912
|
+
* patch files referenced by `patchedDependencies` (pnpm-workspace.yaml
|
|
10913
|
+
* or the root package.json's `pnpm` section) — they must travel into
|
|
10914
|
+
* the docker build context, or the prod install fails to verify them
|
|
10915
|
+
*/
|
|
10916
|
+
const getPnpmPatchFiles = (root = ".") => {
|
|
10917
|
+
var _a, _b, _c;
|
|
10918
|
+
const patchedDependencies = {};
|
|
10919
|
+
try {
|
|
10920
|
+
const ws = (0, yaml_1.parse)((0, fs_1.readFileSync)((0, path_1.join)(root, "pnpm-workspace.yaml"), "utf-8"));
|
|
10921
|
+
Object.assign(patchedDependencies, (_a = ws === null || ws === void 0 ? void 0 : ws.patchedDependencies) !== null && _a !== void 0 ? _a : {});
|
|
10922
|
+
}
|
|
10923
|
+
catch (_d) {
|
|
10924
|
+
// no workspace file
|
|
10925
|
+
}
|
|
10926
|
+
try {
|
|
10927
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(root, "package.json"), "utf-8"));
|
|
10928
|
+
Object.assign(patchedDependencies, (_c = (_b = pkg === null || pkg === void 0 ? void 0 : pkg.pnpm) === null || _b === void 0 ? void 0 : _b.patchedDependencies) !== null && _c !== void 0 ? _c : {});
|
|
10929
|
+
}
|
|
10930
|
+
catch (_e) {
|
|
10931
|
+
// no package.json
|
|
10932
|
+
}
|
|
10933
|
+
return [
|
|
10934
|
+
...new Set(Object.values(patchedDependencies)
|
|
10935
|
+
.map((p) => (0, path_1.join)(root, p))
|
|
10936
|
+
.filter((p) => (0, fs_1.existsSync)(p))),
|
|
10937
|
+
];
|
|
10938
|
+
};
|
|
10939
|
+
exports.getPnpmPatchFiles = getPnpmPatchFiles;
|
|
10940
|
+
/**
|
|
10941
|
+
* list pnpm workspace projects in the same shape yarn berry reports them
|
|
10942
|
+
* (locations relative to the project root, workspace dependencies as
|
|
10943
|
+
* locations). Outside a pnpm workspace this returns [].
|
|
10944
|
+
*/
|
|
10945
|
+
// export for mocking
|
|
10946
|
+
exports.getPnpmWorkspaces = (0, memoizee_1.default)(async () => {
|
|
10947
|
+
let output;
|
|
10948
|
+
try {
|
|
10949
|
+
output = (await (0, child_process_promise_1.exec)("pnpm m ls --json --depth -1")).stdout;
|
|
10950
|
+
}
|
|
10951
|
+
catch (_a) {
|
|
10952
|
+
return [];
|
|
10953
|
+
}
|
|
10954
|
+
const projects = (0, jsonParse_1.jsonParseOrThrow)(output.trim() || "[]");
|
|
10955
|
+
if (!Array.isArray(projects))
|
|
10956
|
+
return [];
|
|
10957
|
+
const withLocations = projects
|
|
10958
|
+
.filter((p) => p.name && p.path)
|
|
10959
|
+
.map((p) => ({
|
|
10960
|
+
name: p.name,
|
|
10961
|
+
location: (0, path_1.relative)(process.cwd(), p.path) || ".",
|
|
10962
|
+
}));
|
|
10963
|
+
const locationByName = new Map(withLocations.map((p) => [p.name, p.location]));
|
|
10964
|
+
return Promise.all(withLocations.map(async ({ name, location }) => ({
|
|
10965
|
+
name,
|
|
10966
|
+
location,
|
|
10967
|
+
workspaceDependencies: await readWorkspaceDependencyLocations(location, locationByName),
|
|
10968
|
+
mismatchedWorkspaceDependencies: [],
|
|
10969
|
+
})));
|
|
10970
|
+
}, { promise: true });
|
|
10971
|
+
//# sourceMappingURL=pnpmUtils.js.map
|
|
10972
|
+
|
|
10973
|
+
/***/ }),
|
|
10974
|
+
|
|
10598
10975
|
/***/ 77257:
|
|
10599
10976
|
/***/ ((__unused_webpack_module, exports) => {
|
|
10600
10977
|
|
|
@@ -10706,10 +11083,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10706
11083
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10707
11084
|
};
|
|
10708
11085
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
10709
|
-
exports.getWorkspaceDependencies = exports.getWorkspaces =
|
|
11086
|
+
exports.getWorkspaceDependencies = exports.getWorkspaces = void 0;
|
|
10710
11087
|
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
10711
|
-
const promises_1 = __nccwpck_require__(91943);
|
|
10712
|
-
const path_1 = __nccwpck_require__(16928);
|
|
10713
11088
|
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
10714
11089
|
const jsonParse_1 = __nccwpck_require__(99461);
|
|
10715
11090
|
const execOrFail = async (cmd, onFail) => {
|
|
@@ -10720,40 +11095,6 @@ const execOrFail = async (cmd, onFail) => {
|
|
|
10720
11095
|
return onFail !== null && onFail !== void 0 ? onFail : null;
|
|
10721
11096
|
}
|
|
10722
11097
|
};
|
|
10723
|
-
const readPackageManagerVersion = async (dir) => {
|
|
10724
|
-
var _a;
|
|
10725
|
-
try {
|
|
10726
|
-
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
|
|
10727
|
-
const match = /^yarn@(.+)$/.exec(pkg.packageManager);
|
|
10728
|
-
return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
10729
|
-
}
|
|
10730
|
-
catch (_b) {
|
|
10731
|
-
return null;
|
|
10732
|
-
}
|
|
10733
|
-
};
|
|
10734
|
-
const getGitRoot = async () => {
|
|
10735
|
-
try {
|
|
10736
|
-
return (await (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")).stdout.trim();
|
|
10737
|
-
}
|
|
10738
|
-
catch (_a) {
|
|
10739
|
-
return null;
|
|
10740
|
-
}
|
|
10741
|
-
};
|
|
10742
|
-
// export for mocking
|
|
10743
|
-
exports.getYarnVersion = (0, memoizee_1.default)(async () => {
|
|
10744
|
-
// Fast path: read from package.json packageManager field
|
|
10745
|
-
const fromCwd = await readPackageManagerVersion(process.cwd());
|
|
10746
|
-
if (fromCwd)
|
|
10747
|
-
return fromCwd;
|
|
10748
|
-
const gitRoot = await getGitRoot();
|
|
10749
|
-
if (gitRoot && gitRoot !== process.cwd()) {
|
|
10750
|
-
const fromGitRoot = await readPackageManagerVersion(gitRoot);
|
|
10751
|
-
if (fromGitRoot)
|
|
10752
|
-
return fromGitRoot;
|
|
10753
|
-
}
|
|
10754
|
-
// Fallback: invoke yarn CLI
|
|
10755
|
-
return await execOrFail("yarn --version", "");
|
|
10756
|
-
}, { promise: true });
|
|
10757
11098
|
// export for mocking
|
|
10758
11099
|
exports.getWorkspaces = (0, memoizee_1.default)(async (isClassic) => {
|
|
10759
11100
|
var _a, _b;
|
|
@@ -11404,7 +11745,7 @@ exports.createVerifyJobs = exports.VERIFY_JOB_NAME = void 0;
|
|
|
11404
11745
|
const createArtifactsConfig_1 = __nccwpck_require__(24494);
|
|
11405
11746
|
const cache_1 = __nccwpck_require__(21100);
|
|
11406
11747
|
const constants_1 = __nccwpck_require__(97627);
|
|
11407
|
-
const
|
|
11748
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
11408
11749
|
const deploy_1 = __nccwpck_require__(19752);
|
|
11409
11750
|
const runner_1 = __nccwpck_require__(71065);
|
|
11410
11751
|
const utils_1 = __nccwpck_require__(24516);
|
|
@@ -11421,9 +11762,9 @@ const createVerifyJobs = async (context) => {
|
|
|
11421
11762
|
return [];
|
|
11422
11763
|
}
|
|
11423
11764
|
const isNodeBuild = context.build.type !== "disabled" && context.build.buildType === "node";
|
|
11424
|
-
const [
|
|
11765
|
+
const [packageManagerInstall, nodeCache] = isNodeBuild
|
|
11425
11766
|
? await Promise.all([
|
|
11426
|
-
(0,
|
|
11767
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
11427
11768
|
(0, cache_1.getNodeCache)(context, "pull"),
|
|
11428
11769
|
])
|
|
11429
11770
|
: [null, null];
|
|
@@ -11459,9 +11800,9 @@ const createVerifyJobs = async (context) => {
|
|
|
11459
11800
|
},
|
|
11460
11801
|
script: [
|
|
11461
11802
|
...setupScript,
|
|
11462
|
-
...(
|
|
11803
|
+
...(packageManagerInstall ? (0, packageManagerInstall_1.ensureNodeVersion)(context) : []),
|
|
11463
11804
|
`cd ${context.build.dir}`,
|
|
11464
|
-
...(
|
|
11805
|
+
...(packageManagerInstall !== null && packageManagerInstall !== void 0 ? packageManagerInstall : []),
|
|
11465
11806
|
...(0, utils_1.ensureArray)(verifyConfig.command),
|
|
11466
11807
|
],
|
|
11467
11808
|
allow_failure: verifyConfig.allowFailure,
|