skuba 16.0.0 → 16.0.1
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/lib/cli/lint/internalLints/upgrade/patches/15.3.0/index.js +0 -5
- package/lib/cli/lint/internalLints/upgrade/patches/15.3.0/index.js.map +2 -2
- package/package.json +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/15.3.0/patchDockerfilePruneProd.d.ts +0 -3
- package/lib/cli/lint/internalLints/upgrade/patches/15.3.0/patchDockerfilePruneProd.js +0 -63
- package/lib/cli/lint/internalLints/upgrade/patches/15.3.0/patchDockerfilePruneProd.js.map +0 -7
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { tryMigrateToESM } from "./migrateToESM.js";
|
|
3
|
-
import { tryPatchDockerfilePruneProd } from "./patchDockerfilePruneProd.js";
|
|
4
3
|
import { tryRemovePnpmConfigPackageJson } from "./removePnpmConfigPackageJson.js";
|
|
5
4
|
export const patches = [
|
|
6
|
-
{
|
|
7
|
-
apply: tryPatchDockerfilePruneProd,
|
|
8
|
-
description: "Replace pnpm install --prod with pnpm prune --prod in Dockerfiles"
|
|
9
|
-
},
|
|
10
5
|
{
|
|
11
6
|
apply: tryRemovePnpmConfigPackageJson,
|
|
12
7
|
description: "Remove pnpm-plugin-skuba from package.json pnpm config"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/15.3.0/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryMigrateToESM } from './migrateToESM.js';\nimport {
|
|
5
|
-
"mappings": ";AAEA,SAAS,uBAAuB;AAChC,SAAS,
|
|
4
|
+
"sourcesContent": ["import type { Patches } from '../../index.js';\n\nimport { tryMigrateToESM } from './migrateToESM.js';\nimport { tryRemovePnpmConfigPackageJson } from './removePnpmConfigPackageJson.js';\n\nexport const patches: Patches = [\n {\n apply: tryRemovePnpmConfigPackageJson,\n description: 'Remove pnpm-plugin-skuba from package.json pnpm config',\n },\n {\n apply: tryMigrateToESM,\n description: 'Migrate to ESM',\n },\n];\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,uBAAuB;AAChC,SAAS,sCAAsC;AAExC,aAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "16.0.
|
|
3
|
+
"version": "16.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SEEK development toolkit for backend applications and packages",
|
|
6
6
|
"homepage": "https://github.com/seek-oss/skuba#readme",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"semver": "7.7.4",
|
|
139
139
|
"supertest": "7.2.2",
|
|
140
140
|
"type-fest": "2.19.0",
|
|
141
|
-
"@skuba-lib/changesets-changelog": "^1.0.
|
|
141
|
+
"@skuba-lib/changesets-changelog": "^1.0.1"
|
|
142
142
|
},
|
|
143
143
|
"engines": {
|
|
144
144
|
"node": ">=22.18.0"
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { inspect } from "util";
|
|
3
|
-
import fg from "fast-glob";
|
|
4
|
-
import fs from "fs-extra";
|
|
5
|
-
import { log } from "../../../../../../utils/logging.js";
|
|
6
|
-
const pnpmInstallProdTestRegex = /^RUN (CI=true )?pnpm install.*--prod/m;
|
|
7
|
-
const pnpmInstallProdReplaceRegex = /^RUN (CI=true )?pnpm install.*--prod/gm;
|
|
8
|
-
export const patchDockerfilePruneProd = async (mode) => {
|
|
9
|
-
const dockerfilePaths = await fg(["**/Dockerfile*"], {
|
|
10
|
-
ignore: ["**/.git", "**/node_modules"]
|
|
11
|
-
});
|
|
12
|
-
if (dockerfilePaths.length === 0) {
|
|
13
|
-
return {
|
|
14
|
-
result: "skip",
|
|
15
|
-
reason: "no dockerfiles found"
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
const dockerfiles = await Promise.all(
|
|
19
|
-
dockerfilePaths.map(async (file) => {
|
|
20
|
-
const contents = await fs.promises.readFile(file, "utf8");
|
|
21
|
-
return {
|
|
22
|
-
file,
|
|
23
|
-
contents
|
|
24
|
-
};
|
|
25
|
-
})
|
|
26
|
-
);
|
|
27
|
-
const dockerfilesToPatch = dockerfiles.filter(
|
|
28
|
-
({ contents }) => pnpmInstallProdTestRegex.test(contents)
|
|
29
|
-
);
|
|
30
|
-
if (dockerfilesToPatch.length === 0) {
|
|
31
|
-
return {
|
|
32
|
-
result: "skip",
|
|
33
|
-
reason: "no dockerfiles to patch"
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
if (mode === "lint") {
|
|
37
|
-
return {
|
|
38
|
-
result: "apply"
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
await Promise.all(
|
|
42
|
-
dockerfilesToPatch.map(async ({ file, contents }) => {
|
|
43
|
-
const updatedContents = contents.replace(
|
|
44
|
-
pnpmInstallProdReplaceRegex,
|
|
45
|
-
"RUN pnpm prune --prod"
|
|
46
|
-
);
|
|
47
|
-
await fs.promises.writeFile(file, updatedContents, "utf8");
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
return {
|
|
51
|
-
result: "apply"
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
export const tryPatchDockerfilePruneProd = async ({ mode }) => {
|
|
55
|
-
try {
|
|
56
|
-
return await patchDockerfilePruneProd(mode);
|
|
57
|
-
} catch (err) {
|
|
58
|
-
log.warn("Failed to apply Dockerfile pnpm prune --prod patch.");
|
|
59
|
-
log.subtle(inspect(err));
|
|
60
|
-
return { result: "skip", reason: "due to an error" };
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
//# sourceMappingURL=patchDockerfilePruneProd.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/15.3.0/patchDockerfilePruneProd.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst pnpmInstallProdTestRegex = /^RUN (CI=true )?pnpm install.*--prod/m;\nconst pnpmInstallProdReplaceRegex = /^RUN (CI=true )?pnpm install.*--prod/gm;\n\nexport const patchDockerfilePruneProd = async (\n mode: 'lint' | 'format',\n): Promise<PatchReturnType> => {\n const dockerfilePaths = await fg(['**/Dockerfile*'], {\n ignore: ['**/.git', '**/node_modules'],\n });\n\n if (dockerfilePaths.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles found',\n };\n }\n\n const dockerfiles = await Promise.all(\n dockerfilePaths.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n const dockerfilesToPatch = dockerfiles.filter(({ contents }) =>\n pnpmInstallProdTestRegex.test(contents),\n );\n\n if (dockerfilesToPatch.length === 0) {\n return {\n result: 'skip',\n reason: 'no dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all(\n dockerfilesToPatch.map(async ({ file, contents }) => {\n const updatedContents = contents.replace(\n pnpmInstallProdReplaceRegex,\n 'RUN pnpm prune --prod',\n );\n await fs.promises.writeFile(file, updatedContents, 'utf8');\n }),\n );\n\n return {\n result: 'apply',\n };\n};\n\nexport const tryPatchDockerfilePruneProd: PatchFunction = async ({ mode }) => {\n try {\n return await patchDockerfilePruneProd(mode);\n } catch (err) {\n log.warn('Failed to apply Dockerfile pnpm prune --prod patch.');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,eAAe;AAExB,OAAO,QAAQ;AACf,OAAO,QAAQ;AAEf,SAAS,WAAW;AAGpB,MAAM,2BAA2B;AACjC,MAAM,8BAA8B;AAE7B,aAAM,2BAA2B,OACtC,SAC6B;AAC7B,QAAM,kBAAkB,MAAM,GAAG,CAAC,gBAAgB,GAAG;AAAA,IACnD,QAAQ,CAAC,WAAW,iBAAiB;AAAA,EACvC,CAAC;AAED,MAAI,gBAAgB,WAAW,GAAG;AAChC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,QAAQ;AAAA,IAChC,gBAAgB,IAAI,OAAO,SAAS;AAClC,YAAM,WAAW,MAAM,GAAG,SAAS,SAAS,MAAM,MAAM;AAExD,aAAO;AAAA,QACL;AAAA,QACA;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,qBAAqB,YAAY;AAAA,IAAO,CAAC,EAAE,SAAS,MACxD,yBAAyB,KAAK,QAAQ;AAAA,EACxC;AAEA,MAAI,mBAAmB,WAAW,GAAG;AACnC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO;AAAA,MACL,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,mBAAmB,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AACnD,YAAM,kBAAkB,SAAS;AAAA,QAC/B;AAAA,QACA;AAAA,MACF;AACA,YAAM,GAAG,SAAS,UAAU,MAAM,iBAAiB,MAAM;AAAA,IAC3D,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL,QAAQ;AAAA,EACV;AACF;AAEO,aAAM,8BAA6C,OAAO,EAAE,KAAK,MAAM;AAC5E,MAAI;AACF,WAAO,MAAM,yBAAyB,IAAI;AAAA,EAC5C,SAAS,KAAK;AACZ,QAAI,KAAK,qDAAqD;AAC9D,QAAI,OAAO,QAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|