@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
|
@@ -10421,7 +10421,7 @@ const jobs_1 = __nccwpck_require__(28006);
|
|
|
10421
10421
|
const utils_1 = __nccwpck_require__(24516);
|
|
10422
10422
|
const removeUndefined_1 = __nccwpck_require__(54420);
|
|
10423
10423
|
const createBuildJobArtifact_1 = __nccwpck_require__(98820);
|
|
10424
|
-
const
|
|
10424
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
10425
10425
|
const constants_1 = __nccwpck_require__(69302);
|
|
10426
10426
|
const writeBuildInfo_1 = __nccwpck_require__(92254);
|
|
10427
10427
|
const writeDotEnv_1 = __nccwpck_require__(76670);
|
|
@@ -10461,7 +10461,7 @@ class AppBuildJob extends jobs_1.CatladderJob {
|
|
|
10461
10461
|
.flatMap((c) => (0, writeDotEnv_1.writeDotEnv)(c))
|
|
10462
10462
|
: []),
|
|
10463
10463
|
...(context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : []),
|
|
10464
|
-
...(0,
|
|
10464
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context), // in pure node repos, we might want to have the nvmrc file in top-level
|
|
10465
10465
|
`cd ${context.build.dir}`,
|
|
10466
10466
|
...(0, utils_1.ensureArray)(script),
|
|
10467
10467
|
],
|
|
@@ -11158,27 +11158,32 @@ const node_1 = __nccwpck_require__(23114);
|
|
|
11158
11158
|
const rails_1 = __nccwpck_require__(42427);
|
|
11159
11159
|
__exportStar(__nccwpck_require__(23114), exports);
|
|
11160
11160
|
__exportStar(__nccwpck_require__(40632), exports);
|
|
11161
|
+
/**
|
|
11162
|
+
* run a package.json script with the project's package manager
|
|
11163
|
+
* (`yarn build` / `pnpm build`)
|
|
11164
|
+
*/
|
|
11165
|
+
const runScript = (packageManager, script) => `${packageManager} ${script}`;
|
|
11161
11166
|
exports.BUILD_TYPES = {
|
|
11162
11167
|
node: {
|
|
11163
11168
|
jobs: node_1.createNodeJobs,
|
|
11164
|
-
defaults: () => ({
|
|
11165
|
-
buildCommand: "
|
|
11166
|
-
startCommand: "
|
|
11169
|
+
defaults: (_, pm) => ({
|
|
11170
|
+
buildCommand: runScript(pm, "build"),
|
|
11171
|
+
startCommand: runScript(pm, "start"),
|
|
11167
11172
|
artifactsPaths: ["dist", ".next"],
|
|
11168
11173
|
artifactsExcludePaths: [".next/cache/**/*"],
|
|
11169
11174
|
}),
|
|
11170
11175
|
},
|
|
11171
11176
|
"node-static": {
|
|
11172
11177
|
jobs: node_1.createNodeJobs,
|
|
11173
|
-
defaults: () => ({
|
|
11174
|
-
buildCommand: "
|
|
11178
|
+
defaults: (_, pm) => ({
|
|
11179
|
+
buildCommand: runScript(pm, "build"),
|
|
11175
11180
|
artifactsPaths: ["dist"],
|
|
11176
11181
|
}),
|
|
11177
11182
|
},
|
|
11178
11183
|
storybook: {
|
|
11179
11184
|
jobs: node_1.createStorybookJobs,
|
|
11180
|
-
defaults: () => ({
|
|
11181
|
-
buildCommand: ["
|
|
11185
|
+
defaults: (_, pm) => ({
|
|
11186
|
+
buildCommand: [runScript(pm, "build-storybook --quiet -o ./dist")],
|
|
11182
11187
|
artifactsPaths: ["dist"],
|
|
11183
11188
|
}),
|
|
11184
11189
|
},
|
|
@@ -11208,13 +11213,13 @@ exports.BUILD_TYPES = {
|
|
|
11208
11213
|
exports.WORKSPACE_BUILD_TYPES = {
|
|
11209
11214
|
node: {
|
|
11210
11215
|
jobs: node_1.createNodeJobs,
|
|
11211
|
-
defaults: () => ({
|
|
11212
|
-
buildCommand: "
|
|
11216
|
+
defaults: (pm) => ({
|
|
11217
|
+
buildCommand: runScript(pm, "build"),
|
|
11213
11218
|
lint: {
|
|
11214
|
-
command: "
|
|
11219
|
+
command: runScript(pm, "lint"),
|
|
11215
11220
|
},
|
|
11216
11221
|
test: {
|
|
11217
|
-
command: "
|
|
11222
|
+
command: runScript(pm, "test"),
|
|
11218
11223
|
},
|
|
11219
11224
|
}),
|
|
11220
11225
|
},
|
|
@@ -11235,7 +11240,7 @@ const base_1 = __nccwpck_require__(61619);
|
|
|
11235
11240
|
const createBuildJobDefinition_1 = __nccwpck_require__(88685);
|
|
11236
11241
|
const docker_1 = __nccwpck_require__(83777);
|
|
11237
11242
|
const cache_1 = __nccwpck_require__(21100);
|
|
11238
|
-
const
|
|
11243
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
11239
11244
|
const createNodeBuildJobs = async (context) => {
|
|
11240
11245
|
if (context.type === "workspace") {
|
|
11241
11246
|
return (0, base_1.createWorkspaceBuildJobs)(context, {
|
|
@@ -11252,18 +11257,17 @@ const createNodeBuildJobs = async (context) => {
|
|
|
11252
11257
|
exports.createNodeBuildJobs = createNodeBuildJobs;
|
|
11253
11258
|
const createNodeBuildJobDefinition = async (context) => {
|
|
11254
11259
|
const buildConfig = context.build.config;
|
|
11255
|
-
const [
|
|
11256
|
-
(0,
|
|
11260
|
+
const [packageManagerInstall, nodeCache] = await Promise.all([
|
|
11261
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
11257
11262
|
(0, cache_1.getNodeCache)(context),
|
|
11258
11263
|
]);
|
|
11259
11264
|
return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
|
|
11260
|
-
prescript:
|
|
11265
|
+
prescript: packageManagerInstall,
|
|
11261
11266
|
cache: nodeCache,
|
|
11262
11267
|
});
|
|
11263
11268
|
};
|
|
11264
11269
|
exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
|
|
11265
11270
|
const createNodeDockerJobDefinition = async (context) => {
|
|
11266
|
-
var _a;
|
|
11267
11271
|
// get the default docker built-in type based on the build type
|
|
11268
11272
|
const dockerDefaultBuiltIn = context.build.buildType === "node-static" ||
|
|
11269
11273
|
context.build.buildType === "storybook"
|
|
@@ -11271,16 +11275,58 @@ const createNodeDockerJobDefinition = async (context) => {
|
|
|
11271
11275
|
: "node";
|
|
11272
11276
|
const [yarnCache, dockerAppCopyAndBuildScript, packageManagerInfo] = await Promise.all([
|
|
11273
11277
|
(0, cache_1.getYarnCache)(context, "pull"),
|
|
11274
|
-
(0,
|
|
11278
|
+
(0, packageManagerInstall_1.getDockerAppCopyAndBuildScript)(context),
|
|
11275
11279
|
context.packageManagerInfo,
|
|
11276
11280
|
]);
|
|
11281
|
+
// the pnpm store (pulled via the cache above) is copied into the
|
|
11282
|
+
// image so the prod install works offline — like the yarn zip cache,
|
|
11283
|
+
// which travels inside the copied `.yarn` config folder
|
|
11284
|
+
const copyPnpmStore = packageManagerInfo.type === "pnpm" &&
|
|
11285
|
+
packageManagerInfo.componentIsInWorkspace;
|
|
11286
|
+
// pnpm copies every workspace manifest into the image — as individual
|
|
11287
|
+
// COPY instructions that many layers exceed docker's depth limit, so
|
|
11288
|
+
// the job tars them up and a single ADD extracts them
|
|
11289
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
11290
|
+
const WORKSPACE_FILES_TAR = ".catladder-workspace-files.tar";
|
|
11277
11291
|
return {
|
|
11278
|
-
script:
|
|
11292
|
+
script: [
|
|
11293
|
+
// the COPY source must exist even when the cache was cold
|
|
11294
|
+
...(copyPnpmStore ? ["mkdir -p .pnpm-store"] : []),
|
|
11295
|
+
...(isPnpm
|
|
11296
|
+
? [
|
|
11297
|
+
`tar -cf ${WORKSPACE_FILES_TAR} ${packageManagerInfo.pathsToCopyInDocker.join(" ")}`,
|
|
11298
|
+
]
|
|
11299
|
+
: []),
|
|
11300
|
+
...(0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
|
|
11301
|
+
],
|
|
11279
11302
|
cache: [...yarnCache],
|
|
11280
11303
|
variables: {
|
|
11281
11304
|
// only required for non static
|
|
11282
11305
|
DOCKER_COPY_AND_INSTALL_APP: dockerAppCopyAndBuildScript,
|
|
11283
|
-
DOCKER_COPY_WORKSPACE_FILES:
|
|
11306
|
+
DOCKER_COPY_WORKSPACE_FILES: isPnpm
|
|
11307
|
+
? [
|
|
11308
|
+
`ADD ${WORKSPACE_FILES_TAR} /app/`,
|
|
11309
|
+
// ADD does not apply --chown to extracted tars, and parent
|
|
11310
|
+
// dirs of the entries come out root-owned — fix ownership
|
|
11311
|
+
// while the stage still runs as root (store not copied yet,
|
|
11312
|
+
// so this only touches the small manifest tree). Custom
|
|
11313
|
+
// base images without a node user run as root and don't
|
|
11314
|
+
// need it, hence the fallback
|
|
11315
|
+
`RUN chown -R node:node /app || true`,
|
|
11316
|
+
...(copyPnpmStore
|
|
11317
|
+
? [`COPY --chown=node:node .pnpm-store /app/.pnpm-store`]
|
|
11318
|
+
: []),
|
|
11319
|
+
].join("\n")
|
|
11320
|
+
: packageManagerInfo.pathsToCopyInDocker
|
|
11321
|
+
.map((dir) => `COPY --chown=node:node ${dir} /app/${dir}`)
|
|
11322
|
+
.join("\n"),
|
|
11323
|
+
// pnpm is not preinstalled in the node base images; installed as
|
|
11324
|
+
// root before the image switches to the node user
|
|
11325
|
+
...(isPnpm
|
|
11326
|
+
? {
|
|
11327
|
+
DOCKER_SETUP_PACKAGE_MANAGER: `RUN npm install -g pnpm@${packageManagerInfo.version}`,
|
|
11328
|
+
}
|
|
11329
|
+
: {}),
|
|
11284
11330
|
},
|
|
11285
11331
|
};
|
|
11286
11332
|
};
|
|
@@ -11299,12 +11345,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
11299
11345
|
};
|
|
11300
11346
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11301
11347
|
exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
11348
|
+
const lodash_es_1 = __nccwpck_require__(50866);
|
|
11302
11349
|
const path_1 = __nccwpck_require__(16928);
|
|
11303
11350
|
const slugify_1 = __importDefault(__nccwpck_require__(21396));
|
|
11304
11351
|
/**
|
|
11305
|
-
* stable reference between the two node caches: the
|
|
11306
|
-
* declares itself redundant when the
|
|
11307
|
-
* exact-lockfile hit (github skips the
|
|
11352
|
+
* stable reference between the two node caches: the package-manager
|
|
11353
|
+
* (yarn zip / pnpm store) cache declares itself redundant when the
|
|
11354
|
+
* node_modules cache scored an exact-lockfile hit (github skips the
|
|
11355
|
+
* ~0.6GB download on warm runs)
|
|
11308
11356
|
*/
|
|
11309
11357
|
const NODE_MODULES_CACHE_ID = "node-modules";
|
|
11310
11358
|
/**
|
|
@@ -11331,23 +11379,37 @@ const getCacheBaseDir = async (context) => {
|
|
|
11331
11379
|
? ((_a = context.build.workspaceBuildConfig.dir) !== null && _a !== void 0 ? _a : ".")
|
|
11332
11380
|
: ".";
|
|
11333
11381
|
};
|
|
11382
|
+
/**
|
|
11383
|
+
* the package manager's download cache: yarn's `.yarn` zip cache, or
|
|
11384
|
+
* pnpm's content-addressable store (which catladder points at a
|
|
11385
|
+
* project-local `.pnpm-store`, see the install script)
|
|
11386
|
+
*/
|
|
11334
11387
|
const getYarnCache = async (context, policy = "pull-push") => {
|
|
11388
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
11389
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
11335
11390
|
const baseDir = await getCacheBaseDir(context);
|
|
11391
|
+
// pnpm keeps its store in a format-versioned subdir (v10, v11, ...)
|
|
11392
|
+
// and never cleans old ones up — scope the cache slot by major so a
|
|
11393
|
+
// pnpm upgrade starts a fresh slot instead of dragging the dead old
|
|
11394
|
+
// store tree along in every cache transfer (formats change only on
|
|
11395
|
+
// majors)
|
|
11396
|
+
const pnpmStoreKey = `pnpm-v${packageManagerInfo.version.split(".")[0]}`;
|
|
11336
11397
|
return [
|
|
11337
11398
|
{
|
|
11338
11399
|
scope: "buildDir",
|
|
11339
11400
|
pathMode: "relative",
|
|
11340
11401
|
buildDir: baseDir,
|
|
11341
|
-
key: "yarn",
|
|
11402
|
+
key: isPnpm ? pnpmStoreKey : "yarn",
|
|
11342
11403
|
policy,
|
|
11343
|
-
paths: [".yarn"],
|
|
11404
|
+
paths: [isPnpm ? ".pnpm-store" : ".yarn"],
|
|
11344
11405
|
// content-key for immutable-cache backends (github); the lockfile
|
|
11345
11406
|
// decides whether the cached content could have changed
|
|
11346
|
-
keyFiles: ["yarn.lock"],
|
|
11347
|
-
// the
|
|
11348
|
-
//
|
|
11349
|
-
// same lockfile, install verifies
|
|
11350
|
-
//
|
|
11407
|
+
keyFiles: [isPnpm ? "pnpm-lock.yaml" : "yarn.lock"],
|
|
11408
|
+
// the package manager's download cache (~hundreds of MB) is only
|
|
11409
|
+
// read when packages have to be (re)installed. When the
|
|
11410
|
+
// node_modules cache hit for the same lockfile, install verifies
|
|
11411
|
+
// its state file and never touches the store — so github skips
|
|
11412
|
+
// downloading this cache entirely
|
|
11351
11413
|
redundantOnExactHitOf: NODE_MODULES_CACHE_ID,
|
|
11352
11414
|
},
|
|
11353
11415
|
];
|
|
@@ -11356,27 +11418,50 @@ exports.getYarnCache = getYarnCache;
|
|
|
11356
11418
|
const getNodeModulesCache = async (context, policy = "pull-push") => {
|
|
11357
11419
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
11358
11420
|
const baseDir = await getCacheBaseDir(context);
|
|
11359
|
-
const {
|
|
11360
|
-
|
|
11421
|
+
const { workspaces } = packageManagerInfo;
|
|
11422
|
+
const isPnpm = packageManagerInfo.type === "pnpm";
|
|
11423
|
+
const lockFileName = isPnpm ? "pnpm-lock.yaml" : "yarn.lock";
|
|
11424
|
+
// yarn berry tracks install state in .yarn/install-state.gz (pnpm's
|
|
11425
|
+
// equivalent lives inside node_modules and is covered by the paths)
|
|
11426
|
+
const hasInstallState = packageManagerInfo.type === "yarn" && !packageManagerInfo.isClassic;
|
|
11427
|
+
// 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.
|
|
11361
11428
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
11362
11429
|
return [
|
|
11363
11430
|
{
|
|
11364
11431
|
scope: "global",
|
|
11365
11432
|
pathMode: "absolute",
|
|
11366
11433
|
// 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
|
|
11367
|
-
|
|
11434
|
+
//
|
|
11435
|
+
// pnpm gets its own, lockfile-keyed cache: node_modules layouts
|
|
11436
|
+
// are not compatible between package managers (a migrating
|
|
11437
|
+
// project must not inherit the yarn slot), and unlike yarn, a
|
|
11438
|
+
// pnpm install on top of a node_modules from a different lockfile
|
|
11439
|
+
// leaves orphaned .pnpm dirs behind that break type identity —
|
|
11440
|
+
// so the slot changes whenever the lockfile changes
|
|
11441
|
+
key: isPnpm
|
|
11442
|
+
? {
|
|
11443
|
+
prefix: "pnpm-" + (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
11444
|
+
files: [(0, path_1.join)(baseDir, "pnpm-lock.yaml")],
|
|
11445
|
+
}
|
|
11446
|
+
: (0, slugify_1.default)(baseDir) + "-node-modules",
|
|
11368
11447
|
// content-key for immutable-cache backends (github); the lockfile
|
|
11369
11448
|
// decides whether the cached content could have changed (absolute
|
|
11370
11449
|
// pathMode: resolve the lockfile explicitly)
|
|
11371
|
-
keyFiles: [(0, path_1.join)(baseDir,
|
|
11372
|
-
// referenced by the
|
|
11373
|
-
//
|
|
11450
|
+
keyFiles: [(0, path_1.join)(baseDir, lockFileName)],
|
|
11451
|
+
// referenced by the package-manager cache: an exact hit here makes
|
|
11452
|
+
// it unnecessary (see redundantOnExactHitOf on getYarnCache)
|
|
11374
11453
|
cacheId: NODE_MODULES_CACHE_ID,
|
|
11375
11454
|
policy,
|
|
11376
|
-
paths: [
|
|
11455
|
+
paths: (0, lodash_es_1.uniq)([
|
|
11377
11456
|
(0, path_1.join)(baseDir, "node_modules"),
|
|
11378
|
-
|
|
11379
|
-
|
|
11457
|
+
// pnpm's per-package node_modules are symlink farms worth
|
|
11458
|
+
// keeping warm (yarn hoists into the root, so root-only
|
|
11459
|
+
// matches its historical behavior)
|
|
11460
|
+
...(isPnpm
|
|
11461
|
+
? workspaces.map((w) => (0, path_1.join)(w.location, "node_modules"))
|
|
11462
|
+
: []),
|
|
11463
|
+
...(hasInstallState ? [(0, path_1.join)(baseDir, ".yarn/install-state.gz")] : []),
|
|
11464
|
+
]),
|
|
11380
11465
|
},
|
|
11381
11466
|
];
|
|
11382
11467
|
};
|
|
@@ -11455,7 +11540,7 @@ const base_1 = __nccwpck_require__(61619);
|
|
|
11455
11540
|
const docker_1 = __nccwpck_require__(83777);
|
|
11456
11541
|
const types_1 = __nccwpck_require__(40632);
|
|
11457
11542
|
const cache_1 = __nccwpck_require__(21100);
|
|
11458
|
-
const
|
|
11543
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
11459
11544
|
const getMeteorCache = (context) => [
|
|
11460
11545
|
{
|
|
11461
11546
|
key: "meteor-build-cache",
|
|
@@ -11470,6 +11555,11 @@ const getMeteorCache = (context) => [
|
|
|
11470
11555
|
];
|
|
11471
11556
|
const getMeteorDockerInstallScripts = async (context) => {
|
|
11472
11557
|
const packageManagerInfo = await context.packageManagerInfo;
|
|
11558
|
+
if (packageManagerInfo.type === "pnpm") {
|
|
11559
|
+
// not a meteor limitation — catladder's meteor docker install path
|
|
11560
|
+
// is only implemented for yarn so far
|
|
11561
|
+
throw new Error("the meteor build type is only implemented for yarn in catladder");
|
|
11562
|
+
}
|
|
11473
11563
|
if (packageManagerInfo.isClassic) {
|
|
11474
11564
|
return new bash_1.BashExpression(`
|
|
11475
11565
|
COPY $APP_DIR/package.json $APP_DIR/yarn.lock ./
|
|
@@ -11496,8 +11586,8 @@ const createMeteorBuildJobs = async (context) => {
|
|
|
11496
11586
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
11497
11587
|
throw new Error("deploy config is not meteor");
|
|
11498
11588
|
}
|
|
11499
|
-
const [
|
|
11500
|
-
(0,
|
|
11589
|
+
const [packageManagerInstall, nodeCache, meteorInstallScripts] = await Promise.all([
|
|
11590
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
11501
11591
|
(0, cache_1.getNodeCache)(context),
|
|
11502
11592
|
buildConfig.installScripts
|
|
11503
11593
|
? getMeteorDockerInstallScripts(context)
|
|
@@ -11512,7 +11602,7 @@ const createMeteorBuildJobs = async (context) => {
|
|
|
11512
11602
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
11513
11603
|
},
|
|
11514
11604
|
script: [
|
|
11515
|
-
...
|
|
11605
|
+
...packageManagerInstall,
|
|
11516
11606
|
'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',
|
|
11517
11607
|
"cp ./__build_info.json ./dist/bundle/programs/server",
|
|
11518
11608
|
],
|
|
@@ -11531,6 +11621,158 @@ exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
|
11531
11621
|
|
|
11532
11622
|
/***/ }),
|
|
11533
11623
|
|
|
11624
|
+
/***/ 18600:
|
|
11625
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11626
|
+
|
|
11627
|
+
"use strict";
|
|
11628
|
+
|
|
11629
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11630
|
+
exports.getDockerAppCopyAndBuildScript = exports.getPackageManagerInstall = exports.ensureNodeVersion = exports.getDefaultAuditCommand = void 0;
|
|
11631
|
+
const bash_1 = __nccwpck_require__(92390);
|
|
11632
|
+
const utils_1 = __nccwpck_require__(24516);
|
|
11633
|
+
const gitlab_1 = __nccwpck_require__(37393);
|
|
11634
|
+
const YARN_INSTALL_CLASSIC = `yarn install --frozen-lockfile`;
|
|
11635
|
+
const YARN_BERRY_PROD_INSTALL = `yarn workspaces focus --production`;
|
|
11636
|
+
// FIXME: check why and when rebuild is needed
|
|
11637
|
+
const YARN_BERRY_PROD_REBUILD = `yarn rebuild`;
|
|
11638
|
+
const getYarnInstallCommand = (packageManagerInfo) => {
|
|
11639
|
+
if (packageManagerInfo.isClassic) {
|
|
11640
|
+
return YARN_INSTALL_CLASSIC;
|
|
11641
|
+
}
|
|
11642
|
+
// inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
|
|
11643
|
+
return `yarn install --immutable --inline-builds`;
|
|
11644
|
+
};
|
|
11645
|
+
const isInWorkspace = (context, packageManagerInfo) => context.type === "workspace" ||
|
|
11646
|
+
("componentIsInWorkspace" in packageManagerInfo &&
|
|
11647
|
+
packageManagerInfo.componentIsInWorkspace);
|
|
11648
|
+
/**
|
|
11649
|
+
* make sure pnpm is available (job images ship it, older/custom images
|
|
11650
|
+
* fall back to corepack or a pinned global install)
|
|
11651
|
+
*/
|
|
11652
|
+
const getEnsurePnpmCommand = (version) => `if ! command -v pnpm &> /dev/null; then corepack enable pnpm 2>/dev/null || npm install -g pnpm@${version}; fi`;
|
|
11653
|
+
/**
|
|
11654
|
+
* pnpm's store is global by default; point it at a project-local
|
|
11655
|
+
* directory so CI can cache it (the pnpm equivalent of the `.yarn`
|
|
11656
|
+
* zip cache). Passed as the --store-dir flag: pnpm 11 stopped reading
|
|
11657
|
+
* the npm_config_store_dir env var (settings only come from
|
|
11658
|
+
* pnpm-workspace.yaml / global config / CLI flags), the flag works on
|
|
11659
|
+
* v10 and v11
|
|
11660
|
+
*/
|
|
11661
|
+
const getPnpmStoreDirExpression = (inWorkspace) => inWorkspace
|
|
11662
|
+
? `"$(git rev-parse --show-toplevel 2>/dev/null || pwd)/.pnpm-store"`
|
|
11663
|
+
: `"$PWD/.pnpm-store"`;
|
|
11664
|
+
const getPnpmInstallCommands = (context, packageManagerInfo) => [
|
|
11665
|
+
getEnsurePnpmCommand(packageManagerInfo.version),
|
|
11666
|
+
`pnpm install --frozen-lockfile --store-dir ${getPnpmStoreDirExpression(isInWorkspace(context, packageManagerInfo))}`,
|
|
11667
|
+
];
|
|
11668
|
+
/**
|
|
11669
|
+
* default `audit` job command per package manager. Exhaustive on the
|
|
11670
|
+
* package-manager type and throws for anything unsupported, so adding a
|
|
11671
|
+
* new package manager surfaces every place that needs a command here.
|
|
11672
|
+
*/
|
|
11673
|
+
const getDefaultAuditCommand = (packageManagerInfo) => {
|
|
11674
|
+
switch (packageManagerInfo.type) {
|
|
11675
|
+
case "pnpm":
|
|
11676
|
+
return "pnpm audit --prod --audit-level critical";
|
|
11677
|
+
case "yarn":
|
|
11678
|
+
return packageManagerInfo.isClassic
|
|
11679
|
+
? "yarn audit --level critical"
|
|
11680
|
+
: "yarn npm audit --environment production --severity critical"; // yarn 2+
|
|
11681
|
+
default:
|
|
11682
|
+
throw new Error(`no audit command implemented for package manager "${packageManagerInfo.type}"`);
|
|
11683
|
+
}
|
|
11684
|
+
};
|
|
11685
|
+
exports.getDefaultAuditCommand = getDefaultAuditCommand;
|
|
11686
|
+
const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")([
|
|
11687
|
+
// github actions overrides HOME in container jobs, so also look
|
|
11688
|
+
// for nvm where the catladder images install it (/root/.nvm)
|
|
11689
|
+
'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',
|
|
11690
|
+
"if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi",
|
|
11691
|
+
]);
|
|
11692
|
+
exports.ensureNodeVersion = ensureNodeVersion;
|
|
11693
|
+
const getPackageManagerInstall = async (context, options) => {
|
|
11694
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
11695
|
+
const postInstall = context.type !== "workspace" &&
|
|
11696
|
+
context.build.type !== "disabled" &&
|
|
11697
|
+
"postInstall" in context.build.config
|
|
11698
|
+
? context.build.config.postInstall
|
|
11699
|
+
: null;
|
|
11700
|
+
const installSection = packageManagerInfo.type === "pnpm"
|
|
11701
|
+
? (0, gitlab_1.collapseableSection)("pnpminstall", "pnpm install")(getPnpmInstallCommands(context, packageManagerInfo))
|
|
11702
|
+
: (0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(packageManagerInfo)]);
|
|
11703
|
+
return [
|
|
11704
|
+
...(0, exports.ensureNodeVersion)(context),
|
|
11705
|
+
...installSection,
|
|
11706
|
+
...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
11707
|
+
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
|
|
11708
|
+
: []),
|
|
11709
|
+
];
|
|
11710
|
+
};
|
|
11711
|
+
exports.getPackageManagerInstall = getPackageManagerInstall;
|
|
11712
|
+
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
11713
|
+
const getPnpmDockerAppCopyAndBuildScript = (packageManagerInfo) => {
|
|
11714
|
+
// the store was copied into the image (like the yarn zip cache), so
|
|
11715
|
+
// the prod install links from it instead of hitting the registry
|
|
11716
|
+
const storeDir = packageManagerInfo.componentIsInWorkspace
|
|
11717
|
+
? "/app/.pnpm-store"
|
|
11718
|
+
: "/app/$APP_DIR/.pnpm-store";
|
|
11719
|
+
// in a workspace, only install the component (and its workspace
|
|
11720
|
+
// dependencies) — the pnpm equivalent of `yarn workspaces focus`.
|
|
11721
|
+
// npm package names are shell-safe unquoted (the whole script is
|
|
11722
|
+
// embedded in a double-quoted bash export, so inner quotes would nest)
|
|
11723
|
+
const filter = packageManagerInfo.componentIsInWorkspace &&
|
|
11724
|
+
packageManagerInfo.currentWorkspace
|
|
11725
|
+
? ` --filter ${packageManagerInfo.currentWorkspace.name}...`
|
|
11726
|
+
: "";
|
|
11727
|
+
return new bash_1.BashExpression(`
|
|
11728
|
+
${DOCKER_COPY_FILES}
|
|
11729
|
+
RUN command -v pnpm >/dev/null 2>&1 || npm install -g pnpm@${packageManagerInfo.version}
|
|
11730
|
+
RUN pnpm install --prod --frozen-lockfile --store-dir ${storeDir}${filter}
|
|
11731
|
+
`.trim());
|
|
11732
|
+
};
|
|
11733
|
+
const getDockerAppCopyAndBuildScript = async (context) => {
|
|
11734
|
+
var _a, _b, _c;
|
|
11735
|
+
const packageManagerInfo = await context.packageManagerInfo;
|
|
11736
|
+
if (packageManagerInfo.type === "pnpm") {
|
|
11737
|
+
return getPnpmDockerAppCopyAndBuildScript(packageManagerInfo);
|
|
11738
|
+
}
|
|
11739
|
+
if (packageManagerInfo.isClassic) {
|
|
11740
|
+
return new bash_1.BashExpression(`
|
|
11741
|
+
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
11742
|
+
${DOCKER_COPY_FILES}
|
|
11743
|
+
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
11744
|
+
`.trim());
|
|
11745
|
+
}
|
|
11746
|
+
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
11747
|
+
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
11748
|
+
: true;
|
|
11749
|
+
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
11750
|
+
context.build.config.docker &&
|
|
11751
|
+
"yarnRebuildEnabled" in context.build.config.docker
|
|
11752
|
+
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
11753
|
+
: yarnRebuildEnabledDefault;
|
|
11754
|
+
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
11755
|
+
// trying to import those fail on this version
|
|
11756
|
+
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => packageManagerInfo.version.startsWith(v));
|
|
11757
|
+
const maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins
|
|
11758
|
+
? "RUN yarn plugin import workspace-tools"
|
|
11759
|
+
: "";
|
|
11760
|
+
// copy first everything and then install
|
|
11761
|
+
// rebuild first does not work as it will run postinstall and that might require files in the app
|
|
11762
|
+
return new bash_1.BashExpression(`
|
|
11763
|
+
ENV YARN_ENABLE_INLINE_BUILDS=1
|
|
11764
|
+
${DOCKER_COPY_FILES}
|
|
11765
|
+
${maybeAddWorkspaceToolsCommand}
|
|
11766
|
+
RUN ${YARN_BERRY_PROD_INSTALL}
|
|
11767
|
+
${yarnRebuildEnabled ? `RUN ${YARN_BERRY_PROD_REBUILD}` : ""}
|
|
11768
|
+
|
|
11769
|
+
`.trim());
|
|
11770
|
+
};
|
|
11771
|
+
exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
11772
|
+
//# sourceMappingURL=packageManagerInstall.js.map
|
|
11773
|
+
|
|
11774
|
+
/***/ }),
|
|
11775
|
+
|
|
11534
11776
|
/***/ 79769:
|
|
11535
11777
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11536
11778
|
|
|
@@ -11545,7 +11787,7 @@ const utils_1 = __nccwpck_require__(24516);
|
|
|
11545
11787
|
const createArtifactsConfig_1 = __nccwpck_require__(24494);
|
|
11546
11788
|
const cache_1 = __nccwpck_require__(21100);
|
|
11547
11789
|
const constants_1 = __nccwpck_require__(97627);
|
|
11548
|
-
const
|
|
11790
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
11549
11791
|
const createNodeTestJobs = async (context) => {
|
|
11550
11792
|
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;
|
|
11551
11793
|
// don't run tests after release
|
|
@@ -11572,8 +11814,8 @@ const createNodeTestJobs = async (context) => {
|
|
|
11572
11814
|
needs: [],
|
|
11573
11815
|
};
|
|
11574
11816
|
const buildConfig = context.build.config;
|
|
11575
|
-
const [
|
|
11576
|
-
(0,
|
|
11817
|
+
const [packageManagerInstall, packageManagerInfo, nodeCache] = await Promise.all([
|
|
11818
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
11577
11819
|
context.packageManagerInfo,
|
|
11578
11820
|
// pull-only: the build job is the designated cache writer — lint and
|
|
11579
11821
|
// test produce equivalent content from the same lockfile, so their
|
|
@@ -11589,13 +11831,11 @@ const createNodeTestJobs = async (context) => {
|
|
|
11589
11831
|
...((_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
|
|
11590
11832
|
},
|
|
11591
11833
|
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
11592
|
-
caches: undefined, // audit does not need
|
|
11834
|
+
caches: undefined, // audit does not need an install and no cache
|
|
11593
11835
|
script: [
|
|
11594
11836
|
`cd ${context.build.dir}`,
|
|
11595
11837
|
...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
|
|
11596
|
-
packageManagerInfo
|
|
11597
|
-
? "yarn audit --level critical"
|
|
11598
|
-
: "yarn npm audit --environment production --severity critical", // yarn 2
|
|
11838
|
+
(0, packageManagerInstall_1.getDefaultAuditCommand)(packageManagerInfo),
|
|
11599
11839
|
]),
|
|
11600
11840
|
],
|
|
11601
11841
|
allow_failure: (_h = (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.allowFailure) !== null && _h !== void 0 ? _h : true,
|
|
@@ -11613,9 +11853,9 @@ const createNodeTestJobs = async (context) => {
|
|
|
11613
11853
|
image: (_p = (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
|
|
11614
11854
|
caches: nodeCache,
|
|
11615
11855
|
script: [
|
|
11616
|
-
...(0,
|
|
11856
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
11617
11857
|
`cd ${context.build.dir}`,
|
|
11618
|
-
...
|
|
11858
|
+
...packageManagerInstall,
|
|
11619
11859
|
...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"]),
|
|
11620
11860
|
],
|
|
11621
11861
|
allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure,
|
|
@@ -11633,9 +11873,9 @@ const createNodeTestJobs = async (context) => {
|
|
|
11633
11873
|
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"),
|
|
11634
11874
|
caches: nodeCache,
|
|
11635
11875
|
script: [
|
|
11636
|
-
...(0,
|
|
11876
|
+
...(0, packageManagerInstall_1.ensureNodeVersion)(context),
|
|
11637
11877
|
`cd ${context.build.dir}`,
|
|
11638
|
-
...
|
|
11878
|
+
...packageManagerInstall,
|
|
11639
11879
|
...((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"]),
|
|
11640
11880
|
],
|
|
11641
11881
|
allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure,
|
|
@@ -11649,91 +11889,6 @@ exports.createNodeTestJobs = createNodeTestJobs;
|
|
|
11649
11889
|
|
|
11650
11890
|
/***/ }),
|
|
11651
11891
|
|
|
11652
|
-
/***/ 59874:
|
|
11653
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11654
|
-
|
|
11655
|
-
"use strict";
|
|
11656
|
-
|
|
11657
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
11658
|
-
exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
|
|
11659
|
-
const bash_1 = __nccwpck_require__(92390);
|
|
11660
|
-
const utils_1 = __nccwpck_require__(24516);
|
|
11661
|
-
const gitlab_1 = __nccwpck_require__(37393);
|
|
11662
|
-
const YARN_INSTALL_CLASSIC = `yarn install --frozen-lockfile`;
|
|
11663
|
-
const YARN_BERRY_PROD_INSTALL = `yarn workspaces focus --production`;
|
|
11664
|
-
// FIXME: check why and when rebuild is needed
|
|
11665
|
-
const YARN_BERRY_PROD_REBUILD = `yarn rebuild`;
|
|
11666
|
-
const getYarnInstallCommand = async (context) => {
|
|
11667
|
-
const packageManagerInfo = await context.packageManagerInfo;
|
|
11668
|
-
if (packageManagerInfo.isClassic) {
|
|
11669
|
-
return YARN_INSTALL_CLASSIC;
|
|
11670
|
-
}
|
|
11671
|
-
// inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
|
|
11672
|
-
return `yarn install --immutable --inline-builds`;
|
|
11673
|
-
};
|
|
11674
|
-
const ensureNodeVersion = (context) => (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")([
|
|
11675
|
-
// github actions overrides HOME in container jobs, so also look
|
|
11676
|
-
// for nvm where the catladder images install it (/root/.nvm)
|
|
11677
|
-
'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',
|
|
11678
|
-
"if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi",
|
|
11679
|
-
]);
|
|
11680
|
-
exports.ensureNodeVersion = ensureNodeVersion;
|
|
11681
|
-
const getYarnInstall = async (context, options) => {
|
|
11682
|
-
const postInstall = context.type !== "workspace" &&
|
|
11683
|
-
context.build.type !== "disabled" &&
|
|
11684
|
-
"postInstall" in context.build.config
|
|
11685
|
-
? context.build.config.postInstall
|
|
11686
|
-
: null;
|
|
11687
|
-
return [
|
|
11688
|
-
...(0, exports.ensureNodeVersion)(context),
|
|
11689
|
-
...(0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([await getYarnInstallCommand(context)]),
|
|
11690
|
-
...(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
|
|
11691
|
-
? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall))
|
|
11692
|
-
: []),
|
|
11693
|
-
];
|
|
11694
|
-
};
|
|
11695
|
-
exports.getYarnInstall = getYarnInstall;
|
|
11696
|
-
const DOCKER_COPY_FILES = `COPY --chown=node:node $APP_DIR .`;
|
|
11697
|
-
const getDockerAppCopyAndBuildScript = async (context) => {
|
|
11698
|
-
var _a, _b, _c;
|
|
11699
|
-
const packageManagerInfo = await context.packageManagerInfo;
|
|
11700
|
-
if (packageManagerInfo.isClassic) {
|
|
11701
|
-
return new bash_1.BashExpression(`
|
|
11702
|
-
RUN ${YARN_INSTALL_CLASSIC} --production --ignore-scripts
|
|
11703
|
-
${DOCKER_COPY_FILES}
|
|
11704
|
-
RUN ${YARN_INSTALL_CLASSIC} --production
|
|
11705
|
-
`.trim());
|
|
11706
|
-
}
|
|
11707
|
-
const yarnRebuildEnabledDefault = context.build.type === "fromWorkspace"
|
|
11708
|
-
? ((_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true)
|
|
11709
|
-
: true;
|
|
11710
|
-
const yarnRebuildEnabled = "docker" in context.build.config &&
|
|
11711
|
-
context.build.config.docker &&
|
|
11712
|
-
"yarnRebuildEnabled" in context.build.config.docker
|
|
11713
|
-
? ((_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault)
|
|
11714
|
-
: yarnRebuildEnabledDefault;
|
|
11715
|
-
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
11716
|
-
// trying to import those fail on this version
|
|
11717
|
-
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) => packageManagerInfo.version.startsWith(v));
|
|
11718
|
-
const maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins
|
|
11719
|
-
? "RUN yarn plugin import workspace-tools"
|
|
11720
|
-
: "";
|
|
11721
|
-
// copy first everything and then install
|
|
11722
|
-
// rebuild first does not work as it will run postinstall and that might require files in the app
|
|
11723
|
-
return new bash_1.BashExpression(`
|
|
11724
|
-
ENV YARN_ENABLE_INLINE_BUILDS=1
|
|
11725
|
-
${DOCKER_COPY_FILES}
|
|
11726
|
-
${maybeAddWorkspaceToolsCommand}
|
|
11727
|
-
RUN ${YARN_BERRY_PROD_INSTALL}
|
|
11728
|
-
${yarnRebuildEnabled ? `RUN ${YARN_BERRY_PROD_REBUILD}` : ""}
|
|
11729
|
-
|
|
11730
|
-
`.trim());
|
|
11731
|
-
};
|
|
11732
|
-
exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
11733
|
-
//# sourceMappingURL=yarn.js.map
|
|
11734
|
-
|
|
11735
|
-
/***/ }),
|
|
11736
|
-
|
|
11737
11892
|
/***/ 50663:
|
|
11738
11893
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11739
11894
|
|
|
@@ -12199,6 +12354,7 @@ const createComponentContext = async (ctx) => {
|
|
|
12199
12354
|
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
12200
12355
|
}
|
|
12201
12356
|
const packageManagerInfoPromise = (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName);
|
|
12357
|
+
const { type: packageManagerType } = await packageManagerInfoPromise;
|
|
12202
12358
|
const envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
12203
12359
|
const componentConfigWithoutDefaults = envContext.envConfigRaw;
|
|
12204
12360
|
const resolvedBuildType = componentConfigWithoutDefaults.build === false
|
|
@@ -12212,12 +12368,12 @@ const createComponentContext = async (ctx) => {
|
|
|
12212
12368
|
const defaults = componentConfigWithoutDefaults.deploy
|
|
12213
12369
|
? {
|
|
12214
12370
|
build: resolvedBuildType &&
|
|
12215
|
-
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
12371
|
+
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext, packageManagerType),
|
|
12216
12372
|
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
|
|
12217
12373
|
}
|
|
12218
12374
|
: {
|
|
12219
12375
|
build: resolvedBuildType &&
|
|
12220
|
-
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
|
|
12376
|
+
build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext, packageManagerType),
|
|
12221
12377
|
deploy: {},
|
|
12222
12378
|
};
|
|
12223
12379
|
const componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
|
|
@@ -12314,7 +12470,8 @@ async function createWorkspaceContext({ env, components, workspaceName, config,
|
|
|
12314
12470
|
if (!workspaceConfigRaw) {
|
|
12315
12471
|
throw new Error(`Workspace ${workspaceName} not found in config`);
|
|
12316
12472
|
}
|
|
12317
|
-
const
|
|
12473
|
+
const packageManagerInfo = (0, packageManager_1.getPackageManagerInfoBase)(config);
|
|
12474
|
+
const defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults((await packageManagerInfo).type);
|
|
12318
12475
|
const workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw);
|
|
12319
12476
|
return {
|
|
12320
12477
|
name: workspaceName,
|
|
@@ -12325,7 +12482,7 @@ async function createWorkspaceContext({ env, components, workspaceName, config,
|
|
|
12325
12482
|
env,
|
|
12326
12483
|
components,
|
|
12327
12484
|
fullConfig: config,
|
|
12328
|
-
packageManagerInfo
|
|
12485
|
+
packageManagerInfo,
|
|
12329
12486
|
build: {
|
|
12330
12487
|
type: "workspace",
|
|
12331
12488
|
dir: (_b = workspaceConfig.dir) !== null && _b !== void 0 ? _b : ".",
|
|
@@ -14799,19 +14956,18 @@ exports.getFullDbName = getFullDbName;
|
|
|
14799
14956
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
14800
14957
|
exports.createCustomDeployJobs = void 0;
|
|
14801
14958
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
|
|
14802
|
-
const
|
|
14959
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
14803
14960
|
const runner_1 = __nccwpck_require__(71065);
|
|
14804
14961
|
const base_1 = __nccwpck_require__(93664);
|
|
14805
14962
|
const types_1 = __nccwpck_require__(71446);
|
|
14806
14963
|
const createCustomDeployJobs = async (context) => {
|
|
14807
|
-
var _a, _b, _c;
|
|
14964
|
+
var _a, _b, _c, _d;
|
|
14808
14965
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
14809
14966
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
14810
14967
|
// should not happen
|
|
14811
14968
|
throw new Error("deploy config is not custom");
|
|
14812
14969
|
}
|
|
14813
|
-
|
|
14814
|
-
const yarnInstall = await (0, yarn_1.getYarnInstall)(context, {
|
|
14970
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
14815
14971
|
noCustomPostInstall: true,
|
|
14816
14972
|
});
|
|
14817
14973
|
const result = (0, base_1.createDeployementJobs)(context, {
|
|
@@ -14823,14 +14979,16 @@ const createCustomDeployJobs = async (context) => {
|
|
|
14823
14979
|
: undefined,
|
|
14824
14980
|
script: [
|
|
14825
14981
|
`cd ${context.build.dir}`,
|
|
14826
|
-
...(deployConfig.
|
|
14982
|
+
...(((_c = deployConfig.requiresInstall) !== null && _c !== void 0 ? _c : deployConfig.requiresYarnInstall)
|
|
14983
|
+
? packageManagerInstall
|
|
14984
|
+
: []),
|
|
14827
14985
|
...deployConfig.script,
|
|
14828
14986
|
],
|
|
14829
14987
|
variables: {},
|
|
14830
14988
|
},
|
|
14831
14989
|
stop: deployConfig.stopScript
|
|
14832
14990
|
? {
|
|
14833
|
-
image: (
|
|
14991
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
14834
14992
|
script: [...deployConfig.stopScript],
|
|
14835
14993
|
variables: {},
|
|
14836
14994
|
}
|
|
@@ -15506,12 +15664,12 @@ exports.NPM_PACKAGE_DEPLOY_TYPE = {
|
|
|
15506
15664
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
15507
15665
|
exports.createPagesDeployJobs = void 0;
|
|
15508
15666
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(19034);
|
|
15509
|
-
const
|
|
15667
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
15510
15668
|
const runner_1 = __nccwpck_require__(71065);
|
|
15511
15669
|
const base_1 = __nccwpck_require__(93664);
|
|
15512
15670
|
const types_1 = __nccwpck_require__(71446);
|
|
15513
15671
|
const createPagesDeployJobs = async (context) => {
|
|
15514
|
-
var _a, _b, _c;
|
|
15672
|
+
var _a, _b, _c, _d;
|
|
15515
15673
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
15516
15674
|
if (!(0, types_1.isOfDeployType)(deployConfig, "pages")) {
|
|
15517
15675
|
// should not happen
|
|
@@ -15526,7 +15684,7 @@ const createPagesDeployJobs = async (context) => {
|
|
|
15526
15684
|
// parallel deployments) — every merge request gets a site preview
|
|
15527
15685
|
const pathPrefix = context.environment.envType === "review" ? "mr-$CI_MERGE_REQUEST_IID" : "";
|
|
15528
15686
|
const publishDir = (_b = deployConfig.publishDir) !== null && _b !== void 0 ? _b : "public";
|
|
15529
|
-
const
|
|
15687
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
15530
15688
|
noCustomPostInstall: true,
|
|
15531
15689
|
});
|
|
15532
15690
|
return (0, base_1.createDeployementJobs)(context, {
|
|
@@ -15537,7 +15695,9 @@ const createPagesDeployJobs = async (context) => {
|
|
|
15537
15695
|
pages: { path_prefix: pathPrefix },
|
|
15538
15696
|
script: [
|
|
15539
15697
|
`cd ${context.build.dir}`,
|
|
15540
|
-
...(deployConfig.
|
|
15698
|
+
...(((_d = deployConfig.requiresInstall) !== null && _d !== void 0 ? _d : deployConfig.requiresYarnInstall)
|
|
15699
|
+
? packageManagerInstall
|
|
15700
|
+
: []),
|
|
15541
15701
|
...deployConfig.script,
|
|
15542
15702
|
// the gitlab environment url should point at the published site
|
|
15543
15703
|
// (the base deploy job reports $ROOT_URL as environment url)
|
|
@@ -16414,6 +16574,89 @@ exports.createJobsForWorkspace = createJobsForWorkspace;
|
|
|
16414
16574
|
|
|
16415
16575
|
/***/ }),
|
|
16416
16576
|
|
|
16577
|
+
/***/ 7633:
|
|
16578
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
16579
|
+
|
|
16580
|
+
"use strict";
|
|
16581
|
+
|
|
16582
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16583
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16584
|
+
};
|
|
16585
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16586
|
+
exports.detectPackageManager = void 0;
|
|
16587
|
+
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
16588
|
+
const fs_1 = __nccwpck_require__(79896);
|
|
16589
|
+
const promises_1 = __nccwpck_require__(91943);
|
|
16590
|
+
const path_1 = __nccwpck_require__(16928);
|
|
16591
|
+
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
16592
|
+
const readPackageManagerField = async (dir) => {
|
|
16593
|
+
try {
|
|
16594
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
|
|
16595
|
+
const match = /^(yarn|pnpm)@(.+)$/.exec(pkg.packageManager);
|
|
16596
|
+
if (!match)
|
|
16597
|
+
return null;
|
|
16598
|
+
return { type: match[1], version: match[2] };
|
|
16599
|
+
}
|
|
16600
|
+
catch (_a) {
|
|
16601
|
+
return null;
|
|
16602
|
+
}
|
|
16603
|
+
};
|
|
16604
|
+
const detectByLockfile = (dir) => {
|
|
16605
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "pnpm-lock.yaml")))
|
|
16606
|
+
return "pnpm";
|
|
16607
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "yarn.lock")))
|
|
16608
|
+
return "yarn";
|
|
16609
|
+
return null;
|
|
16610
|
+
};
|
|
16611
|
+
const getGitRoot = async () => {
|
|
16612
|
+
try {
|
|
16613
|
+
return (await (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")).stdout.trim();
|
|
16614
|
+
}
|
|
16615
|
+
catch (_a) {
|
|
16616
|
+
return null;
|
|
16617
|
+
}
|
|
16618
|
+
};
|
|
16619
|
+
const getInstalledVersion = async (type) => {
|
|
16620
|
+
try {
|
|
16621
|
+
return (await (0, child_process_promise_1.exec)(`${type} --version`)).stdout.trim();
|
|
16622
|
+
}
|
|
16623
|
+
catch (_a) {
|
|
16624
|
+
return "";
|
|
16625
|
+
}
|
|
16626
|
+
};
|
|
16627
|
+
/**
|
|
16628
|
+
* detect which package manager the project uses (and its version).
|
|
16629
|
+
*
|
|
16630
|
+
* Order: the `packageManager` field in package.json (cwd, then git root)
|
|
16631
|
+
* wins, then the lockfile present (pnpm-lock.yaml → pnpm, yarn.lock →
|
|
16632
|
+
* yarn), then falling back to yarn (the historical default).
|
|
16633
|
+
*
|
|
16634
|
+
* An `explicitType` (from `packageManager` in catladder.ts) overrides the
|
|
16635
|
+
* detected type; the version is still taken from the `packageManager`
|
|
16636
|
+
* field when it pins the same manager, otherwise from the installed CLI.
|
|
16637
|
+
*/
|
|
16638
|
+
exports.detectPackageManager = (0, memoizee_1.default)(async (explicitType) => {
|
|
16639
|
+
var _a, _b;
|
|
16640
|
+
const roots = [process.cwd()];
|
|
16641
|
+
const gitRoot = await getGitRoot();
|
|
16642
|
+
if (gitRoot && gitRoot !== process.cwd())
|
|
16643
|
+
roots.push(gitRoot);
|
|
16644
|
+
let fromField = null;
|
|
16645
|
+
for (const root of roots) {
|
|
16646
|
+
fromField = await readPackageManagerField(root);
|
|
16647
|
+
if (fromField)
|
|
16648
|
+
break;
|
|
16649
|
+
}
|
|
16650
|
+
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";
|
|
16651
|
+
const version = (fromField === null || fromField === void 0 ? void 0 : fromField.type) === detectedType
|
|
16652
|
+
? fromField.version
|
|
16653
|
+
: await getInstalledVersion(detectedType);
|
|
16654
|
+
return { type: detectedType, version };
|
|
16655
|
+
}, { promise: true });
|
|
16656
|
+
//# sourceMappingURL=detectPackageManager.js.map
|
|
16657
|
+
|
|
16658
|
+
/***/ }),
|
|
16659
|
+
|
|
16417
16660
|
/***/ 43249:
|
|
16418
16661
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
16419
16662
|
|
|
@@ -16521,12 +16764,23 @@ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent =
|
|
|
16521
16764
|
const fs_1 = __nccwpck_require__(79896);
|
|
16522
16765
|
const path_1 = __nccwpck_require__(16928);
|
|
16523
16766
|
const path_equal_1 = __nccwpck_require__(43882);
|
|
16767
|
+
const detectPackageManager_1 = __nccwpck_require__(7633);
|
|
16768
|
+
const pnpmUtils_1 = __nccwpck_require__(3497);
|
|
16524
16769
|
const yarnUtils_1 = __nccwpck_require__(94191);
|
|
16525
16770
|
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
16771
|
+
const PACKAGE_MANAGER_FILES = {
|
|
16772
|
+
yarn: {
|
|
16773
|
+
lockFile: "yarn.lock",
|
|
16774
|
+
configFiles: [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"], // ".yarn" is yarn 2 folder
|
|
16775
|
+
},
|
|
16776
|
+
pnpm: {
|
|
16777
|
+
lockFile: "pnpm-lock.yaml",
|
|
16778
|
+
configFiles: ["pnpm-workspace.yaml", ".npmrc", ".pnpmfile.cjs"],
|
|
16779
|
+
},
|
|
16780
|
+
};
|
|
16526
16781
|
const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
16527
|
-
const baseInfo = await (0, exports.getPackageManagerInfoBase)();
|
|
16782
|
+
const baseInfo = await (0, exports.getPackageManagerInfoBase)(config);
|
|
16528
16783
|
const { workspaces } = baseInfo;
|
|
16529
|
-
// currently only supports yarn
|
|
16530
16784
|
const component = config.components[componentName];
|
|
16531
16785
|
const currentWorkspace = workspaces.find((w) => (0, path_equal_1.pathEqual)(component.dir, w.location));
|
|
16532
16786
|
const componentIsInWorkspace = Boolean(currentWorkspace);
|
|
@@ -16535,10 +16789,10 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
16535
16789
|
const workspacePackageJson = componentIsInWorkspace
|
|
16536
16790
|
? (0, path_1.join)(workspaceRoot, "package.json")
|
|
16537
16791
|
: null;
|
|
16792
|
+
const { lockFile: lockFileName, configFiles } = PACKAGE_MANAGER_FILES[baseInfo.type];
|
|
16538
16793
|
const lockFile = componentIsInWorkspace
|
|
16539
|
-
? (0, path_1.join)(workspaceRoot,
|
|
16540
|
-
: (0, path_1.join)(component.dir,
|
|
16541
|
-
const configFiles = [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"]; // ".yarn" is yarn 2 folder
|
|
16794
|
+
? (0, path_1.join)(workspaceRoot, lockFileName)
|
|
16795
|
+
: (0, path_1.join)(component.dir, lockFileName);
|
|
16542
16796
|
// copy all those configFiles from workspace root and/or component folder
|
|
16543
16797
|
const configFilePaths = [
|
|
16544
16798
|
...configFiles,
|
|
@@ -16549,12 +16803,27 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
16549
16803
|
const currentWorkspaceDependencies = currentWorkspace
|
|
16550
16804
|
? (0, yarnUtils_1.getWorkspaceDependencies)(currentWorkspace, workspaces)
|
|
16551
16805
|
: [];
|
|
16806
|
+
// pnpm's --frozen-lockfile check requires every importer of the
|
|
16807
|
+
// lockfile to exist on disk, so all workspace manifests (not just the
|
|
16808
|
+
// dependency workspaces, which are copied entirely) go into the image
|
|
16809
|
+
const allWorkspaceManifests = baseInfo.type === "pnpm" && componentIsInWorkspace
|
|
16810
|
+
? workspaces
|
|
16811
|
+
.map((w) => (0, path_1.join)(w.location, "package.json"))
|
|
16812
|
+
.filter((f) => (0, fs_1.existsSync)(f))
|
|
16813
|
+
: [];
|
|
16814
|
+
// patch files referenced by patchedDependencies must exist in the
|
|
16815
|
+
// image, or pnpm's frozen install fails verifying them
|
|
16816
|
+
const patchFiles = baseInfo.type === "pnpm"
|
|
16817
|
+
? (0, pnpmUtils_1.getPnpmPatchFiles)(componentIsInWorkspace ? workspaceRoot : component.dir)
|
|
16818
|
+
: [];
|
|
16552
16819
|
const pathsToCopyInDocker = [
|
|
16553
16820
|
...new Set([
|
|
16554
16821
|
packageJson,
|
|
16555
16822
|
...(workspacePackageJson ? [workspacePackageJson] : []),
|
|
16556
16823
|
lockFile,
|
|
16557
16824
|
...configFilePaths,
|
|
16825
|
+
...allWorkspaceManifests,
|
|
16826
|
+
...patchFiles,
|
|
16558
16827
|
...currentWorkspaceDependencies,
|
|
16559
16828
|
]),
|
|
16560
16829
|
];
|
|
@@ -16567,11 +16836,17 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
16567
16836
|
};
|
|
16568
16837
|
};
|
|
16569
16838
|
exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
|
|
16570
|
-
const _getPackageManagerInfoBase = async () => {
|
|
16571
|
-
|
|
16572
|
-
const version = await (0, yarnUtils_1.getYarnVersion)();
|
|
16839
|
+
const _getPackageManagerInfoBase = async (config) => {
|
|
16840
|
+
const { type, version } = await (0, detectPackageManager_1.detectPackageManager)(config === null || config === void 0 ? void 0 : config.packageManager);
|
|
16573
16841
|
if (!version)
|
|
16574
|
-
throw new Error(
|
|
16842
|
+
throw new Error(`could not get ${type} version`);
|
|
16843
|
+
if (type === "pnpm") {
|
|
16844
|
+
return {
|
|
16845
|
+
type: "pnpm",
|
|
16846
|
+
workspaces: await (0, pnpmUtils_1.getPnpmWorkspaces)(),
|
|
16847
|
+
version,
|
|
16848
|
+
};
|
|
16849
|
+
}
|
|
16575
16850
|
const isClassic = version.startsWith("1");
|
|
16576
16851
|
const workspaces = await (0, yarnUtils_1.getWorkspaces)(isClassic);
|
|
16577
16852
|
return {
|
|
@@ -16583,11 +16858,113 @@ const _getPackageManagerInfoBase = async () => {
|
|
|
16583
16858
|
};
|
|
16584
16859
|
exports.getPackageManagerInfoBase = (0, memoizee_1.default)(_getPackageManagerInfoBase, {
|
|
16585
16860
|
promise: true,
|
|
16861
|
+
// memoize per explicit packageManager choice, not per config identity
|
|
16862
|
+
normalizer: ([config]) => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.packageManager) !== null && _a !== void 0 ? _a : ""; },
|
|
16586
16863
|
});
|
|
16587
16864
|
//# sourceMappingURL=packageManager.js.map
|
|
16588
16865
|
|
|
16589
16866
|
/***/ }),
|
|
16590
16867
|
|
|
16868
|
+
/***/ 3497:
|
|
16869
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
16870
|
+
|
|
16871
|
+
"use strict";
|
|
16872
|
+
|
|
16873
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16874
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16875
|
+
};
|
|
16876
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16877
|
+
exports.getPnpmWorkspaces = exports.getPnpmPatchFiles = void 0;
|
|
16878
|
+
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
16879
|
+
const fs_1 = __nccwpck_require__(79896);
|
|
16880
|
+
const promises_1 = __nccwpck_require__(91943);
|
|
16881
|
+
const path_1 = __nccwpck_require__(16928);
|
|
16882
|
+
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
16883
|
+
const yaml_1 = __nccwpck_require__(33483);
|
|
16884
|
+
const jsonParse_1 = __nccwpck_require__(99461);
|
|
16885
|
+
const readWorkspaceDependencyLocations = async (location, locationByName) => {
|
|
16886
|
+
var _a, _b, _c;
|
|
16887
|
+
try {
|
|
16888
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(location, "package.json"), "utf-8"));
|
|
16889
|
+
const depNames = [
|
|
16890
|
+
...Object.keys((_a = pkg.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
16891
|
+
...Object.keys((_b = pkg.devDependencies) !== null && _b !== void 0 ? _b : {}),
|
|
16892
|
+
...Object.keys((_c = pkg.optionalDependencies) !== null && _c !== void 0 ? _c : {}),
|
|
16893
|
+
];
|
|
16894
|
+
return [
|
|
16895
|
+
...new Set(depNames
|
|
16896
|
+
.map((name) => locationByName.get(name))
|
|
16897
|
+
.filter((l) => Boolean(l) && l !== location)),
|
|
16898
|
+
];
|
|
16899
|
+
}
|
|
16900
|
+
catch (_d) {
|
|
16901
|
+
return [];
|
|
16902
|
+
}
|
|
16903
|
+
};
|
|
16904
|
+
/**
|
|
16905
|
+
* patch files referenced by `patchedDependencies` (pnpm-workspace.yaml
|
|
16906
|
+
* or the root package.json's `pnpm` section) — they must travel into
|
|
16907
|
+
* the docker build context, or the prod install fails to verify them
|
|
16908
|
+
*/
|
|
16909
|
+
const getPnpmPatchFiles = (root = ".") => {
|
|
16910
|
+
var _a, _b, _c;
|
|
16911
|
+
const patchedDependencies = {};
|
|
16912
|
+
try {
|
|
16913
|
+
const ws = (0, yaml_1.parse)((0, fs_1.readFileSync)((0, path_1.join)(root, "pnpm-workspace.yaml"), "utf-8"));
|
|
16914
|
+
Object.assign(patchedDependencies, (_a = ws === null || ws === void 0 ? void 0 : ws.patchedDependencies) !== null && _a !== void 0 ? _a : {});
|
|
16915
|
+
}
|
|
16916
|
+
catch (_d) {
|
|
16917
|
+
// no workspace file
|
|
16918
|
+
}
|
|
16919
|
+
try {
|
|
16920
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(root, "package.json"), "utf-8"));
|
|
16921
|
+
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 : {});
|
|
16922
|
+
}
|
|
16923
|
+
catch (_e) {
|
|
16924
|
+
// no package.json
|
|
16925
|
+
}
|
|
16926
|
+
return [
|
|
16927
|
+
...new Set(Object.values(patchedDependencies)
|
|
16928
|
+
.map((p) => (0, path_1.join)(root, p))
|
|
16929
|
+
.filter((p) => (0, fs_1.existsSync)(p))),
|
|
16930
|
+
];
|
|
16931
|
+
};
|
|
16932
|
+
exports.getPnpmPatchFiles = getPnpmPatchFiles;
|
|
16933
|
+
/**
|
|
16934
|
+
* list pnpm workspace projects in the same shape yarn berry reports them
|
|
16935
|
+
* (locations relative to the project root, workspace dependencies as
|
|
16936
|
+
* locations). Outside a pnpm workspace this returns [].
|
|
16937
|
+
*/
|
|
16938
|
+
// export for mocking
|
|
16939
|
+
exports.getPnpmWorkspaces = (0, memoizee_1.default)(async () => {
|
|
16940
|
+
let output;
|
|
16941
|
+
try {
|
|
16942
|
+
output = (await (0, child_process_promise_1.exec)("pnpm m ls --json --depth -1")).stdout;
|
|
16943
|
+
}
|
|
16944
|
+
catch (_a) {
|
|
16945
|
+
return [];
|
|
16946
|
+
}
|
|
16947
|
+
const projects = (0, jsonParse_1.jsonParseOrThrow)(output.trim() || "[]");
|
|
16948
|
+
if (!Array.isArray(projects))
|
|
16949
|
+
return [];
|
|
16950
|
+
const withLocations = projects
|
|
16951
|
+
.filter((p) => p.name && p.path)
|
|
16952
|
+
.map((p) => ({
|
|
16953
|
+
name: p.name,
|
|
16954
|
+
location: (0, path_1.relative)(process.cwd(), p.path) || ".",
|
|
16955
|
+
}));
|
|
16956
|
+
const locationByName = new Map(withLocations.map((p) => [p.name, p.location]));
|
|
16957
|
+
return Promise.all(withLocations.map(async ({ name, location }) => ({
|
|
16958
|
+
name,
|
|
16959
|
+
location,
|
|
16960
|
+
workspaceDependencies: await readWorkspaceDependencyLocations(location, locationByName),
|
|
16961
|
+
mismatchedWorkspaceDependencies: [],
|
|
16962
|
+
})));
|
|
16963
|
+
}, { promise: true });
|
|
16964
|
+
//# sourceMappingURL=pnpmUtils.js.map
|
|
16965
|
+
|
|
16966
|
+
/***/ }),
|
|
16967
|
+
|
|
16591
16968
|
/***/ 77257:
|
|
16592
16969
|
/***/ ((__unused_webpack_module, exports) => {
|
|
16593
16970
|
|
|
@@ -16699,10 +17076,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16699
17076
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16700
17077
|
};
|
|
16701
17078
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
16702
|
-
exports.getWorkspaceDependencies = exports.getWorkspaces =
|
|
17079
|
+
exports.getWorkspaceDependencies = exports.getWorkspaces = void 0;
|
|
16703
17080
|
const child_process_promise_1 = __nccwpck_require__(42242);
|
|
16704
|
-
const promises_1 = __nccwpck_require__(91943);
|
|
16705
|
-
const path_1 = __nccwpck_require__(16928);
|
|
16706
17081
|
const memoizee_1 = __importDefault(__nccwpck_require__(14199));
|
|
16707
17082
|
const jsonParse_1 = __nccwpck_require__(99461);
|
|
16708
17083
|
const execOrFail = async (cmd, onFail) => {
|
|
@@ -16713,40 +17088,6 @@ const execOrFail = async (cmd, onFail) => {
|
|
|
16713
17088
|
return onFail !== null && onFail !== void 0 ? onFail : null;
|
|
16714
17089
|
}
|
|
16715
17090
|
};
|
|
16716
|
-
const readPackageManagerVersion = async (dir) => {
|
|
16717
|
-
var _a;
|
|
16718
|
-
try {
|
|
16719
|
-
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
|
|
16720
|
-
const match = /^yarn@(.+)$/.exec(pkg.packageManager);
|
|
16721
|
-
return (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
|
|
16722
|
-
}
|
|
16723
|
-
catch (_b) {
|
|
16724
|
-
return null;
|
|
16725
|
-
}
|
|
16726
|
-
};
|
|
16727
|
-
const getGitRoot = async () => {
|
|
16728
|
-
try {
|
|
16729
|
-
return (await (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")).stdout.trim();
|
|
16730
|
-
}
|
|
16731
|
-
catch (_a) {
|
|
16732
|
-
return null;
|
|
16733
|
-
}
|
|
16734
|
-
};
|
|
16735
|
-
// export for mocking
|
|
16736
|
-
exports.getYarnVersion = (0, memoizee_1.default)(async () => {
|
|
16737
|
-
// Fast path: read from package.json packageManager field
|
|
16738
|
-
const fromCwd = await readPackageManagerVersion(process.cwd());
|
|
16739
|
-
if (fromCwd)
|
|
16740
|
-
return fromCwd;
|
|
16741
|
-
const gitRoot = await getGitRoot();
|
|
16742
|
-
if (gitRoot && gitRoot !== process.cwd()) {
|
|
16743
|
-
const fromGitRoot = await readPackageManagerVersion(gitRoot);
|
|
16744
|
-
if (fromGitRoot)
|
|
16745
|
-
return fromGitRoot;
|
|
16746
|
-
}
|
|
16747
|
-
// Fallback: invoke yarn CLI
|
|
16748
|
-
return await execOrFail("yarn --version", "");
|
|
16749
|
-
}, { promise: true });
|
|
16750
17091
|
// export for mocking
|
|
16751
17092
|
exports.getWorkspaces = (0, memoizee_1.default)(async (isClassic) => {
|
|
16752
17093
|
var _a, _b;
|
|
@@ -17397,7 +17738,7 @@ exports.createVerifyJobs = exports.VERIFY_JOB_NAME = void 0;
|
|
|
17397
17738
|
const createArtifactsConfig_1 = __nccwpck_require__(24494);
|
|
17398
17739
|
const cache_1 = __nccwpck_require__(21100);
|
|
17399
17740
|
const constants_1 = __nccwpck_require__(97627);
|
|
17400
|
-
const
|
|
17741
|
+
const packageManagerInstall_1 = __nccwpck_require__(18600);
|
|
17401
17742
|
const deploy_1 = __nccwpck_require__(19752);
|
|
17402
17743
|
const runner_1 = __nccwpck_require__(71065);
|
|
17403
17744
|
const utils_1 = __nccwpck_require__(24516);
|
|
@@ -17414,9 +17755,9 @@ const createVerifyJobs = async (context) => {
|
|
|
17414
17755
|
return [];
|
|
17415
17756
|
}
|
|
17416
17757
|
const isNodeBuild = context.build.type !== "disabled" && context.build.buildType === "node";
|
|
17417
|
-
const [
|
|
17758
|
+
const [packageManagerInstall, nodeCache] = isNodeBuild
|
|
17418
17759
|
? await Promise.all([
|
|
17419
|
-
(0,
|
|
17760
|
+
(0, packageManagerInstall_1.getPackageManagerInstall)(context),
|
|
17420
17761
|
(0, cache_1.getNodeCache)(context, "pull"),
|
|
17421
17762
|
])
|
|
17422
17763
|
: [null, null];
|
|
@@ -17452,9 +17793,9 @@ const createVerifyJobs = async (context) => {
|
|
|
17452
17793
|
},
|
|
17453
17794
|
script: [
|
|
17454
17795
|
...setupScript,
|
|
17455
|
-
...(
|
|
17796
|
+
...(packageManagerInstall ? (0, packageManagerInstall_1.ensureNodeVersion)(context) : []),
|
|
17456
17797
|
`cd ${context.build.dir}`,
|
|
17457
|
-
...(
|
|
17798
|
+
...(packageManagerInstall !== null && packageManagerInstall !== void 0 ? packageManagerInstall : []),
|
|
17458
17799
|
...(0, utils_1.ensureArray)(verifyConfig.command),
|
|
17459
17800
|
],
|
|
17460
17801
|
allow_failure: verifyConfig.allowFailure,
|