@taiga-ui/syncer 0.250.0 → 0.252.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/bin/src/index.js +2 -2
- package/bin/src/sync-versions.js +26 -26
- package/package.json +1 -1
package/bin/src/index.js
CHANGED
|
@@ -8,10 +8,10 @@ const packageJson = require(node_path_1.default.resolve(process.cwd(), './packag
|
|
|
8
8
|
const syncerOptions = packageJson?.syncer ?? null;
|
|
9
9
|
if (syncerOptions) {
|
|
10
10
|
(0, sync_versions_1.tuiSyncVersions)({
|
|
11
|
-
|
|
11
|
+
ignorePackageNames: syncerOptions.ignorePackageNames,
|
|
12
12
|
includePaths: syncerOptions.includePaths,
|
|
13
13
|
matchPackageNames: syncerOptions.matchPackageNames,
|
|
14
|
-
|
|
14
|
+
newVersion: packageJson.version,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
else {
|
package/bin/src/sync-versions.js
CHANGED
|
@@ -8,7 +8,7 @@ const node_fs_1 = require("node:fs");
|
|
|
8
8
|
const glob_1 = require("glob");
|
|
9
9
|
const INDENTATION = 4;
|
|
10
10
|
function tuiSyncVersions(options) {
|
|
11
|
-
const {
|
|
11
|
+
const { ignorePackageNames, includePaths, matchPackageNames, newVersion } = options;
|
|
12
12
|
const patterns = includePaths.map((pattern) => pattern.endsWith('.json')
|
|
13
13
|
? pattern
|
|
14
14
|
: `${pattern}/**/*(package.json|package-lock.json)`);
|
|
@@ -24,12 +24,12 @@ function tuiSyncVersions(options) {
|
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
26
26
|
tuiUpdatePackageJsonStructure({
|
|
27
|
+
ignorePackageNames,
|
|
27
28
|
isPackageLockFile: file.endsWith('-lock.json'),
|
|
29
|
+
matchPackageNames,
|
|
30
|
+
newVersion,
|
|
28
31
|
packageJson,
|
|
29
32
|
prevVersion,
|
|
30
|
-
newVersion,
|
|
31
|
-
ignorePackageNames,
|
|
32
|
-
matchPackageNames,
|
|
33
33
|
});
|
|
34
34
|
const updatedJSON = JSON.stringify(packageJson, null, 4);
|
|
35
35
|
if (originalJSON !== updatedJSON) {
|
|
@@ -42,9 +42,9 @@ function tuiSyncVersions(options) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
function tuiBumpDeps(options) {
|
|
45
|
-
const { deps,
|
|
45
|
+
const { deps, ignorePackageNames, isPeerDependency, matchPackageNames, newVersion, prevVersion, } = options;
|
|
46
46
|
Object.keys(deps)
|
|
47
|
-
.filter((key) => tuiIsMatchedPackageName({ name: key
|
|
47
|
+
.filter((key) => tuiIsMatchedPackageName({ ignorePackageNames, matchPackageNames, name: key }))
|
|
48
48
|
.forEach((key) => {
|
|
49
49
|
if (typeof deps[key] === 'string') {
|
|
50
50
|
deps[key] = isPeerDependency
|
|
@@ -55,26 +55,26 @@ function tuiBumpDeps(options) {
|
|
|
55
55
|
tuiBumpDeps({
|
|
56
56
|
deps: deps[key]?.requires ??
|
|
57
57
|
{},
|
|
58
|
-
isPeerDependency,
|
|
59
58
|
ignorePackageNames,
|
|
60
|
-
|
|
61
|
-
newVersion,
|
|
59
|
+
isPeerDependency,
|
|
62
60
|
matchPackageNames,
|
|
61
|
+
newVersion,
|
|
62
|
+
prevVersion,
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
function tuiIsMatchedPackageName(options) {
|
|
68
|
-
const {
|
|
68
|
+
const { ignorePackageNames, matchPackageNames, name } = options;
|
|
69
69
|
if (name && ignorePackageNames.includes(name)) {
|
|
70
70
|
return false;
|
|
71
71
|
}
|
|
72
72
|
return !!matchPackageNames.find((match) => !!name?.match(new RegExp(match)));
|
|
73
73
|
}
|
|
74
|
-
function tuiUpdatePackageJsonStructure({
|
|
75
|
-
const {
|
|
74
|
+
function tuiUpdatePackageJsonStructure({ ignorePackageNames, isPackageLockFile, matchPackageNames, newVersion, packageJson, prevVersion, }) {
|
|
75
|
+
const { dependencies, devDependencies, name, packages, peerDependencies } = packageJson;
|
|
76
76
|
if (typeof name === 'string' &&
|
|
77
|
-
tuiIsMatchedPackageName({
|
|
77
|
+
tuiIsMatchedPackageName({ ignorePackageNames, matchPackageNames, name })) {
|
|
78
78
|
if ('version' in packageJson && typeof packageJson['version'] === 'string') {
|
|
79
79
|
packageJson['version'] = newVersion;
|
|
80
80
|
}
|
|
@@ -82,47 +82,47 @@ function tuiUpdatePackageJsonStructure({ packageJson, isPackageLockFile, ignoreP
|
|
|
82
82
|
if (isObject(dependencies)) {
|
|
83
83
|
tuiBumpDeps({
|
|
84
84
|
deps: dependencies,
|
|
85
|
-
prevVersion,
|
|
86
|
-
newVersion,
|
|
87
|
-
matchPackageNames,
|
|
88
85
|
ignorePackageNames,
|
|
86
|
+
matchPackageNames,
|
|
87
|
+
newVersion,
|
|
88
|
+
prevVersion,
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
91
|
if (isObject(peerDependencies)) {
|
|
92
92
|
tuiBumpDeps({
|
|
93
93
|
deps: peerDependencies,
|
|
94
|
-
|
|
95
|
-
newVersion,
|
|
94
|
+
ignorePackageNames,
|
|
96
95
|
isPeerDependency: true,
|
|
97
96
|
matchPackageNames,
|
|
98
|
-
|
|
97
|
+
newVersion,
|
|
98
|
+
prevVersion,
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
if (isObject(devDependencies)) {
|
|
102
102
|
tuiBumpDeps({
|
|
103
103
|
deps: devDependencies,
|
|
104
|
-
prevVersion,
|
|
105
|
-
newVersion,
|
|
106
104
|
ignorePackageNames,
|
|
107
105
|
matchPackageNames,
|
|
106
|
+
newVersion,
|
|
107
|
+
prevVersion,
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
110
|
if (isPackageLockFile && isObject(packages)) {
|
|
111
111
|
for (const packageLockJson of Object.values(packages)) {
|
|
112
112
|
if (!tuiIsMatchedPackageName({
|
|
113
|
-
name: packageLockJson?.name,
|
|
114
113
|
ignorePackageNames,
|
|
115
114
|
matchPackageNames,
|
|
115
|
+
name: packageLockJson?.name,
|
|
116
116
|
})) {
|
|
117
117
|
continue;
|
|
118
118
|
}
|
|
119
119
|
tuiUpdatePackageJsonStructure({
|
|
120
|
-
packageJson: packageLockJson,
|
|
121
|
-
prevVersion,
|
|
122
|
-
newVersion,
|
|
123
|
-
isPackageLockFile: true,
|
|
124
120
|
ignorePackageNames,
|
|
121
|
+
isPackageLockFile: true,
|
|
125
122
|
matchPackageNames,
|
|
123
|
+
newVersion,
|
|
124
|
+
packageJson: packageLockJson,
|
|
125
|
+
prevVersion,
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
}
|