@deot/dev-updater 2.2.1 → 2.2.2
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/dist/index.cjs.js +14 -7
- package/dist/index.es.js +14 -7
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -54,13 +54,13 @@ class Update {
|
|
|
54
54
|
commandOptions;
|
|
55
55
|
constructor(commandOptions) {
|
|
56
56
|
const locals = devShared.Locals.impl();
|
|
57
|
-
const { packageDir } = locals;
|
|
57
|
+
const { rootPackageOptions, packageDir, cwd } = locals;
|
|
58
58
|
const packageOptionsMap = {
|
|
59
|
+
[cwd]: rootPackageOptions,
|
|
59
60
|
...Object.keys(locals.packageOptionsMap).reduce((result, key) => {
|
|
60
61
|
result[path__namespace.resolve(packageDir, key)] = locals.packageOptionsMap[key];
|
|
61
62
|
return result;
|
|
62
|
-
}, {})
|
|
63
|
-
[packageDir]: locals.packageOptions
|
|
63
|
+
}, {})
|
|
64
64
|
};
|
|
65
65
|
this.packageOptionsMap = packageOptionsMap;
|
|
66
66
|
this.commandOptions = commandOptions;
|
|
@@ -105,6 +105,7 @@ class Update {
|
|
|
105
105
|
}
|
|
106
106
|
async updatePackageOptions(changed) {
|
|
107
107
|
const { packageOptionsMap, commandOptions } = this;
|
|
108
|
+
let packageFolderNames = [];
|
|
108
109
|
Object.keys(packageOptionsMap).forEach((packageDir) => {
|
|
109
110
|
const packageOptions = packageOptionsMap[packageDir];
|
|
110
111
|
const { devDependencies = {}, dependencies = {} } = packageOptions;
|
|
@@ -119,14 +120,19 @@ class Update {
|
|
|
119
120
|
});
|
|
120
121
|
});
|
|
121
122
|
if (isChanged) {
|
|
123
|
+
const locals = devShared.Locals.impl();
|
|
124
|
+
const { cwd } = locals;
|
|
125
|
+
if (packageDir !== cwd) {
|
|
126
|
+
packageFolderNames.push(packageDir.split("/").pop());
|
|
127
|
+
}
|
|
122
128
|
if (commandOptions.dryRun) {
|
|
123
|
-
|
|
124
|
-
devShared.Logger.log(chalk.magenta(`CHANGED: `) + chalk.yellow(`Skipping ${path__namespace.relative(locals.cwd, packageDir)} Update`));
|
|
129
|
+
devShared.Logger.log(chalk.magenta(`CHANGED: `) + chalk.yellow(`Skipping ${path__namespace.relative(cwd, packageDir)} Update`));
|
|
125
130
|
} else {
|
|
126
131
|
fs.outputFileSync(`${packageDir}/package.json`, JSON.stringify(packageOptions, null, 2));
|
|
127
132
|
}
|
|
128
133
|
}
|
|
129
134
|
});
|
|
135
|
+
return packageFolderNames;
|
|
130
136
|
}
|
|
131
137
|
async updateLock() {
|
|
132
138
|
if (this.commandOptions.dryRun) {
|
|
@@ -182,7 +188,7 @@ ${message}`);
|
|
|
182
188
|
spinner.start();
|
|
183
189
|
let changed = await this.getPackageChanged();
|
|
184
190
|
spinner.stop();
|
|
185
|
-
let message = `
|
|
191
|
+
let message = `deps updated
|
|
186
192
|
|
|
187
193
|
`;
|
|
188
194
|
let keys = Object.keys(changed);
|
|
@@ -198,7 +204,8 @@ ${message}`);
|
|
|
198
204
|
devShared.Logger.log(`${chalk.cyan(key)}: ${chalk.yellow(version)} -> ${chalk.green(changed[key][version])}`);
|
|
199
205
|
});
|
|
200
206
|
});
|
|
201
|
-
await this.updatePackageOptions(changed);
|
|
207
|
+
const packageFolderNames = await this.updatePackageOptions(changed);
|
|
208
|
+
message = `chore${packageFolderNames.length ? "(" : ""}${packageFolderNames.join(",")}${packageFolderNames.length ? ")" : ""}: ${message}`;
|
|
202
209
|
await this.updateLock();
|
|
203
210
|
await this.test();
|
|
204
211
|
await this.commit(message);
|
package/dist/index.es.js
CHANGED
|
@@ -31,13 +31,13 @@ class Update {
|
|
|
31
31
|
commandOptions;
|
|
32
32
|
constructor(commandOptions) {
|
|
33
33
|
const locals = Locals.impl();
|
|
34
|
-
const { packageDir } = locals;
|
|
34
|
+
const { rootPackageOptions, packageDir, cwd } = locals;
|
|
35
35
|
const packageOptionsMap = {
|
|
36
|
+
[cwd]: rootPackageOptions,
|
|
36
37
|
...Object.keys(locals.packageOptionsMap).reduce((result, key) => {
|
|
37
38
|
result[path.resolve(packageDir, key)] = locals.packageOptionsMap[key];
|
|
38
39
|
return result;
|
|
39
|
-
}, {})
|
|
40
|
-
[packageDir]: locals.packageOptions
|
|
40
|
+
}, {})
|
|
41
41
|
};
|
|
42
42
|
this.packageOptionsMap = packageOptionsMap;
|
|
43
43
|
this.commandOptions = commandOptions;
|
|
@@ -82,6 +82,7 @@ class Update {
|
|
|
82
82
|
}
|
|
83
83
|
async updatePackageOptions(changed) {
|
|
84
84
|
const { packageOptionsMap, commandOptions } = this;
|
|
85
|
+
let packageFolderNames = [];
|
|
85
86
|
Object.keys(packageOptionsMap).forEach((packageDir) => {
|
|
86
87
|
const packageOptions = packageOptionsMap[packageDir];
|
|
87
88
|
const { devDependencies = {}, dependencies = {} } = packageOptions;
|
|
@@ -96,14 +97,19 @@ class Update {
|
|
|
96
97
|
});
|
|
97
98
|
});
|
|
98
99
|
if (isChanged) {
|
|
100
|
+
const locals = Locals.impl();
|
|
101
|
+
const { cwd } = locals;
|
|
102
|
+
if (packageDir !== cwd) {
|
|
103
|
+
packageFolderNames.push(packageDir.split("/").pop());
|
|
104
|
+
}
|
|
99
105
|
if (commandOptions.dryRun) {
|
|
100
|
-
|
|
101
|
-
Logger.log(chalk.magenta(`CHANGED: `) + chalk.yellow(`Skipping ${path.relative(locals.cwd, packageDir)} Update`));
|
|
106
|
+
Logger.log(chalk.magenta(`CHANGED: `) + chalk.yellow(`Skipping ${path.relative(cwd, packageDir)} Update`));
|
|
102
107
|
} else {
|
|
103
108
|
fs.outputFileSync(`${packageDir}/package.json`, JSON.stringify(packageOptions, null, 2));
|
|
104
109
|
}
|
|
105
110
|
}
|
|
106
111
|
});
|
|
112
|
+
return packageFolderNames;
|
|
107
113
|
}
|
|
108
114
|
async updateLock() {
|
|
109
115
|
if (this.commandOptions.dryRun) {
|
|
@@ -159,7 +165,7 @@ ${message}`);
|
|
|
159
165
|
spinner.start();
|
|
160
166
|
let changed = await this.getPackageChanged();
|
|
161
167
|
spinner.stop();
|
|
162
|
-
let message = `
|
|
168
|
+
let message = `deps updated
|
|
163
169
|
|
|
164
170
|
`;
|
|
165
171
|
let keys = Object.keys(changed);
|
|
@@ -175,7 +181,8 @@ ${message}`);
|
|
|
175
181
|
Logger.log(`${chalk.cyan(key)}: ${chalk.yellow(version)} -> ${chalk.green(changed[key][version])}`);
|
|
176
182
|
});
|
|
177
183
|
});
|
|
178
|
-
await this.updatePackageOptions(changed);
|
|
184
|
+
const packageFolderNames = await this.updatePackageOptions(changed);
|
|
185
|
+
message = `chore${packageFolderNames.length ? "(" : ""}${packageFolderNames.join(",")}${packageFolderNames.length ? ")" : ""}: ${message}`;
|
|
179
186
|
await this.updateLock();
|
|
180
187
|
await this.test();
|
|
181
188
|
await this.commit(message);
|