skuba 11.0.0-feat-npmrc-to-workspace-20250511014436 → 11.0.0-main-20250511022834
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/configure/processing/configFile.d.ts +2 -2
- package/lib/cli/configure/processing/configFile.js +21 -18
- package/lib/cli/configure/processing/configFile.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +2 -6
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +22 -26
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +0 -5
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +9 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js +95 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js.map +7 -0
- package/lib/utils/copy.js +1 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +0 -10
- package/lib/utils/dir.js +2 -74
- package/lib/utils/dir.js.map +3 -3
- package/lib/utils/npmrc.d.ts +1 -0
- package/lib/utils/npmrc.js +3 -0
- package/lib/utils/npmrc.js.map +2 -2
- package/package.json +2 -2
- package/template/base/_.gitignore +0 -2
- package/template/base/_.npmrc +9 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/express-rest-api/Dockerfile.dev-deps +2 -2
- package/template/greeter/.buildkite/pipeline.yml +1 -1
- package/template/greeter/Dockerfile +2 -2
- package/template/greeter/package.json +1 -1
- package/template/koa-rest-api/.buildkite/pipeline.yml +1 -1
- package/template/koa-rest-api/Dockerfile.dev-deps +2 -2
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +1 -1
- package/template/lambda-sqs-worker-cdk/Dockerfile +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +1 -1
- package/template/oss-npm-package/_package.json +1 -1
- package/template/private-npm-package/_package.json +1 -1
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +0 -167
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +0 -7
- package/template/base/_pnpm-workspace.yaml +0 -10
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* than `lib/`) but they generally represent the same _intent_.
|
|
6
6
|
*/
|
|
7
7
|
export declare const generateIgnoreFileSimpleVariants: (patterns: string[]) => Set<string>;
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const mergeWithConfigFile: (rawTemplateFile: string, fileType?: "ignore" | "
|
|
8
|
+
export declare const generateNpmrcSimpleVariants: (patterns: string[]) => Set<string>;
|
|
9
|
+
export declare const mergeWithConfigFile: (rawTemplateFile: string, fileType?: "ignore" | "npmrc") => (rawInputFile?: string) => string;
|
|
@@ -19,8 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var configFile_exports = {};
|
|
20
20
|
__export(configFile_exports, {
|
|
21
21
|
generateIgnoreFileSimpleVariants: () => generateIgnoreFileSimpleVariants,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
generateNpmrcSimpleVariants: () => generateNpmrcSimpleVariants,
|
|
23
|
+
mergeWithConfigFile: () => mergeWithConfigFile
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(configFile_exports);
|
|
26
26
|
const OUTDATED_PATTERNS = ["node_modules_bak/", "tmp-*/"];
|
|
@@ -46,18 +46,24 @@ const generateIgnoreFileSimpleVariants = (patterns) => {
|
|
|
46
46
|
set.delete("");
|
|
47
47
|
return set;
|
|
48
48
|
};
|
|
49
|
-
const
|
|
49
|
+
const generateNpmrcSimpleVariants = (patterns) => {
|
|
50
|
+
const set = /* @__PURE__ */ new Set();
|
|
51
|
+
for (const pattern of patterns) {
|
|
52
|
+
set.add(pattern);
|
|
53
|
+
const match = /^(?<key>[^"=]+)="?(?<value>[^"=]+)"?$/.exec(pattern);
|
|
54
|
+
if (!match?.groups) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const { key, value } = match.groups;
|
|
58
|
+
set.add(`${key}=${value}`);
|
|
59
|
+
set.add(`${key}="${value}"`);
|
|
60
|
+
}
|
|
61
|
+
set.delete("");
|
|
62
|
+
return set;
|
|
63
|
+
};
|
|
50
64
|
const mergeWithConfigFile = (rawTemplateFile, fileType = "ignore") => {
|
|
51
65
|
const templateFile = rawTemplateFile.trim();
|
|
52
|
-
|
|
53
|
-
switch (fileType) {
|
|
54
|
-
case "ignore":
|
|
55
|
-
generator = generateIgnoreFileSimpleVariants;
|
|
56
|
-
break;
|
|
57
|
-
case "pnpm-workspace":
|
|
58
|
-
generator = () => /* @__PURE__ */ new Set();
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
66
|
+
const generator = fileType === "ignore" ? generateIgnoreFileSimpleVariants : generateNpmrcSimpleVariants;
|
|
61
67
|
const templatePatterns = generator([
|
|
62
68
|
...OUTDATED_PATTERNS,
|
|
63
69
|
...templateFile.split("\n").map((line) => line.trim())
|
|
@@ -67,10 +73,7 @@ const mergeWithConfigFile = (rawTemplateFile, fileType = "ignore") => {
|
|
|
67
73
|
return `${templateFile}
|
|
68
74
|
`;
|
|
69
75
|
}
|
|
70
|
-
const replacedFile =
|
|
71
|
-
rawInputFile.replace(/\r?\n/g, "\n"),
|
|
72
|
-
templateFile
|
|
73
|
-
);
|
|
76
|
+
const replacedFile = rawInputFile.replace(/\r?\n/g, "\n").replace(/# managed by skuba[\s\S]*# end managed by skuba/, templateFile);
|
|
74
77
|
if (replacedFile.includes(templateFile)) {
|
|
75
78
|
return replacedFile;
|
|
76
79
|
}
|
|
@@ -83,7 +86,7 @@ const mergeWithConfigFile = (rawTemplateFile, fileType = "ignore") => {
|
|
|
83
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
84
87
|
0 && (module.exports = {
|
|
85
88
|
generateIgnoreFileSimpleVariants,
|
|
86
|
-
|
|
87
|
-
|
|
89
|
+
generateNpmrcSimpleVariants,
|
|
90
|
+
mergeWithConfigFile
|
|
88
91
|
});
|
|
89
92
|
//# sourceMappingURL=configFile.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/processing/configFile.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Patterns that are superseded by skuba's bundled ignore file patterns and are\n * non-trivial to derive using e.g. `generateSimpleVariants`.\n */\nconst OUTDATED_PATTERNS = ['node_modules_bak/', 'tmp-*/'];\n\nconst ASTERISKS = /\\*/g;\nconst LEADING_SLASH = /^\\//;\nconst TRAILING_SLASH = /\\/$/;\n\n/**\n * Generate simple variants of an ignore pattern for exact matching purposes.\n *\n * Note that these patterns are not actually equivalent (e.g. `lib` matches more\n * than `lib/`) but they generally represent the same _intent_.\n */\nexport const generateIgnoreFileSimpleVariants = (patterns: string[]) => {\n const set = new Set<string>();\n\n for (const pattern of patterns) {\n const deAsterisked = pattern.replace(ASTERISKS, '');\n const stripped = deAsterisked\n .replace(LEADING_SLASH, '')\n .replace(TRAILING_SLASH, '');\n\n set.add(pattern);\n set.add(deAsterisked);\n set.add(deAsterisked.replace(LEADING_SLASH, ''));\n set.add(deAsterisked.replace(TRAILING_SLASH, ''));\n set.add(stripped);\n\n if (stripped !== '') {\n set.add(`/${stripped}`);\n set.add(`${stripped}/`);\n set.add(`/${stripped}/`);\n }\n }\n\n set.delete('');\n\n return set;\n};\n\nexport const
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,MAAM,oBAAoB,CAAC,qBAAqB,QAAQ;AAExD,MAAM,YAAY;AAClB,MAAM,gBAAgB;AACtB,MAAM,iBAAiB;AAQhB,MAAM,mCAAmC,CAAC,aAAuB;AACtE,QAAM,MAAM,oBAAI,IAAY;AAE5B,aAAW,WAAW,UAAU;AAC9B,UAAM,eAAe,QAAQ,QAAQ,WAAW,EAAE;AAClD,UAAM,WAAW,aACd,QAAQ,eAAe,EAAE,EACzB,QAAQ,gBAAgB,EAAE;AAE7B,QAAI,IAAI,OAAO;AACf,QAAI,IAAI,YAAY;AACpB,QAAI,IAAI,aAAa,QAAQ,eAAe,EAAE,CAAC;AAC/C,QAAI,IAAI,aAAa,QAAQ,gBAAgB,EAAE,CAAC;AAChD,QAAI,IAAI,QAAQ;AAEhB,QAAI,aAAa,IAAI;AACnB,UAAI,IAAI,IAAI,QAAQ,EAAE;AACtB,UAAI,IAAI,GAAG,QAAQ,GAAG;AACtB,UAAI,IAAI,IAAI,QAAQ,GAAG;AAAA,IACzB;AAAA,EACF;AAEA,MAAI,OAAO,EAAE;AAEb,SAAO;AACT;AAEO,MAAM,
|
|
4
|
+
"sourcesContent": ["/**\n * Patterns that are superseded by skuba's bundled ignore file patterns and are\n * non-trivial to derive using e.g. `generateSimpleVariants`.\n */\nconst OUTDATED_PATTERNS = ['node_modules_bak/', 'tmp-*/'];\n\nconst ASTERISKS = /\\*/g;\nconst LEADING_SLASH = /^\\//;\nconst TRAILING_SLASH = /\\/$/;\n\n/**\n * Generate simple variants of an ignore pattern for exact matching purposes.\n *\n * Note that these patterns are not actually equivalent (e.g. `lib` matches more\n * than `lib/`) but they generally represent the same _intent_.\n */\nexport const generateIgnoreFileSimpleVariants = (patterns: string[]) => {\n const set = new Set<string>();\n\n for (const pattern of patterns) {\n const deAsterisked = pattern.replace(ASTERISKS, '');\n const stripped = deAsterisked\n .replace(LEADING_SLASH, '')\n .replace(TRAILING_SLASH, '');\n\n set.add(pattern);\n set.add(deAsterisked);\n set.add(deAsterisked.replace(LEADING_SLASH, ''));\n set.add(deAsterisked.replace(TRAILING_SLASH, ''));\n set.add(stripped);\n\n if (stripped !== '') {\n set.add(`/${stripped}`);\n set.add(`${stripped}/`);\n set.add(`/${stripped}/`);\n }\n }\n\n set.delete('');\n\n return set;\n};\n\nexport const generateNpmrcSimpleVariants = (patterns: string[]) => {\n const set = new Set<string>();\n\n for (const pattern of patterns) {\n set.add(pattern);\n\n const match = /^(?<key>[^\"=]+)=\"?(?<value>[^\"=]+)\"?$/.exec(pattern);\n if (!match?.groups) {\n continue;\n }\n\n const { key, value } = match.groups;\n\n set.add(`${key}=${value}`);\n set.add(`${key}=\"${value}\"`);\n }\n\n set.delete('');\n\n return set;\n};\n\nexport const mergeWithConfigFile = (\n rawTemplateFile: string,\n fileType: 'ignore' | 'npmrc' = 'ignore',\n) => {\n const templateFile = rawTemplateFile.trim();\n\n const generator =\n fileType === 'ignore'\n ? generateIgnoreFileSimpleVariants\n : generateNpmrcSimpleVariants;\n\n const templatePatterns = generator([\n ...OUTDATED_PATTERNS,\n ...templateFile.split('\\n').map((line) => line.trim()),\n ]);\n\n return (rawInputFile?: string) => {\n if (rawInputFile === undefined) {\n return `${templateFile}\\n`;\n }\n\n const replacedFile = rawInputFile\n .replace(/\\r?\\n/g, '\\n')\n .replace(/# managed by skuba[\\s\\S]*# end managed by skuba/, templateFile);\n\n if (replacedFile.includes(templateFile)) {\n return replacedFile;\n }\n\n // Crunch the existing lines of a non-skuba config.\n const migratedFile = replacedFile\n .split('\\n')\n .filter((line) => !templatePatterns.has(line))\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n\n const outputFile = [templateFile, migratedFile].join('\\n\\n').trim();\n\n return `${outputFile}\\n`;\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;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T,mCACA;AAEN,QAAM,mBAAmB,UAAU;AAAA,IACjC,GAAG;AAAA,IACH,GAAG,aAAa,MAAM,IAAI,EAAE,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC;AAAA,EACvD,CAAC;AAED,SAAO,CAAC,iBAA0B;AAChC,QAAI,iBAAiB,QAAW;AAC9B,aAAO,GAAG,YAAY;AAAA;AAAA,IACxB;AAEA,UAAM,eAAe,aAClB,QAAQ,UAAU,IAAI,EACtB,QAAQ,mDAAmD,YAAY;AAE1E,QAAI,aAAa,SAAS,YAAY,GAAG;AACvC,aAAO;AAAA,IACT;AAGA,UAAM,eAAe,aAClB,MAAM,IAAI,EACV,OAAO,CAAC,SAAS,CAAC,iBAAiB,IAAI,IAAI,CAAC,EAC5C,KAAK,IAAI,EACT,QAAQ,WAAW,MAAM,EACzB,KAAK;AAER,UAAM,aAAa,CAAC,cAAc,YAAY,EAAE,KAAK,MAAM,EAAE,KAAK;AAElE,WAAO,GAAG,UAAU;AAAA;AAAA,EACtB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import type { Logger } from '../../../utils/logging';
|
|
2
2
|
import { type PackageManagerConfig } from '../../../utils/packageManager';
|
|
3
3
|
import type { InternalLintResult } from '../internal';
|
|
4
|
-
type ConditionOptions = {
|
|
5
|
-
packageManager: PackageManagerConfig;
|
|
6
|
-
isInWorkspaceRoot: boolean;
|
|
7
|
-
};
|
|
8
4
|
type RefreshableConfigFile = {
|
|
9
5
|
name: string;
|
|
10
|
-
type: 'ignore' | '
|
|
6
|
+
type: 'ignore' | 'npmrc';
|
|
11
7
|
additionalMapping?: (s: string, packageManager: PackageManagerConfig) => string;
|
|
12
|
-
if?: (
|
|
8
|
+
if?: (packageManager: PackageManagerConfig) => boolean;
|
|
13
9
|
};
|
|
14
10
|
export declare const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[];
|
|
15
11
|
export declare const refreshConfigFiles: (mode: "format" | "lint", logger: Logger) => Promise<{
|
|
@@ -37,44 +37,43 @@ var import_path = __toESM(require("path"));
|
|
|
37
37
|
var import_util = require("util");
|
|
38
38
|
var import_fs_extra = require("fs-extra");
|
|
39
39
|
var import__ = require("../../..");
|
|
40
|
-
var
|
|
40
|
+
var import_npmrc = require("../../../utils/npmrc");
|
|
41
41
|
var import_packageManager = require("../../../utils/packageManager");
|
|
42
42
|
var import_template = require("../../../utils/template");
|
|
43
43
|
var import_package = require("../../configure/analysis/package");
|
|
44
44
|
var import_project = require("../../configure/analysis/project");
|
|
45
45
|
var import_configFile = require("../../configure/processing/configFile");
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
.
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const ensureNoAuthToken = (fileContents) => fileContents.split("\n").filter((line) => !(0, import_npmrc.hasNpmrcSecret)(line)).join("\n");
|
|
47
|
+
const removeRedundantNpmrc = (contents) => {
|
|
48
|
+
const npmrcLines = contents.split("\n").filter((line) => import_npmrc.NPMRC_LINES.includes(line.trim()));
|
|
49
|
+
if (npmrcLines.length > 0 && npmrcLines.every((line) => line.includes("!"))) {
|
|
50
|
+
return contents.split("\n").filter((line) => !import_npmrc.NPMRC_LINES.includes(line.trim())).join("\n");
|
|
51
|
+
}
|
|
52
|
+
return contents;
|
|
53
|
+
};
|
|
54
54
|
const REFRESHABLE_CONFIG_FILES = [
|
|
55
55
|
{
|
|
56
56
|
name: ".gitignore",
|
|
57
57
|
type: "ignore",
|
|
58
|
-
additionalMapping:
|
|
58
|
+
additionalMapping: removeRedundantNpmrc
|
|
59
59
|
},
|
|
60
60
|
{ name: ".prettierignore", type: "ignore" },
|
|
61
61
|
{
|
|
62
|
-
name: "
|
|
63
|
-
type: "
|
|
64
|
-
|
|
62
|
+
name: ".npmrc",
|
|
63
|
+
type: "npmrc",
|
|
64
|
+
additionalMapping: ensureNoAuthToken,
|
|
65
|
+
if: (packageManager) => packageManager.command === "pnpm"
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
name: ".dockerignore",
|
|
68
69
|
type: "ignore",
|
|
69
|
-
additionalMapping:
|
|
70
|
+
additionalMapping: removeRedundantNpmrc
|
|
70
71
|
}
|
|
71
72
|
];
|
|
72
73
|
const refreshConfigFiles = async (mode, logger) => {
|
|
73
|
-
const [manifest, gitRoot
|
|
74
|
+
const [manifest, gitRoot] = await Promise.all([
|
|
74
75
|
(0, import_package.getDestinationManifest)(),
|
|
75
|
-
import__.Git.findRoot({ dir: process.cwd() })
|
|
76
|
-
(0, import_dir.findWorkspaceRoot)(),
|
|
77
|
-
(0, import_dir.findCurrentWorkspaceProjectRoot)()
|
|
76
|
+
import__.Git.findRoot({ dir: process.cwd() })
|
|
78
77
|
]);
|
|
79
78
|
const destinationRoot = import_path.default.dirname(manifest.path);
|
|
80
79
|
const readDestinationFile = (0, import_project.createDestinationFileReader)(destinationRoot);
|
|
@@ -83,8 +82,8 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
83
82
|
type: fileType,
|
|
84
83
|
additionalMapping = (s) => s,
|
|
85
84
|
if: condition = () => true
|
|
86
|
-
},
|
|
87
|
-
if (!condition(
|
|
85
|
+
}, packageManager2) => {
|
|
86
|
+
if (!condition(packageManager2)) {
|
|
88
87
|
return { needsChange: false };
|
|
89
88
|
}
|
|
90
89
|
const [inputFile, templateFile, isGitIgnored] = await Promise.all([
|
|
@@ -100,7 +99,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
100
99
|
}
|
|
101
100
|
const data = additionalMapping(
|
|
102
101
|
inputFile ? (0, import_configFile.mergeWithConfigFile)(templateFile, fileType)(inputFile) : templateFile,
|
|
103
|
-
|
|
102
|
+
packageManager2
|
|
104
103
|
);
|
|
105
104
|
const filepath = import_path.default.join(destinationRoot, filename);
|
|
106
105
|
if (mode === "format") {
|
|
@@ -120,7 +119,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
120
119
|
msg: `The ${logger.bold(
|
|
121
120
|
filename
|
|
122
121
|
)} file is out of date. Run \`${logger.bold(
|
|
123
|
-
|
|
122
|
+
packageManager2.print.exec,
|
|
124
123
|
"skuba",
|
|
125
124
|
"format"
|
|
126
125
|
)}\` to update it.`,
|
|
@@ -132,10 +131,7 @@ const refreshConfigFiles = async (mode, logger) => {
|
|
|
132
131
|
const packageManager = await (0, import_packageManager.detectPackageManager)(destinationRoot);
|
|
133
132
|
const results = await Promise.all(
|
|
134
133
|
REFRESHABLE_CONFIG_FILES.map(
|
|
135
|
-
(conf) => refreshConfigFile(conf,
|
|
136
|
-
packageManager,
|
|
137
|
-
isInWorkspaceRoot: workspaceRoot === currentWorkspaceProjectRoot
|
|
138
|
-
})
|
|
134
|
+
(conf) => refreshConfigFile(conf, packageManager)
|
|
139
135
|
)
|
|
140
136
|
);
|
|
141
137
|
results.forEach((result) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/lint/internalLints/refreshConfigFiles.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport { writeFile } from 'fs-extra';\n\nimport { Git } from '../../..';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAA+D;AAE/D,sBAA0B;AAE1B,eAAoB;
|
|
6
|
-
"names": ["path", "stripAnsi"]
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect, stripVTControlCharacters as stripAnsi } from 'util';\n\nimport { writeFile } from 'fs-extra';\n\nimport { Git } from '../../..';\nimport type { Logger } from '../../../utils/logging';\nimport { NPMRC_LINES, hasNpmrcSecret } from '../../../utils/npmrc';\nimport {\n type PackageManagerConfig,\n detectPackageManager,\n} from '../../../utils/packageManager';\nimport { readBaseTemplateFile } from '../../../utils/template';\nimport { getDestinationManifest } from '../../configure/analysis/package';\nimport { createDestinationFileReader } from '../../configure/analysis/project';\nimport { mergeWithConfigFile } from '../../configure/processing/configFile';\nimport type { InternalLintResult } from '../internal';\n\nconst ensureNoAuthToken = (fileContents: string) =>\n fileContents\n .split('\\n')\n .filter((line) => !hasNpmrcSecret(line))\n .join('\\n');\n\ntype RefreshableConfigFile = {\n name: string;\n type: 'ignore' | 'npmrc';\n additionalMapping?: (\n s: string,\n packageManager: PackageManagerConfig,\n ) => string;\n if?: (packageManager: PackageManagerConfig) => boolean;\n};\n\nconst removeRedundantNpmrc = (contents: string) => {\n const npmrcLines = contents\n .split('\\n')\n .filter((line) => NPMRC_LINES.includes(line.trim()));\n\n // If we're only left with !.npmrc line we can remove it\n // TODO: Consider if we should generalise this\n if (npmrcLines.length > 0 && npmrcLines.every((line) => line.includes('!'))) {\n return contents\n .split('\\n')\n .filter((line) => !NPMRC_LINES.includes(line.trim()))\n .join('\\n');\n }\n return contents;\n};\n\nexport const REFRESHABLE_CONFIG_FILES: RefreshableConfigFile[] = [\n {\n name: '.gitignore',\n type: 'ignore',\n additionalMapping: removeRedundantNpmrc,\n },\n { name: '.prettierignore', type: 'ignore' },\n {\n name: '.npmrc',\n type: 'npmrc',\n additionalMapping: ensureNoAuthToken,\n if: (packageManager: PackageManagerConfig) =>\n packageManager.command === 'pnpm',\n },\n {\n name: '.dockerignore',\n type: 'ignore',\n additionalMapping: removeRedundantNpmrc,\n },\n];\n\nexport const refreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n) => {\n const [manifest, gitRoot] = await Promise.all([\n getDestinationManifest(),\n Git.findRoot({ dir: process.cwd() }),\n ]);\n\n const destinationRoot = path.dirname(manifest.path);\n\n const readDestinationFile = createDestinationFileReader(destinationRoot);\n\n const refreshConfigFile = async (\n {\n name: filename,\n type: fileType,\n additionalMapping = (s) => s,\n if: condition = () => true,\n }: RefreshableConfigFile,\n packageManager: PackageManagerConfig,\n ) => {\n if (!condition(packageManager)) {\n return { needsChange: false };\n }\n\n const [inputFile, templateFile, isGitIgnored] = await Promise.all([\n readDestinationFile(filename),\n readBaseTemplateFile(`_${filename}`),\n gitRoot\n ? Git.isFileGitIgnored({\n gitRoot,\n absolutePath: path.join(destinationRoot, filename),\n })\n : false,\n ]);\n\n // If the file is gitignored and doesn't exist, don't make it\n if (inputFile === undefined && isGitIgnored) {\n return { needsChange: false };\n }\n\n const data = additionalMapping(\n inputFile\n ? mergeWithConfigFile(templateFile, fileType)(inputFile)\n : templateFile,\n packageManager,\n );\n\n const filepath = path.join(destinationRoot, filename);\n\n if (mode === 'format') {\n if (data === inputFile) {\n return { needsChange: false };\n }\n\n await writeFile(filepath, data);\n return {\n needsChange: false,\n msg: `Refreshed ${logger.bold(filename)}.`,\n filename,\n };\n }\n\n if (data !== inputFile) {\n return {\n needsChange: true,\n msg: `The ${logger.bold(\n filename,\n )} file is out of date. Run \\`${logger.bold(\n packageManager.print.exec,\n 'skuba',\n 'format',\n )}\\` to update it.`,\n filename,\n };\n }\n\n return { needsChange: false };\n };\n\n const packageManager = await detectPackageManager(destinationRoot);\n\n const results = await Promise.all(\n REFRESHABLE_CONFIG_FILES.map((conf) =>\n refreshConfigFile(conf, packageManager),\n ),\n );\n\n // Log after for reproducible test output ordering\n results.forEach((result) => {\n if (result.msg) {\n logger.warn(result.msg);\n }\n });\n\n const anyNeedChanging = results.some(({ needsChange }) => needsChange);\n\n return {\n ok: !anyNeedChanging,\n fixable: anyNeedChanging,\n annotations: results.flatMap(({ needsChange, filename, msg }) =>\n needsChange && msg\n ? [\n {\n path: filename,\n message: stripAnsi(msg),\n },\n ]\n : [],\n ),\n };\n};\n\nexport const tryRefreshConfigFiles = async (\n mode: 'format' | 'lint',\n logger: Logger,\n): Promise<InternalLintResult> => {\n try {\n return await refreshConfigFiles(mode, logger);\n } catch (err) {\n logger.warn('Failed to refresh config files.');\n logger.subtle(inspect(err));\n\n return {\n ok: false,\n f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,gBAAe,MAAM;AAAA,UACrB;AAAA,UACA;AAAA,QACF,CAAC;AAAA,QACD;AAAA,MACF;AAAA,IACF;AAEA,WAAO,EAAE,aAAa,MAAM;AAAA,EAC9B;AAEA,QAAM,iBAAiB,UAAM,4CAAqB,eAAe;AAEjE,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,yBAAyB;AAAA,MAAI,CAAC,SAC5B,kBAAkB,MAAM,cAAc;AAAA,IACxC;AAAA,EACF;AAGA,UAAQ,QAAQ,CAAC,WAAW;AAC1B,QAAI,OAAO,KAAK;AACd,aAAO,KAAK,OAAO,GAAG;AAAA,IACxB;AAAA,EACF,CAAC;AAED,QAAM,kBAAkB,QAAQ,KAAK,CAAC,EAAE,YAAY,MAAM,WAAW;AAErE,SAAO;AAAA,IACL,IAAI,CAAC;AAAA,IACL,SAAS;AAAA,IACT,aAAa,QAAQ;AAAA,MAAQ,CAAC,EAAE,aAAa,UAAU,IAAI,MACzD,eAAe,MACX;AAAA,QACE;AAAA,UACE,MAAM;AAAA,UACN,aAAS,YAAAC,0BAAU,GAAG;AAAA,QACxB;AAAA,MACF,IACA,CAAC;AAAA,IACP;AAAA,EACF;AACF;AAEO,MAAM,wBAAwB,OACnC,MACA,WACgC;AAChC,MAAI;AACF,WAAO,MAAM,mBAAmB,MAAM,MAAM;AAAA,EAC9C,SAAS,KAAK;AACZ,WAAO,KAAK,iCAAiC;AAC7C,WAAO,WAAO,qBAAQ,GAAG,CAAC;AAE1B,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,SAAS;AAAA,MACT,aAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": ["path", "packageManager", "stripAnsi"]
|
|
7
7
|
}
|
|
@@ -21,16 +21,11 @@ __export(__exports, {
|
|
|
21
21
|
patches: () => patches
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(__exports);
|
|
24
|
-
var import_migrateNpmrcToPnpmWorkspace = require("./migrateNpmrcToPnpmWorkspace");
|
|
25
24
|
var import_stopBundlingInCDKTests = require("./stopBundlingInCDKTests");
|
|
26
25
|
const patches = [
|
|
27
26
|
{
|
|
28
27
|
apply: import_stopBundlingInCDKTests.tryStopBundlingInCDKTests,
|
|
29
28
|
description: "Stop bundling inside CDK unit tests"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
apply: import_migrateNpmrcToPnpmWorkspace.tryMigrateNpmrcToPnpmWorkspace,
|
|
33
|
-
description: "Move .npmrc config to pnpm-workspace.yaml"
|
|
34
29
|
}
|
|
35
30
|
];
|
|
36
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/10.1.0/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Patches } from '../..';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,
|
|
4
|
+
"sourcesContent": ["import type { Patches } from '../..';\n\nimport { tryStopBundlingInCDKTests } from './stopBundlingInCDKTests';\n\nexport const patches: Patches = [\n {\n apply: tryStopBundlingInCDKTests,\n description: 'Stop bundling inside CDK unit tests',\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oCAA0C;AAEnC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ __export(__exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(__exports);
|
|
24
24
|
var import_patchRenovateConfig = require("../../../patchRenovateConfig");
|
|
25
25
|
var import_addEmptyExports = require("./addEmptyExports");
|
|
26
|
+
var import_moveNpmrcOutOfIgnoreManagedSection = require("./moveNpmrcOutOfIgnoreManagedSection");
|
|
26
27
|
var import_patchDockerfile = require("./patchDockerfile");
|
|
27
28
|
var import_patchServerListener = require("./patchServerListener");
|
|
28
29
|
const patches = [
|
|
@@ -41,6 +42,14 @@ const patches = [
|
|
|
41
42
|
{
|
|
42
43
|
apply: import_patchServerListener.tryPatchServerListener,
|
|
43
44
|
description: "Add keepAliveTimeout to server listener"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
apply: (0, import_moveNpmrcOutOfIgnoreManagedSection.tryMoveNpmrcOutOfIgnoreManagedSection)(".gitignore"),
|
|
48
|
+
description: "Move .npmrc out of the .gitignore managed section"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
apply: (0, import_moveNpmrcOutOfIgnoreManagedSection.tryMoveNpmrcOutOfIgnoreManagedSection)(".dockerignore"),
|
|
52
|
+
description: "Move .npmrc out of the .dockerignore managed section"
|
|
44
53
|
}
|
|
45
54
|
];
|
|
46
55
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Patches } from '../..';\nimport { tryPatchRenovateConfig } from '../../../patchRenovateConfig';\n\nimport { tryAddEmptyExports } from './addEmptyExports';\nimport { tryPatchDockerfile } from './patchDockerfile';\nimport { tryPatchServerListener } from './patchServerListener';\n\nexport const patches: Patches = [\n {\n apply: tryAddEmptyExports,\n description:\n 'Add empty exports to Jest files for compliance with TypeScript isolated modules',\n },\n {\n apply: tryPatchRenovateConfig,\n description: 'Update Renovate config to support private SEEK packages',\n },\n {\n apply: tryPatchDockerfile,\n description: 'Upgrade Node.js Distroless Docker image to -debian12 variant',\n },\n {\n apply: tryPatchServerListener,\n description: 'Add keepAliveTimeout to server listener',\n },\n];\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAuC;AAEvC,6BAAmC;AACnC,6BAAmC;AACnC,iCAAuC;AAEhC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AACF;",
|
|
4
|
+
"sourcesContent": ["import type { Patches } from '../..';\nimport { tryPatchRenovateConfig } from '../../../patchRenovateConfig';\n\nimport { tryAddEmptyExports } from './addEmptyExports';\nimport { tryMoveNpmrcOutOfIgnoreManagedSection } from './moveNpmrcOutOfIgnoreManagedSection';\nimport { tryPatchDockerfile } from './patchDockerfile';\nimport { tryPatchServerListener } from './patchServerListener';\n\nexport const patches: Patches = [\n {\n apply: tryAddEmptyExports,\n description:\n 'Add empty exports to Jest files for compliance with TypeScript isolated modules',\n },\n {\n apply: tryPatchRenovateConfig,\n description: 'Update Renovate config to support private SEEK packages',\n },\n {\n apply: tryPatchDockerfile,\n description: 'Upgrade Node.js Distroless Docker image to -debian12 variant',\n },\n {\n apply: tryPatchServerListener,\n description: 'Add keepAliveTimeout to server listener',\n },\n {\n apply: tryMoveNpmrcOutOfIgnoreManagedSection('.gitignore'),\n description: 'Move .npmrc out of the .gitignore managed section',\n },\n {\n apply: tryMoveNpmrcOutOfIgnoreManagedSection('.dockerignore'),\n description: 'Move .npmrc out of the .dockerignore managed section',\n },\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAuC;AAEvC,6BAAmC;AACnC,gDAAsD;AACtD,6BAAmC;AACnC,iCAAuC;AAEhC,MAAM,UAAmB;AAAA,EAC9B;AAAA,IACE,OAAO;AAAA,IACP,aACE;AAAA,EACJ;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,WAAO,iFAAsC,YAAY;AAAA,IACzD,aAAa;AAAA,EACf;AAAA,EACA;AAAA,IACE,WAAO,iFAAsC,eAAe;AAAA,IAC5D,aAAa;AAAA,EACf;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var moveNpmrcOutOfIgnoreManagedSection_exports = {};
|
|
30
|
+
__export(moveNpmrcOutOfIgnoreManagedSection_exports, {
|
|
31
|
+
tryMoveNpmrcOutOfIgnoreManagedSection: () => tryMoveNpmrcOutOfIgnoreManagedSection
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(moveNpmrcOutOfIgnoreManagedSection_exports);
|
|
34
|
+
var import_path = __toESM(require("path"));
|
|
35
|
+
var import_util = require("util");
|
|
36
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
37
|
+
var import_logging = require("../../../../../../utils/logging");
|
|
38
|
+
var import_npmrc = require("../../../../../../utils/npmrc");
|
|
39
|
+
var import_project = require("../../../../../configure/analysis/project");
|
|
40
|
+
const NPMRC_IGNORE_SECTION = `
|
|
41
|
+
|
|
42
|
+
# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.
|
|
43
|
+
# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.
|
|
44
|
+
# You can use \`skuba format\` to generate the file or otherwise commit an empty file.
|
|
45
|
+
# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.
|
|
46
|
+
.npmrc
|
|
47
|
+
`;
|
|
48
|
+
const moveNpmrcOutOfIgnoreManagedSection = async (mode, dir, fileName) => {
|
|
49
|
+
const readFile = (0, import_project.createDestinationFileReader)(dir);
|
|
50
|
+
const ignoreFile = await readFile(fileName);
|
|
51
|
+
if (!ignoreFile) {
|
|
52
|
+
return { result: "skip", reason: `no ${fileName} file found` };
|
|
53
|
+
}
|
|
54
|
+
let isIgnored;
|
|
55
|
+
let currentlyInManagedSection = false;
|
|
56
|
+
for (const line of ignoreFile.split("\n")) {
|
|
57
|
+
if (line.trim() === "# managed by skuba") {
|
|
58
|
+
currentlyInManagedSection = true;
|
|
59
|
+
} else if (line.trim() === "# end managed by skuba") {
|
|
60
|
+
currentlyInManagedSection = false;
|
|
61
|
+
}
|
|
62
|
+
if (line.trim() === ".npmrc" || line.trim() === "/.npmrc") {
|
|
63
|
+
isIgnored = { inManaged: currentlyInManagedSection };
|
|
64
|
+
}
|
|
65
|
+
if (line.trim() === "!.npmrc" || line.trim() === "!/.npmrc") {
|
|
66
|
+
isIgnored = void 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (isIgnored && !isIgnored.inManaged) {
|
|
70
|
+
return { result: "skip", reason: "already ignored in unmanaged section" };
|
|
71
|
+
}
|
|
72
|
+
if (!isIgnored) {
|
|
73
|
+
return { result: "skip", reason: "not ignored" };
|
|
74
|
+
}
|
|
75
|
+
if (mode === "lint") {
|
|
76
|
+
return { result: "apply" };
|
|
77
|
+
}
|
|
78
|
+
const newIgnoreFile = ignoreFile.split("\n").filter((line) => !import_npmrc.NPMRC_LINES.includes(line.trim())).join("\n").trim() + NPMRC_IGNORE_SECTION;
|
|
79
|
+
await import_fs_extra.default.promises.writeFile(import_path.default.join(dir, fileName), newIgnoreFile);
|
|
80
|
+
return { result: "apply" };
|
|
81
|
+
};
|
|
82
|
+
const tryMoveNpmrcOutOfIgnoreManagedSection = (type) => async ({ mode, dir = process.cwd() }) => {
|
|
83
|
+
try {
|
|
84
|
+
return await moveNpmrcOutOfIgnoreManagedSection(mode, dir, type);
|
|
85
|
+
} catch (err) {
|
|
86
|
+
import_logging.log.warn(`Failed to move .npmrc out of ${type} managed sections.`);
|
|
87
|
+
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
88
|
+
return { result: "skip", reason: "due to an error" };
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
tryMoveNpmrcOutOfIgnoreManagedSection
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=moveNpmrcOutOfIgnoreManagedSection.js.map
|
package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.ts"],
|
|
4
|
+
"sourcesContent": ["import path from 'path';\nimport { inspect } from 'util';\n\nimport fs from 'fs-extra';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\nimport { NPMRC_LINES } from '../../../../../../utils/npmrc';\nimport { createDestinationFileReader } from '../../../../../configure/analysis/project';\n\nconst NPMRC_IGNORE_SECTION = `\n\n# Ignore .npmrc. This is no longer managed by skuba as pnpm projects use a managed .npmrc.\n# IMPORTANT: if migrating to pnpm, remove this line and add an .npmrc IN THE SAME COMMIT.\n# You can use \\`skuba format\\` to generate the file or otherwise commit an empty file.\n# Doing so will conflict with a local .npmrc and make it more difficult to unintentionally commit auth secrets.\n.npmrc\n`;\n\nconst moveNpmrcOutOfIgnoreManagedSection = async (\n mode: 'format' | 'lint',\n dir: string,\n fileName: '.gitignore' | '.dockerignore',\n): Promise<PatchReturnType> => {\n const readFile = createDestinationFileReader(dir);\n\n const ignoreFile = await readFile(fileName);\n\n if (!ignoreFile) {\n return { result: 'skip', reason: `no ${fileName} file found` };\n }\n\n let isIgnored: { inManaged: boolean } | undefined;\n let currentlyInManagedSection = false;\n\n for (const line of ignoreFile.split('\\n')) {\n if (line.trim() === '# managed by skuba') {\n currentlyInManagedSection = true;\n } else if (line.trim() === '# end managed by skuba') {\n currentlyInManagedSection = false;\n }\n\n if (line.trim() === '.npmrc' || line.trim() === '/.npmrc') {\n isIgnored = { inManaged: currentlyInManagedSection };\n }\n\n if (line.trim() === '!.npmrc' || line.trim() === '!/.npmrc') {\n isIgnored = undefined;\n }\n }\n\n if (isIgnored && !isIgnored.inManaged) {\n return { result: 'skip', reason: 'already ignored in unmanaged section' };\n }\n\n if (!isIgnored) {\n return { result: 'skip', reason: 'not ignored' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n const newIgnoreFile =\n ignoreFile\n .split('\\n')\n .filter((line) => !NPMRC_LINES.includes(line.trim()))\n .join('\\n')\n .trim() + NPMRC_IGNORE_SECTION;\n\n await fs.promises.writeFile(path.join(dir, fileName), newIgnoreFile);\n\n return { result: 'apply' };\n};\n\nexport const tryMoveNpmrcOutOfIgnoreManagedSection = (\n type: '.gitignore' | '.dockerignore',\n) =>\n (async ({ mode, dir = process.cwd() }) => {\n try {\n return await moveNpmrcOutOfIgnoreManagedSection(mode, dir, type);\n } catch (err) {\n log.warn(`Failed to move .npmrc out of ${type} managed sections.`);\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n }) satisfies PatchFunction;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AACjB,kBAAwB;AAExB,sBAAe;AAGf,qBAAoB;AACpB,mBAA4B;AAC5B,qBAA4C;AAE5C,MAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS7B,MAAM,qCAAqC,OACzC,MACA,KACA,aAC6B;AAC7B,QAAM,eAAW,4CAA4B,GAAG;AAEhD,QAAM,aAAa,MAAM,SAAS,QAAQ;AAE1C,MAAI,CAAC,YAAY;AACf,WAAO,EAAE,QAAQ,QAAQ,QAAQ,MAAM,QAAQ,cAAc;AAAA,EAC/D;AAEA,MAAI;AACJ,MAAI,4BAA4B;AAEhC,aAAW,QAAQ,WAAW,MAAM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@@ -79,7 +79,7 @@ const copyFiles = async (opts, currentSourceDir = opts.sourceRoot, currentDestin
|
|
|
79
79
|
const filenames = await import_fs_extra.default.promises.readdir(currentSourceDir);
|
|
80
80
|
const toDestinationPath = (filename) => import_path.default.join(
|
|
81
81
|
currentDestinationDir,
|
|
82
|
-
opts.stripUnderscorePrefix ? filename.replace(/^_\./, ".").replace(/^_package\.json/, "package.json").replace(/^_eslint\.config\.js/, "eslint.config.js")
|
|
82
|
+
opts.stripUnderscorePrefix ? filename.replace(/^_\./, ".").replace(/^_package\.json/, "package.json").replace(/^_eslint\.config\.js/, "eslint.config.js") : filename
|
|
83
83
|
);
|
|
84
84
|
const filteredFilenames = filenames.filter(
|
|
85
85
|
(filename) => opts.include(
|
package/lib/utils/copy.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/copy.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport ejs from 'ejs';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error';\nimport { log } from './logging';\n\nexport type TextProcessor = (sourcePath: string, contents: string) => string;\n\nexport const copyFile = async (\n sourcePath: string,\n destinationPath: string,\n {\n overwrite = true,\n processors,\n }: Pick<CopyFilesOptions, 'overwrite' | 'processors'>,\n) => {\n const oldContents = await fs.promises.readFile(sourcePath, 'utf8');\n\n const newContents = processors.reduce(\n (contents, process) => process(sourcePath, contents),\n oldContents,\n );\n\n if (oldContents === newContents && sourcePath === destinationPath) {\n return;\n }\n\n try {\n await fs.promises.writeFile(destinationPath, newContents, {\n flag: overwrite ? 'w' : 'wx',\n });\n } catch (err) {\n if (isErrorWithCode(err, 'EEXIST')) {\n return;\n }\n\n throw err;\n }\n};\n\ninterface CopyFilesOptions {\n sourceRoot: string;\n destinationRoot: string;\n\n include: (pathname: string) => boolean;\n overwrite?: boolean;\n processors: TextProcessor[];\n stripUnderscorePrefix?: boolean;\n}\n\nexport const createEjsRenderer =\n (templateData: Record<string, unknown>): TextProcessor =>\n (sourcePath: string, contents) => {\n try {\n return ejs.render(contents, templateData, { strict: false });\n } catch (err) {\n log.err('Failed to render', log.bold(sourcePath));\n log.subtle(err);\n return contents;\n }\n };\n\nexport const createStringReplacer =\n (\n replacements: Array<{\n input: RegExp;\n output: string;\n }>,\n ): TextProcessor =>\n (_sourcePath: string, contents) =>\n replacements.reduce(\n (newContents, { input, output }) => newContents.replace(input, output),\n contents,\n );\n\nexport const copyFiles = async (\n opts: CopyFilesOptions,\n currentSourceDir: string = opts.sourceRoot,\n currentDestinationDir: string = opts.destinationRoot,\n) => {\n const filenames = await fs.promises.readdir(currentSourceDir);\n\n const toDestinationPath = (filename: string) =>\n path.join(\n currentDestinationDir,\n opts.stripUnderscorePrefix\n ? filename\n .replace(/^_\\./, '.')\n .replace(/^_package\\.json/, 'package.json')\n .replace(/^_eslint\\.config\\.js/, 'eslint.config.js')\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,iBAAgB;AAChB,sBAAe;AAEf,mBAAgC;AAChC,qBAAoB;AAIb,MAAM,WAAW,OACtB,YACA,iBACA;AAAA,EACE,YAAY;AAAA,EACZ;AACF,MACG;AACH,QAAM,cAAc,MAAM,gBAAAA,QAAG,SAAS,SAAS,YAAY,MAAM;AAEjE,QAAM,cAAc,WAAW;AAAA,IAC7B,CAAC,UAAU,YAAY,QAAQ,YAAY,QAAQ;AAAA,IACnD;AAAA,EACF;AAEA,MAAI,gBAAgB,eAAe,eAAe,iBAAiB;AACjE;AAAA,EACF;AAEA,MAAI;AACF,UAAM,gBAAAA,QAAG,SAAS,UAAU,iBAAiB,aAAa;AAAA,MACxD,MAAM,YAAY,MAAM;AAAA,IAC1B,CAAC;AAAA,EACH,SAAS,KAAK;AACZ,YAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC;AAAA,IACF;AAEA,UAAM;AAAA,EACR;AACF;AAYO,MAAM,oBACX,CAAC,iBACD,CAAC,YAAoB,aAAa;AAChC,MAAI;AACF,WAAO,WAAAC,QAAI,OAAO,UAAU,cAAc,EAAE,QAAQ,MAAM,CAAC;AAAA,EAC7D,SAAS,KAAK;AACZ,uBAAI,IAAI,oBAAoB,mBAAI,KAAK,UAAU,CAAC;AAChD,uBAAI,OAAO,GAAG;AACd,WAAO;AAAA,EACT;AACF;AAEK,MAAM,uBACX,CACE,iBAKF,CAAC,aAAqB,aACpB,aAAa;AAAA,EACX,CAAC,aAAa,EAAE,OAAO,OAAO,MAAM,YAAY,QAAQ,OAAO,MAAM;AAAA,EACrE;AACF;AAEG,MAAM,YAAY,OACvB,MACA,mBAA2B,KAAK,YAChC,wBAAgC,KAAK,oBAClC;AACH,QAAM,YAAY,MAAM,gBAAAD,QAAG,SAAS,QAAQ,gBAAgB;AAE5D,QAAM,oBAAoB,CAAC,aACzB,YAAAE,QAAK;AAAA,IACH;AAAA,IACA,KAAK,wBACD,SACG,QAAQ,QAAQ,GAAG,EACnB,QAAQ,mBAAmB,cAAc,EACzC,QAAQ,wBAAwB,kBAAkB,
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport ejs from 'ejs';\nimport fs from 'fs-extra';\n\nimport { isErrorWithCode } from './error';\nimport { log } from './logging';\n\nexport type TextProcessor = (sourcePath: string, contents: string) => string;\n\nexport const copyFile = async (\n sourcePath: string,\n destinationPath: string,\n {\n overwrite = true,\n processors,\n }: Pick<CopyFilesOptions, 'overwrite' | 'processors'>,\n) => {\n const oldContents = await fs.promises.readFile(sourcePath, 'utf8');\n\n const newContents = processors.reduce(\n (contents, process) => process(sourcePath, contents),\n oldContents,\n );\n\n if (oldContents === newContents && sourcePath === destinationPath) {\n return;\n }\n\n try {\n await fs.promises.writeFile(destinationPath, newContents, {\n flag: overwrite ? 'w' : 'wx',\n });\n } catch (err) {\n if (isErrorWithCode(err, 'EEXIST')) {\n return;\n }\n\n throw err;\n }\n};\n\ninterface CopyFilesOptions {\n sourceRoot: string;\n destinationRoot: string;\n\n include: (pathname: string) => boolean;\n overwrite?: boolean;\n processors: TextProcessor[];\n stripUnderscorePrefix?: boolean;\n}\n\nexport const createEjsRenderer =\n (templateData: Record<string, unknown>): TextProcessor =>\n (sourcePath: string, contents) => {\n try {\n return ejs.render(contents, templateData, { strict: false });\n } catch (err) {\n log.err('Failed to render', log.bold(sourcePath));\n log.subtle(err);\n return contents;\n }\n };\n\nexport const createStringReplacer =\n (\n replacements: Array<{\n input: RegExp;\n output: string;\n }>,\n ): TextProcessor =>\n (_sourcePath: string, contents) =>\n replacements.reduce(\n (newContents, { input, output }) => newContents.replace(input, output),\n contents,\n );\n\nexport const copyFiles = async (\n opts: CopyFilesOptions,\n currentSourceDir: string = opts.sourceRoot,\n currentDestinationDir: string = opts.destinationRoot,\n) => {\n const filenames = await fs.promises.readdir(currentSourceDir);\n\n const toDestinationPath = (filename: string) =>\n path.join(\n currentDestinationDir,\n opts.stripUnderscorePrefix\n ? filename\n .replace(/^_\\./, '.')\n .replace(/^_package\\.json/, 'package.json')\n .replace(/^_eslint\\.config\\.js/, 'eslint.config.js')\n : filename,\n );\n\n const filteredFilenames = filenames.filter((filename) =>\n opts.include(\n path.relative(opts.destinationRoot, toDestinationPath(filename)),\n ),\n );\n\n await Promise.all(\n filteredFilenames.map(async (filename) => {\n const sourcePath = path.join(currentSourceDir, filename);\n const destinationPath = toDestinationPath(filename);\n\n try {\n await copyFile(sourcePath, destinationPath, opts);\n } catch (err) {\n if (isErrorWithCode(err, 'EISDIR')) {\n await fs.promises.mkdir(destinationPath, { recursive: true });\n return copyFiles(opts, sourcePath, destinationPath);\n }\n\n log.err('Failed to render', log.bold(sourcePath));\n\n throw err;\n }\n }),\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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,QAAQ,mBAAmB,cAAc,EACzC,QAAQ,wBAAwB,kBAAkB,IACrD;AAAA,EACN;AAEF,QAAM,oBAAoB,UAAU;AAAA,IAAO,CAAC,aAC1C,KAAK;AAAA,MACH,YAAAA,QAAK,SAAS,KAAK,iBAAiB,kBAAkB,QAAQ,CAAC;AAAA,IACjE;AAAA,EACF;AAEA,QAAM,QAAQ;AAAA,IACZ,kBAAkB,IAAI,OAAO,aAAa;AACxC,YAAM,aAAa,YAAAA,QAAK,KAAK,kBAAkB,QAAQ;AACvD,YAAM,kBAAkB,kBAAkB,QAAQ;AAElD,UAAI;AACF,cAAM,SAAS,YAAY,iBAAiB,IAAI;AAAA,MAClD,SAAS,KAAK;AACZ,gBAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC,gBAAM,gBAAAF,QAAG,SAAS,MAAM,iBAAiB,EAAE,WAAW,KAAK,CAAC;AAC5D,iBAAO,UAAU,MAAM,YAAY,eAAe;AAAA,QACpD;AAEA,2BAAI,IAAI,oBAAoB,mBAAI,KAAK,UAAU,CAAC;AAEhD,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["fs", "ejs", "path"]
|
|
7
7
|
}
|
package/lib/utils/dir.d.ts
CHANGED
|
@@ -20,13 +20,3 @@ export declare const crawlDirectory: (root: string, ignoreFilenames?: string[])
|
|
|
20
20
|
* `.gitignore` and `.prettierignore`.
|
|
21
21
|
*/
|
|
22
22
|
export declare const createInclusionFilter: (ignoreFilepaths: string[]) => Promise<(pathname: string) => boolean>;
|
|
23
|
-
export declare const locateNearestFile: ({ cwd, filename, }: {
|
|
24
|
-
cwd: string;
|
|
25
|
-
filename: string;
|
|
26
|
-
}) => Promise<string | null>;
|
|
27
|
-
export declare const locateFurthestFile: ({ cwd, filename, }: {
|
|
28
|
-
cwd: string;
|
|
29
|
-
filename: string;
|
|
30
|
-
}) => Promise<string | null>;
|
|
31
|
-
export declare const findWorkspaceRoot: (cwd?: string) => Promise<string | null>;
|
|
32
|
-
export declare const findCurrentWorkspaceProjectRoot: (cwd?: string) => Promise<string | null>;
|
package/lib/utils/dir.js
CHANGED
|
@@ -30,18 +30,13 @@ var dir_exports = {};
|
|
|
30
30
|
__export(dir_exports, {
|
|
31
31
|
buildPatternToFilepathMap: () => buildPatternToFilepathMap,
|
|
32
32
|
crawlDirectory: () => crawlDirectory,
|
|
33
|
-
createInclusionFilter: () => createInclusionFilter
|
|
34
|
-
findCurrentWorkspaceProjectRoot: () => findCurrentWorkspaceProjectRoot,
|
|
35
|
-
findWorkspaceRoot: () => findWorkspaceRoot,
|
|
36
|
-
locateFurthestFile: () => locateFurthestFile,
|
|
37
|
-
locateNearestFile: () => locateNearestFile
|
|
33
|
+
createInclusionFilter: () => createInclusionFilter
|
|
38
34
|
});
|
|
39
35
|
module.exports = __toCommonJS(dir_exports);
|
|
40
36
|
var import_path = __toESM(require("path"));
|
|
41
37
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
42
38
|
var import_ignore = __toESM(require("ignore"));
|
|
43
39
|
var import_picomatch = __toESM(require("picomatch"));
|
|
44
|
-
var import_findRoot = require("../api/git/findRoot");
|
|
45
40
|
var import_error = require("./error");
|
|
46
41
|
const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
|
|
47
42
|
patterns.map((pattern) => {
|
|
@@ -99,77 +94,10 @@ async function crawl(directoryPath, filters, paths = []) {
|
|
|
99
94
|
}
|
|
100
95
|
return paths;
|
|
101
96
|
}
|
|
102
|
-
const locateNearestFile = async ({
|
|
103
|
-
cwd,
|
|
104
|
-
filename
|
|
105
|
-
}) => {
|
|
106
|
-
let currentDir = cwd;
|
|
107
|
-
while (currentDir !== import_path.default.dirname(currentDir)) {
|
|
108
|
-
const filePath = import_path.default.join(currentDir, filename);
|
|
109
|
-
if (await import_fs_extra.default.pathExists(filePath)) {
|
|
110
|
-
return filePath;
|
|
111
|
-
}
|
|
112
|
-
currentDir = import_path.default.dirname(currentDir);
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
};
|
|
116
|
-
const locateFurthestFile = async ({
|
|
117
|
-
cwd,
|
|
118
|
-
filename
|
|
119
|
-
}) => {
|
|
120
|
-
let currentDir = cwd;
|
|
121
|
-
let furthestFilePath = null;
|
|
122
|
-
while (currentDir !== import_path.default.dirname(currentDir)) {
|
|
123
|
-
const filePath = import_path.default.join(currentDir, filename);
|
|
124
|
-
if (await import_fs_extra.default.pathExists(filePath)) {
|
|
125
|
-
furthestFilePath = filePath;
|
|
126
|
-
}
|
|
127
|
-
currentDir = import_path.default.dirname(currentDir);
|
|
128
|
-
}
|
|
129
|
-
return furthestFilePath;
|
|
130
|
-
};
|
|
131
|
-
const workspaceRootCache = {};
|
|
132
|
-
const findWorkspaceRoot = async (cwd = process.cwd()) => {
|
|
133
|
-
const find = async () => {
|
|
134
|
-
const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([
|
|
135
|
-
locateNearestFile({ cwd, filename: "pnpm-lock.yaml" }),
|
|
136
|
-
locateNearestFile({ cwd, filename: "yarn.lock" }),
|
|
137
|
-
locateFurthestFile({ cwd, filename: "package.json" }),
|
|
138
|
-
(0, import_findRoot.findRoot)({ dir: cwd })
|
|
139
|
-
]);
|
|
140
|
-
const candidates = [
|
|
141
|
-
pnpmLock ? import_path.default.dirname(pnpmLock) : null,
|
|
142
|
-
yarnLock ? import_path.default.dirname(yarnLock) : null,
|
|
143
|
-
packageJson ? import_path.default.dirname(packageJson) : null,
|
|
144
|
-
gitRoot
|
|
145
|
-
].filter((dir) => dir !== null);
|
|
146
|
-
if (candidates[0]) {
|
|
147
|
-
return candidates.reduce((longest, current) => {
|
|
148
|
-
if (current.split(import_path.default.sep).length > longest.split(import_path.default.sep).length) {
|
|
149
|
-
return current;
|
|
150
|
-
}
|
|
151
|
-
return longest;
|
|
152
|
-
}, candidates[0]);
|
|
153
|
-
}
|
|
154
|
-
return null;
|
|
155
|
-
};
|
|
156
|
-
return workspaceRootCache[cwd] ??= await find();
|
|
157
|
-
};
|
|
158
|
-
const findCurrentWorkspaceProjectRoot = async (cwd = process.cwd()) => {
|
|
159
|
-
const packageJson = await locateNearestFile({
|
|
160
|
-
cwd,
|
|
161
|
-
filename: "package.json"
|
|
162
|
-
});
|
|
163
|
-
return packageJson ? import_path.default.dirname(packageJson) : null;
|
|
164
|
-
};
|
|
165
97
|
// Annotate the CommonJS export names for ESM import in node:
|
|
166
98
|
0 && (module.exports = {
|
|
167
99
|
buildPatternToFilepathMap,
|
|
168
100
|
crawlDirectory,
|
|
169
|
-
createInclusionFilter
|
|
170
|
-
findCurrentWorkspaceProjectRoot,
|
|
171
|
-
findWorkspaceRoot,
|
|
172
|
-
locateFurthestFile,
|
|
173
|
-
locateNearestFile
|
|
101
|
+
createInclusionFilter
|
|
174
102
|
});
|
|
175
103
|
//# sourceMappingURL=dir.js.map
|
package/lib/utils/dir.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/dir.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
6
|
-
"names": ["picomatch", "path", "fs", "ignore"
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { isErrorWithCode } from './error';\n\n/**\n * Build a map that associates each glob pattern with its matching filepaths.\n */\nexport const buildPatternToFilepathMap = (\n patterns: string[],\n allFilepaths: string[],\n options?: picomatch.PicomatchOptions,\n) =>\n Object.fromEntries(\n patterns.map((pattern) => {\n const isMatch = picomatch(pattern, options);\n\n const filepaths = allFilepaths.filter((filepath) => isMatch(filepath));\n\n return [pattern, filepaths] as const;\n }),\n );\n\n/**\n * List relative filepaths contained within a directory root.\n *\n * This excludes:\n *\n * - Patterns in the ignore files specified in `ignoreFilenames`\n * - `.git` subdirectories\n * - `node_modules` subdirectories\n */\nexport const crawlDirectory = async (\n root: string,\n ignoreFilenames = ['.gitignore'],\n) => {\n const ignoreFileFilter = await createInclusionFilter(\n ignoreFilenames.map((ignoreFilename) => path.join(root, ignoreFilename)),\n );\n\n const absoluteFilenames = await crawl(root, {\n includeDirName: (dirname) => !['.git', 'node_modules'].includes(dirname),\n includeFilePath: (pathname) =>\n ignoreFileFilter(path.relative(root, pathname)),\n });\n\n const relativeFilepaths = absoluteFilenames.map((filepath) =>\n path.relative(root, filepath),\n );\n\n return relativeFilepaths;\n};\n\n/**\n * Create a filter function that excludes filepaths based on ignore files like\n * `.gitignore` and `.prettierignore`.\n */\nexport const createInclusionFilter = async (ignoreFilepaths: string[]) => {\n const ignoreFiles = await Promise.all(\n ignoreFilepaths.map(async (ignoreFilepath) => {\n try {\n return await fs.promises.readFile(ignoreFilepath, 'utf8');\n } catch (err) {\n if (isErrorWithCode(err, 'ENOENT')) {\n return;\n }\n\n throw err;\n }\n }),\n );\n\n const managers = ignoreFiles\n .filter((value): value is string => typeof value === 'string')\n .map((value) => ignore().add(value));\n\n return ignore().add('.git').add(managers).createFilter();\n};\n\n/**\n * Recursively crawl a directory and return all file paths that match the\n * filters. `paths` is mutated and returned.\n */\nasync function crawl(\n directoryPath: string,\n filters: {\n includeDirName: (dirName: string) => boolean;\n includeFilePath: (path: string) => boolean;\n },\n paths: string[] = [],\n) {\n try {\n const entries = await fs.promises.readdir(directoryPath, {\n withFileTypes: true,\n });\n\n await Promise.all(\n entries.map(async (entry) => {\n const fullPath = path.join(directoryPath, entry.name);\n\n if (\n (entry.isFile() || entry.isSymbolicLink()) &&\n filters.includeFilePath(fullPath)\n ) {\n paths.push(fullPath);\n }\n\n if (entry.isDirectory() && filters.includeDirName(entry.name)) {\n await crawl(fullPath, filters, paths);\n }\n }),\n );\n } catch {\n // Ignore errors, because of e.g. permission issues reading directories\n }\n\n return paths;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,mBAAgC;AAKzB,MAAM,4BAA4B,CACvC,UACA,cACA,YAEA,OAAO;AAAA,EACL,SAAS,IAAI,CAAC,YAAY;AACxB,UAAM,cAAU,iBAAAA,SAAU,SAAS,OAAO;AAE1C,UAAM,YAAY,aAAa,OAAO,CAAC,aAAa,QAAQ,QAAQ,CAAC;AAErE,WAAO,CAAC,SAAS,SAAS;AAAA,EAC5B,CAAC;AACH;AAWK,MAAM,iBAAiB,OAC5B,MACA,kBAAkB,CAAC,YAAY,MAC5B;AACH,QAAM,mBAAmB,MAAM;AAAA,IAC7B,gBAAgB,IAAI,CAAC,mBAAmB,YAAAC,QAAK,KAAK,MAAM,cAAc,CAAC;AAAA,EACzE;AAEA,QAAM,oBAAoB,MAAM,MAAM,MAAM;AAAA,IAC1C,gBAAgB,CAAC,YAAY,CAAC,CAAC,QAAQ,cAAc,EAAE,SAAS,OAAO;AAAA,IACvE,iBAAiB,CAAC,aAChB,iBAAiB,YAAAA,QAAK,SAAS,MAAM,QAAQ,CAAC;AAAA,EAClD,CAAC;AAED,QAAM,oBAAoB,kBAAkB;AAAA,IAAI,CAAC,aAC/C,YAAAA,QAAK,SAAS,MAAM,QAAQ;AAAA,EAC9B;AAEA,SAAO;AACT;AAMO,MAAM,wBAAwB,OAAO,oBAA8B;AACxE,QAAM,cAAc,MAAM,QAAQ;AAAA,IAChC,gBAAgB,IAAI,OAAO,mBAAmB;AAC5C,UAAI;AACF,eAAO,MAAM,gBAAAC,QAAG,SAAS,SAAS,gBAAgB,MAAM;AAAA,MAC1D,SAAS,KAAK;AACZ,gBAAI,8BAAgB,KAAK,QAAQ,GAAG;AAClC;AAAA,QACF;AAEA,cAAM;AAAA,MACR;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,WAAW,YACd,OAAO,CAAC,UAA2B,OAAO,UAAU,QAAQ,EAC5D,IAAI,CAAC,cAAU,cAAAC,SAAO,EAAE,IAAI,KAAK,CAAC;AAErC,aAAO,cAAAA,SAAO,EAAE,IAAI,MAAM,EAAE,IAAI,QAAQ,EAAE,aAAa;AACzD;AAMA,eAAe,MACb,eACA,SAIA,QAAkB,CAAC,GACnB;AACA,MAAI;AACF,UAAM,UAAU,MAAM,gBAAAD,QAAG,SAAS,QAAQ,eAAe;AAAA,MACvD,eAAe;AAAA,IACjB,CAAC;AAED,UAAM,QAAQ;AAAA,MACZ,QAAQ,IAAI,OAAO,UAAU;AAC3B,cAAM,WAAW,YAAAD,QAAK,KAAK,eAAe,MAAM,IAAI;AAEpD,aACG,MAAM,OAAO,KAAK,MAAM,eAAe,MACxC,QAAQ,gBAAgB,QAAQ,GAChC;AACA,gBAAM,KAAK,QAAQ;AAAA,QACrB;AAEA,YAAI,MAAM,YAAY,KAAK,QAAQ,eAAe,MAAM,IAAI,GAAG;AAC7D,gBAAM,MAAM,UAAU,SAAS,KAAK;AAAA,QACtC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["picomatch", "path", "fs", "ignore"]
|
|
7
7
|
}
|
package/lib/utils/npmrc.d.ts
CHANGED
package/lib/utils/npmrc.js
CHANGED
|
@@ -18,12 +18,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var npmrc_exports = {};
|
|
20
20
|
__export(npmrc_exports, {
|
|
21
|
+
NPMRC_LINES: () => NPMRC_LINES,
|
|
21
22
|
hasNpmrcSecret: () => hasNpmrcSecret
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(npmrc_exports);
|
|
25
|
+
const NPMRC_LINES = [".npmrc", "!.npmrc", "/.npmrc", "!/.npmrc"];
|
|
24
26
|
const hasNpmrcSecret = (lineOrFullFileContents) => lineOrFullFileContents.includes("_auth") || lineOrFullFileContents.includes("_password");
|
|
25
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
28
|
0 && (module.exports = {
|
|
29
|
+
NPMRC_LINES,
|
|
27
30
|
hasNpmrcSecret
|
|
28
31
|
});
|
|
29
32
|
//# sourceMappingURL=npmrc.js.map
|
package/lib/utils/npmrc.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/utils/npmrc.ts"],
|
|
4
|
-
"sourcesContent": ["// Preventing against _auth, _authToken, _password\n// https://docs.npmjs.com/cli/v10/configuring-npm/npmrc#auth-related-configuration\nexport const hasNpmrcSecret = (lineOrFullFileContents: string): boolean =>\n lineOrFullFileContents.includes('_auth') ||\n lineOrFullFileContents.includes('_password');\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["export const NPMRC_LINES = ['.npmrc', '!.npmrc', '/.npmrc', '!/.npmrc'];\n\n// Preventing against _auth, _authToken, _password\n// https://docs.npmjs.com/cli/v10/configuring-npm/npmrc#auth-related-configuration\nexport const hasNpmrcSecret = (lineOrFullFileContents: string): boolean =>\n lineOrFullFileContents.includes('_auth') ||\n lineOrFullFileContents.includes('_password');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc,CAAC,UAAU,WAAW,WAAW,UAAU;AAI/D,MAAM,iBAAiB,CAAC,2BAC7B,uBAAuB,SAAS,OAAO,KACvC,uBAAuB,SAAS,WAAW;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "11.0.0-
|
|
3
|
+
"version": "11.0.0-main-20250511022834",
|
|
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",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"tsx": "^4.16.2",
|
|
99
99
|
"typescript": "~5.8.0",
|
|
100
100
|
"zod": "^3.22.4",
|
|
101
|
-
"eslint-config-skuba": "6.0.0-
|
|
101
|
+
"eslint-config-skuba": "6.0.0-main-20250511022834"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
104
|
"@changesets/cli": "2.29.3",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# managed by skuba
|
|
2
|
+
package-manager-strict-version=true
|
|
3
|
+
public-hoist-pattern[]="@types*"
|
|
4
|
+
public-hoist-pattern[]="*eslint*"
|
|
5
|
+
public-hoist-pattern[]="*prettier*"
|
|
6
|
+
public-hoist-pattern[]="esbuild"
|
|
7
|
+
public-hoist-pattern[]="jest"
|
|
8
|
+
public-hoist-pattern[]="tsconfig-seek"
|
|
9
|
+
# end managed by skuba
|
|
@@ -6,9 +6,9 @@ configs:
|
|
|
6
6
|
- &docker-ecr-cache
|
|
7
7
|
seek-oss/docker-ecr-cache#v2.2.1: &docker-ecr-cache-defaults
|
|
8
8
|
cache-on:
|
|
9
|
+
- .npmrc
|
|
9
10
|
- package.json#.packageManager
|
|
10
11
|
- pnpm-lock.yaml
|
|
11
|
-
- pnpm-workspace.yaml
|
|
12
12
|
dockerfile: Dockerfile.dev-deps
|
|
13
13
|
secrets:
|
|
14
14
|
- id=npm,src=/var/lib/buildkite-agent/.npmrc
|
|
@@ -10,9 +10,9 @@ RUN --mount=type=bind,source=package.json,target=package.json \
|
|
|
10
10
|
|
|
11
11
|
WORKDIR /workdir
|
|
12
12
|
|
|
13
|
-
RUN --mount=type=bind,source
|
|
13
|
+
RUN --mount=type=bind,source=.npmrc,target=.npmrc \
|
|
14
|
+
--mount=type=bind,source=package.json,target=package.json \
|
|
14
15
|
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
15
|
-
--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml \
|
|
16
16
|
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
17
17
|
--mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN,required=true \
|
|
18
18
|
pnpm fetch
|
|
@@ -10,9 +10,9 @@ RUN --mount=type=bind,source=package.json,target=package.json \
|
|
|
10
10
|
|
|
11
11
|
WORKDIR /workdir
|
|
12
12
|
|
|
13
|
-
RUN --mount=type=bind,source
|
|
13
|
+
RUN --mount=type=bind,source=.npmrc,target=.npmrc \
|
|
14
|
+
--mount=type=bind,source=package.json,target=package.json \
|
|
14
15
|
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
15
|
-
--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml \
|
|
16
16
|
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
17
17
|
--mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN,required=true \
|
|
18
18
|
pnpm fetch
|
|
@@ -6,9 +6,9 @@ configs:
|
|
|
6
6
|
- &docker-ecr-cache
|
|
7
7
|
seek-oss/docker-ecr-cache#v2.2.1: &docker-ecr-cache-defaults
|
|
8
8
|
cache-on:
|
|
9
|
+
- .npmrc
|
|
9
10
|
- package.json#.packageManager
|
|
10
11
|
- pnpm-lock.yaml
|
|
11
|
-
- pnpm-workspace.yaml
|
|
12
12
|
dockerfile: Dockerfile.dev-deps
|
|
13
13
|
secrets:
|
|
14
14
|
- id=npm,src=/var/lib/buildkite-agent/.npmrc
|
|
@@ -10,9 +10,9 @@ RUN --mount=type=bind,source=package.json,target=package.json \
|
|
|
10
10
|
|
|
11
11
|
WORKDIR /workdir
|
|
12
12
|
|
|
13
|
-
RUN --mount=type=bind,source
|
|
13
|
+
RUN --mount=type=bind,source=.npmrc,target=.npmrc \
|
|
14
|
+
--mount=type=bind,source=package.json,target=package.json \
|
|
14
15
|
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
15
|
-
--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml \
|
|
16
16
|
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
17
17
|
--mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN,required=true \
|
|
18
18
|
pnpm fetch
|
|
@@ -6,9 +6,9 @@ configs:
|
|
|
6
6
|
- &docker-ecr-cache
|
|
7
7
|
seek-oss/docker-ecr-cache#v2.2.1: &docker-ecr-cache-defaults
|
|
8
8
|
cache-on:
|
|
9
|
+
- .npmrc
|
|
9
10
|
- package.json#.packageManager
|
|
10
11
|
- pnpm-lock.yaml
|
|
11
|
-
- pnpm-workspace.yaml
|
|
12
12
|
secrets:
|
|
13
13
|
- id=npm,src=/var/lib/buildkite-agent/.npmrc
|
|
14
14
|
- NPM_TOKEN
|
|
@@ -13,9 +13,9 @@ RUN --mount=type=bind,source=package.json,target=package.json \
|
|
|
13
13
|
|
|
14
14
|
WORKDIR /workdir
|
|
15
15
|
|
|
16
|
-
RUN --mount=type=bind,source
|
|
16
|
+
RUN --mount=type=bind,source=.npmrc,target=.npmrc \
|
|
17
|
+
--mount=type=bind,source=package.json,target=package.json \
|
|
17
18
|
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
|
|
18
|
-
--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml \
|
|
19
19
|
--mount=type=secret,id=npm,dst=/root/.npmrc,required=true \
|
|
20
20
|
--mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN,required=true \
|
|
21
21
|
pnpm fetch
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var migrateNpmrcToPnpmWorkspace_exports = {};
|
|
20
|
-
__export(migrateNpmrcToPnpmWorkspace_exports, {
|
|
21
|
-
tryMigrateNpmrcToPnpmWorkspace: () => tryMigrateNpmrcToPnpmWorkspace
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(migrateNpmrcToPnpmWorkspace_exports);
|
|
24
|
-
var import_util = require("util");
|
|
25
|
-
var import_fast_glob = require("fast-glob");
|
|
26
|
-
var import_fs_extra = require("fs-extra");
|
|
27
|
-
var import_dir = require("../../../../../../utils/dir");
|
|
28
|
-
var import_logging = require("../../../../../../utils/logging");
|
|
29
|
-
var import_npmrc = require("../../../../../../utils/npmrc");
|
|
30
|
-
var import_configFile = require("../../../../../configure/processing/configFile");
|
|
31
|
-
const NPMRC = ".npmrc";
|
|
32
|
-
const checkFileExists = async (filePath) => {
|
|
33
|
-
try {
|
|
34
|
-
await import_fs_extra.promises.access(filePath);
|
|
35
|
-
return true;
|
|
36
|
-
} catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
const migrateCustomNpmrcSettings = async () => {
|
|
41
|
-
const contents = await import_fs_extra.promises.readFile(NPMRC, "utf-8");
|
|
42
|
-
const remainderLines = (0, import_configFile.replaceManagedSection)(contents, "").split("\n").map((line) => line.trim()).filter((line) => line.length > 0).filter((line) => !line.startsWith("#")).filter((line) => !(0, import_npmrc.hasNpmrcSecret)(line));
|
|
43
|
-
if (remainderLines.length === 0) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const pnpmWorkspaceFile = "pnpm-workspace.yaml";
|
|
47
|
-
const pnpmWorkspaceExists = await checkFileExists(pnpmWorkspaceFile);
|
|
48
|
-
if (!pnpmWorkspaceExists) {
|
|
49
|
-
await import_fs_extra.promises.writeFile(pnpmWorkspaceFile, "");
|
|
50
|
-
}
|
|
51
|
-
const pnpmWorkspaceContents = await import_fs_extra.promises.readFile(pnpmWorkspaceFile, "utf-8");
|
|
52
|
-
const commentedLines = remainderLines.map((line) => `# ${line}`).join("\n");
|
|
53
|
-
const newContents = `# TODO: Translate these settings to the required format for pnpm-workspace.yaml.
|
|
54
|
-
# skuba moved these from .npmrc, but doesn't know what they mean.
|
|
55
|
-
# See: https://pnpm.io/settings
|
|
56
|
-
#
|
|
57
|
-
${commentedLines}
|
|
58
|
-
|
|
59
|
-
${pnpmWorkspaceContents}`;
|
|
60
|
-
await import_fs_extra.promises.writeFile(pnpmWorkspaceFile, newContents);
|
|
61
|
-
};
|
|
62
|
-
const fixDockerfiles = async () => {
|
|
63
|
-
const fileNames = await (0, import_fast_glob.glob)(["**/Dockerfile*"]);
|
|
64
|
-
await Promise.all(
|
|
65
|
-
fileNames.map(async (fileName) => {
|
|
66
|
-
const contents = await import_fs_extra.promises.readFile(fileName, "utf8");
|
|
67
|
-
const patched = contents.replaceAll(
|
|
68
|
-
"--mount=type=bind,source=.npmrc,target=.npmrc",
|
|
69
|
-
"--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml"
|
|
70
|
-
);
|
|
71
|
-
if (patched !== contents) {
|
|
72
|
-
await import_fs_extra.promises.writeFile(fileName, patched);
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
const fixBuildkitePipelines = async () => {
|
|
78
|
-
const fileNames = await (0, import_fast_glob.glob)(["**/.buildkite/**.{yml,yaml}"]);
|
|
79
|
-
await Promise.all(
|
|
80
|
-
fileNames.map(async (fileName) => {
|
|
81
|
-
const contents = await import_fs_extra.promises.readFile(fileName, "utf8");
|
|
82
|
-
const patched = contents.replace(
|
|
83
|
-
/(cache-on:[\s\S]*?)([ \t]+-[ \t]+\.npmrc)([\s\S]*?)(?=\n[ \t]*\S|$)/g,
|
|
84
|
-
(_, before, npmrcLine, after) => before + npmrcLine.replace(".npmrc", "pnpm-workspace.yaml") + after
|
|
85
|
-
);
|
|
86
|
-
if (patched !== contents) {
|
|
87
|
-
await import_fs_extra.promises.writeFile(fileName, patched);
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
const forceUpgradeToPnpm10 = async () => {
|
|
93
|
-
const fileNames = await (0, import_fast_glob.glob)(["**/package.json"]);
|
|
94
|
-
await Promise.all(
|
|
95
|
-
fileNames.map(async (fileName) => {
|
|
96
|
-
const contents = await import_fs_extra.promises.readFile(fileName, "utf8");
|
|
97
|
-
const packageManagerMatch = /"packageManager"\s*:\s*"pnpm@([^"]+)"/.exec(
|
|
98
|
-
contents
|
|
99
|
-
);
|
|
100
|
-
if (!packageManagerMatch) return;
|
|
101
|
-
const currentVersion = packageManagerMatch[1] ?? "";
|
|
102
|
-
const majorVersion = parseInt(currentVersion.split(".")?.[0] ?? "0", 10);
|
|
103
|
-
if (!isNaN(majorVersion) && majorVersion < 10) {
|
|
104
|
-
const patched = contents.replace(
|
|
105
|
-
/"packageManager"(\s*):(\s*)"pnpm@[^"]+"/,
|
|
106
|
-
'"packageManager"$1:$2"pnpm@10.8.1"'
|
|
107
|
-
);
|
|
108
|
-
await import_fs_extra.promises.writeFile(fileName, patched);
|
|
109
|
-
}
|
|
110
|
-
})
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
const migrateNpmrcToPnpmWorkspace = async ({
|
|
114
|
-
mode,
|
|
115
|
-
packageManager
|
|
116
|
-
}) => {
|
|
117
|
-
if (packageManager.command !== "pnpm") {
|
|
118
|
-
return {
|
|
119
|
-
result: "skip",
|
|
120
|
-
reason: "not using pnpm"
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
const [workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([
|
|
124
|
-
(0, import_dir.findWorkspaceRoot)(),
|
|
125
|
-
(0, import_dir.findCurrentWorkspaceProjectRoot)()
|
|
126
|
-
]);
|
|
127
|
-
if (workspaceRoot !== currentWorkspaceProjectRoot) {
|
|
128
|
-
return {
|
|
129
|
-
result: "skip",
|
|
130
|
-
reason: "not running in the workspace root"
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
const npmrcExists = await checkFileExists(NPMRC);
|
|
134
|
-
if (!npmrcExists) {
|
|
135
|
-
return {
|
|
136
|
-
result: "skip",
|
|
137
|
-
reason: "no .npmrc found"
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
if (mode === "lint") {
|
|
141
|
-
return {
|
|
142
|
-
result: "apply"
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
await Promise.all([
|
|
146
|
-
migrateCustomNpmrcSettings(),
|
|
147
|
-
fixDockerfiles(),
|
|
148
|
-
fixBuildkitePipelines(),
|
|
149
|
-
forceUpgradeToPnpm10()
|
|
150
|
-
]);
|
|
151
|
-
await import_fs_extra.promises.rm(NPMRC);
|
|
152
|
-
return { result: "apply" };
|
|
153
|
-
};
|
|
154
|
-
const tryMigrateNpmrcToPnpmWorkspace = async (config) => {
|
|
155
|
-
try {
|
|
156
|
-
return await migrateNpmrcToPnpmWorkspace(config);
|
|
157
|
-
} catch (err) {
|
|
158
|
-
import_logging.log.warn("Failed to migrate .npmrc to pnpm-workspace.yaml");
|
|
159
|
-
import_logging.log.subtle((0, import_util.inspect)(err));
|
|
160
|
-
return { result: "skip", reason: "due to an error" };
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
164
|
-
0 && (module.exports = {
|
|
165
|
-
tryMigrateNpmrcToPnpmWorkspace
|
|
166
|
-
});
|
|
167
|
-
//# sourceMappingURL=migrateNpmrcToPnpmWorkspace.js.map
|
package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport { promises as fs } from 'fs-extra';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport {\n findCurrentWorkspaceProjectRoot,\n findWorkspaceRoot,\n} from '../../../../../../utils/dir';\nimport { log } from '../../../../../../utils/logging';\nimport { hasNpmrcSecret } from '../../../../../../utils/npmrc';\nimport { replaceManagedSection } from '../../../../../configure/processing/configFile';\n\nconst NPMRC = '.npmrc';\n\nconst checkFileExists = async (filePath: string) => {\n try {\n await fs.access(filePath);\n return true;\n } catch {\n return false;\n }\n};\n\nconst migrateCustomNpmrcSettings = async () => {\n const contents = await fs.readFile(NPMRC, 'utf-8');\n\n const remainderLines = replaceManagedSection(contents, '')\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line.length > 0)\n .filter((line) => !line.startsWith('#'))\n .filter((line) => !hasNpmrcSecret(line));\n\n if (remainderLines.length === 0) {\n return;\n }\n\n const pnpmWorkspaceFile = 'pnpm-workspace.yaml';\n const pnpmWorkspaceExists = await checkFileExists(pnpmWorkspaceFile);\n if (!pnpmWorkspaceExists) {\n await fs.writeFile(pnpmWorkspaceFile, '');\n }\n\n // prepend the lines to the pnpm-workspace.yaml file, but commented out\n const pnpmWorkspaceContents = await fs.readFile(pnpmWorkspaceFile, 'utf-8');\n const commentedLines = remainderLines.map((line) => `# ${line}`).join('\\n');\n const newContents = `# TODO: Translate these settings to the required format for pnpm-workspace.yaml.\n# skuba moved these from .npmrc, but doesn't know what they mean.\n# See: https://pnpm.io/settings\n#\n${commentedLines}\n\n${pnpmWorkspaceContents}`;\n\n await fs.writeFile(pnpmWorkspaceFile, newContents);\n};\n\nconst fixDockerfiles = async () => {\n const fileNames = await glob(['**/Dockerfile*']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n const patched = contents.replaceAll(\n '--mount=type=bind,source=.npmrc,target=.npmrc',\n '--mount=type=bind,source=pnpm-workspace.yaml,target=pnpm-workspace.yaml',\n );\n\n if (patched !== contents) {\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst fixBuildkitePipelines = async () => {\n const fileNames = await glob(['**/.buildkite/**.{yml,yaml}']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n const patched = contents.replace(\n /(cache-on:[\\s\\S]*?)([ \\t]+-[ \\t]+\\.npmrc)([\\s\\S]*?)(?=\\n[ \\t]*\\S|$)/g,\n (_, before: string, npmrcLine: string, after: string) =>\n before + npmrcLine.replace('.npmrc', 'pnpm-workspace.yaml') + after,\n );\n\n if (patched !== contents) {\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst forceUpgradeToPnpm10 = async () => {\n const fileNames = await glob(['**/package.json']);\n\n await Promise.all(\n fileNames.map(async (fileName) => {\n const contents = await fs.readFile(fileName, 'utf8');\n\n const packageManagerMatch = /\"packageManager\"\\s*:\\s*\"pnpm@([^\"]+)\"/.exec(\n contents,\n );\n\n if (!packageManagerMatch) return;\n\n const currentVersion = packageManagerMatch[1] ?? '';\n const majorVersion = parseInt(currentVersion.split('.')?.[0] ?? '0', 10);\n\n if (!isNaN(majorVersion) && majorVersion < 10) {\n const patched = contents.replace(\n /\"packageManager\"(\\s*):(\\s*)\"pnpm@[^\"]+\"/,\n '\"packageManager\"$1:$2\"pnpm@10.8.1\"',\n );\n\n await fs.writeFile(fileName, patched);\n }\n }),\n );\n};\n\nconst migrateNpmrcToPnpmWorkspace: PatchFunction = async ({\n mode,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n const [workspaceRoot, currentWorkspaceProjectRoot] = await Promise.all([\n findWorkspaceRoot(),\n findCurrentWorkspaceProjectRoot(),\n ]);\n\n if (workspaceRoot !== currentWorkspaceProjectRoot) {\n return {\n result: 'skip',\n reason: 'not running in the workspace root',\n };\n }\n\n const npmrcExists = await checkFileExists(NPMRC);\n if (!npmrcExists) {\n return {\n result: 'skip',\n reason: 'no .npmrc found',\n };\n }\n\n if (mode === 'lint') {\n return {\n result: 'apply',\n };\n }\n\n await Promise.all([\n migrateCustomNpmrcSettings(),\n fixDockerfiles(),\n fixBuildkitePipelines(),\n forceUpgradeToPnpm10(),\n ]);\n\n await fs.rm(NPMRC);\n\n return { result: 'apply' };\n};\n\nexport const tryMigrateNpmrcToPnpmWorkspace: PatchFunction = async (config) => {\n try {\n return await migrateNpmrcToPnpmWorkspace(config);\n } catch (err) {\n log.warn('Failed to migrate .npmrc to pnpm-workspace.yaml');\n log.subtle(inspect(err));\n return { result: 'skip', reason: 'due to an error' };\n }\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAA+B;AAG/B,iBAGO;AACP,qBAAoB;AACpB,mB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