@tmbr/bundler 1.12.5 → 1.12.6
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/cli.js +10 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -16,7 +16,7 @@ const command = process.argv[2];
|
|
|
16
16
|
|
|
17
17
|
if (!['build', 'watch'].includes(command)) {
|
|
18
18
|
console.log(`Invalid command: ${chalk.red(command)}\n`);
|
|
19
|
-
process.exit();
|
|
19
|
+
process.exit(1);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const logger = (options = {}) => ({
|
|
@@ -145,14 +145,21 @@ async function main() {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
if (process.argv[3]
|
|
148
|
+
if (process.argv[3]) {
|
|
149
|
+
|
|
150
|
+
const file = process.argv[3];
|
|
151
|
+
|
|
152
|
+
if (!fs.existsSync(file)) {
|
|
153
|
+
console.log(`Config file not found: ${chalk.red(file)}\n`);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
149
156
|
|
|
150
157
|
function extend(options, config) {
|
|
151
158
|
if (typeof config === 'undefined') return;
|
|
152
159
|
Object.assign(options, typeof config === 'function' ? config(options) : config);
|
|
153
160
|
}
|
|
154
161
|
|
|
155
|
-
import(`${cwd}/${
|
|
162
|
+
import(`${cwd}/${file}`).then(settings => {
|
|
156
163
|
extend(watchOptions, settings.watch);
|
|
157
164
|
extend(buildOptions, settings.build);
|
|
158
165
|
extend(serveOptions, settings.serve);
|