@catladder/cli 0.0.0-next-d71e41ba → 0.0.0-next-dccc0a36
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 +790 -272
- package/dist/bundles/cli/index.js +790 -272
- 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 +68 -5
- package/dist/bundles/skills/catladder-builds/references/build-types.md +8 -6
- 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 +16 -4
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js +4 -4
- package/dist/packages/pipeline/src/backends/github/GithubBackend.js.map +1 -1
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js +4 -4
- package/dist/packages/pipeline/src/backends/gitlab/GitlabBackend.js.map +1 -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/build/types.d.ts +6 -5
- package/dist/packages/pipeline/src/build/types.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/customImages/hash.d.ts +9 -0
- package/dist/packages/pipeline/src/customImages/hash.js +41 -16
- package/dist/packages/pipeline/src/customImages/hash.js.map +1 -1
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.d.ts +23 -5
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.js +177 -43
- package/dist/packages/pipeline/src/customImages/jobImagesPlan.js.map +1 -1
- package/dist/packages/pipeline/src/customImages/projectImages.d.ts +67 -0
- package/dist/packages/pipeline/src/customImages/projectImages.js +9 -0
- package/dist/packages/pipeline/src/customImages/projectImages.js.map +1 -0
- 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 +9 -3
- package/dist/packages/pipeline/src/deploy/types/index.d.ts +4 -4
- package/dist/packages/pipeline/src/deploy/types/pages.d.ts +9 -3
- package/dist/packages/pipeline/src/index.d.ts +2 -0
- package/dist/packages/pipeline/src/index.js +2 -0
- package/dist/packages/pipeline/src/index.js.map +1 -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 +16 -1
- package/dist/packages/pipeline/src/types/config.js.map +1 -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/types/jobs.d.ts +2 -1
- package/dist/packages/pipeline/src/types/jobs.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 +68 -5
- package/dist/skills/catladder-builds/references/build-types.md +8 -6
- 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 +16 -4
- 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
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { GitlabJobImage } from "../types/gitlab-types";
|
|
2
|
+
/**
|
|
3
|
+
* a docker image declared by the project (`config.images`): built
|
|
4
|
+
* automatically in the pipeline, content-hashed into the project's own
|
|
5
|
+
* registry and rebuilt only when its inputs change.
|
|
6
|
+
*/
|
|
7
|
+
type ProjectImageCommon = {
|
|
8
|
+
/**
|
|
9
|
+
* the docker build context, relative to the repository root.
|
|
10
|
+
*
|
|
11
|
+
* Defaults to `dir` for a directory-based image, and to the
|
|
12
|
+
* repository root (`.`) for an inline `dockerfile`.
|
|
13
|
+
*
|
|
14
|
+
* NOTE: the context itself is not hashed — only the Dockerfile (or
|
|
15
|
+
* `dir`), `buildArgs` and `hashExtraPaths` are. List files that are
|
|
16
|
+
* `COPY`ed from a wider context in `hashExtraPaths` if changing them
|
|
17
|
+
* should rebuild the image.
|
|
18
|
+
*/
|
|
19
|
+
context?: string;
|
|
20
|
+
/**
|
|
21
|
+
* extra files that influence the image content — they become part of
|
|
22
|
+
* the content hash and the change detection
|
|
23
|
+
*/
|
|
24
|
+
hashExtraPaths?: string[];
|
|
25
|
+
/**
|
|
26
|
+
* docker `--build-arg` values passed to the image build, part of the
|
|
27
|
+
* content hash
|
|
28
|
+
*/
|
|
29
|
+
buildArgs?: Record<string, string>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* where the image definition comes from: a directory in the repository
|
|
33
|
+
* containing a `Dockerfile`, or an inline Dockerfile written straight
|
|
34
|
+
* into the config (materialized into the generated files)
|
|
35
|
+
*/
|
|
36
|
+
export type ProjectImageConfig = ProjectImageCommon & ({
|
|
37
|
+
/**
|
|
38
|
+
* directory containing the `Dockerfile`, relative to the
|
|
39
|
+
* repository root. Also the default build context.
|
|
40
|
+
*/
|
|
41
|
+
dir: string;
|
|
42
|
+
dockerfile?: never;
|
|
43
|
+
} | {
|
|
44
|
+
/**
|
|
45
|
+
* the Dockerfile content, as one string or as lines. Written to
|
|
46
|
+
* `.catladder-generated/images/project/<name>/Dockerfile`; the
|
|
47
|
+
* build context defaults to the repository root.
|
|
48
|
+
*/
|
|
49
|
+
dockerfile: string | string[];
|
|
50
|
+
dir?: never;
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* a reference to a project-declared job image (`config.images`), usable
|
|
54
|
+
* in every `jobImage` field. The pipeline backends resolve it to the
|
|
55
|
+
* concrete content-hashed image url in the project registry.
|
|
56
|
+
*/
|
|
57
|
+
export type ProjectImageRef = {
|
|
58
|
+
/** the key of the image in `config.images` */
|
|
59
|
+
image: string;
|
|
60
|
+
};
|
|
61
|
+
export declare const isProjectImageRef: (value: unknown) => value is ProjectImageRef;
|
|
62
|
+
/**
|
|
63
|
+
* everything a `jobImage` config field accepts: a concrete image (url
|
|
64
|
+
* or gitlab image object) or a reference to a project-declared image
|
|
65
|
+
*/
|
|
66
|
+
export type JobImageConfig = GitlabJobImage | ProjectImageRef;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isProjectImageRef = void 0;
|
|
4
|
+
const isProjectImageRef = (value) => typeof value === "object" &&
|
|
5
|
+
value !== null &&
|
|
6
|
+
"image" in value &&
|
|
7
|
+
typeof value.image === "string";
|
|
8
|
+
exports.isProjectImageRef = isProjectImageRef;
|
|
9
|
+
//# sourceMappingURL=projectImages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectImages.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/customImages/projectImages.ts"],"names":[],"mappings":";;;AAoEO,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAA4B,EAAE,CAC5E,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,OAAO,IAAI,KAAK;IAChB,OAAQ,KAAyB,CAAC,KAAK,KAAK,QAAQ,CAAC;AAJ1C,QAAA,iBAAiB,qBAIyB"}
|
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCustomDeployJobs = void 0;
|
|
4
4
|
const getAllCacheConfigsFromConfig_1 = require("../../build/cache/getAllCacheConfigsFromConfig");
|
|
5
|
-
const
|
|
5
|
+
const packageManagerInstall_1 = require("../../build/node/packageManagerInstall");
|
|
6
6
|
const runner_1 = require("../../runner");
|
|
7
7
|
const base_1 = require("../base");
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const createCustomDeployJobs = async (context) => {
|
|
10
|
-
var _a, _b, _c;
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
11
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12
12
|
if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
|
|
13
13
|
// should not happen
|
|
14
14
|
throw new Error("deploy config is not custom");
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
const yarnInstall = await (0, yarn_1.getYarnInstall)(context, {
|
|
16
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
18
17
|
noCustomPostInstall: true,
|
|
19
18
|
});
|
|
20
19
|
const result = (0, base_1.createDeployementJobs)(context, {
|
|
@@ -26,14 +25,16 @@ const createCustomDeployJobs = async (context) => {
|
|
|
26
25
|
: undefined,
|
|
27
26
|
script: [
|
|
28
27
|
`cd ${context.build.dir}`,
|
|
29
|
-
...(deployConfig.
|
|
28
|
+
...(((_c = deployConfig.requiresInstall) !== null && _c !== void 0 ? _c : deployConfig.requiresYarnInstall)
|
|
29
|
+
? packageManagerInstall
|
|
30
|
+
: []),
|
|
30
31
|
...deployConfig.script,
|
|
31
32
|
],
|
|
32
33
|
variables: {},
|
|
33
34
|
},
|
|
34
35
|
stop: deployConfig.stopScript
|
|
35
36
|
? {
|
|
36
|
-
image: (
|
|
37
|
+
image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
|
|
37
38
|
script: [...deployConfig.stopScript],
|
|
38
39
|
variables: {},
|
|
39
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/custom/deployJob.ts"],"names":[],"mappings":";;;AAAA,iGAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/custom/deployJob.ts"],"names":[],"mappings":";;;AAAA,iGAA8F;AAC9F,kFAAkF;AAClF,yCAA8C;AAG9C,kCAAgD;AAEhD,oCAA0C;AAEnC,MAAM,sBAAsB,GAAG,KAAK,EACzC,OAAyB,EACA,EAAE;;IAC3B,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,MAAM,0CAAE,MAAM,CAAC;IAE5C,IAAI,CAAC,IAAA,sBAAc,EAAC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5C,oBAAoB;QACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IACD,MAAM,qBAAqB,GAAG,MAAM,IAAA,gDAAwB,EAAC,OAAO,EAAE;QACpE,mBAAmB,EAAE,IAAI;KAC1B,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,4BAAqB,EAAC,OAAO,EAAE;QAC5C,MAAM,EAAE;YACN,KAAK,EAAE,MAAA,YAAY,CAAC,QAAQ,mCAAI,IAAA,uBAAc,EAAC,cAAc,CAAC;YAC9D,KAAK,EAAE,IAAA,2DAA4B,EAAC,OAAO,EAAE,YAAY,CAAC;YAC1D,SAAS,EAAE,YAAY,CAAC,cAAc;gBACpC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,cAAc,EAAE;gBACxC,CAAC,CAAC,SAAS;YACb,MAAM,EAAE;gBACN,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE;gBACzB,GAAG,CAAC,CAAC,MAAA,YAAY,CAAC,eAAe,mCAAI,YAAY,CAAC,mBAAmB,CAAC;oBACpE,CAAC,CAAC,qBAAqB;oBACvB,CAAC,CAAC,EAAE,CAAC;gBACP,GAAG,YAAY,CAAC,MAAM;aACvB;YACD,SAAS,EAAE,EAAE;SACd;QACD,IAAI,EAAE,YAAY,CAAC,UAAU;YAC3B,CAAC,CAAC;gBACE,KAAK,EAAE,MAAA,YAAY,CAAC,QAAQ,mCAAI,IAAA,uBAAc,EAAC,cAAc,CAAC;gBAC9D,MAAM,EAAE,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC;gBACpC,SAAS,EAAE,EAAE;aACd;YACH,CAAC,CAAC,SAAS;KACd,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAtCW,QAAA,sBAAsB,0BAsCjC"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPagesDeployJobs = void 0;
|
|
4
4
|
const getAllCacheConfigsFromConfig_1 = require("../../build/cache/getAllCacheConfigsFromConfig");
|
|
5
|
-
const
|
|
5
|
+
const packageManagerInstall_1 = require("../../build/node/packageManagerInstall");
|
|
6
6
|
const runner_1 = require("../../runner");
|
|
7
7
|
const base_1 = require("../base");
|
|
8
8
|
const types_1 = require("../types");
|
|
9
9
|
const createPagesDeployJobs = async (context) => {
|
|
10
|
-
var _a, _b, _c;
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
11
|
const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
12
12
|
if (!(0, types_1.isOfDeployType)(deployConfig, "pages")) {
|
|
13
13
|
// should not happen
|
|
@@ -22,7 +22,7 @@ const createPagesDeployJobs = async (context) => {
|
|
|
22
22
|
// parallel deployments) — every merge request gets a site preview
|
|
23
23
|
const pathPrefix = context.environment.envType === "review" ? "mr-$CI_MERGE_REQUEST_IID" : "";
|
|
24
24
|
const publishDir = (_b = deployConfig.publishDir) !== null && _b !== void 0 ? _b : "public";
|
|
25
|
-
const
|
|
25
|
+
const packageManagerInstall = await (0, packageManagerInstall_1.getPackageManagerInstall)(context, {
|
|
26
26
|
noCustomPostInstall: true,
|
|
27
27
|
});
|
|
28
28
|
return (0, base_1.createDeployementJobs)(context, {
|
|
@@ -33,7 +33,9 @@ const createPagesDeployJobs = async (context) => {
|
|
|
33
33
|
pages: { path_prefix: pathPrefix },
|
|
34
34
|
script: [
|
|
35
35
|
`cd ${context.build.dir}`,
|
|
36
|
-
...(deployConfig.
|
|
36
|
+
...(((_d = deployConfig.requiresInstall) !== null && _d !== void 0 ? _d : deployConfig.requiresYarnInstall)
|
|
37
|
+
? packageManagerInstall
|
|
38
|
+
: []),
|
|
37
39
|
...deployConfig.script,
|
|
38
40
|
// the gitlab environment url should point at the published site
|
|
39
41
|
// (the base deploy job reports $ROOT_URL as environment url)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/pages/deployJob.ts"],"names":[],"mappings":";;;AAAA,iGAA8F;AAC9F,
|
|
1
|
+
{"version":3,"file":"deployJob.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/deploy/pages/deployJob.ts"],"names":[],"mappings":";;;AAAA,iGAA8F;AAC9F,kFAAkF;AAClF,yCAA8C;AAG9C,kCAAgD;AAChD,oCAA0C;AAEnC,MAAM,qBAAqB,GAAG,KAAK,EACxC,OAAyB,EACA,EAAE;;IAC3B,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,MAAM,0CAAE,MAAM,CAAC;IAC5C,IAAI,CAAC,IAAA,sBAAc,EAAC,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC;QAC3C,oBAAoB;QACpB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;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AAe,EAAE;gBACf,0DAA0D;gBAC1D,YAAY,EAAE,UAAU;gBACxB,iEAAiE;gBACjE,+DAA+D;gBAC/D,yBAAyB,EAAE,KAAK;gBAChC,uBAAuB,EAAE,KAAK;aAC/B;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AArDW,QAAA,qBAAqB,yBAqDhC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithCacheConfig } from "../../build";
|
|
2
|
-
import type {
|
|
2
|
+
import type { JobImageConfig } from "../../customImages/projectImages";
|
|
3
3
|
import type { DeployConfigBase } from "./base";
|
|
4
4
|
export type DeployConfigCustom = {
|
|
5
5
|
/**
|
|
@@ -11,7 +11,13 @@ export type DeployConfigCustom = {
|
|
|
11
11
|
*/
|
|
12
12
|
requiresDocker: boolean;
|
|
13
13
|
/**
|
|
14
|
-
* whether your custom script requires
|
|
14
|
+
* whether your custom script requires the package-manager install
|
|
15
|
+
* (yarn/pnpm, autodetected) to run first
|
|
16
|
+
*/
|
|
17
|
+
requiresInstall?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use {@link requiresInstall} — same behavior (the
|
|
20
|
+
* install always uses the project's detected package manager)
|
|
15
21
|
*/
|
|
16
22
|
requiresYarnInstall?: boolean;
|
|
17
23
|
/**
|
|
@@ -25,7 +31,7 @@ export type DeployConfigCustom = {
|
|
|
25
31
|
/**
|
|
26
32
|
* image to use
|
|
27
33
|
*/
|
|
28
|
-
jobImage?:
|
|
34
|
+
jobImage?: JobImageConfig;
|
|
29
35
|
/**
|
|
30
36
|
* job artifact paths the deploy produces (relative to the repo root)
|
|
31
37
|
*/
|
|
@@ -15,17 +15,17 @@ export type DeployConfigType = DeployConfig["type"];
|
|
|
15
15
|
export type DeployConfigGeneric<T extends DeployConfigType> = Extract<DeployConfig, {
|
|
16
16
|
type: T;
|
|
17
17
|
}>;
|
|
18
|
-
export declare const isOfDeployType: <T extends ("custom" | "kubernetes" | "
|
|
18
|
+
export declare const isOfDeployType: <T extends ("custom" | "kubernetes" | "pages" | "google-cloudrun" | "dockerTag" | "npmPackage")[]>(t: DeployConfig | false | null | undefined, ...types: T) => t is Extract<DeployConfigKubernetes, {
|
|
19
19
|
type: T[number];
|
|
20
|
-
}> | Extract<
|
|
20
|
+
}> | Extract<DeployConfigCustom, {
|
|
21
21
|
type: T[number];
|
|
22
22
|
}> | Extract<DeployConfigCloudRun, {
|
|
23
23
|
type: T[number];
|
|
24
|
-
}> | Extract<
|
|
24
|
+
}> | Extract<DeployConfigDockerTag, {
|
|
25
25
|
type: T[number];
|
|
26
26
|
}> | Extract<DeployConfigNpmPackage, {
|
|
27
27
|
type: T[number];
|
|
28
28
|
}> | Extract<DeployConfigPages, {
|
|
29
29
|
type: T[number];
|
|
30
30
|
}>;
|
|
31
|
-
export declare const getDeployConfigType: (t: DeployConfig | false | null | undefined) => "custom" | "kubernetes" | "
|
|
31
|
+
export declare const getDeployConfigType: (t: DeployConfig | false | null | undefined) => "custom" | "kubernetes" | "pages" | "google-cloudrun" | "dockerTag" | "npmPackage";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { WithCacheConfig } from "../../build";
|
|
2
|
-
import type {
|
|
2
|
+
import type { JobImageConfig } from "../../customImages/projectImages";
|
|
3
3
|
import type { DeployConfigBase } from "./base";
|
|
4
4
|
export type DeployConfigPages = {
|
|
5
5
|
/**
|
|
@@ -27,11 +27,17 @@ export type DeployConfigPages = {
|
|
|
27
27
|
*/
|
|
28
28
|
publishDir?: string;
|
|
29
29
|
/**
|
|
30
|
-
* whether the script needs
|
|
30
|
+
* whether the script needs the package-manager install (yarn/pnpm,
|
|
31
|
+
* autodetected) to run first
|
|
32
|
+
*/
|
|
33
|
+
requiresInstall?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated use {@link requiresInstall} — same behavior (the
|
|
36
|
+
* install always uses the project's detected package manager)
|
|
31
37
|
*/
|
|
32
38
|
requiresYarnInstall?: boolean;
|
|
33
39
|
/**
|
|
34
40
|
* image to use
|
|
35
41
|
*/
|
|
36
|
-
jobImage?:
|
|
42
|
+
jobImage?: JobImageConfig;
|
|
37
43
|
} & DeployConfigBase & WithCacheConfig;
|
|
@@ -3,6 +3,8 @@ export * from "./backends";
|
|
|
3
3
|
export * from "./types";
|
|
4
4
|
export * from "./rules";
|
|
5
5
|
export * from "./runner";
|
|
6
|
+
export * from "./customImages/projectImages";
|
|
7
|
+
export * from "./customImages/jobImagesPlan";
|
|
6
8
|
export * from "./config";
|
|
7
9
|
export * from "./store";
|
|
8
10
|
export * from "./context";
|
|
@@ -19,6 +19,8 @@ __exportStar(require("./backends"), exports);
|
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
__exportStar(require("./rules"), exports);
|
|
21
21
|
__exportStar(require("./runner"), exports);
|
|
22
|
+
__exportStar(require("./customImages/projectImages"), exports);
|
|
23
|
+
__exportStar(require("./customImages/jobImagesPlan"), exports);
|
|
22
24
|
__exportStar(require("./config"), exports);
|
|
23
25
|
__exportStar(require("./store"), exports);
|
|
24
26
|
__exportStar(require("./context"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pipeline/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,0CAAwB;AACxB,0CAAwB;AACxB,2CAAyB;AACzB,+DAA6C;AAC7C,+DAA6C;AAC7C,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,0CAAwB;AACxB,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,qDAAmC;AACnC,sDAAoC;AACpC,kDAAgC;AAChC,2CAAyB;AACzB,gDAA8B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import memoizee from "memoizee";
|
|
2
|
+
import type { PackageManagerType } from "../types/context";
|
|
3
|
+
export type DetectedPackageManager = {
|
|
4
|
+
type: PackageManagerType;
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* detect which package manager the project uses (and its version).
|
|
9
|
+
*
|
|
10
|
+
* Order: the `packageManager` field in package.json (cwd, then git root)
|
|
11
|
+
* wins, then the lockfile present (pnpm-lock.yaml → pnpm, yarn.lock →
|
|
12
|
+
* yarn), then falling back to yarn (the historical default).
|
|
13
|
+
*
|
|
14
|
+
* An `explicitType` (from `packageManager` in catladder.ts) overrides the
|
|
15
|
+
* detected type; the version is still taken from the `packageManager`
|
|
16
|
+
* field when it pins the same manager, otherwise from the installed CLI.
|
|
17
|
+
*/
|
|
18
|
+
export declare const detectPackageManager: ((explicitType?: PackageManagerType) => Promise<DetectedPackageManager>) & memoizee.Memoized<(explicitType?: PackageManagerType) => Promise<DetectedPackageManager>>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.detectPackageManager = void 0;
|
|
7
|
+
const child_process_promise_1 = require("child-process-promise");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const promises_1 = require("fs/promises");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const memoizee_1 = __importDefault(require("memoizee"));
|
|
12
|
+
const readPackageManagerField = async (dir) => {
|
|
13
|
+
try {
|
|
14
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(dir, "package.json"), "utf-8"));
|
|
15
|
+
const match = /^(yarn|pnpm)@(.+)$/.exec(pkg.packageManager);
|
|
16
|
+
if (!match)
|
|
17
|
+
return null;
|
|
18
|
+
return { type: match[1], version: match[2] };
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const detectByLockfile = (dir) => {
|
|
25
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "pnpm-lock.yaml")))
|
|
26
|
+
return "pnpm";
|
|
27
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(dir, "yarn.lock")))
|
|
28
|
+
return "yarn";
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
const getGitRoot = async () => {
|
|
32
|
+
try {
|
|
33
|
+
return (await (0, child_process_promise_1.exec)("git rev-parse --show-toplevel")).stdout.trim();
|
|
34
|
+
}
|
|
35
|
+
catch (_a) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getInstalledVersion = async (type) => {
|
|
40
|
+
try {
|
|
41
|
+
return (await (0, child_process_promise_1.exec)(`${type} --version`)).stdout.trim();
|
|
42
|
+
}
|
|
43
|
+
catch (_a) {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* detect which package manager the project uses (and its version).
|
|
49
|
+
*
|
|
50
|
+
* Order: the `packageManager` field in package.json (cwd, then git root)
|
|
51
|
+
* wins, then the lockfile present (pnpm-lock.yaml → pnpm, yarn.lock →
|
|
52
|
+
* yarn), then falling back to yarn (the historical default).
|
|
53
|
+
*
|
|
54
|
+
* An `explicitType` (from `packageManager` in catladder.ts) overrides the
|
|
55
|
+
* detected type; the version is still taken from the `packageManager`
|
|
56
|
+
* field when it pins the same manager, otherwise from the installed CLI.
|
|
57
|
+
*/
|
|
58
|
+
exports.detectPackageManager = (0, memoizee_1.default)(async (explicitType) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const roots = [process.cwd()];
|
|
61
|
+
const gitRoot = await getGitRoot();
|
|
62
|
+
if (gitRoot && gitRoot !== process.cwd())
|
|
63
|
+
roots.push(gitRoot);
|
|
64
|
+
let fromField = null;
|
|
65
|
+
for (const root of roots) {
|
|
66
|
+
fromField = await readPackageManagerField(root);
|
|
67
|
+
if (fromField)
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
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";
|
|
71
|
+
const version = (fromField === null || fromField === void 0 ? void 0 : fromField.type) === detectedType
|
|
72
|
+
? fromField.version
|
|
73
|
+
: await getInstalledVersion(detectedType);
|
|
74
|
+
return { type: detectedType, version };
|
|
75
|
+
}, { promise: true });
|
|
76
|
+
//# sourceMappingURL=detectPackageManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectPackageManager.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/detectPackageManager.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA6C;AAC7C,2BAAgC;AAChC,0CAAuC;AACvC,+BAA4B;AAC5B,wDAAgC;AAQhC,MAAM,uBAAuB,GAAG,KAAK,EACnC,GAAW,EAC6B,EAAE;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3E,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,GAA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,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,UAAU,EAAE,CAAC;IACnC,IAAI,OAAO,IAAI,OAAO,KAAK,OAAO,CAAC,GAAG,EAAE;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE9D,IAAI,SAAS,GAAkC,IAAI,CAAC;IACpD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,SAAS,GAAG,MAAM,uBAAuB,CAAC,IAAI,CAAC,CAAC;QAChD,IAAI,SAAS;YAAE,MAAM;IACvB,CAAC;IAED,MAAM,YAAY,GAChB,MAAA,MAAA,YAAY,aAAZ,YAAY,cAAZ,YAAY,GACZ,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,mCACf,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mCACzC,MAAM,CAAC;IAET,MAAM,OAAO,GACX,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,YAAY;QAC9B,CAAC,CAAC,SAAS,CAAC,OAAO;QACnB,CAAC,CAAC,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAE9C,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AACzC,CAAC,EACD,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Config, PackageManagerInfoBase, PackageManagerInfoComponent } from "../types";
|
|
2
2
|
import memoizee from "memoizee";
|
|
3
3
|
export declare const getPackageManagerInfoForComponent: (config: Config, componentName: string) => Promise<PackageManagerInfoComponent>;
|
|
4
|
-
export declare const getPackageManagerInfoBase: (() => Promise<PackageManagerInfoBase>) & memoizee.Memoized<() => Promise<PackageManagerInfoBase>>;
|
|
4
|
+
export declare const getPackageManagerInfoBase: ((config?: Config) => Promise<PackageManagerInfoBase>) & memoizee.Memoized<(config?: Config) => Promise<PackageManagerInfoBase>>;
|
|
@@ -7,12 +7,23 @@ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent =
|
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = require("path");
|
|
9
9
|
const path_equal_1 = require("path-equal");
|
|
10
|
+
const detectPackageManager_1 = require("./detectPackageManager");
|
|
11
|
+
const pnpmUtils_1 = require("./pnpm/pnpmUtils");
|
|
10
12
|
const yarnUtils_1 = require("./yarn/yarnUtils");
|
|
11
13
|
const memoizee_1 = __importDefault(require("memoizee"));
|
|
14
|
+
const PACKAGE_MANAGER_FILES = {
|
|
15
|
+
yarn: {
|
|
16
|
+
lockFile: "yarn.lock",
|
|
17
|
+
configFiles: [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"], // ".yarn" is yarn 2 folder
|
|
18
|
+
},
|
|
19
|
+
pnpm: {
|
|
20
|
+
lockFile: "pnpm-lock.yaml",
|
|
21
|
+
configFiles: ["pnpm-workspace.yaml", ".npmrc", ".pnpmfile.cjs"],
|
|
22
|
+
},
|
|
23
|
+
};
|
|
12
24
|
const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
13
|
-
const baseInfo = await (0, exports.getPackageManagerInfoBase)();
|
|
25
|
+
const baseInfo = await (0, exports.getPackageManagerInfoBase)(config);
|
|
14
26
|
const { workspaces } = baseInfo;
|
|
15
|
-
// currently only supports yarn
|
|
16
27
|
const component = config.components[componentName];
|
|
17
28
|
const currentWorkspace = workspaces.find((w) => (0, path_equal_1.pathEqual)(component.dir, w.location));
|
|
18
29
|
const componentIsInWorkspace = Boolean(currentWorkspace);
|
|
@@ -21,10 +32,10 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
21
32
|
const workspacePackageJson = componentIsInWorkspace
|
|
22
33
|
? (0, path_1.join)(workspaceRoot, "package.json")
|
|
23
34
|
: null;
|
|
35
|
+
const { lockFile: lockFileName, configFiles } = PACKAGE_MANAGER_FILES[baseInfo.type];
|
|
24
36
|
const lockFile = componentIsInWorkspace
|
|
25
|
-
? (0, path_1.join)(workspaceRoot,
|
|
26
|
-
: (0, path_1.join)(component.dir,
|
|
27
|
-
const configFiles = [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"]; // ".yarn" is yarn 2 folder
|
|
37
|
+
? (0, path_1.join)(workspaceRoot, lockFileName)
|
|
38
|
+
: (0, path_1.join)(component.dir, lockFileName);
|
|
28
39
|
// copy all those configFiles from workspace root and/or component folder
|
|
29
40
|
const configFilePaths = [
|
|
30
41
|
...configFiles,
|
|
@@ -35,12 +46,27 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
35
46
|
const currentWorkspaceDependencies = currentWorkspace
|
|
36
47
|
? (0, yarnUtils_1.getWorkspaceDependencies)(currentWorkspace, workspaces)
|
|
37
48
|
: [];
|
|
49
|
+
// pnpm's --frozen-lockfile check requires every importer of the
|
|
50
|
+
// lockfile to exist on disk, so all workspace manifests (not just the
|
|
51
|
+
// dependency workspaces, which are copied entirely) go into the image
|
|
52
|
+
const allWorkspaceManifests = baseInfo.type === "pnpm" && componentIsInWorkspace
|
|
53
|
+
? workspaces
|
|
54
|
+
.map((w) => (0, path_1.join)(w.location, "package.json"))
|
|
55
|
+
.filter((f) => (0, fs_1.existsSync)(f))
|
|
56
|
+
: [];
|
|
57
|
+
// patch files referenced by patchedDependencies must exist in the
|
|
58
|
+
// image, or pnpm's frozen install fails verifying them
|
|
59
|
+
const patchFiles = baseInfo.type === "pnpm"
|
|
60
|
+
? (0, pnpmUtils_1.getPnpmPatchFiles)(componentIsInWorkspace ? workspaceRoot : component.dir)
|
|
61
|
+
: [];
|
|
38
62
|
const pathsToCopyInDocker = [
|
|
39
63
|
...new Set([
|
|
40
64
|
packageJson,
|
|
41
65
|
...(workspacePackageJson ? [workspacePackageJson] : []),
|
|
42
66
|
lockFile,
|
|
43
67
|
...configFilePaths,
|
|
68
|
+
...allWorkspaceManifests,
|
|
69
|
+
...patchFiles,
|
|
44
70
|
...currentWorkspaceDependencies,
|
|
45
71
|
]),
|
|
46
72
|
];
|
|
@@ -53,11 +79,17 @@ const getPackageManagerInfoForComponent = async (config, componentName) => {
|
|
|
53
79
|
};
|
|
54
80
|
};
|
|
55
81
|
exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
|
|
56
|
-
const _getPackageManagerInfoBase = async () => {
|
|
57
|
-
|
|
58
|
-
const version = await (0, yarnUtils_1.getYarnVersion)();
|
|
82
|
+
const _getPackageManagerInfoBase = async (config) => {
|
|
83
|
+
const { type, version } = await (0, detectPackageManager_1.detectPackageManager)(config === null || config === void 0 ? void 0 : config.packageManager);
|
|
59
84
|
if (!version)
|
|
60
|
-
throw new Error(
|
|
85
|
+
throw new Error(`could not get ${type} version`);
|
|
86
|
+
if (type === "pnpm") {
|
|
87
|
+
return {
|
|
88
|
+
type: "pnpm",
|
|
89
|
+
workspaces: await (0, pnpmUtils_1.getPnpmWorkspaces)(),
|
|
90
|
+
version,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
61
93
|
const isClassic = version.startsWith("1");
|
|
62
94
|
const workspaces = await (0, yarnUtils_1.getWorkspaces)(isClassic);
|
|
63
95
|
return {
|
|
@@ -69,5 +101,7 @@ const _getPackageManagerInfoBase = async () => {
|
|
|
69
101
|
};
|
|
70
102
|
exports.getPackageManagerInfoBase = (0, memoizee_1.default)(_getPackageManagerInfoBase, {
|
|
71
103
|
promise: true,
|
|
104
|
+
// memoize per explicit packageManager choice, not per config identity
|
|
105
|
+
normalizer: ([config]) => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.packageManager) !== null && _a !== void 0 ? _a : ""; },
|
|
72
106
|
});
|
|
73
107
|
//# sourceMappingURL=packageManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/packageManager.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAgC;AAChC,+BAA4B;AAC5B,2CAAuC;AAMvC,
|
|
1
|
+
{"version":3,"file":"packageManager.js","sourceRoot":"","sources":["../../../../../../../packages/pipeline/src/pipeline/packageManager.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAgC;AAChC,+BAA4B;AAC5B,2CAAuC;AAMvC,iEAA8D;AAC9D,gDAAwE;AACxE,gDAA2E;AAC3E,wDAAgC;AAEhC,MAAM,qBAAqB,GAAG;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,WAAW;QACrB,WAAW,EAAE,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,2BAA2B;KACxF;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,gBAAgB;QAC1B,WAAW,EAAE,CAAC,qBAAqB,EAAE,QAAQ,EAAE,eAAe,CAAC;KAChE;CACO,CAAC;AAEJ,MAAM,iCAAiC,GAAG,KAAK,EACpD,MAAc,EACd,aAAqB,EACiB,EAAE;IACxC,MAAM,QAAQ,GAAG,MAAM,IAAA,iCAAyB,EAAC,MAAM,CAAC,CAAC;IACzD,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAEhC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACnD,MAAM,gBAAgB,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC7C,IAAA,sBAAS,EAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CACrC,CAAC;IACF,MAAM,sBAAsB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,GAAG,CAAC,CAAC,mFAAmF;IAC9G,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,SAAS,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IACxD,MAAM,oBAAoB,GAAG,sBAAsB;QACjD,CAAC,CAAC,IAAA,WAAI,EAAC,aAAa,EAAE,cAAc,CAAC;QACrC,CAAC,C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;IAC5E,OAAO,EAAE,IAAI;IACb,sEAAsE;IACtE,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,WAAC,OAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,cAAc,mCAAI,EAAE,CAAA,EAAA;CACvD,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import memoizee from "memoizee";
|
|
2
|
+
import type { YarnWorkspace } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* patch files referenced by `patchedDependencies` (pnpm-workspace.yaml
|
|
5
|
+
* or the root package.json's `pnpm` section) — they must travel into
|
|
6
|
+
* the docker build context, or the prod install fails to verify them
|
|
7
|
+
*/
|
|
8
|
+
export declare const getPnpmPatchFiles: (root?: string) => string[];
|
|
9
|
+
/**
|
|
10
|
+
* list pnpm workspace projects in the same shape yarn berry reports them
|
|
11
|
+
* (locations relative to the project root, workspace dependencies as
|
|
12
|
+
* locations). Outside a pnpm workspace this returns [].
|
|
13
|
+
*/
|
|
14
|
+
export declare const getPnpmWorkspaces: (() => Promise<Array<YarnWorkspace>>) & memoizee.Memoized<() => Promise<Array<YarnWorkspace>>>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPnpmWorkspaces = exports.getPnpmPatchFiles = void 0;
|
|
7
|
+
const child_process_promise_1 = require("child-process-promise");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const promises_1 = require("fs/promises");
|
|
10
|
+
const path_1 = require("path");
|
|
11
|
+
const memoizee_1 = __importDefault(require("memoizee"));
|
|
12
|
+
const yaml_1 = require("yaml");
|
|
13
|
+
const jsonParse_1 = require("../../utils/jsonParse");
|
|
14
|
+
const readWorkspaceDependencyLocations = async (location, locationByName) => {
|
|
15
|
+
var _a, _b, _c;
|
|
16
|
+
try {
|
|
17
|
+
const pkg = JSON.parse(await (0, promises_1.readFile)((0, path_1.join)(location, "package.json"), "utf-8"));
|
|
18
|
+
const depNames = [
|
|
19
|
+
...Object.keys((_a = pkg.dependencies) !== null && _a !== void 0 ? _a : {}),
|
|
20
|
+
...Object.keys((_b = pkg.devDependencies) !== null && _b !== void 0 ? _b : {}),
|
|
21
|
+
...Object.keys((_c = pkg.optionalDependencies) !== null && _c !== void 0 ? _c : {}),
|
|
22
|
+
];
|
|
23
|
+
return [
|
|
24
|
+
...new Set(depNames
|
|
25
|
+
.map((name) => locationByName.get(name))
|
|
26
|
+
.filter((l) => Boolean(l) && l !== location)),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
catch (_d) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* patch files referenced by `patchedDependencies` (pnpm-workspace.yaml
|
|
35
|
+
* or the root package.json's `pnpm` section) — they must travel into
|
|
36
|
+
* the docker build context, or the prod install fails to verify them
|
|
37
|
+
*/
|
|
38
|
+
const getPnpmPatchFiles = (root = ".") => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
const patchedDependencies = {};
|
|
41
|
+
try {
|
|
42
|
+
const ws = (0, yaml_1.parse)((0, fs_1.readFileSync)((0, path_1.join)(root, "pnpm-workspace.yaml"), "utf-8"));
|
|
43
|
+
Object.assign(patchedDependencies, (_a = ws === null || ws === void 0 ? void 0 : ws.patchedDependencies) !== null && _a !== void 0 ? _a : {});
|
|
44
|
+
}
|
|
45
|
+
catch (_d) {
|
|
46
|
+
// no workspace file
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(root, "package.json"), "utf-8"));
|
|
50
|
+
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 : {});
|
|
51
|
+
}
|
|
52
|
+
catch (_e) {
|
|
53
|
+
// no package.json
|
|
54
|
+
}
|
|
55
|
+
return [
|
|
56
|
+
...new Set(Object.values(patchedDependencies)
|
|
57
|
+
.map((p) => (0, path_1.join)(root, p))
|
|
58
|
+
.filter((p) => (0, fs_1.existsSync)(p))),
|
|
59
|
+
];
|
|
60
|
+
};
|
|
61
|
+
exports.getPnpmPatchFiles = getPnpmPatchFiles;
|
|
62
|
+
/**
|
|
63
|
+
* list pnpm workspace projects in the same shape yarn berry reports them
|
|
64
|
+
* (locations relative to the project root, workspace dependencies as
|
|
65
|
+
* locations). Outside a pnpm workspace this returns [].
|
|
66
|
+
*/
|
|
67
|
+
// export for mocking
|
|
68
|
+
exports.getPnpmWorkspaces = (0, memoizee_1.default)(async () => {
|
|
69
|
+
let output;
|
|
70
|
+
try {
|
|
71
|
+
output = (await (0, child_process_promise_1.exec)("pnpm m ls --json --depth -1")).stdout;
|
|
72
|
+
}
|
|
73
|
+
catch (_a) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const projects = (0, jsonParse_1.jsonParseOrThrow)(output.trim() || "[]");
|
|
77
|
+
if (!Array.isArray(projects))
|
|
78
|
+
return [];
|
|
79
|
+
const withLocations = projects
|
|
80
|
+
.filter((p) => p.name && p.path)
|
|
81
|
+
.map((p) => ({
|
|
82
|
+
name: p.name,
|
|
83
|
+
location: (0, path_1.relative)(process.cwd(), p.path) || ".",
|
|
84
|
+
}));
|
|
85
|
+
const locationByName = new Map(withLocations.map((p) => [p.name, p.location]));
|
|
86
|
+
return Promise.all(withLocations.map(async ({ name, location }) => ({
|
|
87
|
+
name,
|
|
88
|
+
location,
|
|
89
|
+
workspaceDependencies: await readWorkspaceDependencyLocations(location, locationByName),
|
|
90
|
+
mismatchedWorkspaceDependencies: [],
|
|
91
|
+
})));
|
|
92
|
+
}, { promise: true });
|
|
93
|
+
//# sourceMappingURL=pnpmUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pnpmUtils.js","sourceRoot":"","sources":["../../../../../../../../packages/pipeline/src/pipeline/pnpm/pnpmUtils.ts"],"names":[],"mappings":";;;;;;AAAA,iEAA6C;AAC7C,2BAA8C;AAC9C,0CAAuC;AACvC,+BAAsC;AACtC,wDAAgC;AAChC,+BAA6B;AAE7B,qDAAyD;AAQzD,MAAM,gCAAgC,GAAG,KAAK,EAC5C,QAAgB,EAChB,cAAmC,EAChB,EAAE;;IACrB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CACpB,MAAM,IAAA,mBAAQ,EAAC,IAAA,WAAI,EAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC,CACxD,CAAC;QACF,MAAM,QAAQ,GAAG;YACf,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,GAAG,CAAC,YAAY,mCAAI,EAAE,CAAC;YACtC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,GAAG,CAAC,eAAe,mCAAI,EAAE,CAAC;YACzC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAA,GAAG,CAAC,oBAAoB,mCAAI,EAAE,CAAC;SAC/C,CAAC;QACF,OAAO;YACL,GAAG,IAAI,GAAG,CACR,QAAQ;iBACL,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;iBACvC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,CAC5D;SACF,CAAC;IACJ,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAI,GAAG,GAAG,EAAY,EAAE;;IACxD,M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