skuba 8.1.0-patch-pnpm-package-20240411042949 → 8.1.0-pm-20240506055052

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.
Files changed (47) hide show
  1. package/lib/api/git/index.d.ts +1 -0
  2. package/lib/api/git/index.js +3 -0
  3. package/lib/api/git/index.js.map +2 -2
  4. package/lib/api/git/isFileGitIgnored.d.ts +4 -0
  5. package/lib/api/git/isFileGitIgnored.js +49 -0
  6. package/lib/api/git/isFileGitIgnored.js.map +7 -0
  7. package/lib/cli/init/index.js +1 -15
  8. package/lib/cli/init/index.js.map +2 -2
  9. package/lib/cli/lint/internalLints/patchRenovateConfig.d.ts +1 -1
  10. package/lib/cli/lint/internalLints/patchRenovateConfig.js +1 -4
  11. package/lib/cli/lint/internalLints/patchRenovateConfig.js.map +2 -2
  12. package/lib/cli/lint/internalLints/refreshConfigFiles.js +14 -3
  13. package/lib/cli/lint/internalLints/refreshConfigFiles.js.map +2 -2
  14. package/lib/cli/lint/internalLints/upgrade/index.d.ts +1 -9
  15. package/lib/cli/lint/internalLints/upgrade/index.js +5 -15
  16. package/lib/cli/lint/internalLints/upgrade/index.js.map +2 -2
  17. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js +1 -1
  18. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/addEmptyExports.js.map +2 -2
  19. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.d.ts +1 -1
  20. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js +1 -1
  21. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/moveNpmrcOutOfIgnoreManagedSection.js.map +2 -2
  22. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js +1 -4
  23. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchDockerfile.js.map +2 -2
  24. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js +1 -4
  25. package/lib/cli/lint/internalLints/upgrade/patches/7.3.1/patchServerListener.js.map +2 -2
  26. package/lib/utils/packageManager.js +13 -8
  27. package/lib/utils/packageManager.js.map +3 -3
  28. package/package.json +5 -6
  29. package/template/base/_.prettierignore +1 -0
  30. package/template/express-rest-api/package.json +1 -1
  31. package/template/greeter/package.json +1 -1
  32. package/template/koa-rest-api/package.json +1 -1
  33. package/template/lambda-sqs-worker/package.json +1 -1
  34. package/template/lambda-sqs-worker-cdk/cdk.json +0 -23
  35. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +6 -6
  36. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +18 -20
  37. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +15 -14
  38. package/template/lambda-sqs-worker-cdk/infra/config.ts +41 -0
  39. package/template/lambda-sqs-worker-cdk/infra/index.ts +2 -5
  40. package/template/lambda-sqs-worker-cdk/package.json +2 -2
  41. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.d.ts +0 -2
  42. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js +0 -35
  43. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/index.js.map +0 -7
  44. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.d.ts +0 -2
  45. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js +0 -147
  46. package/lib/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.js.map +0 -7
  47. package/template/lambda-sqs-worker-cdk/shared/context-types.ts +0 -22
@@ -1,147 +0,0 @@
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 patchPnpmPackageManager_exports = {};
30
- __export(patchPnpmPackageManager_exports, {
31
- tryPatchPnpmPackageManager: () => tryPatchPnpmPackageManager
32
- });
33
- module.exports = __toCommonJS(patchPnpmPackageManager_exports);
34
- var import_util = require("util");
35
- var import_fast_glob = __toESM(require("fast-glob"));
36
- var import_fs_extra = require("fs-extra");
37
- var import_semver = require("semver");
38
- var import_logging = require("../../../../../../utils/logging");
39
- const DOCKERFILE_COREPACK_COMMAND = "RUN corepack enable pnpm";
40
- const PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\
41
- corepack enable pnpm && corepack install`;
42
- const PACKAGE_JSON_CACHE = "- package.json#.packageManager";
43
- const BEFORE_PIPELINE_REGEX = /(\s*cache-on:\s*\n\s*-\s*\.npmrc\s*\n)((\s*)-\s*pnpm-lock\.yaml)/gm;
44
- const ECR_REGEX = /seek-oss\/docker-ecr-cache#v([\d\.]+)/gm;
45
- const fetchFiles = async (files) => Promise.all(
46
- files.map(async (file) => {
47
- const contents = await (0, import_fs_extra.readFile)(file, "utf8");
48
- return {
49
- file,
50
- contents
51
- };
52
- })
53
- );
54
- const patchPnpmPackageManager = async ({
55
- mode,
56
- manifest,
57
- packageManager
58
- }) => {
59
- if (packageManager.command !== "pnpm") {
60
- return {
61
- result: "skip",
62
- reason: "not using pnpm"
63
- };
64
- }
65
- if (!manifest.packageJson.packageManager?.includes("pnpm")) {
66
- return {
67
- result: "skip",
68
- reason: "no packageManager declaration in package.json found"
69
- };
70
- }
71
- const [maybeDockerfiles, maybePipelines] = await Promise.all([
72
- (0, import_fast_glob.default)(["Dockerfile*"]),
73
- (0, import_fast_glob.default)([".buildkite/*.yml"])
74
- ]);
75
- if (!maybeDockerfiles.length || !maybePipelines.length) {
76
- return {
77
- result: "skip",
78
- reason: "Either dockerfiles or pipelines were not found"
79
- };
80
- }
81
- const [dockerfiles, pipelines] = await Promise.all([
82
- fetchFiles(maybeDockerfiles),
83
- fetchFiles(maybePipelines)
84
- ]);
85
- const dockerFilesToPatch = dockerfiles.filter(
86
- ({ contents }) => contents.includes(DOCKERFILE_COREPACK_COMMAND) && !contents.includes("target=package.json")
87
- );
88
- const pipelinesToPatch = pipelines.filter(
89
- ({ contents }) => Boolean(BEFORE_PIPELINE_REGEX.exec(contents))
90
- );
91
- if (!dockerFilesToPatch.length && !pipelinesToPatch.length) {
92
- return {
93
- result: "skip",
94
- reason: "no pipeline or dockerfiles to patch"
95
- };
96
- }
97
- if (mode === "lint") {
98
- return { result: "apply" };
99
- }
100
- if (dockerFilesToPatch.length) {
101
- await Promise.all(
102
- dockerFilesToPatch.map(async ({ file, contents }) => {
103
- const patchedContent = contents.replace(
104
- DOCKERFILE_COREPACK_COMMAND,
105
- PACKAGE_JSON_MOUNT
106
- );
107
- await (0, import_fs_extra.writeFile)(file, patchedContent);
108
- })
109
- );
110
- }
111
- if (pipelinesToPatch.length) {
112
- await Promise.all(
113
- pipelinesToPatch.map(async ({ file, contents }) => {
114
- const patchedContent = contents.replace(
115
- BEFORE_PIPELINE_REGEX,
116
- `$1$3${PACKAGE_JSON_CACHE}
117
- $2`
118
- );
119
- const patchedEcrContent = patchedContent.replace(
120
- ECR_REGEX,
121
- (match, version) => {
122
- if (typeof version === "string" && (0, import_semver.lt)(version, "2.2.0")) {
123
- return "seek-oss/docker-ecr-cache#v2.2.0";
124
- }
125
- return match;
126
- }
127
- );
128
- await (0, import_fs_extra.writeFile)(file, patchedEcrContent);
129
- })
130
- );
131
- }
132
- return { result: "apply" };
133
- };
134
- const tryPatchPnpmPackageManager = async (config) => {
135
- try {
136
- return await patchPnpmPackageManager(config);
137
- } catch (err) {
138
- import_logging.log.warn("Failed to patch pnpm packageManager CI configuration.");
139
- import_logging.log.subtle((0, import_util.inspect)(err));
140
- return { result: "skip", reason: "due to an error" };
141
- }
142
- };
143
- // Annotate the CommonJS export names for ESM import in node:
144
- 0 && (module.exports = {
145
- tryPatchPnpmPackageManager
146
- });
147
- //# sourceMappingURL=patchPnpmPackageManager.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/8.0.0/patchPnpmPackageManager.ts"],
4
- "sourcesContent": ["import { inspect } from 'util';\n\nimport fg from 'fast-glob';\nimport { readFile, writeFile } from 'fs-extra';\nimport { lt } from 'semver';\n\nimport type { PatchFunction, PatchReturnType } from '../..';\nimport { log } from '../../../../../../utils/logging';\n\nconst DOCKERFILE_COREPACK_COMMAND = 'RUN corepack enable pnpm';\nconst PACKAGE_JSON_MOUNT = `RUN --mount=type=bind,source=package.json,target=package.json \\\\\n corepack enable pnpm && corepack install`;\nconst PACKAGE_JSON_CACHE = '- package.json#.packageManager';\n\nconst BEFORE_PIPELINE_REGEX =\n /(\\s*cache-on:\\s*\\n\\s*-\\s*\\.npmrc\\s*\\n)((\\s*)-\\s*pnpm-lock\\.yaml)/gm;\nconst ECR_REGEX = /seek-oss\\/docker-ecr-cache#v([\\d\\.]+)/gm;\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\nconst patchPnpmPackageManager: PatchFunction = async ({\n mode,\n manifest,\n packageManager,\n}): Promise<PatchReturnType> => {\n if (packageManager.command !== 'pnpm') {\n return {\n result: 'skip',\n reason: 'not using pnpm',\n };\n }\n\n if (\n !(\n manifest.packageJson as { packageManager?: string }\n ).packageManager?.includes('pnpm')\n ) {\n return {\n result: 'skip',\n reason: 'no packageManager declaration in package.json found',\n };\n }\n\n const [maybeDockerfiles, maybePipelines] = await Promise.all([\n fg(['Dockerfile*']),\n fg(['.buildkite/*.yml']),\n ]);\n\n if (!maybeDockerfiles.length || !maybePipelines.length) {\n return {\n result: 'skip',\n reason: 'Either dockerfiles or pipelines were not found',\n };\n }\n\n const [dockerfiles, pipelines] = await Promise.all([\n fetchFiles(maybeDockerfiles),\n fetchFiles(maybePipelines),\n ]);\n\n const dockerFilesToPatch = dockerfiles.filter(\n ({ contents }) =>\n contents.includes(DOCKERFILE_COREPACK_COMMAND) &&\n !contents.includes('target=package.json'),\n );\n\n const pipelinesToPatch = pipelines.filter(({ contents }) =>\n Boolean(BEFORE_PIPELINE_REGEX.exec(contents)),\n );\n\n if (!dockerFilesToPatch.length && !pipelinesToPatch.length) {\n return {\n result: 'skip',\n reason: 'no pipeline or dockerfiles to patch',\n };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n if (dockerFilesToPatch.length) {\n await Promise.all(\n dockerFilesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n DOCKERFILE_COREPACK_COMMAND,\n PACKAGE_JSON_MOUNT,\n );\n await writeFile(file, patchedContent);\n }),\n );\n }\n\n if (pipelinesToPatch.length) {\n await Promise.all(\n pipelinesToPatch.map(async ({ file, contents }) => {\n const patchedContent = contents.replace(\n BEFORE_PIPELINE_REGEX,\n `$1$3${PACKAGE_JSON_CACHE}\\n$2`,\n );\n\n const patchedEcrContent = patchedContent.replace(\n ECR_REGEX,\n (match, version) => {\n if (typeof version === 'string' && lt(version, '2.2.0')) {\n return 'seek-oss/docker-ecr-cache#v2.2.0';\n }\n return match;\n },\n );\n\n await writeFile(file, patchedEcrContent);\n }),\n );\n }\n\n return { result: 'apply' };\n};\n\nexport const tryPatchPnpmPackageManager: PatchFunction = async (config) => {\n try {\n return await patchPnpmPackageManager(config);\n } catch (err) {\n log.warn('Failed to patch pnpm packageManager CI configuration.');\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,uBAAe;AACf,sBAAoC;AACpC,oBAAmB;AAGnB,qBAAoB;AAEpB,MAAM,8BAA8B;AACpC,MAAM,qBAAqB;AAAA;AAE3B,MAAM,qBAAqB;AAE3B,MAAM,wBACJ;AACF,MAAM,YAAY;AAElB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,UAAM,0BAAS,MAAM,MAAM;AAE5C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEF,MAAM,0BAAyC,OAAO;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AACF,MAAgC;AAC9B,MAAI,eAAe,YAAY,QAAQ;AACrC,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,MACE,CACE,SAAS,YACT,gBAAgB,SAAS,MAAM,GACjC;AACA,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,QAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,CAAC,kBAAkB,cAAc,IAAI,MAAM,QAAQ,IAAI;AAAA,QAC3D,iBAAAA,SAAG,CAAC,aAAa,CAAC;AAAA,QAClB,iBAAAA,SAAG,CAAC,kBAAk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,kBAAG,SAAS,OAAO,GAAG;AACvD,qBAAO;AAAA,YACT;AACA,mBAAO;AAAA,UACT;AAAA,QACF;AAEA,kBAAM,2BAAU,MAAM,iBAAiB;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,6BAA4C,OAAO,WAAW;AACzE,MAAI;AACF,WAAO,MAAM,wBAAwB,MAAM;AAAA,EAC7C,SAAS,KAAK;AACZ,uBAAI,KAAK,uDAAuD;AAChE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
6
- "names": ["fg"]
7
- }
@@ -1,22 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const StageContextSchema = z.enum(['dev', 'prod']);
4
- export type StageContext = z.infer<typeof StageContextSchema>;
5
-
6
- export const EnvContextSchema = z.object({
7
- workerLambda: z.object({
8
- reservedConcurrency: z.number(),
9
- environment: z.object({
10
- ENVIRONMENT: z.string(),
11
- }),
12
- }),
13
- sourceSnsTopicArn: z.string(),
14
- });
15
-
16
- export type EnvContext = z.infer<typeof EnvContextSchema>;
17
-
18
- export const GlobalContextSchema = z.object({
19
- appName: z.string(),
20
- });
21
-
22
- export type GlobalContext = z.infer<typeof GlobalContextSchema>;