@ziacik/upgrade-verify 1.0.0 → 1.0.1

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 CHANGED
@@ -7,9 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.1] - 2023-10-21
11
+
12
+ ### Fixed
13
+
14
+ - Fixed the "Package subpath './package.json' is not defined by "exports"" error. #20
15
+ - Generated stats are now properly sorted when remove hashes option is used. #19
16
+
10
17
  ## [1.0.0] - 2023-10-21
11
18
 
12
- ## Added
19
+ ### Added
13
20
 
14
21
  - `removeHashes` option added to the `verify-build` executor, with a default of `true`, which removes hashes from file names, making the comparisons more deterministic.
15
22
  - `check-issues` executor added.
@@ -51,7 +58,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
51
58
  - READMEs updated and props added to package.json.
52
59
  - A _Package subpath './package.json' is not defined by "exports"_ error hopefully fixed.
53
60
 
54
- [unreleased]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-1.0.0...HEAD
61
+ [unreleased]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-1.0.1...HEAD
62
+ [1.0.1]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-1.0.0...upgrade-verify-1.0.1
55
63
  [1.0.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-0.2.0...upgrade-verify-1.0.0
56
64
  [0.2.0]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-0.1.1...upgrade-verify-0.2.0
57
65
  [0.1.1]: https://github.com/ziacik/nx-tools/compare/upgrade-verify-0.1.0...upgrade-verify-0.1.1
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@ziacik/upgrade-verify",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
+ "dependencies": {
5
+ "@nx/devkit": "16.10.0"
6
+ },
4
7
  "type": "commonjs",
5
- "executors": "./executors.json",
8
+ "main": "./src/index.js",
9
+ "typings": "./src/index.d.ts",
10
+ "author": "František Žiačik",
6
11
  "keywords": [
7
12
  "nx",
8
13
  "upgrade-verify",
@@ -12,23 +17,11 @@
12
17
  "upgrade",
13
18
  "plugin"
14
19
  ],
15
- "author": "František Žiačik",
16
20
  "repository": {
17
21
  "type": "git",
18
- "url": "https://github.com/ziacik/nx-tools"
22
+ "url": "https://github.com/ziacik/nx-tools",
23
+ "directory": "packages/upgrade-verify"
19
24
  },
20
25
  "license": "MIT",
21
- "exports": {
22
- ".": {
23
- "require": "./package.json"
24
- }
25
- },
26
- "dependencies": {
27
- "@nx/devkit": "16.10.0",
28
- "process": "0.11.10"
29
- },
30
- "peerDependencies": {
31
- "@swc/helpers": "0.5.2"
32
- },
33
- "main": "./src/index.js"
26
+ "executors": "./executors.json"
34
27
  }
@@ -6,7 +6,7 @@
6
6
  <base href="/">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1" />
8
8
  <link rel="icon" type="image/x-icon" href="favicon.ico" />
9
- <link rel="stylesheet" href="styles.ef46db3751d8e999.css"><link rel="stylesheet" href="main.0274b0362ab850a9.css"></head>
9
+ <link rel="stylesheet" href="styles.ef46db3751d8e999.css"><link rel="stylesheet" href="main.4274b0362ab850a9.css"></head>
10
10
  <body>
11
11
  <app-root></app-root>
12
12
  <script src="runtime.dd97139be5136261.js" type="module"></script><script src="styles.91b7890a3e13c303.js" type="module"></script><script src="main.3d931a8f6ad8b28f.js" type="module"></script></body>
@@ -6,8 +6,8 @@
6
6
  { "name": "assets", "size": 100, "items": [{ "name": ".gitkeep", "size": 100, "items": [] }] },
7
7
  { "name": "assetsx", "size": 0, "items": [{ "name": ".gitkeep", "size": 0, "items": [] }] },
8
8
  { "name": "index.xhtml", "size": 608, "items": [] },
9
- { "name": "main.0274b0362ab850a9.css", "size": 6168, "items": [] },
10
9
  { "name": "main.3d931a8f6ad8b28f.js", "size": 18760, "items": [] },
10
+ { "name": "main.4274b0362ab850a9.css", "size": 6168, "items": [] },
11
11
  { "name": "runtime.dd97139be5136261.js", "size": 2109, "items": [] },
12
12
  { "name": "styles.abc.js", "size": 176, "items": [] },
13
13
  { "name": "styles.ef46db3751d8e999.css", "size": 0, "items": [] }
@@ -9,7 +9,7 @@
9
9
  { "name": "main.css", "size": 6168, "items": [] },
10
10
  { "name": "main.js", "size": 18760, "items": [] },
11
11
  { "name": "runtime.js", "size": 2109, "items": [] },
12
- { "name": "styles.js", "size": 176, "items": [] },
13
- { "name": "styles.css", "size": 0, "items": [] }
12
+ { "name": "styles.css", "size": 0, "items": [] },
13
+ { "name": "styles.js", "size": 176, "items": [] }
14
14
  ]
15
15
  }
@@ -6,8 +6,8 @@
6
6
  { "name": "assets", "size": 0, "items": [{ "name": ".gitkeep", "size": 0, "items": [] }] },
7
7
  { "name": "favicon.ico", "size": 15086, "items": [] },
8
8
  { "name": "index.html", "size": 608, "items": [] },
9
- { "name": "main.0274b0362ab850a9.css", "size": 6168, "items": [] },
10
9
  { "name": "main.3d931a8f6ad8b28f.js", "size": 18760, "items": [] },
10
+ { "name": "main.4274b0362ab850a9.css", "size": 6168, "items": [] },
11
11
  { "name": "runtime.dd97139be5136261.js", "size": 2109, "items": [] },
12
12
  { "name": "styles.91b7890a3e13c303.js", "size": 176, "items": [] },
13
13
  { "name": "styles.ef46db3751d8e999.css", "size": 0, "items": [] }
@@ -15,6 +15,7 @@ _export(exports, {
15
15
  });
16
16
  const _promises = require("fs/promises");
17
17
  const _path = require("path");
18
+ const _withhashremoved = require("./with-hash-removed");
18
19
  async function loadExistingDistStats(statsPath) {
19
20
  try {
20
21
  const statsStr = await (0, _promises.readFile)(statsPath, 'utf-8');
@@ -34,7 +35,7 @@ async function calculateStats(root, relative, removeHashes) {
34
35
  const stats = await (0, _promises.stat)(path);
35
36
  if (stats.isFile()) {
36
37
  return {
37
- name: removeHashes ? withHashRemoved(relative) : relative,
38
+ name: removeHashes ? (0, _withhashremoved.withHashRemoved)(relative) : relative,
38
39
  size: stats.size,
39
40
  items: []
40
41
  };
@@ -44,15 +45,11 @@ async function calculateStats(root, relative, removeHashes) {
44
45
  return {
45
46
  name: relative,
46
47
  size: nestedStats.reduce((result, stat)=>result + stat.size, 0),
47
- items: nestedStats
48
+ items: nestedStats.sort((a, b)=>a.name.localeCompare(b.name))
48
49
  };
49
50
  } else {
50
51
  throw new Error('What: ' + path);
51
52
  }
52
53
  }
53
- const HASH_REGEX = /\.[a-f0-9]{16}\./g;
54
- function withHashRemoved(fileName) {
55
- return fileName.replace(HASH_REGEX, '.');
56
- }
57
54
 
58
55
  //# sourceMappingURL=dist-stats.js.map
@@ -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';\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,\n\t\t};\n\t} else {\n\t\tthrow new Error('What: ' + path);\n\t}\n}\n\nconst HASH_REGEX = /\\.[a-f0-9]{16}\\./g;\n\nfunction withHashRemoved(fileName: string): string {\n\treturn fileName.replace(HASH_REGEX, '.');\n}\n"],"names":["loadExistingDistStats","calculateDistStats","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","Error","HASH_REGEX","fileName","replace"],"mappings":";;;;;;;;IASsBA,qBAAqB;eAArBA;;IASAC,kBAAkB;eAAlBA;;;0BAlBkB;sBACnB;AAQd,eAAeD,sBAAsBE,SAAiB;IAC5D,IAAI;QACH,MAAMC,WAAW,MAAMC,IAAAA,kBAAQ,EAACF,WAAW;QAC3C,OAAOG,KAAKC,KAAK,CAACH;IACnB,EAAE,UAAM;QACP,OAAOI;IACR;AACD;AAEO,eAAeN,mBAAmBO,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,gBAAgBR,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;QACR;IACD,OAAO;QACN,MAAM,IAAIO,MAAM,WAAWnB;IAC5B;AACD;AAEA,MAAMoB,aAAa;AAEnB,SAASd,gBAAgBe,QAAgB;IACxC,OAAOA,SAASC,OAAO,CAACF,YAAY;AACrC"}
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":["loadExistingDistStats","calculateDistStats","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":";;;;;;;;IAUsBA,qBAAqB;eAArBA;;IASAC,kBAAkB;eAAlBA;;;0BAnBkB;sBACnB;iCACW;AAQzB,eAAeD,sBAAsBE,SAAiB;IAC5D,IAAI;QACH,MAAMC,WAAW,MAAMC,IAAAA,kBAAQ,EAACF,WAAW;QAC3C,OAAOG,KAAKC,KAAK,CAACH;IACnB,EAAE,UAAM;QACP,OAAOI;IACR;AACD;AAEO,eAAeN,mBAAmBO,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"}
@@ -0,0 +1 @@
1
+ export declare function withHashRemoved(fileName: string): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "withHashRemoved", {
3
+ enumerable: true,
4
+ get: function() {
5
+ return withHashRemoved;
6
+ }
7
+ });
8
+ const HASH_REGEX = /\.[a-f0-9]{16}\./g;
9
+ function withHashRemoved(fileName) {
10
+ return fileName.replace(HASH_REGEX, '.');
11
+ }
12
+
13
+ //# sourceMappingURL=with-hash-removed.js.map
@@ -0,0 +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"],"mappings":";+BAEgBA;;;eAAAA;;;AAFhB,MAAMC,aAAa;AAEZ,SAASD,gBAAgBE,QAAgB;IAC/C,OAAOA,SAASC,OAAO,CAACF,YAAY;AACrC"}