skuba 13.0.0-update-conditions-20251014052300 → 13.0.1-handle-extra-cases-20251015055510
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/modules/index.js +0 -2
- package/lib/cli/configure/modules/index.js.map +2 -2
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js +18 -12
- package/lib/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.js.map +2 -2
- package/package.json +8 -9
- package/template/base/tsconfig.json +1 -1
- package/template/express-rest-api/README.md +2 -2
- package/template/greeter/README.md +2 -2
- package/template/greeter/package.json +1 -1
- package/template/koa-rest-api/README.md +2 -2
- package/template/lambda-sqs-worker-cdk/README.md +2 -2
- package/template/lambda-sqs-worker-cdk/package.json +1 -1
- package/template/oss-npm-package/tsconfig.json +1 -1
- package/template/private-npm-package/tsconfig.json +1 -1
- package/lib/cli/configure/modules/skubaDive.d.ts +0 -2
- package/lib/cli/configure/modules/skubaDive.js +0 -72
- package/lib/cli/configure/modules/skubaDive.js.map +0 -7
|
@@ -29,7 +29,6 @@ var import_package = require("./package.js");
|
|
|
29
29
|
var import_prettier = require("./prettier.js");
|
|
30
30
|
var import_renovate = require("./renovate.js");
|
|
31
31
|
var import_serverless = require("./serverless.js");
|
|
32
|
-
var import_skubaDive = require("./skubaDive.js");
|
|
33
32
|
var import_tslint = require("./tslint.js");
|
|
34
33
|
const loadModules = (opts) => Promise.all(
|
|
35
34
|
[
|
|
@@ -41,7 +40,6 @@ const loadModules = (opts) => Promise.all(
|
|
|
41
40
|
import_prettier.prettierModule,
|
|
42
41
|
import_renovate.renovateModule,
|
|
43
42
|
import_serverless.serverlessModule,
|
|
44
|
-
import_skubaDive.skubaDiveModule,
|
|
45
43
|
import_tslint.tslintModule
|
|
46
44
|
].map(async (createModule) => createModule(opts))
|
|
47
45
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/cli/configure/modules/index.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Module, Options } from '../types.js';\n\nimport { eslintModule } from './eslint.js';\nimport { ignoreModule } from './ignore.js';\nimport { jestModule } from './jest.js';\nimport { nodemonModule } from './nodemon.js';\nimport { packageModule } from './package.js';\nimport { prettierModule } from './prettier.js';\nimport { renovateModule } from './renovate.js';\nimport { serverlessModule } from './serverless.js';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA6B;AAC7B,oBAA6B;AAC7B,kBAA2B;AAC3B,qBAA8B;AAC9B,qBAA8B;AAC9B,sBAA+B;AAC/B,sBAA+B;AAC/B,wBAAiC;AACjC,
|
|
4
|
+
"sourcesContent": ["import type { Module, Options } from '../types.js';\n\nimport { eslintModule } from './eslint.js';\nimport { ignoreModule } from './ignore.js';\nimport { jestModule } from './jest.js';\nimport { nodemonModule } from './nodemon.js';\nimport { packageModule } from './package.js';\nimport { prettierModule } from './prettier.js';\nimport { renovateModule } from './renovate.js';\nimport { serverlessModule } from './serverless.js';\nimport { tslintModule } from './tslint.js';\n\nexport const loadModules = (opts: Options): Promise<Module[]> =>\n Promise.all(\n [\n eslintModule,\n ignoreModule,\n jestModule,\n nodemonModule,\n packageModule,\n prettierModule,\n renovateModule,\n serverlessModule,\n tslintModule,\n ].map(async (createModule) => createModule(opts)),\n );\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA6B;AAC7B,oBAA6B;AAC7B,kBAA2B;AAC3B,qBAA8B;AAC9B,qBAA8B;AAC9B,sBAA+B;AAC/B,sBAA+B;AAC/B,wBAAiC;AACjC,oBAA6B;AAEtB,MAAM,cAAc,CAAC,SAC1B,QAAQ;AAAA,EACN;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,EAAE,IAAI,OAAO,iBAAiB,aAAa,IAAI,CAAC;AAClD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -256,29 +256,35 @@ const patchServerlessFile = ({
|
|
|
256
256
|
if (contents.includes("package.json")) {
|
|
257
257
|
return void 0;
|
|
258
258
|
}
|
|
259
|
-
const packageBlockRegex = /^(\s*)(
|
|
259
|
+
const packageBlockRegex = /^(\s*)(patterns:)\s*\n((?:\1\s+-\s+.+\n)*)/gm;
|
|
260
260
|
let match;
|
|
261
261
|
let modified = contents;
|
|
262
262
|
let hasChanges = false;
|
|
263
263
|
packageBlockRegex.lastIndex = 0;
|
|
264
264
|
while ((match = packageBlockRegex.exec(contents)) !== null) {
|
|
265
|
-
const [
|
|
266
|
-
fullMatch,
|
|
267
|
-
baseIndent,
|
|
268
|
-
packageLabel,
|
|
269
|
-
patternsIndent,
|
|
270
|
-
patternsLabel,
|
|
271
|
-
patternsContent
|
|
272
|
-
] = match;
|
|
265
|
+
const [fullMatch, patternsIndent, patternsLabel, patternsContent] = match;
|
|
273
266
|
if (patternsContent?.includes("package.json")) {
|
|
274
267
|
continue;
|
|
275
268
|
}
|
|
276
269
|
const arrayItemIndent = `${patternsIndent} `;
|
|
277
|
-
const
|
|
278
|
-
${patternsIndent}${patternsLabel}
|
|
270
|
+
const newPatternsBlock = `${patternsIndent}${patternsLabel}
|
|
279
271
|
${patternsContent}${arrayItemIndent}- 'package.json'
|
|
280
272
|
`;
|
|
281
|
-
modified = modified.replace(fullMatch,
|
|
273
|
+
modified = modified.replace(fullMatch, newPatternsBlock);
|
|
274
|
+
hasChanges = true;
|
|
275
|
+
}
|
|
276
|
+
const packageIncludeBlockRegex = /^(\s*)(include:)\s*\n((?:\1\s+-\s+.+\n)*)/gm;
|
|
277
|
+
packageIncludeBlockRegex.lastIndex = 0;
|
|
278
|
+
while ((match = packageIncludeBlockRegex.exec(contents)) !== null) {
|
|
279
|
+
const [fullMatch, includeIndent, includeLabel, includeContent] = match;
|
|
280
|
+
if (includeContent?.includes("package.json")) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const arrayItemIndent = `${includeIndent} `;
|
|
284
|
+
const newIncludeBlock = `${includeIndent}${includeLabel}
|
|
285
|
+
${includeContent}${arrayItemIndent}- 'package.json'
|
|
286
|
+
`;
|
|
287
|
+
modified = modified.replace(fullMatch, newIncludeBlock);
|
|
282
288
|
hasChanges = true;
|
|
283
289
|
}
|
|
284
290
|
if (!hasChanges) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../../src/cli/lint/internalLints/upgrade/patches/12.4.1/updateLambdaConfigs.ts"],
|
|
4
|
-
"sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../../../../index.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n/**\n * Find a block delimited by braces and return its content and position\n * @param content The text to search in\n * @param pattern The regex pattern to match (should match up to the opening brace)\n * @returns Object containing the matched content and indices, or undefined if not found\n */\nconst findBracedBlock = (\n content: string,\n pattern: RegExp,\n):\n | {\n content: string;\n startIndex: number;\n endIndex: number;\n matchIndex: number;\n }\n | undefined => {\n const match = pattern.exec(content);\n if (!match) {\n return undefined;\n }\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = match.index + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < content.length) {\n if (content[endIndex] === '{') {\n braceCount++;\n } else if (content[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n return undefined;\n }\n\n return {\n content: content.slice(startIndex, endIndex - 1),\n startIndex,\n endIndex,\n matchIndex: match.index,\n };\n};\n\n/**\n * Find and replace all braced blocks matching a pattern\n * @param content The text to search in\n * @param pattern The regex pattern to match (should be global and match up to the opening brace)\n * @param replacer Function that receives the block content and returns the replacement, or undefined to skip\n * @returns The modified content, or undefined if no changes were made\n */\nconst replaceAllBracedBlocks = (\n content: string,\n pattern: RegExp,\n replacer: (blockContent: string) => string | undefined,\n): string | undefined => {\n let modified = content;\n let hasChanges = false;\n let match: RegExpExecArray | null;\n let offset = 0;\n\n while ((match = pattern.exec(content)) !== null) {\n const adjustedIndex = match.index + offset;\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = adjustedIndex + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < modified.length) {\n if (modified[endIndex] === '{') {\n braceCount++;\n } else if (modified[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n continue;\n }\n\n const blockContent = modified.slice(startIndex, endIndex - 1);\n const replacement = replacer(blockContent);\n\n if (replacement === undefined) {\n continue;\n }\n\n // Replace this block\n const before = modified.slice(0, adjustedIndex);\n const after = modified.slice(endIndex);\n const fullReplacement = `${match[0].slice(0, -1)}{${replacement}}`;\n modified = `${before}${fullReplacement}${after}`;\n\n // Adjust offset for next iteration\n offset += fullReplacement.length - (endIndex - adjustedIndex);\n hasChanges = true;\n }\n\n return hasChanges ? modified : undefined;\n};\n\nconst patchCdkTsFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (!contents.includes('aws_lambda_nodejs.NodejsFunction')) {\n return undefined;\n }\n\n const modified = replaceAllBracedBlocks(\n contents,\n /bundling:\\s*\\{/g,\n (bundlingContent) => {\n // Check if --conditions already exists\n if (bundlingContent.includes('--conditions')) {\n return undefined;\n }\n\n // Find esbuildArgs block within bundling\n const esbuildArgsBlock = findBracedBlock(\n bundlingContent,\n /esbuildArgs\\s*:\\s*\\{/,\n );\n\n if (esbuildArgsBlock) {\n const argsContent = esbuildArgsBlock.content.trim();\n const separator = argsContent ? ', ' : '';\n const newArgsContent = `'--conditions': '${customCondition}'${separator}${argsContent}`;\n\n const modifiedBundlingContent = `${bundlingContent.slice(0, esbuildArgsBlock.matchIndex)}esbuildArgs: {${newArgsContent}}${bundlingContent.slice(esbuildArgsBlock.endIndex)}`;\n\n return modifiedBundlingContent;\n }\n\n // Add new esbuildArgs property\n const modifiedBundlingContent = bundlingContent.trimStart();\n return `\\n esbuildArgs: { '--conditions': '${customCondition}' },\\n ${modifiedBundlingContent}`;\n },\n );\n\n if (!modified) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchWebpackConfigFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Find module.exports block\n const exportsBlock = findBracedBlock(contents, /module\\.exports\\s*=\\s*\\{/);\n if (!exportsBlock) {\n return undefined;\n }\n\n const exportsContent = exportsBlock.content;\n\n // Check if resolve.conditionNames already has our custom condition\n if (exportsContent.includes(customCondition)) {\n return undefined;\n }\n\n // Find resolve block within module.exports\n const resolveBlock = findBracedBlock(exportsContent, /resolve\\s*:\\s*\\{/);\n\n if (resolveBlock) {\n const resolveContent = resolveBlock.content;\n\n // Find conditionNames array within resolve\n const conditionNamesMatch = /conditionNames\\s*:\\s*\\[([^\\]]*)\\]/s.exec(\n resolveContent,\n );\n\n if (conditionNamesMatch?.[1] !== undefined) {\n // Add custom condition to existing conditionNames array\n const existingConditions = conditionNamesMatch[1].trim();\n const separator = existingConditions ? ', ' : '';\n const newConditionNames = `conditionNames: ['${customCondition}'${separator}${existingConditions}]`;\n\n const modifiedResolveContent = `${resolveContent.slice(0, conditionNamesMatch.index)}${newConditionNames}${resolveContent.slice(conditionNamesMatch.index + conditionNamesMatch[0].length)}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${modifiedResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add conditionNames property to resolve block\n const modifiedResolveContent = resolveContent.trimStart();\n const newResolveContent = `\\n conditionNames: ['${customCondition}', '...'],\\n ${modifiedResolveContent}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${newResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add resolve property with conditionNames to module.exports\n const modifiedExportsContent = exportsContent.trimStart();\n const newExportsContent = `\\n resolve: {\\n conditionNames: ['${customCondition}', '...'],\\n },\\n ${modifiedExportsContent}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${newExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessEsbuildFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Check if custom condition already exists\n if (contents.includes(customCondition)) {\n return undefined;\n }\n\n // Check for serverless-esbuild plugin or build.esbuild or custom.esbuild configuration\n if (\n !contents.includes('serverless-esbuild') &&\n !contents.includes('build:') &&\n !contents.includes('custom:')\n ) {\n return undefined;\n }\n\n // Match either build: or custom: followed by esbuild: with nested configuration\n // This regex only matches multi-line esbuild blocks, not inline \"esbuild: false\"\n const esbuildBlockRegex =\n /^((?:build|custom):)\\s*\\n(\\s+)(esbuild:)\\s*\\n((?:\\2\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n esbuildBlockRegex.lastIndex = 0;\n\n while ((match = esbuildBlockRegex.exec(contents)) !== null) {\n const [fullMatch, blockType, baseIndent, esbuildLabel, esbuildContent] =\n match;\n\n // Check if esbuild is disabled (esbuild: false)\n if (/esbuild:\\s*false/.exec(fullMatch)) {\n continue;\n }\n\n // Check if conditions already exists in this block\n if (esbuildContent?.includes('conditions:')) {\n continue;\n }\n\n // Determine indentation (should be baseIndent + 2 spaces for YAML)\n const conditionsIndent = `${baseIndent} `;\n const arrayItemIndent = `${conditionsIndent} `;\n\n // Build the new esbuild block with conditions added\n const newEsbuildBlock = `${blockType}\\n${baseIndent}${esbuildLabel}\\n${conditionsIndent}conditions:\\n${arrayItemIndent}- '${customCondition}'\\n${esbuildContent}`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newEsbuildBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (contents.includes('esbuild')) {\n return patchServerlessEsbuildFile({\n contents,\n customCondition,\n });\n }\n\n if (contents.includes('serverless-webpack')) {\n return undefined;\n }\n\n // patch package patterns for serverless framework\n if (contents.includes('package.json')) {\n return undefined;\n }\n\n // Match package: blocks with patterns: arrays\n const packageBlockRegex =\n /^(\\s*)(package:)\\s*\\n(\\s+)(patterns:)\\s*\\n((?:\\3\\s+-\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n packageBlockRegex.lastIndex = 0;\n\n while ((match = packageBlockRegex.exec(contents)) !== null) {\n const [\n fullMatch,\n baseIndent,\n packageLabel,\n patternsIndent,\n patternsLabel,\n patternsContent,\n ] = match;\n\n // Check if package.json already exists in this block\n if (patternsContent?.includes('package.json')) {\n continue;\n }\n\n // Add package.json to the patterns list\n const arrayItemIndent = `${patternsIndent} `;\n const newPackageBlock = `${baseIndent}${packageLabel}\\n${patternsIndent}${patternsLabel}\\n${patternsContent}${arrayItemIndent}- 'package.json'\\n`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newPackageBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nexport const tryUpdateLambdaConfigs: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let customCondition: string;\n try {\n const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });\n customCondition = `@seek/${repo}/source`;\n } catch {\n return { result: 'skip', reason: 'no repository name found' };\n }\n\n const [tsFileNames, webpackFileNames, serverlessFileNames] =\n await Promise.all([\n glob('**/*.ts', {\n ignore: [\n '**/.git',\n '**/node_modules',\n 'src/cli/lint/internalLints/upgrade/patches/**/*',\n ],\n }),\n glob('**/*webpack.config.js', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n glob('**/serverless*.y*ml', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n ]);\n\n if (\n !tsFileNames.length &&\n !webpackFileNames.length &&\n !serverlessFileNames.length\n ) {\n return {\n result: 'skip',\n reason: 'no .ts or webpack config files or .yml files found',\n };\n }\n\n const [tsFiles, webpackFiles, serverlessFiles] = await Promise.all([\n fetchFiles(tsFileNames),\n fetchFiles(webpackFileNames),\n fetchFiles(serverlessFileNames),\n ]);\n\n const filesToPatch = [\n ...tsFiles.flatMap(({ file, contents }) => {\n const patched = patchCdkTsFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...webpackFiles.flatMap(({ file, contents }) => {\n const patched = patchWebpackConfigFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...serverlessFiles.flatMap(({ file, contents }) => {\n const patched = patchServerlessFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ];\n\n if (!filesToPatch.length) {\n return { result: 'skip', reason: 'no lambda configurations to patch' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n filesToPatch.map(async ({ file, modified }) => {\n await fs.promises.writeFile(file, modified, 'utf8');\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const updateLambdaConfigs: PatchFunction = async (config) => {\n try {\n return await tryUpdateLambdaConfigs(config);\n } catch (err) {\n log.warn('Failed to write configure `tsconfig.json` and `package.json`');\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;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAAe;AAEf,eAAoB;AACpB,qBAAoB;AAGpB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,SAAS,MAAM,MAAM;AAExD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAQF,MAAM,kBAAkB,CACtB,SACA,YAQe;AACf,QAAM,QAAQ,QAAQ,KAAK,OAAO;AAClC,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAGA,MAAI,aAAa;AACjB,QAAM,aAAa,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC1C,MAAI,WAAW;AAEf,SAAO,aAAa,KAAK,WAAW,QAAQ,QAAQ;AAClD,QAAI,QAAQ,QAAQ,MAAM,KAAK;AAC7B;AAAA,IACF,WAAW,QAAQ,QAAQ,MAAM,KAAK;AACpC;AAAA,IACF;AACA;AAAA,EACF;AAEA,MAAI,eAAe,GA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E,CAAC,SAAS,SAAS,oBAAoB,KACvC,CAAC,SAAS,SAAS,QAAQ,KAC3B,CAAC,SAAS,SAAS,SAAS,GAC5B;AACA,WAAO;AAAA,EACT;AAIA,QAAM,oBACJ;AAEF,MAAI;AACJ,MAAI,WAAW;AACf,MAAI,aAAa;AAGjB,oBAAkB,YAAY;AAE9B,UAAQ,QAAQ,kBAAkB,KAAK,QAAQ,OAAO,MAAM;AAC1D,UAAM,CAAC,WAAW,WAAW,YAAY,cAAc,cAAc,IACnE;AAGF,QAAI,mBAAmB,KAAK,SAAS,GAAG;AACtC;AAAA,IACF;AAGA,QAAI,gBAAgB,SAAS,aAAa,GAAG;AAC3C;AAAA,IACF;AAGA,UAAM,mBAAmB,GAAG,UAAU;AACtC,UAAM,kBAAkB,GAAG,gBAAgB;AAG3C,UAAM,kBAAkB,GAAG,SAAS;AAAA,EAAK,UAAU,GAAG,YAAY;AAAA,EAAK,gBAAgB;AAAA,EAAgB,eAAe,MAAM,eAAe;AAAA,EAAM,cAAc;AAG/J,eAAW,SAAS,QAAQ,WAAW,eAAe;AACtD,iBAAa;AAAA,EACf;AAEA,MAAI,CAAC,YAAY;AACf,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,UAAU;AAAA,IACV;AAAA,EACF;AACF;AAEA,MAAM,sBAAsB,CAAC;AAAA,EAC3B;AAAA,EACA;AACF,MAQiB;AACf,MAAI,SAAS,SAAS,SAAS,GAAG;AAChC,WAAO,2BAA2B;AAAA,MAChC;AAAA,MACA;AAAA,IACF,CAAC;AAAA,EACH;AAEA,MAAI,SAAS,SAAS,oBAAoB,GAAG;AAC3C,WAAO;AAAA,EACT;AAGA,MAAI,SAAS,SAAS,cAAc,GAAG;AACrC,WAAO;AAAA,EACT;AAGA,QAAM,
|
|
4
|
+
"sourcesContent": ["import { inspect } from 'util';\n\nimport { glob } from 'fast-glob';\nimport fs from 'fs-extra';\n\nimport { Git } from '../../../../../../index.js';\nimport { log } from '../../../../../../utils/logging.js';\nimport type { PatchFunction, PatchReturnType } from '../../index.js';\n\nconst fetchFiles = async (files: string[]) =>\n Promise.all(\n files.map(async (file) => {\n const contents = await fs.promises.readFile(file, 'utf8');\n\n return {\n file,\n contents,\n };\n }),\n );\n\n/**\n * Find a block delimited by braces and return its content and position\n * @param content The text to search in\n * @param pattern The regex pattern to match (should match up to the opening brace)\n * @returns Object containing the matched content and indices, or undefined if not found\n */\nconst findBracedBlock = (\n content: string,\n pattern: RegExp,\n):\n | {\n content: string;\n startIndex: number;\n endIndex: number;\n matchIndex: number;\n }\n | undefined => {\n const match = pattern.exec(content);\n if (!match) {\n return undefined;\n }\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = match.index + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < content.length) {\n if (content[endIndex] === '{') {\n braceCount++;\n } else if (content[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n return undefined;\n }\n\n return {\n content: content.slice(startIndex, endIndex - 1),\n startIndex,\n endIndex,\n matchIndex: match.index,\n };\n};\n\n/**\n * Find and replace all braced blocks matching a pattern\n * @param content The text to search in\n * @param pattern The regex pattern to match (should be global and match up to the opening brace)\n * @param replacer Function that receives the block content and returns the replacement, or undefined to skip\n * @returns The modified content, or undefined if no changes were made\n */\nconst replaceAllBracedBlocks = (\n content: string,\n pattern: RegExp,\n replacer: (blockContent: string) => string | undefined,\n): string | undefined => {\n let modified = content;\n let hasChanges = false;\n let match: RegExpExecArray | null;\n let offset = 0;\n\n while ((match = pattern.exec(content)) !== null) {\n const adjustedIndex = match.index + offset;\n\n // Find the matching closing brace\n let braceCount = 1;\n const startIndex = adjustedIndex + match[0].length;\n let endIndex = startIndex;\n\n while (braceCount > 0 && endIndex < modified.length) {\n if (modified[endIndex] === '{') {\n braceCount++;\n } else if (modified[endIndex] === '}') {\n braceCount--;\n }\n endIndex++;\n }\n\n if (braceCount !== 0) {\n continue;\n }\n\n const blockContent = modified.slice(startIndex, endIndex - 1);\n const replacement = replacer(blockContent);\n\n if (replacement === undefined) {\n continue;\n }\n\n // Replace this block\n const before = modified.slice(0, adjustedIndex);\n const after = modified.slice(endIndex);\n const fullReplacement = `${match[0].slice(0, -1)}{${replacement}}`;\n modified = `${before}${fullReplacement}${after}`;\n\n // Adjust offset for next iteration\n offset += fullReplacement.length - (endIndex - adjustedIndex);\n hasChanges = true;\n }\n\n return hasChanges ? modified : undefined;\n};\n\nconst patchCdkTsFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (!contents.includes('aws_lambda_nodejs.NodejsFunction')) {\n return undefined;\n }\n\n const modified = replaceAllBracedBlocks(\n contents,\n /bundling:\\s*\\{/g,\n (bundlingContent) => {\n // Check if --conditions already exists\n if (bundlingContent.includes('--conditions')) {\n return undefined;\n }\n\n // Find esbuildArgs block within bundling\n const esbuildArgsBlock = findBracedBlock(\n bundlingContent,\n /esbuildArgs\\s*:\\s*\\{/,\n );\n\n if (esbuildArgsBlock) {\n const argsContent = esbuildArgsBlock.content.trim();\n const separator = argsContent ? ', ' : '';\n const newArgsContent = `'--conditions': '${customCondition}'${separator}${argsContent}`;\n\n const modifiedBundlingContent = `${bundlingContent.slice(0, esbuildArgsBlock.matchIndex)}esbuildArgs: {${newArgsContent}}${bundlingContent.slice(esbuildArgsBlock.endIndex)}`;\n\n return modifiedBundlingContent;\n }\n\n // Add new esbuildArgs property\n const modifiedBundlingContent = bundlingContent.trimStart();\n return `\\n esbuildArgs: { '--conditions': '${customCondition}' },\\n ${modifiedBundlingContent}`;\n },\n );\n\n if (!modified) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchWebpackConfigFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Find module.exports block\n const exportsBlock = findBracedBlock(contents, /module\\.exports\\s*=\\s*\\{/);\n if (!exportsBlock) {\n return undefined;\n }\n\n const exportsContent = exportsBlock.content;\n\n // Check if resolve.conditionNames already has our custom condition\n if (exportsContent.includes(customCondition)) {\n return undefined;\n }\n\n // Find resolve block within module.exports\n const resolveBlock = findBracedBlock(exportsContent, /resolve\\s*:\\s*\\{/);\n\n if (resolveBlock) {\n const resolveContent = resolveBlock.content;\n\n // Find conditionNames array within resolve\n const conditionNamesMatch = /conditionNames\\s*:\\s*\\[([^\\]]*)\\]/s.exec(\n resolveContent,\n );\n\n if (conditionNamesMatch?.[1] !== undefined) {\n // Add custom condition to existing conditionNames array\n const existingConditions = conditionNamesMatch[1].trim();\n const separator = existingConditions ? ', ' : '';\n const newConditionNames = `conditionNames: ['${customCondition}'${separator}${existingConditions}]`;\n\n const modifiedResolveContent = `${resolveContent.slice(0, conditionNamesMatch.index)}${newConditionNames}${resolveContent.slice(conditionNamesMatch.index + conditionNamesMatch[0].length)}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${modifiedResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add conditionNames property to resolve block\n const modifiedResolveContent = resolveContent.trimStart();\n const newResolveContent = `\\n conditionNames: ['${customCondition}', '...'],\\n ${modifiedResolveContent}`;\n\n const modifiedExportsContent = `${exportsContent.slice(0, resolveBlock.matchIndex)}resolve: {${newResolveContent}}${exportsContent.slice(resolveBlock.endIndex)}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${modifiedExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n }\n\n // Add resolve property with conditionNames to module.exports\n const modifiedExportsContent = exportsContent.trimStart();\n const newExportsContent = `\\n resolve: {\\n conditionNames: ['${customCondition}', '...'],\\n },\\n ${modifiedExportsContent}`;\n\n const modified = `${contents.slice(0, exportsBlock.startIndex)}${newExportsContent}${contents.slice(exportsBlock.endIndex)}`;\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessEsbuildFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n // Check if custom condition already exists\n if (contents.includes(customCondition)) {\n return undefined;\n }\n\n // Check for serverless-esbuild plugin or build.esbuild or custom.esbuild configuration\n if (\n !contents.includes('serverless-esbuild') &&\n !contents.includes('build:') &&\n !contents.includes('custom:')\n ) {\n return undefined;\n }\n\n // Match either build: or custom: followed by esbuild: with nested configuration\n // This regex only matches multi-line esbuild blocks, not inline \"esbuild: false\"\n const esbuildBlockRegex =\n /^((?:build|custom):)\\s*\\n(\\s+)(esbuild:)\\s*\\n((?:\\2\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n esbuildBlockRegex.lastIndex = 0;\n\n while ((match = esbuildBlockRegex.exec(contents)) !== null) {\n const [fullMatch, blockType, baseIndent, esbuildLabel, esbuildContent] =\n match;\n\n // Check if esbuild is disabled (esbuild: false)\n if (/esbuild:\\s*false/.exec(fullMatch)) {\n continue;\n }\n\n // Check if conditions already exists in this block\n if (esbuildContent?.includes('conditions:')) {\n continue;\n }\n\n // Determine indentation (should be baseIndent + 2 spaces for YAML)\n const conditionsIndent = `${baseIndent} `;\n const arrayItemIndent = `${conditionsIndent} `;\n\n // Build the new esbuild block with conditions added\n const newEsbuildBlock = `${blockType}\\n${baseIndent}${esbuildLabel}\\n${conditionsIndent}conditions:\\n${arrayItemIndent}- '${customCondition}'\\n${esbuildContent}`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newEsbuildBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nconst patchServerlessFile = ({\n contents,\n customCondition,\n}: {\n contents: string;\n customCondition: string;\n}):\n | {\n original: string;\n modified: string;\n }\n | undefined => {\n if (contents.includes('esbuild')) {\n return patchServerlessEsbuildFile({\n contents,\n customCondition,\n });\n }\n\n if (contents.includes('serverless-webpack')) {\n return undefined;\n }\n\n // patch package patterns for serverless framework\n if (contents.includes('package.json')) {\n return undefined;\n }\n\n // Match package: blocks with patterns: arrays (allow other properties in between)\n const packageBlockRegex = /^(\\s*)(patterns:)\\s*\\n((?:\\1\\s+-\\s+.+\\n)*)/gm;\n\n let match;\n let modified = contents;\n let hasChanges = false;\n\n // Reset regex lastIndex for multiple matches\n packageBlockRegex.lastIndex = 0;\n\n while ((match = packageBlockRegex.exec(contents)) !== null) {\n const [fullMatch, patternsIndent, patternsLabel, patternsContent] = match;\n\n // Check if package.json already exists in this block\n if (patternsContent?.includes('package.json')) {\n continue;\n }\n\n // Add package.json to the patterns list\n const arrayItemIndent = `${patternsIndent} `;\n const newPatternsBlock = `${patternsIndent}${patternsLabel}\\n${patternsContent}${arrayItemIndent}- 'package.json'\\n`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newPatternsBlock);\n hasChanges = true;\n }\n\n // Also match package: blocks with include: arrays (allow other properties in between)\n const packageIncludeBlockRegex =\n /^(\\s*)(include:)\\s*\\n((?:\\1\\s+-\\s+.+\\n)*)/gm;\n\n // Reset regex lastIndex for multiple matches\n packageIncludeBlockRegex.lastIndex = 0;\n\n while ((match = packageIncludeBlockRegex.exec(contents)) !== null) {\n const [fullMatch, includeIndent, includeLabel, includeContent] = match;\n\n // Check if package.json already exists in this block\n if (includeContent?.includes('package.json')) {\n continue;\n }\n\n // Add package.json to the include list\n const arrayItemIndent = `${includeIndent} `;\n const newIncludeBlock = `${includeIndent}${includeLabel}\\n${includeContent}${arrayItemIndent}- 'package.json'\\n`;\n\n // Replace in the modified content\n modified = modified.replace(fullMatch, newIncludeBlock);\n hasChanges = true;\n }\n\n if (!hasChanges) {\n return undefined;\n }\n\n return {\n original: contents,\n modified,\n };\n};\n\nexport const tryUpdateLambdaConfigs: PatchFunction = async ({\n mode,\n}): Promise<PatchReturnType> => {\n let customCondition: string;\n try {\n const { repo } = await Git.getOwnerAndRepo({ dir: process.cwd() });\n customCondition = `@seek/${repo}/source`;\n } catch {\n return { result: 'skip', reason: 'no repository name found' };\n }\n\n const [tsFileNames, webpackFileNames, serverlessFileNames] =\n await Promise.all([\n glob('**/*.ts', {\n ignore: [\n '**/.git',\n '**/node_modules',\n 'src/cli/lint/internalLints/upgrade/patches/**/*',\n ],\n }),\n glob('**/*webpack.config.js', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n glob('**/serverless*.y*ml', {\n ignore: ['**/.git', '**/node_modules'],\n }),\n ]);\n\n if (\n !tsFileNames.length &&\n !webpackFileNames.length &&\n !serverlessFileNames.length\n ) {\n return {\n result: 'skip',\n reason: 'no .ts or webpack config files or .yml files found',\n };\n }\n\n const [tsFiles, webpackFiles, serverlessFiles] = await Promise.all([\n fetchFiles(tsFileNames),\n fetchFiles(webpackFileNames),\n fetchFiles(serverlessFileNames),\n ]);\n\n const filesToPatch = [\n ...tsFiles.flatMap(({ file, contents }) => {\n const patched = patchCdkTsFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...webpackFiles.flatMap(({ file, contents }) => {\n const patched = patchWebpackConfigFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ...serverlessFiles.flatMap(({ file, contents }) => {\n const patched = patchServerlessFile({\n contents,\n customCondition,\n });\n if (patched && patched.modified !== patched.original) {\n return {\n file,\n original: patched.original,\n modified: patched.modified,\n };\n }\n return [];\n }),\n ];\n\n if (!filesToPatch.length) {\n return { result: 'skip', reason: 'no lambda configurations to patch' };\n }\n\n if (mode === 'lint') {\n return { result: 'apply' };\n }\n\n await Promise.all(\n filesToPatch.map(async ({ file, modified }) => {\n await fs.promises.writeFile(file, modified, 'utf8');\n }),\n );\n\n return { result: 'apply' };\n};\n\nexport const updateLambdaConfigs: PatchFunction = async (config) => {\n try {\n return await tryUpdateLambdaConfigs(config);\n } catch (err) {\n log.warn('Failed to write configure `tsconfig.json` and `package.json`');\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;AAAA,kBAAwB;AAExB,uBAAqB;AACrB,sBAAe;AAEf,eAAoB;AACpB,qBAAoB;AAGpB,MAAM,aAAa,OAAO,UACxB,QAAQ;AAAA,EACN,MAAM,IAAI,OAAO,SAAS;AACxB,UAAM,WAAW,MAAM,gBAAAA,QAAG,SAAS,SAAS,MAAM,MAAM;AAExD,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAQF,MAAM,kBAAkB,CACtB,SACA,YAQe;AACf,QAAM,QAAQ,QAAQ,KAAK,OAAO;AAClC,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AAGA,MAAI,aAAa;AACjB,QAAM,aAAa,MAAM,QAAQ,MAAM,CAAC,EAAE;AAC1C,MAAI,WAAW;AAEf,SAAO,aAAa,KAAK,WAAW,QAAQ,QAAQ;AAClD,QAAI,QAAQ,QAAQ,MAAM,KAAK;AAC7B;AAAA,IACF,WAAW,QAAQ,QAAQ,MAAM,KAAK;AACpC;AAAA,IACF;AACA;AAAA,EACF;AAEA,MAAI,eAAe,GAAG;AACpB,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,SAAS,QAAQ,MAAM,YAAY,WAAW,CAAC;AAAA,IAC/C;AAAA,IACA;AAAA,IACA,YAAY,MAAM;AAAA,EACpB;AACF;AASA,MAAM,yBAAyB,CAC7B,SACA,SACA,aACuB;AACvB,MAAI,WAAW;AACf,MAAI,aAAa;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AAAA,EACvE;AAEA,MAAI,SAAS,QAAQ;AACnB,WAAO,EAAE,QAAQ,QAAQ;AAAA,EAC3B;AAEA,QAAM,QAAQ;AAAA,IACZ,aAAa,IAAI,OAAO,EAAE,MAAM,SAAS,MAAM;AAC7C,YAAM,gBAAAJ,QAAG,SAAS,UAAU,MAAM,UAAU,MAAM;AAAA,IACpD,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,QAAQ,QAAQ;AAC3B;AAEO,MAAM,sBAAqC,OAAO,WAAW;AAClE,MAAI;AACF,WAAO,MAAM,uBAAuB,MAAM;AAAA,EAC5C,SAAS,KAAK;AACZ,uBAAI,KAAK,8DAA8D;AACvE,uBAAI,WAAO,qBAAQ,GAAG,CAAC;AACvB,WAAO,EAAE,QAAQ,QAAQ,QAAQ,kBAAkB;AAAA,EACrD;AACF;",
|
|
6
6
|
"names": ["fs", "modifiedBundlingContent", "modifiedResolveContent", "modifiedExportsContent", "modified"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skuba",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.1-handle-extra-cases-20251015055510",
|
|
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",
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"imports": {
|
|
17
|
-
"#src/*": {
|
|
18
|
-
"@seek/<%- serviceName %>/source": "./src/*",
|
|
19
|
-
"default": "./lib/*"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
16
|
"main": "lib/index.js",
|
|
23
17
|
"types": "./lib/index.d.ts",
|
|
24
18
|
"bin": {
|
|
@@ -48,6 +42,11 @@
|
|
|
48
42
|
"remark-lint-no-undefined-references",
|
|
49
43
|
{
|
|
50
44
|
"allow": [
|
|
45
|
+
"!CAUTION",
|
|
46
|
+
"!IMPORTANT",
|
|
47
|
+
"!NOTE",
|
|
48
|
+
"!TIP",
|
|
49
|
+
"!WARNING",
|
|
51
50
|
" ",
|
|
52
51
|
"x"
|
|
53
52
|
]
|
|
@@ -104,7 +103,7 @@
|
|
|
104
103
|
"typescript": "~5.9.0",
|
|
105
104
|
"zod": "^4.0.0",
|
|
106
105
|
"@skuba-lib/api": "^1.0.1",
|
|
107
|
-
"eslint-config-skuba": "7.2.0
|
|
106
|
+
"eslint-config-skuba": "7.2.0"
|
|
108
107
|
},
|
|
109
108
|
"devDependencies": {
|
|
110
109
|
"@changesets/cli": "2.29.7",
|
|
@@ -152,7 +151,7 @@
|
|
|
152
151
|
"entryPoint": "src/index.ts",
|
|
153
152
|
"template": null,
|
|
154
153
|
"type": "package",
|
|
155
|
-
"version": "
|
|
154
|
+
"version": "13.0.0"
|
|
156
155
|
},
|
|
157
156
|
"scripts": {
|
|
158
157
|
"build": "scripts/build.sh",
|
|
@@ -87,7 +87,7 @@ TODO: add support links for the dev deployment.
|
|
|
87
87
|
<!--
|
|
88
88
|
- CloudWatch dashboard
|
|
89
89
|
- Datadog dashboard
|
|
90
|
-
-
|
|
90
|
+
- Datadog logs
|
|
91
91
|
-->
|
|
92
92
|
|
|
93
93
|
### Prod
|
|
@@ -97,7 +97,7 @@ TODO: add support links for the prod deployment.
|
|
|
97
97
|
<!--
|
|
98
98
|
- CloudWatch dashboard
|
|
99
99
|
- Datadog dashboard
|
|
100
|
-
-
|
|
100
|
+
- Datadog logs
|
|
101
101
|
-->
|
|
102
102
|
|
|
103
103
|
[CodeDeploy]: https://docs.aws.amazon.com/codedeploy
|
|
@@ -80,7 +80,7 @@ TODO: add support links for the dev deployment.
|
|
|
80
80
|
<!--
|
|
81
81
|
- CloudWatch dashboard
|
|
82
82
|
- Datadog dashboard
|
|
83
|
-
-
|
|
83
|
+
- Datadog logs
|
|
84
84
|
-->
|
|
85
85
|
|
|
86
86
|
### Prod
|
|
@@ -90,7 +90,7 @@ TODO: add support links for the prod deployment.
|
|
|
90
90
|
<!--
|
|
91
91
|
- CloudWatch dashboard
|
|
92
92
|
- Datadog dashboard
|
|
93
|
-
-
|
|
93
|
+
- Datadog logs
|
|
94
94
|
-->
|
|
95
95
|
|
|
96
96
|
[Technical Guidelines]: https://myseek.atlassian.net/wiki/spaces/AA/pages/2358346017/
|
|
@@ -92,7 +92,7 @@ TODO: add support links for the dev deployment.
|
|
|
92
92
|
<!--
|
|
93
93
|
- CloudWatch dashboard
|
|
94
94
|
- Datadog dashboard
|
|
95
|
-
-
|
|
95
|
+
- Datadog logs
|
|
96
96
|
-->
|
|
97
97
|
|
|
98
98
|
### Prod
|
|
@@ -102,7 +102,7 @@ TODO: add support links for the prod deployment.
|
|
|
102
102
|
<!--
|
|
103
103
|
- CloudWatch dashboard
|
|
104
104
|
- Datadog dashboard
|
|
105
|
-
-
|
|
105
|
+
- Datadog logs
|
|
106
106
|
-->
|
|
107
107
|
|
|
108
108
|
[CodeDeploy]: https://docs.aws.amazon.com/codedeploy
|
|
@@ -125,7 +125,7 @@ TODO: add support links for the dev deployment.
|
|
|
125
125
|
<!--
|
|
126
126
|
- CloudWatch dashboard
|
|
127
127
|
- Datadog dashboard
|
|
128
|
-
-
|
|
128
|
+
- Datadog logs
|
|
129
129
|
-->
|
|
130
130
|
|
|
131
131
|
### Prod
|
|
@@ -135,7 +135,7 @@ TODO: add support links for the prod deployment.
|
|
|
135
135
|
<!--
|
|
136
136
|
- CloudWatch dashboard
|
|
137
137
|
- Datadog dashboard
|
|
138
|
-
-
|
|
138
|
+
- Datadog logs
|
|
139
139
|
-->
|
|
140
140
|
|
|
141
141
|
[@seek/aws-codedeploy-hooks]: https://github.com/seek-oss/aws-codedeploy-hooks
|
|
@@ -1,72 +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 skubaDive_exports = {};
|
|
30
|
-
__export(skubaDive_exports, {
|
|
31
|
-
skubaDiveModule: () => skubaDiveModule
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(skubaDive_exports);
|
|
34
|
-
var import_path = __toESM(require("path"));
|
|
35
|
-
var import_skubaDive = require("../dependencies/skubaDive.js");
|
|
36
|
-
var import_javascript = require("../processing/javascript.js");
|
|
37
|
-
var import_loadFiles = require("../processing/loadFiles.js");
|
|
38
|
-
var import_package = require("../processing/package.js");
|
|
39
|
-
const DEFAULT_FILENAME = "src/register.ts";
|
|
40
|
-
const skubaDiveModule = ({ entryPoint, type }) => {
|
|
41
|
-
if (type === "package") {
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
...(0, import_loadFiles.loadFiles)(DEFAULT_FILENAME, "package.json"),
|
|
46
|
-
[entryPoint]: (inputFile, files) => {
|
|
47
|
-
const packageJson = (0, import_package.parsePackage)(files["package.json"]);
|
|
48
|
-
const registerFile = files[DEFAULT_FILENAME];
|
|
49
|
-
if (!packageJson?.dependencies?.["skuba-dive"] || inputFile === void 0 || inputFile.includes("skuba-dive/register") || registerFile?.includes("skuba-dive/register")) {
|
|
50
|
-
return inputFile;
|
|
51
|
-
}
|
|
52
|
-
const outputFile = (0, import_javascript.stripImports)(import_skubaDive.SKUBA_DIVE_HOOKS, inputFile);
|
|
53
|
-
const relativeToSrc = import_path.default.posix.relative(
|
|
54
|
-
import_path.default.join(entryPoint, ".."),
|
|
55
|
-
"src"
|
|
56
|
-
);
|
|
57
|
-
if (relativeToSrc === "") {
|
|
58
|
-
return (0, import_javascript.prependImport)("skuba-dive/register", outputFile);
|
|
59
|
-
}
|
|
60
|
-
files[DEFAULT_FILENAME] = (0, import_javascript.prependImport)(
|
|
61
|
-
"skuba-dive/register",
|
|
62
|
-
registerFile
|
|
63
|
-
);
|
|
64
|
-
return (0, import_javascript.prependImport)(`${relativeToSrc}/register`, outputFile);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
skubaDiveModule
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=skubaDive.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../../src/cli/configure/modules/skubaDive.ts"],
|
|
4
|
-
"sourcesContent": ["import path from 'path';\n\nimport { SKUBA_DIVE_HOOKS } from '../dependencies/skubaDive.js';\nimport { prependImport, stripImports } from '../processing/javascript.js';\nimport { loadFiles } from '../processing/loadFiles.js';\nimport { parsePackage } from '../processing/package.js';\nimport type { Module, Options } from '../types.js';\n\nconst DEFAULT_FILENAME = 'src/register.ts';\n\nexport const skubaDiveModule = ({ entryPoint, type }: Options): Module => {\n // skuba-dive is a runtime component; it's not appropriate for packages\n if (type === 'package') {\n return {};\n }\n\n return {\n ...loadFiles(DEFAULT_FILENAME, 'package.json'),\n\n [entryPoint]: (inputFile, files) => {\n const packageJson = parsePackage(files['package.json']);\n\n const registerFile = files[DEFAULT_FILENAME];\n\n if (\n !packageJson?.dependencies?.['skuba-dive'] ||\n inputFile === undefined ||\n inputFile.includes('skuba-dive/register') ||\n registerFile?.includes('skuba-dive/register')\n ) {\n return inputFile;\n }\n\n const outputFile = stripImports(SKUBA_DIVE_HOOKS, inputFile);\n\n const relativeToSrc = path.posix.relative(\n path.join(entryPoint, '..'),\n 'src',\n );\n\n // import skuba-dive directly from the entry point\n if (relativeToSrc === '') {\n return prependImport('skuba-dive/register', outputFile);\n }\n\n // import skuba-dive via src/register.ts\n files[DEFAULT_FILENAME] = prependImport(\n 'skuba-dive/register',\n registerFile,\n );\n\n return prependImport(`${relativeToSrc}/register`, outputFile);\n },\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAEjB,uBAAiC;AACjC,wBAA4C;AAC5C,uBAA0B;AAC1B,qBAA6B;AAG7B,MAAM,mBAAmB;AAElB,MAAM,kBAAkB,CAAC,EAAE,YAAY,KAAK,MAAuB;AAExE,MAAI,SAAS,WAAW;AACtB,WAAO,CAAC;AAAA,EACV;AAEA,SAAO;AAAA,IACL,OAAG,4BAAU,kBAAkB,cAAc;AAAA,IAE7C,CAAC,UAAU,GAAG,CAAC,WAAW,UAAU;AAClC,YAAM,kBAAc,6BAAa,MAAM,cAAc,CAAC;AAEtD,YAAM,eAAe,MAAM,gBAAgB;AAE3C,UACE,CAAC,aAAa,eAAe,YAAY,KACzC,cAAc,UACd,UAAU,SAAS,qBAAqB,KACxC,cAAc,SAAS,qBAAqB,GAC5C;AACA,eAAO;AAAA,MACT;AAEA,YAAM,iBAAa,gCAAa,mCAAkB,SAAS;AAE3D,YAAM,gBAAgB,YAAAA,QAAK,MAAM;AAAA,QAC/B,YAAAA,QAAK,KAAK,YAAY,IAAI;AAAA,QAC1B;AAAA,MACF;AAGA,UAAI,kBAAkB,IAAI;AACxB,mBAAO,iCAAc,uBAAuB,UAAU;AAAA,MACxD;AAGA,YAAM,gBAAgB,QAAI;AAAA,QACxB;AAAA,QACA;AAAA,MACF;AAEA,iBAAO,iCAAc,GAAG,aAAa,aAAa,UAAU;AAAA,IAC9D;AAAA,EACF;AACF;",
|
|
6
|
-
"names": ["path"]
|
|
7
|
-
}
|