@ziacik/upgrade-verify 3.3.1 → 5.0.0
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/CHANGELOG.md +15 -1
- package/package.json +5 -3
- package/src/executors/check-issues/executor.js +1 -1
- package/src/executors/check-issues/executor.js.map +1 -1
- package/src/executors/check-issues/schema.d.js.map +1 -1
- package/src/executors/verify-build/dist-stat-comparer.js.map +1 -1
- package/src/executors/verify-build/dist-stats.js +4 -4
- package/src/executors/verify-build/dist-stats.js.map +1 -1
- package/src/executors/verify-build/executor.js +5 -6
- package/src/executors/verify-build/executor.js.map +1 -1
- package/src/executors/verify-build/schema.d.js.map +1 -1
- package/src/executors/verify-build/with-hash-removed.js.map +1 -1
- package/src/index.js.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [5.0.0] - 2026-02-28
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Upgraded nx to 22.5.3.
|
|
15
|
+
|
|
16
|
+
## [4.0.0] - 2025-04-05
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Upgraded nx to 20.7.1.
|
|
21
|
+
|
|
10
22
|
## [3.3.1] - 2024-09-25
|
|
11
23
|
|
|
12
24
|
### Changed
|
|
@@ -125,7 +137,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
125
137
|
- READMEs updated and props added to package.json.
|
|
126
138
|
- A _Package subpath './package.json' is not defined by "exports"_ error hopefully fixed.
|
|
127
139
|
|
|
128
|
-
[unreleased]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-
|
|
140
|
+
[unreleased]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-5.0.0...HEAD
|
|
141
|
+
[5.0.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-4.0.0...upgrade-verify-5.0.0
|
|
142
|
+
[4.0.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-3.3.1...upgrade-verify-4.0.0
|
|
129
143
|
[3.3.1]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-3.3.0...upgrade-verify-3.3.1
|
|
130
144
|
[3.3.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-3.2.0...upgrade-verify-3.3.0
|
|
131
145
|
[3.2.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-3.1.0...upgrade-verify-3.2.0
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ziacik/upgrade-verify",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@nx/devkit": "
|
|
6
|
-
"@swc/helpers": "0.5.
|
|
5
|
+
"@nx/devkit": "22.5.3",
|
|
6
|
+
"@swc/helpers": "~0.5.18",
|
|
7
|
+
"@nx/vite": "^22.5.1",
|
|
8
|
+
"vitest": "^4.0.0"
|
|
7
9
|
},
|
|
8
10
|
"type": "commonjs",
|
|
9
11
|
"main": "./src/index.js",
|
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
const _devkit = require("@nx/devkit");
|
|
9
9
|
const _promises = require("fs/promises");
|
|
10
10
|
const _path = require("path");
|
|
11
|
-
const GITHUB_ISSUE_REGEX =
|
|
11
|
+
const GITHUB_ISSUE_REGEX = /https:\/\/github.com\/(?<owner>[^/]+)\/(?<repo>[^/]+)\/issues\/(?<issueNumber>\d+)/;
|
|
12
12
|
async function runExecutor(options, context) {
|
|
13
13
|
const issuesMd = await tryLoadIssuesMd(context.root);
|
|
14
14
|
if (issuesMd != null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/check-issues/executor.ts"],"sourcesContent":["import { ExecutorContext, logger } from '@nx/devkit';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { CheckIssuesExecutorSchema } from './schema';\n\nconst GITHUB_ISSUE_REGEX = /https:\\/\\/github.com\\/(?<owner>[^/]+)\\/(?<repo>[^/]+)\\/issues\\/(?<issueNumber>\\d+)/;\n\nexport default async function runExecutor(options: CheckIssuesExecutorSchema, context: ExecutorContext) {\n\tconst issuesMd = await tryLoadIssuesMd(context.root);\n\n\tif (issuesMd != null) {\n\t\tconst issueMdLines = issuesMd.split('\\n');\n\t\tawait printClosedIssueLines(issueMdLines);\n\t} else {\n\t\tlogger.info(\"There is no 'ISSUES.md' file in the workspace root.\");\n\t}\n\n\treturn {\n\t\tsuccess: true,\n\t};\n}\n\nasync function printClosedIssueLines(issueMdLines: string[]) {\n\tconst resolvedLines = await Promise.all(issueMdLines.map(resolveIssueMdLine));\n\tconst closedLines = resolvedLines.filter((resolvedLine) => resolvedLine.result === 'closed');\n\n\tif (closedLines.length > 0) {\n\t\tlogger.info('Issues which are closed now:');\n\n\t\tfor (const closedLine of closedLines) {\n\t\t\tlogger.info(`- ${closedLine.issueMdLine}`);\n\t\t}\n\t} else {\n\t\tlogger.info('No issues have been closed.');\n\t}\n}\n\nasync function resolveIssueMdLine(issueMdLine: string): Promise<{ issueMdLine: string; result: 'noissue' | 'active' | 'closed' }> {\n\tconst githubLink = issueMdLine.match(GITHUB_ISSUE_REGEX);\n\n\tif (!githubLink) {\n\t\treturn { issueMdLine, result: 'noissue' };\n\t}\n\n\tconst [, owner, repo, issueNumber] = githubLink;\n\n\tconst response = await fetch(`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}`);\n\tconst { state } = await response.json();\n\n\treturn {\n\t\tissueMdLine,\n\t\tresult: state === 'closed' ? 'closed' : 'active',\n\t};\n}\n\nasync function tryLoadIssuesMd(root: string): Promise<string | undefined> {\n\ttry {\n\t\treturn await readFile(join(root, 'ISSUES.md'), 'utf8');\n\t} catch (e) {\n\t\tif (isNodeError(e) && e.code === 'ENOENT') {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\nfunction isNodeError(error: unknown): error is NodeJS.ErrnoException {\n\treturn error instanceof Error && 'code' in error;\n}\n"],"names":["runExecutor","GITHUB_ISSUE_REGEX","options","context","issuesMd","tryLoadIssuesMd","root","issueMdLines","split","printClosedIssueLines","logger","info","success","resolvedLines","Promise","all","map","resolveIssueMdLine","closedLines","filter","resolvedLine","result","length","closedLine","issueMdLine","githubLink","match","owner","repo","issueNumber","response","fetch","state","json","readFile","join","e","isNodeError","code","undefined","error","Error"],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/check-issues/executor.ts"],"sourcesContent":["import { ExecutorContext, logger } from '@nx/devkit';\nimport { readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { CheckIssuesExecutorSchema } from './schema';\n\nconst GITHUB_ISSUE_REGEX = /https:\\/\\/github.com\\/(?<owner>[^/]+)\\/(?<repo>[^/]+)\\/issues\\/(?<issueNumber>\\d+)/;\n\nexport default async function runExecutor(options: CheckIssuesExecutorSchema, context: ExecutorContext) {\n\tconst issuesMd = await tryLoadIssuesMd(context.root);\n\n\tif (issuesMd != null) {\n\t\tconst issueMdLines = issuesMd.split('\\n');\n\t\tawait printClosedIssueLines(issueMdLines);\n\t} else {\n\t\tlogger.info(\"There is no 'ISSUES.md' file in the workspace root.\");\n\t}\n\n\treturn {\n\t\tsuccess: true,\n\t};\n}\n\nasync function printClosedIssueLines(issueMdLines: string[]) {\n\tconst resolvedLines = await Promise.all(issueMdLines.map(resolveIssueMdLine));\n\tconst closedLines = resolvedLines.filter((resolvedLine) => resolvedLine.result === 'closed');\n\n\tif (closedLines.length > 0) {\n\t\tlogger.info('Issues which are closed now:');\n\n\t\tfor (const closedLine of closedLines) {\n\t\t\tlogger.info(`- ${closedLine.issueMdLine}`);\n\t\t}\n\t} else {\n\t\tlogger.info('No issues have been closed.');\n\t}\n}\n\nasync function resolveIssueMdLine(issueMdLine: string): Promise<{ issueMdLine: string; result: 'noissue' | 'active' | 'closed' }> {\n\tconst githubLink = issueMdLine.match(GITHUB_ISSUE_REGEX);\n\n\tif (!githubLink) {\n\t\treturn { issueMdLine, result: 'noissue' };\n\t}\n\n\tconst [, owner, repo, issueNumber] = githubLink;\n\n\tconst response = await fetch(`https://api.github.com/repos/${owner}/${repo}/issues/${issueNumber}`);\n\tconst { state } = await response.json();\n\n\treturn {\n\t\tissueMdLine,\n\t\tresult: state === 'closed' ? 'closed' : 'active',\n\t};\n}\n\nasync function tryLoadIssuesMd(root: string): Promise<string | undefined> {\n\ttry {\n\t\treturn await readFile(join(root, 'ISSUES.md'), 'utf8');\n\t} catch (e) {\n\t\tif (isNodeError(e) && e.code === 'ENOENT') {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\tthrow e;\n\t\t}\n\t}\n}\n\nfunction isNodeError(error: unknown): error is NodeJS.ErrnoException {\n\treturn error instanceof Error && 'code' in error;\n}\n"],"names":["runExecutor","GITHUB_ISSUE_REGEX","options","context","issuesMd","tryLoadIssuesMd","root","issueMdLines","split","printClosedIssueLines","logger","info","success","resolvedLines","Promise","all","map","resolveIssueMdLine","closedLines","filter","resolvedLine","result","length","closedLine","issueMdLine","githubLink","match","owner","repo","issueNumber","response","fetch","state","json","readFile","join","e","isNodeError","code","undefined","error","Error"],"mappings":";+BAOA;;;eAA8BA;;;wBAPU;0BACf;sBACJ;AAGrB,MAAMC,qBAAqB;AAEZ,eAAeD,YAAYE,OAAkC,EAAEC,OAAwB;IACrG,MAAMC,WAAW,MAAMC,gBAAgBF,QAAQG,IAAI;IAEnD,IAAIF,YAAY,MAAM;QACrB,MAAMG,eAAeH,SAASI,KAAK,CAAC;QACpC,MAAMC,sBAAsBF;IAC7B,OAAO;QACNG,cAAM,CAACC,IAAI,CAAC;IACb;IAEA,OAAO;QACNC,SAAS;IACV;AACD;AAEA,eAAeH,sBAAsBF,YAAsB;IAC1D,MAAMM,gBAAgB,MAAMC,QAAQC,GAAG,CAACR,aAAaS,GAAG,CAACC;IACzD,MAAMC,cAAcL,cAAcM,MAAM,CAAC,CAACC,eAAiBA,aAAaC,MAAM,KAAK;IAEnF,IAAIH,YAAYI,MAAM,GAAG,GAAG;QAC3BZ,cAAM,CAACC,IAAI,CAAC;QAEZ,KAAK,MAAMY,cAAcL,YAAa;YACrCR,cAAM,CAACC,IAAI,CAAC,CAAC,EAAE,EAAEY,WAAWC,WAAW,EAAE;QAC1C;IACD,OAAO;QACNd,cAAM,CAACC,IAAI,CAAC;IACb;AACD;AAEA,eAAeM,mBAAmBO,WAAmB;IACpD,MAAMC,aAAaD,YAAYE,KAAK,CAACzB;IAErC,IAAI,CAACwB,YAAY;QAChB,OAAO;YAAED;YAAaH,QAAQ;QAAU;IACzC;IAEA,MAAM,GAAGM,OAAOC,MAAMC,YAAY,GAAGJ;IAErC,MAAMK,WAAW,MAAMC,MAAM,CAAC,6BAA6B,EAAEJ,MAAM,CAAC,EAAEC,KAAK,QAAQ,EAAEC,aAAa;IAClG,MAAM,EAAEG,KAAK,EAAE,GAAG,MAAMF,SAASG,IAAI;IAErC,OAAO;QACNT;QACAH,QAAQW,UAAU,WAAW,WAAW;IACzC;AACD;AAEA,eAAe3B,gBAAgBC,IAAY;IAC1C,IAAI;QACH,OAAO,MAAM4B,IAAAA,kBAAQ,EAACC,IAAAA,UAAI,EAAC7B,MAAM,cAAc;IAChD,EAAE,OAAO8B,GAAG;QACX,IAAIC,YAAYD,MAAMA,EAAEE,IAAI,KAAK,UAAU;YAC1C,OAAOC;QACR,OAAO;YACN,MAAMH;QACP;IACD;AACD;AAEA,SAASC,YAAYG,KAAc;IAClC,OAAOA,iBAAiBC,SAAS,UAAUD;AAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/check-issues/schema.d.ts"],"sourcesContent":["export interface CheckIssuesExecutorSchema {} // eslint-disable-line\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/check-issues/schema.d.ts"],"sourcesContent":["export interface CheckIssuesExecutorSchema {} // eslint-disable-line\n"],"names":[],"mappings":";CAA8C,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/dist-stat-comparer.ts"],"sourcesContent":["import { Stat } from './dist-stats';\n\nexport type ComparisonResult = {\n\treadonly totalSizeDifferencePercentage: number;\n\treadonly fileCountDifferencePercentage: number;\n\treadonly newFilesPercentage: number;\n\treadonly deletedFilesPercentage: number;\n};\n\nexport function compareStats(existingStats: Stat, newStats: Stat): ComparisonResult {\n\tconst totalSizeDifferencePercentage = countDiffPercentage(existingStats.size, newStats.size);\n\tconst fileCountDifferencePercentage = countDiffPercentage(countFiles(existingStats), countFiles(newStats));\n\tconst newFilesPercentage = countPercentage(countNewFiles(existingStats, newStats), countFiles(newStats));\n\tconst deletedFilesPercentage = countPercentage(countDeletedFiles(existingStats, newStats), countFiles(existingStats));\n\treturn {\n\t\ttotalSizeDifferencePercentage,\n\t\tfileCountDifferencePercentage,\n\t\tnewFilesPercentage,\n\t\tdeletedFilesPercentage,\n\t};\n}\n\nfunction countDiffPercentage(existingNumber: number, newNumber: number): number {\n\treturn countPercentage(newNumber - existingNumber, existingNumber);\n}\n\nfunction countPercentage(partNumber: number, totalNumber: number): number {\n\treturn Math.round((partNumber * 100) / totalNumber);\n}\n\nfunction countFiles(stats: Stat): number {\n\treturn stats.items.length + stats.items.reduce((result, item) => result + countFiles(item), 0);\n}\n\nfunction countNewFiles(existingStats: Stat, newStats: Stat): number {\n\tconst existingNames = flatFileNamesSet(existingStats);\n\tconst newNames = flatFileNamesList(newStats);\n\treturn newNames.filter((name) => !existingNames.has(name)).length;\n}\n\nfunction countDeletedFiles(existingStats: Stat, newStats: Stat): number {\n\tconst existingNames = flatFileNamesList(existingStats);\n\tconst newNames = flatFileNamesSet(newStats);\n\treturn existingNames.filter((name) => !newNames.has(name)).length;\n}\n\nfunction flatFileNamesSet(stats: Stat): Set<string> {\n\treturn new Set(flatFileNamesList(stats));\n}\n\nfunction flatFileNamesList(stats: Stat, prefix = ''): string[] {\n\treturn stats.items.map((item) => `${prefix}/${item.name}`).concat(stats.items.flatMap((item) => flatFileNamesList(item, item.name)));\n}\n"],"names":["compareStats","existingStats","newStats","totalSizeDifferencePercentage","countDiffPercentage","size","fileCountDifferencePercentage","countFiles","newFilesPercentage","countPercentage","countNewFiles","deletedFilesPercentage","countDeletedFiles","existingNumber","newNumber","partNumber","totalNumber","Math","round","stats","items","length","reduce","result","item","existingNames","flatFileNamesSet","newNames","flatFileNamesList","filter","name","has","Set","prefix","map","concat","flatMap"],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/dist-stat-comparer.ts"],"sourcesContent":["import { Stat } from './dist-stats';\n\nexport type ComparisonResult = {\n\treadonly totalSizeDifferencePercentage: number;\n\treadonly fileCountDifferencePercentage: number;\n\treadonly newFilesPercentage: number;\n\treadonly deletedFilesPercentage: number;\n};\n\nexport function compareStats(existingStats: Stat, newStats: Stat): ComparisonResult {\n\tconst totalSizeDifferencePercentage = countDiffPercentage(existingStats.size, newStats.size);\n\tconst fileCountDifferencePercentage = countDiffPercentage(countFiles(existingStats), countFiles(newStats));\n\tconst newFilesPercentage = countPercentage(countNewFiles(existingStats, newStats), countFiles(newStats));\n\tconst deletedFilesPercentage = countPercentage(countDeletedFiles(existingStats, newStats), countFiles(existingStats));\n\treturn {\n\t\ttotalSizeDifferencePercentage,\n\t\tfileCountDifferencePercentage,\n\t\tnewFilesPercentage,\n\t\tdeletedFilesPercentage,\n\t};\n}\n\nfunction countDiffPercentage(existingNumber: number, newNumber: number): number {\n\treturn countPercentage(newNumber - existingNumber, existingNumber);\n}\n\nfunction countPercentage(partNumber: number, totalNumber: number): number {\n\treturn Math.round((partNumber * 100) / totalNumber);\n}\n\nfunction countFiles(stats: Stat): number {\n\treturn stats.items.length + stats.items.reduce((result, item) => result + countFiles(item), 0);\n}\n\nfunction countNewFiles(existingStats: Stat, newStats: Stat): number {\n\tconst existingNames = flatFileNamesSet(existingStats);\n\tconst newNames = flatFileNamesList(newStats);\n\treturn newNames.filter((name) => !existingNames.has(name)).length;\n}\n\nfunction countDeletedFiles(existingStats: Stat, newStats: Stat): number {\n\tconst existingNames = flatFileNamesList(existingStats);\n\tconst newNames = flatFileNamesSet(newStats);\n\treturn existingNames.filter((name) => !newNames.has(name)).length;\n}\n\nfunction flatFileNamesSet(stats: Stat): Set<string> {\n\treturn new Set(flatFileNamesList(stats));\n}\n\nfunction flatFileNamesList(stats: Stat, prefix = ''): string[] {\n\treturn stats.items.map((item) => `${prefix}/${item.name}`).concat(stats.items.flatMap((item) => flatFileNamesList(item, item.name)));\n}\n"],"names":["compareStats","existingStats","newStats","totalSizeDifferencePercentage","countDiffPercentage","size","fileCountDifferencePercentage","countFiles","newFilesPercentage","countPercentage","countNewFiles","deletedFilesPercentage","countDeletedFiles","existingNumber","newNumber","partNumber","totalNumber","Math","round","stats","items","length","reduce","result","item","existingNames","flatFileNamesSet","newNames","flatFileNamesList","filter","name","has","Set","prefix","map","concat","flatMap"],"mappings":";+BASgBA;;;eAAAA;;;AAAT,SAASA,aAAaC,aAAmB,EAAEC,QAAc;IAC/D,MAAMC,gCAAgCC,oBAAoBH,cAAcI,IAAI,EAAEH,SAASG,IAAI;IAC3F,MAAMC,gCAAgCF,oBAAoBG,WAAWN,gBAAgBM,WAAWL;IAChG,MAAMM,qBAAqBC,gBAAgBC,cAAcT,eAAeC,WAAWK,WAAWL;IAC9F,MAAMS,yBAAyBF,gBAAgBG,kBAAkBX,eAAeC,WAAWK,WAAWN;IACtG,OAAO;QACNE;QACAG;QACAE;QACAG;IACD;AACD;AAEA,SAASP,oBAAoBS,cAAsB,EAAEC,SAAiB;IACrE,OAAOL,gBAAgBK,YAAYD,gBAAgBA;AACpD;AAEA,SAASJ,gBAAgBM,UAAkB,EAAEC,WAAmB;IAC/D,OAAOC,KAAKC,KAAK,CAAC,AAACH,aAAa,MAAOC;AACxC;AAEA,SAAST,WAAWY,KAAW;IAC9B,OAAOA,MAAMC,KAAK,CAACC,MAAM,GAAGF,MAAMC,KAAK,CAACE,MAAM,CAAC,CAACC,QAAQC,OAASD,SAAShB,WAAWiB,OAAO;AAC7F;AAEA,SAASd,cAAcT,aAAmB,EAAEC,QAAc;IACzD,MAAMuB,gBAAgBC,iBAAiBzB;IACvC,MAAM0B,WAAWC,kBAAkB1B;IACnC,OAAOyB,SAASE,MAAM,CAAC,CAACC,OAAS,CAACL,cAAcM,GAAG,CAACD,OAAOT,MAAM;AAClE;AAEA,SAAST,kBAAkBX,aAAmB,EAAEC,QAAc;IAC7D,MAAMuB,gBAAgBG,kBAAkB3B;IACxC,MAAM0B,WAAWD,iBAAiBxB;IAClC,OAAOuB,cAAcI,MAAM,CAAC,CAACC,OAAS,CAACH,SAASI,GAAG,CAACD,OAAOT,MAAM;AAClE;AAEA,SAASK,iBAAiBP,KAAW;IACpC,OAAO,IAAIa,IAAIJ,kBAAkBT;AAClC;AAEA,SAASS,kBAAkBT,KAAW,EAAEc,SAAS,EAAE;IAClD,OAAOd,MAAMC,KAAK,CAACc,GAAG,CAAC,CAACV,OAAS,GAAGS,OAAO,CAAC,EAAET,KAAKM,IAAI,EAAE,EAAEK,MAAM,CAAChB,MAAMC,KAAK,CAACgB,OAAO,CAAC,CAACZ,OAASI,kBAAkBJ,MAAMA,KAAKM,IAAI;AAClI"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
function _export(target, all) {
|
|
3
3
|
for(var name in all)Object.defineProperty(target, name, {
|
|
4
4
|
enumerable: true,
|
|
5
|
-
get: all
|
|
5
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
6
6
|
});
|
|
7
7
|
}
|
|
8
8
|
_export(exports, {
|
|
9
|
-
calculateDistStats
|
|
9
|
+
get calculateDistStats () {
|
|
10
10
|
return calculateDistStats;
|
|
11
11
|
},
|
|
12
|
-
loadExistingDistStats
|
|
12
|
+
get loadExistingDistStats () {
|
|
13
13
|
return loadExistingDistStats;
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -20,7 +20,7 @@ async function loadExistingDistStats(statsPath) {
|
|
|
20
20
|
try {
|
|
21
21
|
const statsStr = await (0, _promises.readFile)(statsPath, 'utf-8');
|
|
22
22
|
return JSON.parse(statsStr);
|
|
23
|
-
} catch (
|
|
23
|
+
} catch (unused) {
|
|
24
24
|
return undefined;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/dist-stats.ts"],"sourcesContent":["import { readFile, readdir, stat } from 'fs/promises';\nimport { join } from 'path';\nimport { withHashRemoved } from './with-hash-removed';\n\nexport type Stat = {\n\treadonly name: string;\n\treadonly size: number;\n\treadonly items: Stat[];\n};\n\nexport async function loadExistingDistStats(statsPath: string): Promise<Stat | undefined> {\n\ttry {\n\t\tconst statsStr = await readFile(statsPath, 'utf-8');\n\t\treturn JSON.parse(statsStr);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport async function calculateDistStats(distDir: string, removeHashes: boolean): Promise<Stat> {\n\treturn getFolderStats(distDir, '', removeHashes);\n}\n\nasync function getFolderStats(root: string, relative: string, removeHashes: boolean): Promise<Stat> {\n\treturn calculateStats(root, relative, removeHashes);\n}\n\nasync function calculateStats(root: string, relative: string, removeHashes: boolean): Promise<Stat> {\n\tconst path = join(root, relative);\n\tconst stats = await stat(path);\n\n\tif (stats.isFile()) {\n\t\treturn {\n\t\t\tname: removeHashes ? withHashRemoved(relative) : relative,\n\t\t\tsize: stats.size,\n\t\t\titems: [],\n\t\t};\n\t} else if (stats.isDirectory()) {\n\t\tconst nestedFiles = await readdir(path);\n\t\tconst nestedStats = await Promise.all(nestedFiles.map((nestedFile) => calculateStats(join(root, relative), nestedFile, removeHashes)));\n\t\treturn {\n\t\t\tname: relative,\n\t\t\tsize: nestedStats.reduce((result, stat) => result + stat.size, 0),\n\t\t\titems: nestedStats.sort((a, b) => a.name.localeCompare(b.name)),\n\t\t};\n\t} else {\n\t\tthrow new Error('What: ' + path);\n\t}\n}\n"],"names":["calculateDistStats","loadExistingDistStats","statsPath","statsStr","readFile","JSON","parse","undefined","distDir","removeHashes","getFolderStats","root","relative","calculateStats","path","join","stats","stat","isFile","name","withHashRemoved","size","items","isDirectory","nestedFiles","readdir","nestedStats","Promise","all","map","nestedFile","reduce","result","sort","a","b","localeCompare","Error"],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/dist-stats.ts"],"sourcesContent":["import { readFile, readdir, stat } from 'fs/promises';\nimport { join } from 'path';\nimport { withHashRemoved } from './with-hash-removed';\n\nexport type Stat = {\n\treadonly name: string;\n\treadonly size: number;\n\treadonly items: Stat[];\n};\n\nexport async function loadExistingDistStats(statsPath: string): Promise<Stat | undefined> {\n\ttry {\n\t\tconst statsStr = await readFile(statsPath, 'utf-8');\n\t\treturn JSON.parse(statsStr);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nexport async function calculateDistStats(distDir: string, removeHashes: boolean): Promise<Stat> {\n\treturn getFolderStats(distDir, '', removeHashes);\n}\n\nasync function getFolderStats(root: string, relative: string, removeHashes: boolean): Promise<Stat> {\n\treturn calculateStats(root, relative, removeHashes);\n}\n\nasync function calculateStats(root: string, relative: string, removeHashes: boolean): Promise<Stat> {\n\tconst path = join(root, relative);\n\tconst stats = await stat(path);\n\n\tif (stats.isFile()) {\n\t\treturn {\n\t\t\tname: removeHashes ? withHashRemoved(relative) : relative,\n\t\t\tsize: stats.size,\n\t\t\titems: [],\n\t\t};\n\t} else if (stats.isDirectory()) {\n\t\tconst nestedFiles = await readdir(path);\n\t\tconst nestedStats = await Promise.all(nestedFiles.map((nestedFile) => calculateStats(join(root, relative), nestedFile, removeHashes)));\n\t\treturn {\n\t\t\tname: relative,\n\t\t\tsize: nestedStats.reduce((result, stat) => result + stat.size, 0),\n\t\t\titems: nestedStats.sort((a, b) => a.name.localeCompare(b.name)),\n\t\t};\n\t} else {\n\t\tthrow new Error('What: ' + path);\n\t}\n}\n"],"names":["calculateDistStats","loadExistingDistStats","statsPath","statsStr","readFile","JSON","parse","undefined","distDir","removeHashes","getFolderStats","root","relative","calculateStats","path","join","stats","stat","isFile","name","withHashRemoved","size","items","isDirectory","nestedFiles","readdir","nestedStats","Promise","all","map","nestedFile","reduce","result","sort","a","b","localeCompare","Error"],"mappings":";;;;;;;;QAmBsBA;eAAAA;;QATAC;eAAAA;;;0BAVkB;sBACnB;iCACW;AAQzB,eAAeA,sBAAsBC,SAAiB;IAC5D,IAAI;QACH,MAAMC,WAAW,MAAMC,IAAAA,kBAAQ,EAACF,WAAW;QAC3C,OAAOG,KAAKC,KAAK,CAACH;IACnB,EAAE,eAAM;QACP,OAAOI;IACR;AACD;AAEO,eAAeP,mBAAmBQ,OAAe,EAAEC,YAAqB;IAC9E,OAAOC,eAAeF,SAAS,IAAIC;AACpC;AAEA,eAAeC,eAAeC,IAAY,EAAEC,QAAgB,EAAEH,YAAqB;IAClF,OAAOI,eAAeF,MAAMC,UAAUH;AACvC;AAEA,eAAeI,eAAeF,IAAY,EAAEC,QAAgB,EAAEH,YAAqB;IAClF,MAAMK,OAAOC,IAAAA,UAAI,EAACJ,MAAMC;IACxB,MAAMI,QAAQ,MAAMC,IAAAA,cAAI,EAACH;IAEzB,IAAIE,MAAME,MAAM,IAAI;QACnB,OAAO;YACNC,MAAMV,eAAeW,IAAAA,gCAAe,EAACR,YAAYA;YACjDS,MAAML,MAAMK,IAAI;YAChBC,OAAO,EAAE;QACV;IACD,OAAO,IAAIN,MAAMO,WAAW,IAAI;QAC/B,MAAMC,cAAc,MAAMC,IAAAA,iBAAO,EAACX;QAClC,MAAMY,cAAc,MAAMC,QAAQC,GAAG,CAACJ,YAAYK,GAAG,CAAC,CAACC,aAAejB,eAAeE,IAAAA,UAAI,EAACJ,MAAMC,WAAWkB,YAAYrB;QACvH,OAAO;YACNU,MAAMP;YACNS,MAAMK,YAAYK,MAAM,CAAC,CAACC,QAAQf,OAASe,SAASf,KAAKI,IAAI,EAAE;YAC/DC,OAAOI,YAAYO,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEf,IAAI,CAACiB,aAAa,CAACD,EAAEhB,IAAI;QAC9D;IACD,OAAO;QACN,MAAM,IAAIkB,MAAM,WAAWvB;IAC5B;AACD"}
|
|
@@ -11,13 +11,13 @@ const _path = require("path");
|
|
|
11
11
|
const _diststatcomparer = require("./dist-stat-comparer");
|
|
12
12
|
const _diststats = require("./dist-stats");
|
|
13
13
|
async function verifyBuild(options, context) {
|
|
14
|
-
if (context.
|
|
15
|
-
throw new Error('
|
|
14
|
+
if (context.projectsConfigurations == null) {
|
|
15
|
+
throw new Error('ProjectsConfigurations context info not available.');
|
|
16
16
|
}
|
|
17
17
|
if (context.projectName == null) {
|
|
18
18
|
throw new Error('Project name not specified in context info.');
|
|
19
19
|
}
|
|
20
|
-
const projectConfig = context.
|
|
20
|
+
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
21
21
|
if (projectConfig.targets == null) {
|
|
22
22
|
throw new Error('Target info not available for the project in context info.');
|
|
23
23
|
}
|
|
@@ -32,9 +32,9 @@ async function verifyBuild(options, context) {
|
|
|
32
32
|
...process.env
|
|
33
33
|
};
|
|
34
34
|
for (const configurationName of Object.keys(projectConfig.targets['build'].configurations)){
|
|
35
|
+
var _runContext_projectName, _options_removeHashes;
|
|
35
36
|
retainEnv(envBackup);
|
|
36
37
|
const runContext = JSON.parse(JSON.stringify(context));
|
|
37
|
-
var _runContext_projectName;
|
|
38
38
|
const results = await (0, _devkit.runExecutor)({
|
|
39
39
|
project: (_runContext_projectName = runContext.projectName) != null ? _runContext_projectName : '',
|
|
40
40
|
target: 'build',
|
|
@@ -49,7 +49,6 @@ async function verifyBuild(options, context) {
|
|
|
49
49
|
}
|
|
50
50
|
const statsPath = (0, _path.join)(statsDir, configurationName + '.json');
|
|
51
51
|
const existingStats = await (0, _diststats.loadExistingDistStats)(statsPath);
|
|
52
|
-
var _options_removeHashes;
|
|
53
52
|
const newStats = await (0, _diststats.calculateDistStats)(distDir, (_options_removeHashes = options.removeHashes) != null ? _options_removeHashes : true);
|
|
54
53
|
await (0, _promises.writeFile)(statsPath, JSON.stringify(newStats, null, '\t'));
|
|
55
54
|
if (existingStats != null) {
|
|
@@ -67,7 +66,7 @@ async function verifyBuild(options, context) {
|
|
|
67
66
|
async function tryMkdir(statsDir) {
|
|
68
67
|
try {
|
|
69
68
|
await (0, _promises.mkdir)(statsDir);
|
|
70
|
-
} catch (
|
|
69
|
+
} catch (unused) {
|
|
71
70
|
// ignore
|
|
72
71
|
}
|
|
73
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/executor.ts"],"sourcesContent":["import { ExecutorContext, logger, runExecutor } from '@nx/devkit';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { compareStats } from './dist-stat-comparer';\nimport { calculateDistStats, loadExistingDistStats } from './dist-stats';\nimport { VerifyBuildExecutorSchema } from './schema';\n\nexport default async function verifyBuild(options: VerifyBuildExecutorSchema, context: ExecutorContext) {\n\tif (context.
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/executor.ts"],"sourcesContent":["import { ExecutorContext, logger, runExecutor } from '@nx/devkit';\nimport { mkdir, writeFile } from 'fs/promises';\nimport { join } from 'path';\nimport { compareStats } from './dist-stat-comparer';\nimport { calculateDistStats, loadExistingDistStats } from './dist-stats';\nimport { VerifyBuildExecutorSchema } from './schema';\n\nexport default async function verifyBuild(options: VerifyBuildExecutorSchema, context: ExecutorContext) {\n\tif (context.projectsConfigurations == null) {\n\t\tthrow new Error('ProjectsConfigurations context info not available.');\n\t}\n\n\tif (context.projectName == null) {\n\t\tthrow new Error('Project name not specified in context info.');\n\t}\n\n\tconst projectConfig = context.projectsConfigurations.projects[context.projectName];\n\n\tif (projectConfig.targets == null) {\n\t\tthrow new Error('Target info not available for the project in context info.');\n\t}\n\n\tconst distDir = join(context.root, projectConfig.targets['build'].options.outputPath);\n\tconst statsDir = join(context.root, projectConfig.root, '.stats');\n\tawait tryMkdir(statsDir);\n\n\tif (projectConfig.targets['build'].configurations == null) {\n\t\tthrow new Error('Configurations info not available for the project, target \"build\", in context info.');\n\t}\n\n\tlet success = true;\n\tconst envBackup = { ...process.env };\n\n\tfor (const configurationName of Object.keys(projectConfig.targets['build'].configurations)) {\n\t\tretainEnv(envBackup);\n\t\tconst runContext: ExecutorContext = JSON.parse(JSON.stringify(context));\n\n\t\tconst results = await runExecutor(\n\t\t\t{\n\t\t\t\tproject: runContext.projectName ?? '',\n\t\t\t\ttarget: 'build',\n\t\t\t\tconfiguration: configurationName,\n\t\t\t},\n\t\t\t{},\n\t\t\trunContext\n\t\t);\n\n\t\tfor await (const result of results) {\n\t\t\tif (!result.success) {\n\t\t\t\treturn { success: false };\n\t\t\t}\n\t\t}\n\n\t\tconst statsPath = join(statsDir, configurationName + '.json');\n\t\tconst existingStats = await loadExistingDistStats(statsPath);\n\t\tconst newStats = await calculateDistStats(distDir, options.removeHashes ?? true);\n\n\t\tawait writeFile(statsPath, JSON.stringify(newStats, null, '\\t'));\n\n\t\tif (existingStats != null) {\n\t\t\tconst comparison = compareStats(existingStats, newStats);\n\t\t\tlogger.info(\n\t\t\t\t`Stats for ${runContext.projectName}/${configurationName}: ${comparison.totalSizeDifferencePercentage}% total size difference, ${comparison.fileCountDifferencePercentage}% file count difference, ${comparison.newFilesPercentage}% new files, ${comparison.deletedFilesPercentage}% deleted files`\n\t\t\t);\n\n\t\t\tif (\n\t\t\t\tMath.abs(comparison.deletedFilesPercentage) > 10 ||\n\t\t\t\tMath.abs(comparison.fileCountDifferencePercentage) > 10 ||\n\t\t\t\tMath.abs(comparison.newFilesPercentage) > 10 ||\n\t\t\t\tMath.abs(comparison.totalSizeDifferencePercentage) > 10\n\t\t\t) {\n\t\t\t\tsuccess = false;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { success };\n}\n\nasync function tryMkdir(statsDir: string) {\n\ttry {\n\t\tawait mkdir(statsDir);\n\t} catch {\n\t\t// ignore\n\t}\n}\n\nfunction retainEnv(envBackup: Record<string, unknown>): void {\n\tfor (const key of Object.keys(process.env)) {\n\t\tdelete process.env[key];\n\t}\n\tObject.assign(process.env, envBackup);\n}\n"],"names":["verifyBuild","options","context","projectsConfigurations","Error","projectName","projectConfig","projects","targets","distDir","join","root","outputPath","statsDir","tryMkdir","configurations","success","envBackup","process","env","configurationName","Object","keys","runContext","retainEnv","JSON","parse","stringify","results","runExecutor","project","target","configuration","result","statsPath","existingStats","loadExistingDistStats","newStats","calculateDistStats","removeHashes","writeFile","comparison","compareStats","logger","info","totalSizeDifferencePercentage","fileCountDifferencePercentage","newFilesPercentage","deletedFilesPercentage","Math","abs","mkdir","key","assign"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/schema.d.ts"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/schema.d.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/with-hash-removed.ts"],"sourcesContent":["const HASH_REGEX = /\\.[a-f0-9]{16}\\./g;\n\nexport function withHashRemoved(fileName: string): string {\n\treturn fileName.replace(HASH_REGEX, '.');\n}\n"],"names":["withHashRemoved","HASH_REGEX","fileName","replace"],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/upgrade-verify/src/executors/verify-build/with-hash-removed.ts"],"sourcesContent":["const HASH_REGEX = /\\.[a-f0-9]{16}\\./g;\n\nexport function withHashRemoved(fileName: string): string {\n\treturn fileName.replace(HASH_REGEX, '.');\n}\n"],"names":["withHashRemoved","HASH_REGEX","fileName","replace"],"mappings":";+BAEgBA;;;eAAAA;;;AAFhB,MAAMC,aAAa;AAEZ,SAASD,gBAAgBE,QAAgB;IAC/C,OAAOA,SAASC,OAAO,CAACF,YAAY;AACrC"}
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../packages/upgrade-verify/src/index.ts"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../../../../packages/upgrade-verify/src/index.ts"],"names":[],"mappings":""}
|