@deot/dev-updater 2.2.0 → 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 +15 -7
- package/dist/index.es.js +15 -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;
|
|
@@ -96,6 +96,7 @@ class Update {
|
|
|
96
96
|
}
|
|
97
97
|
resolve();
|
|
98
98
|
}).catch(() => {
|
|
99
|
+
delete packageNames[packageName];
|
|
99
100
|
resolve();
|
|
100
101
|
});
|
|
101
102
|
});
|
|
@@ -104,6 +105,7 @@ class Update {
|
|
|
104
105
|
}
|
|
105
106
|
async updatePackageOptions(changed) {
|
|
106
107
|
const { packageOptionsMap, commandOptions } = this;
|
|
108
|
+
let packageFolderNames = [];
|
|
107
109
|
Object.keys(packageOptionsMap).forEach((packageDir) => {
|
|
108
110
|
const packageOptions = packageOptionsMap[packageDir];
|
|
109
111
|
const { devDependencies = {}, dependencies = {} } = packageOptions;
|
|
@@ -118,14 +120,19 @@ class Update {
|
|
|
118
120
|
});
|
|
119
121
|
});
|
|
120
122
|
if (isChanged) {
|
|
123
|
+
const locals = devShared.Locals.impl();
|
|
124
|
+
const { cwd } = locals;
|
|
125
|
+
if (packageDir !== cwd) {
|
|
126
|
+
packageFolderNames.push(packageDir.split("/").pop());
|
|
127
|
+
}
|
|
121
128
|
if (commandOptions.dryRun) {
|
|
122
|
-
|
|
123
|
-
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`));
|
|
124
130
|
} else {
|
|
125
131
|
fs.outputFileSync(`${packageDir}/package.json`, JSON.stringify(packageOptions, null, 2));
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
});
|
|
135
|
+
return packageFolderNames;
|
|
129
136
|
}
|
|
130
137
|
async updateLock() {
|
|
131
138
|
if (this.commandOptions.dryRun) {
|
|
@@ -181,7 +188,7 @@ ${message}`);
|
|
|
181
188
|
spinner.start();
|
|
182
189
|
let changed = await this.getPackageChanged();
|
|
183
190
|
spinner.stop();
|
|
184
|
-
let message = `
|
|
191
|
+
let message = `deps updated
|
|
185
192
|
|
|
186
193
|
`;
|
|
187
194
|
let keys = Object.keys(changed);
|
|
@@ -197,7 +204,8 @@ ${message}`);
|
|
|
197
204
|
devShared.Logger.log(`${chalk.cyan(key)}: ${chalk.yellow(version)} -> ${chalk.green(changed[key][version])}`);
|
|
198
205
|
});
|
|
199
206
|
});
|
|
200
|
-
await this.updatePackageOptions(changed);
|
|
207
|
+
const packageFolderNames = await this.updatePackageOptions(changed);
|
|
208
|
+
message = `chore${packageFolderNames.length ? "(" : ""}${packageFolderNames.join(",")}${packageFolderNames.length ? ")" : ""}: ${message}`;
|
|
201
209
|
await this.updateLock();
|
|
202
210
|
await this.test();
|
|
203
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;
|
|
@@ -73,6 +73,7 @@ class Update {
|
|
|
73
73
|
}
|
|
74
74
|
resolve();
|
|
75
75
|
}).catch(() => {
|
|
76
|
+
delete packageNames[packageName];
|
|
76
77
|
resolve();
|
|
77
78
|
});
|
|
78
79
|
});
|
|
@@ -81,6 +82,7 @@ class Update {
|
|
|
81
82
|
}
|
|
82
83
|
async updatePackageOptions(changed) {
|
|
83
84
|
const { packageOptionsMap, commandOptions } = this;
|
|
85
|
+
let packageFolderNames = [];
|
|
84
86
|
Object.keys(packageOptionsMap).forEach((packageDir) => {
|
|
85
87
|
const packageOptions = packageOptionsMap[packageDir];
|
|
86
88
|
const { devDependencies = {}, dependencies = {} } = packageOptions;
|
|
@@ -95,14 +97,19 @@ class Update {
|
|
|
95
97
|
});
|
|
96
98
|
});
|
|
97
99
|
if (isChanged) {
|
|
100
|
+
const locals = Locals.impl();
|
|
101
|
+
const { cwd } = locals;
|
|
102
|
+
if (packageDir !== cwd) {
|
|
103
|
+
packageFolderNames.push(packageDir.split("/").pop());
|
|
104
|
+
}
|
|
98
105
|
if (commandOptions.dryRun) {
|
|
99
|
-
|
|
100
|
-
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`));
|
|
101
107
|
} else {
|
|
102
108
|
fs.outputFileSync(`${packageDir}/package.json`, JSON.stringify(packageOptions, null, 2));
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
});
|
|
112
|
+
return packageFolderNames;
|
|
106
113
|
}
|
|
107
114
|
async updateLock() {
|
|
108
115
|
if (this.commandOptions.dryRun) {
|
|
@@ -158,7 +165,7 @@ ${message}`);
|
|
|
158
165
|
spinner.start();
|
|
159
166
|
let changed = await this.getPackageChanged();
|
|
160
167
|
spinner.stop();
|
|
161
|
-
let message = `
|
|
168
|
+
let message = `deps updated
|
|
162
169
|
|
|
163
170
|
`;
|
|
164
171
|
let keys = Object.keys(changed);
|
|
@@ -174,7 +181,8 @@ ${message}`);
|
|
|
174
181
|
Logger.log(`${chalk.cyan(key)}: ${chalk.yellow(version)} -> ${chalk.green(changed[key][version])}`);
|
|
175
182
|
});
|
|
176
183
|
});
|
|
177
|
-
await this.updatePackageOptions(changed);
|
|
184
|
+
const packageFolderNames = await this.updatePackageOptions(changed);
|
|
185
|
+
message = `chore${packageFolderNames.length ? "(" : ""}${packageFolderNames.join(",")}${packageFolderNames.length ? ")" : ""}: ${message}`;
|
|
178
186
|
await this.updateLock();
|
|
179
187
|
await this.test();
|
|
180
188
|
await this.commit(message);
|