skuba 10.2.0-config-20250421024010 → 11.0.0-feat-npmrc-to-workspace-20250511013825
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/README.md +0 -3
- package/lib/api/github/issueComment.d.ts +4 -2
- package/lib/api/github/issueComment.js +13 -0
- package/lib/api/github/issueComment.js.map +2 -2
- package/lib/cli/build/assets.js +3 -9
- package/lib/cli/build/assets.js.map +2 -2
- package/lib/cli/configure/processing/configFile.d.ts +2 -2
- package/lib/cli/configure/processing/configFile.js +18 -21
- package/lib/cli/configure/processing/configFile.js.map +2 -2
- package/lib/cli/lint/internalLints/detectBadCodeowners.js +1 -2
- package/lib/cli/lint/internalLints/detectBadCodeowners.js.map +2 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.d.ts +6 -2
- package/lib/cli/lint/internalLints/refreshConfigFiles.js +26 -22
- package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +3 -3
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js +5 -0
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.d.ts +2 -0
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js +167 -0
- package/lib/cli/lint/internalLints/upgrade/patches/10.1.0/migrateNpmrcToPnpmWorkspace.js.map +7 -0
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js +0 -9
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/index.js.map +2 -2
- package/lib/cli/test/index.js +1 -0
- package/lib/cli/test/index.js.map +2 -2
- package/lib/utils/copy.js +1 -1
- package/lib/utils/copy.js.map +2 -2
- package/lib/utils/dir.d.ts +10 -0
- package/lib/utils/dir.js +74 -2
- package/lib/utils/dir.js.map +3 -3
- package/lib/utils/npmrc.d.ts +0 -1
- package/lib/utils/npmrc.js +0 -3
- package/lib/utils/npmrc.js.map +2 -2
- package/package.json +12 -12
- package/template/base/_.gitignore +2 -0
- package/template/base/_pnpm-workspace.yaml +10 -0
- package/template/express-rest-api/.buildkite/pipeline.yml +9 -18
- package/template/express-rest-api/Dockerfile.dev-deps +4 -3
- package/template/express-rest-api/package.json +1 -1
- package/template/greeter/.buildkite/pipeline.yml +5 -14
- package/template/greeter/Dockerfile +4 -3
- package/template/greeter/package.json +2 -2
- package/template/koa-rest-api/.buildkite/pipeline.yml +9 -18
- package/template/koa-rest-api/Dockerfile.dev-deps +4 -3
- package/template/koa-rest-api/package.json +1 -1
- package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +9 -18
- package/template/lambda-sqs-worker-cdk/Dockerfile +4 -3
- package/template/lambda-sqs-worker-cdk/infra/appStack.ts +7 -0
- package/template/lambda-sqs-worker-cdk/package.json +3 -2
- package/template/lambda-sqs-worker-cdk/src/app.ts +10 -3
- package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +5 -8
- package/template/oss-npm-package/_package.json +2 -2
- package/template/private-npm-package/_package.json +1 -1
- package/config/index.d.ts +0 -1
- package/config/index.js +0 -1
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.d.ts +0 -2
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js +0 -95
- package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js.map +0 -7
- package/lib/config/index.d.ts +0 -1
- package/lib/config/index.js +0 -29
- package/lib/config/index.js.map +0 -7
- package/lib/config/load.d.ts +0 -2
- package/lib/config/load.js +0 -75
- package/lib/config/load.js.map +0 -7
- package/lib/config/types.d.ts +0 -51
- package/lib/config/types.js +0 -74
- package/lib/config/types.js.map +0 -7
- package/template/base/_.npmrc +0 -9
|
@@ -0,0 +1,167 @@
|
|
|
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
|
|
@@ -0,0 +1,7 @@
|
|
|
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,mBAA+B;AAC/B,wBAAsC;AAEtC,MAAM,QAAQ;AAEd,MAAM,kBAAkB,OAAO,aAAqB;AAClD,MAAI;AACF,UAAM,gBAAAA,SAAG,OA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M,QAAQ,IAAI;AAAA,QACrE,8BAAkB;AAAA,QAClB,4CAAgC;AAAA,EAClC,CAAC;AAED,MAAI,kBAAkB,6BAA6B;AACjD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,cAAc,MAAM,gBAAgB,KAAK;AAC/C,MAAI,CAAC,aAAa;AAChB,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,IAAI;AAAA,IAChB,2BAA2B;AAAA,IAC3B,eAAe;AAAA,IACf,sBAAsB;AAAA,IACtB,qBAAqB;AAAA,EACvB,CAAC;AAED,QAAM,gBAAAA,SAAG,GAAG,KAAK;AAEjB,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,iCAAgD,OAAO,WAAW;AAC7E,MAAI;AACF,WAAO,MAAM,4BAA4B,MAAM;AAAA,EACjD,SAAS,KAAK;AACZ,uBAAI,KAAK,iDAAiD;AAC1D,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
|
+
"names": ["fs"]
|
|
7
|
+
}
|
|
@@ -23,7 +23,6 @@ __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");
|
|
27
26
|
var import_patchDockerfile = require("./patchDockerfile");
|
|
28
27
|
var import_patchServerListener = require("./patchServerListener");
|
|
29
28
|
const patches = [
|
|
@@ -42,14 +41,6 @@ const patches = [
|
|
|
42
41
|
{
|
|
43
42
|
apply: import_patchServerListener.tryPatchServerListener,
|
|
44
43
|
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"
|
|
53
44
|
}
|
|
54
45
|
];
|
|
55
46
|
// 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 {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iCAAuC;AAEvC,6BAAmC;AACnC,
|
|
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cli/test/index.js
CHANGED
|
@@ -24,6 +24,7 @@ module.exports = __toCommonJS(test_exports);
|
|
|
24
24
|
var import_jest = require("jest");
|
|
25
25
|
const test = async () => {
|
|
26
26
|
process.env.NODE_ENV ??= "test";
|
|
27
|
+
process.env.TS_JEST_LOG ??= "stdout:error";
|
|
27
28
|
const argv = process.argv.slice(2);
|
|
28
29
|
return (0, import_jest.run)(argv);
|
|
29
30
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/cli/test/index.ts"],
|
|
4
|
-
"sourcesContent": ["import { run } from 'jest';\n\nexport const test = async () => {\n // This is usually set in `jest-cli`'s binary wrapper\n process.env.NODE_ENV ??= 'test';\n\n const argv = process.argv.slice(2);\n\n return run(argv);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoB;AAEb,MAAM,OAAO,YAAY;AAE9B,UAAQ,IAAI,aAAa;
|
|
4
|
+
"sourcesContent": ["import { run } from 'jest';\n\nexport const test = async () => {\n // This is usually set in `jest-cli`'s binary wrapper\n process.env.NODE_ENV ??= 'test';\n\n // ts-jest is logging a warning about `isolatedModules`.\n // This is a workaround until we can remove the `isolatedModules` option.\n // https://github.com/seek-oss/skuba/issues/1841\n process.env.TS_JEST_LOG ??= 'stdout:error';\n\n const argv = process.argv.slice(2);\n\n return run(argv);\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAoB;AAEb,MAAM,OAAO,YAAY;AAE9B,UAAQ,IAAI,aAAa;AAKzB,UAAQ,IAAI,gBAAgB;AAE5B,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,aAAO,iBAAI,IAAI;AACjB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/utils/copy.js
CHANGED
|
@@ -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") : filename
|
|
82
|
+
opts.stripUnderscorePrefix ? filename.replace(/^_\./, ".").replace(/^_package\.json/, "package.json").replace(/^_eslint\.config\.js/, "eslint.config.js").replace(/^_pnpm-workspace\.yaml/, "pnpm-workspace.yaml") : 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 : 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;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 .replace(/^_pnpm-workspace\\.yaml/, 'pnpm-workspace.yaml')\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;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;AAE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AM,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,3 +20,13 @@ 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,13 +30,18 @@ var dir_exports = {};
|
|
|
30
30
|
__export(dir_exports, {
|
|
31
31
|
buildPatternToFilepathMap: () => buildPatternToFilepathMap,
|
|
32
32
|
crawlDirectory: () => crawlDirectory,
|
|
33
|
-
createInclusionFilter: () => createInclusionFilter
|
|
33
|
+
createInclusionFilter: () => createInclusionFilter,
|
|
34
|
+
findCurrentWorkspaceProjectRoot: () => findCurrentWorkspaceProjectRoot,
|
|
35
|
+
findWorkspaceRoot: () => findWorkspaceRoot,
|
|
36
|
+
locateFurthestFile: () => locateFurthestFile,
|
|
37
|
+
locateNearestFile: () => locateNearestFile
|
|
34
38
|
});
|
|
35
39
|
module.exports = __toCommonJS(dir_exports);
|
|
36
40
|
var import_path = __toESM(require("path"));
|
|
37
41
|
var import_fs_extra = __toESM(require("fs-extra"));
|
|
38
42
|
var import_ignore = __toESM(require("ignore"));
|
|
39
43
|
var import_picomatch = __toESM(require("picomatch"));
|
|
44
|
+
var import_findRoot = require("../api/git/findRoot");
|
|
40
45
|
var import_error = require("./error");
|
|
41
46
|
const buildPatternToFilepathMap = (patterns, allFilepaths, options) => Object.fromEntries(
|
|
42
47
|
patterns.map((pattern) => {
|
|
@@ -94,10 +99,77 @@ async function crawl(directoryPath, filters, paths = []) {
|
|
|
94
99
|
}
|
|
95
100
|
return paths;
|
|
96
101
|
}
|
|
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
|
+
};
|
|
97
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
98
166
|
0 && (module.exports = {
|
|
99
167
|
buildPatternToFilepathMap,
|
|
100
168
|
crawlDirectory,
|
|
101
|
-
createInclusionFilter
|
|
169
|
+
createInclusionFilter,
|
|
170
|
+
findCurrentWorkspaceProjectRoot,
|
|
171
|
+
findWorkspaceRoot,
|
|
172
|
+
locateFurthestFile,
|
|
173
|
+
locateNearestFile
|
|
102
174
|
});
|
|
103
175
|
//# 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 { 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,iBAAi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AD,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"]
|
|
4
|
+
"sourcesContent": ["import path from 'path';\n\nimport fs from 'fs-extra';\nimport ignore from 'ignore';\nimport picomatch from 'picomatch';\n\nimport { findRoot as findGitRoot } from '../api/git/findRoot';\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\nexport const locateNearestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n return filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return null;\n};\n\nexport const locateFurthestFile = async ({\n cwd,\n filename,\n}: {\n cwd: string;\n filename: string;\n}) => {\n let currentDir = cwd;\n let furthestFilePath: string | null = null;\n\n while (currentDir !== path.dirname(currentDir)) {\n const filePath = path.join(currentDir, filename);\n if (await fs.pathExists(filePath)) {\n furthestFilePath = filePath;\n }\n currentDir = path.dirname(currentDir);\n }\n\n return furthestFilePath;\n};\n\nconst workspaceRootCache: Record<string, string | null> = {};\n\nexport const findWorkspaceRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const find = async (): Promise<string | null> => {\n const [pnpmLock, yarnLock, packageJson, gitRoot] = await Promise.all([\n locateNearestFile({ cwd, filename: 'pnpm-lock.yaml' }),\n locateNearestFile({ cwd, filename: 'yarn.lock' }),\n locateFurthestFile({ cwd, filename: 'package.json' }),\n findGitRoot({ dir: cwd }),\n ]);\n\n const candidates = [\n pnpmLock ? path.dirname(pnpmLock) : null,\n yarnLock ? path.dirname(yarnLock) : null,\n packageJson ? path.dirname(packageJson) : null,\n gitRoot,\n ].filter((dir): dir is string => dir !== null);\n\n if (candidates[0]) {\n // Pick the longest path. This will be the most specific, which helps guard against someone\n // having an accidental lockfile in a parent directory by mistake.\n\n return candidates.reduce((longest, current) => {\n if (current.split(path.sep).length > longest.split(path.sep).length) {\n return current;\n }\n return longest;\n }, candidates[0]);\n }\n\n return null;\n };\n\n return (workspaceRootCache[cwd] ??= await find());\n};\n\nexport const findCurrentWorkspaceProjectRoot = async (\n cwd = process.cwd(),\n): Promise<string | null> => {\n const packageJson = await locateNearestFile({\n cwd,\n filename: 'package.json',\n });\n return packageJson ? path.dirname(packageJson) : null;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,sBAAe;AACf,oBAAmB;AACnB,uBAAsB;AAEtB,sBAAwC;AAExC,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,SAA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AAA,MACnE,kBAAkB,EAAE,KAAK,UAAU,iBAAiB,CAAC;AAAA,MACrD,kBAAkB,EAAE,KAAK,UAAU,YAAY,CAAC;AAAA,MAChD,mBAAmB,EAAE,KAAK,UAAU,eAAe,CAAC;AAAA,UACpD,gBAAAG,UAAY,EAAE,KAAK,IAAI,CAAC;AAAA,IAC1B,CAAC;AAED,UAAM,aAAa;AAAA,MACjB,WAAW,YAAAH,QAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,WAAW,YAAAA,QAAK,QAAQ,QAAQ,IAAI;AAAA,MACpC,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AAAA,MAC1C;AAAA,IACF,EAAE,OAAO,CAAC,QAAuB,QAAQ,IAAI;AAE7C,QAAI,WAAW,CAAC,GAAG;AAIjB,aAAO,WAAW,OAAO,CAAC,SAAS,YAAY;AAC7C,YAAI,QAAQ,MAAM,YAAAA,QAAK,GAAG,EAAE,SAAS,QAAQ,MAAM,YAAAA,QAAK,GAAG,EAAE,QAAQ;AACnE,iBAAO;AAAA,QACT;AACA,eAAO;AAAA,MACT,GAAG,WAAW,CAAC,CAAC;AAAA,IAClB;AAEA,WAAO;AAAA,EACT;AAEA,SAAQ,mBAAmB,GAAG,MAAM,MAAM,KAAK;AACjD;AAEO,MAAM,kCAAkC,OAC7C,MAAM,QAAQ,IAAI,MACS;AAC3B,QAAM,cAAc,MAAM,kBAAkB;AAAA,IAC1C;AAAA,IACA,UAAU;AAAA,EACZ,CAAC;AACD,SAAO,cAAc,YAAAA,QAAK,QAAQ,WAAW,IAAI;AACnD;",
|
|
6
|
+
"names": ["picomatch", "path", "fs", "ignore", "findGitRoot"]
|
|
7
7
|
}
|
package/lib/utils/npmrc.d.ts
CHANGED
package/lib/utils/npmrc.js
CHANGED
|
@@ -18,15 +18,12 @@ 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,
|
|
22
21
|
hasNpmrcSecret: () => hasNpmrcSecret
|
|
23
22
|
});
|
|
24
23
|
module.exports = __toCommonJS(npmrc_exports);
|
|
25
|
-
const NPMRC_LINES = [".npmrc", "!.npmrc", "/.npmrc", "!/.npmrc"];
|
|
26
24
|
const hasNpmrcSecret = (lineOrFullFileContents) => lineOrFullFileContents.includes("_auth") || lineOrFullFileContents.includes("_password");
|
|
27
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
26
|
0 && (module.exports = {
|
|
29
|
-
NPMRC_LINES,
|
|
30
27
|
hasNpmrcSecret
|
|
31
28
|
});
|
|
32
29
|
//# 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": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
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;AAEO,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": "
|
|
3
|
+
"version": "11.0.0-feat-npmrc-to-workspace-20250511013825",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@octokit/graphql": "^8.0.0",
|
|
57
57
|
"@octokit/graphql-schema": "^15.3.0",
|
|
58
58
|
"@octokit/rest": "^21.0.0",
|
|
59
|
-
"@octokit/types": "^
|
|
59
|
+
"@octokit/types": "^14.0.0",
|
|
60
60
|
"@types/jest": "^29.0.0",
|
|
61
61
|
"@types/node": "^22.0.0",
|
|
62
62
|
"chalk": "^4.1.0",
|
|
@@ -78,7 +78,6 @@
|
|
|
78
78
|
"isomorphic-git": "^1.11.1",
|
|
79
79
|
"jest": "^29.0.1",
|
|
80
80
|
"jest-watch-typeahead": "^2.1.1",
|
|
81
|
-
"jiti": "^2.4.2",
|
|
82
81
|
"lodash.mergewith": "^4.6.2",
|
|
83
82
|
"minimist": "^1.2.6",
|
|
84
83
|
"normalize-package-data": "^7.0.0",
|
|
@@ -89,7 +88,7 @@
|
|
|
89
88
|
"prettier": "~3.5.0",
|
|
90
89
|
"prettier-plugin-packagejson": "^2.4.10",
|
|
91
90
|
"read-pkg-up": "^7.0.1",
|
|
92
|
-
"semantic-release": "^
|
|
91
|
+
"semantic-release": "^24.2.3",
|
|
93
92
|
"simple-git": "^3.5.0",
|
|
94
93
|
"ts-dedent": "^2.2.0",
|
|
95
94
|
"ts-jest": "^29.1.0",
|
|
@@ -99,10 +98,10 @@
|
|
|
99
98
|
"tsx": "^4.16.2",
|
|
100
99
|
"typescript": "~5.8.0",
|
|
101
100
|
"zod": "^3.22.4",
|
|
102
|
-
"eslint-config-skuba": "
|
|
101
|
+
"eslint-config-skuba": "6.0.0-feat-npmrc-to-workspace-20250511013825"
|
|
103
102
|
},
|
|
104
103
|
"devDependencies": {
|
|
105
|
-
"@changesets/cli": "2.
|
|
104
|
+
"@changesets/cli": "2.29.3",
|
|
106
105
|
"@changesets/get-github-info": "0.6.0",
|
|
107
106
|
"@jest/reporters": "29.7.0",
|
|
108
107
|
"@jest/test-result": "29.7.0",
|
|
@@ -115,7 +114,7 @@
|
|
|
115
114
|
"@types/module-alias": "2.0.4",
|
|
116
115
|
"@types/npm-registry-fetch": "8.0.7",
|
|
117
116
|
"@types/npm-which": "3.0.3",
|
|
118
|
-
"@types/picomatch": "
|
|
117
|
+
"@types/picomatch": "4.0.0",
|
|
119
118
|
"@types/semver": "7.7.0",
|
|
120
119
|
"@types/supertest": "6.0.3",
|
|
121
120
|
"enhanced-resolve": "5.18.1",
|
|
@@ -123,8 +122,8 @@
|
|
|
123
122
|
"fastify": "5.3.2",
|
|
124
123
|
"jest-diff": "29.7.0",
|
|
125
124
|
"jsonfile": "6.1.0",
|
|
126
|
-
"koa": "
|
|
127
|
-
"memfs": "4.17.
|
|
125
|
+
"koa": "3.0.0",
|
|
126
|
+
"memfs": "4.17.1",
|
|
128
127
|
"remark-cli": "12.0.1",
|
|
129
128
|
"remark-preset-lint-recommended": "7.0.1",
|
|
130
129
|
"semver": "7.7.1",
|
|
@@ -140,7 +139,7 @@
|
|
|
140
139
|
}
|
|
141
140
|
},
|
|
142
141
|
"engines": {
|
|
143
|
-
"node": ">=
|
|
142
|
+
"node": ">=20.9.0"
|
|
144
143
|
},
|
|
145
144
|
"publishConfig": {
|
|
146
145
|
"provenance": true
|
|
@@ -158,12 +157,13 @@
|
|
|
158
157
|
"deploy": "scripts/deploy.sh",
|
|
159
158
|
"format": "pnpm --silent skuba format && pnpm format:packages",
|
|
160
159
|
"format:packages": "pnpm --filter '!./template/**' format",
|
|
161
|
-
"lint": "pnpm --silent skuba lint && pnpm
|
|
160
|
+
"lint": "pnpm --silent skuba lint && pnpm --silent lint:md",
|
|
161
|
+
"lint-all": "pnpm lint && pnpm lint:packages",
|
|
162
162
|
"lint:md": "remark --frail --quiet .",
|
|
163
163
|
"lint:packages": "pnpm --filter '!./template/**' lint",
|
|
164
164
|
"release": "pnpm --silent build && changeset publish",
|
|
165
165
|
"skuba": "pnpm --silent build && pnpm --silent skuba:exec",
|
|
166
|
-
"skuba:exec": "node --experimental-vm-modules lib/skuba",
|
|
166
|
+
"skuba:exec": "node --experimental-vm-modules --no-warnings=ExperimentalWarning lib/skuba",
|
|
167
167
|
"stage": "changeset version && node ./.changeset/inject.js && pnpm format",
|
|
168
168
|
"test": "pnpm --silent skuba test --selectProjects unit --",
|
|
169
169
|
"test:ci": "pnpm --silent skuba test --runInBand",
|