slicejs-cli 2.9.3 → 2.9.5
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/client.js +5 -11
- package/commands/startServer/startServer.js +1 -3
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -174,12 +174,10 @@ buildCommand
|
|
|
174
174
|
// DEV COMMAND (DEVELOPMENT)
|
|
175
175
|
sliceClient
|
|
176
176
|
.command("dev")
|
|
177
|
-
.description("Start development server")
|
|
177
|
+
.description("Start development server with hot reload enabled by default")
|
|
178
178
|
.option("-p, --port <port>", "Port for development server", 3000)
|
|
179
|
-
.option("-
|
|
179
|
+
.option("--no-hmr", "Disable hot module reload (enabled by default)")
|
|
180
180
|
.action(async (options) => {
|
|
181
|
-
// Ensure the process.env.NODE_ENV reflects the requested mode for any
|
|
182
|
-
// code (builds, spawned processes, libraries) that reads it.
|
|
183
181
|
const prevEnv = process.env.NODE_ENV;
|
|
184
182
|
process.env.NODE_ENV = 'development';
|
|
185
183
|
try {
|
|
@@ -187,8 +185,7 @@ sliceClient
|
|
|
187
185
|
await startServer({
|
|
188
186
|
mode: 'development',
|
|
189
187
|
port: parseInt(options.port),
|
|
190
|
-
watch: options.
|
|
191
|
-
bundled: false
|
|
188
|
+
watch: options.hmr
|
|
192
189
|
});
|
|
193
190
|
});
|
|
194
191
|
} finally {
|
|
@@ -199,9 +196,8 @@ sliceClient
|
|
|
199
196
|
// START COMMAND - PRODUCTION MODE
|
|
200
197
|
sliceClient
|
|
201
198
|
.command("start")
|
|
202
|
-
.description("
|
|
199
|
+
.description("Serve production files from dist/ (requires prior slice build)")
|
|
203
200
|
.option("-p, --port <port>", "Port for server", 3000)
|
|
204
|
-
.option("-w, --watch", "Enable watch mode for file changes")
|
|
205
201
|
.action(async (options) => {
|
|
206
202
|
const prevEnv = process.env.NODE_ENV;
|
|
207
203
|
process.env.NODE_ENV = 'production';
|
|
@@ -209,9 +205,7 @@ sliceClient
|
|
|
209
205
|
await runWithVersionCheck(async () => {
|
|
210
206
|
await startServer({
|
|
211
207
|
mode: 'production',
|
|
212
|
-
port: parseInt(options.port)
|
|
213
|
-
watch: options.watch,
|
|
214
|
-
bundled: false
|
|
208
|
+
port: parseInt(options.port)
|
|
215
209
|
});
|
|
216
210
|
});
|
|
217
211
|
} finally {
|
|
@@ -88,8 +88,6 @@ function startNodeServer(port, mode) {
|
|
|
88
88
|
const args = [apiIndexPath];
|
|
89
89
|
if (mode === 'production') {
|
|
90
90
|
args.push('--production');
|
|
91
|
-
} else if (mode === 'bundled') {
|
|
92
|
-
args.push('--bundled');
|
|
93
91
|
} else {
|
|
94
92
|
args.push('--development');
|
|
95
93
|
}
|
|
@@ -216,7 +214,7 @@ export default async function startServer(options = {}) {
|
|
|
216
214
|
}
|
|
217
215
|
Print.info('Production mode: serving optimized files from /dist');
|
|
218
216
|
} else {
|
|
219
|
-
Print.info('Development mode: serving files from /src
|
|
217
|
+
Print.info('Development mode: serving files from /src (HMR enabled)');
|
|
220
218
|
}
|
|
221
219
|
|
|
222
220
|
Print.newLine();
|