@payfit/nx-core 5.13.4-ephemeral-fix-frontend-version-patching.2 → 5.13.4-ephemeral-fix-frontend-version-patching.3
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import customVersionAction = require('./version-actions');
|
|
3
3
|
declare class VersionActionsFrontend extends customVersionAction {
|
|
4
|
+
findFiles(tree: Tree, startDir: string, patterns: string | string[], results?: string[]): string[];
|
|
4
5
|
updateProjectVersion(tree: Tree, newVersion: string): Promise<string[]>;
|
|
5
6
|
}
|
|
6
7
|
export = VersionActionsFrontend;
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const path_1 = require("path");
|
|
3
|
-
const
|
|
3
|
+
const minimatch_1 = require("minimatch");
|
|
4
4
|
const customVersionAction = require("./version-actions");
|
|
5
5
|
class VersionActionsFrontend extends customVersionAction {
|
|
6
|
+
findFiles(tree, startDir, patterns, results = []) {
|
|
7
|
+
const globs = Array.isArray(patterns) ? patterns : [patterns];
|
|
8
|
+
if (!tree.exists(startDir)) {
|
|
9
|
+
return results;
|
|
10
|
+
}
|
|
11
|
+
for (const child of tree.children(startDir)) {
|
|
12
|
+
const fullPath = `${startDir}/${child}`;
|
|
13
|
+
if (tree.isFile(fullPath)) {
|
|
14
|
+
if (globs.some(p => (0, minimatch_1.minimatch)(fullPath, p, { matchBase: true }))) {
|
|
15
|
+
results.push(fullPath);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.findFiles(tree, fullPath, globs, results);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return results;
|
|
23
|
+
}
|
|
6
24
|
updateProjectVersion(tree, newVersion) {
|
|
7
25
|
const VERSION_NEEDLE_PATTERN = '%%%FRONTEND_APP_RELEASED_VERSION%%%';
|
|
8
26
|
for (const manifest of this.manifestsToUpdate) {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.read(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
tree.write(
|
|
18
|
-
.read(versionFileToUpdate)
|
|
19
|
-
.toString()
|
|
20
|
-
.replace(VERSION_NEEDLE_PATTERN, newVersion));
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
logger_1.consola.warn(`No version needle found in ${versionFileToUpdate}`);
|
|
27
|
+
const filesToUpdate = this.findFiles(tree, (0, path_1.dirname)(manifest.manifestPath), ['**/*.json', '**/*.html']).filter(file => {
|
|
28
|
+
const content = tree.read(file)?.toString();
|
|
29
|
+
return content?.includes(VERSION_NEEDLE_PATTERN);
|
|
30
|
+
});
|
|
31
|
+
for (const file of filesToUpdate) {
|
|
32
|
+
const content = tree.read(file)?.toString();
|
|
33
|
+
if (!content)
|
|
34
|
+
continue;
|
|
35
|
+
tree.write(file, content.replace(VERSION_NEEDLE_PATTERN, newVersion));
|
|
24
36
|
}
|
|
25
37
|
}
|
|
26
38
|
return super.updateProjectVersion(tree, newVersion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-actions-frontend.js","sourceRoot":"","sources":["../../../src/scripts/version-actions-frontend.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"version-actions-frontend.js","sourceRoot":"","sources":["../../../src/scripts/version-actions-frontend.ts"],"names":[],"mappings":";AAAA,+BAA8B;AAG9B,yCAAqC;AAErC,yDAAyD;AAEzD,MAAM,sBAAuB,SAAQ,mBAAmB;IACtD,SAAS,CACP,IAAU,EACV,QAAgB,EAChB,QAA2B,EAC3B,UAAoB,EAAE;QAEtB,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QAE7D,IAAI,CAAC,IAAI,CAAC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M,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAA;gBAC3C,IAAI,CAAC,OAAO;oBAAE,SAAQ;gBACtB,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,sBAAsB,EAAE,UAAU,CAAC,CAAC,CAAA;YACvE,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACrD,CAAC;CACF;AAED,iBAAS,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payfit/nx-core",
|
|
3
|
-
"version": "5.13.4-ephemeral-fix-frontend-version-patching.
|
|
3
|
+
"version": "5.13.4-ephemeral-fix-frontend-version-patching.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./dist/src/index.js",
|
|
6
6
|
"types": "./dist/src/index.d.ts",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"graphql": "^16.11.0",
|
|
27
27
|
"ky": "^1.8.1",
|
|
28
28
|
"memfs": "4.51.1",
|
|
29
|
+
"minimatch": "^10.1.1",
|
|
29
30
|
"semver": "7.7.3",
|
|
30
31
|
"tinyexec": "1.0.2",
|
|
31
32
|
"tslib": "^2.8.1",
|
|
@@ -53,6 +54,7 @@
|
|
|
53
54
|
"default": "./dist/src/index.js"
|
|
54
55
|
},
|
|
55
56
|
"./versionActions": "./dist/src/scripts/version-actions.js",
|
|
57
|
+
"./versionActionsFrontend": "./dist/src/scripts/version-actions-frontend.js",
|
|
56
58
|
"./package.json": "./package.json"
|
|
57
59
|
},
|
|
58
60
|
"executors": "./executors.json",
|