kn-cli 1.0.102 → 1.0.104
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/build/webpack.config.js +8 -6
- package/package.json +1 -1
- package/src/build.js +32 -2
package/build/webpack.config.js
CHANGED
|
@@ -161,7 +161,7 @@ const LOADER_JS=[
|
|
|
161
161
|
},
|
|
162
162
|
},
|
|
163
163
|
]
|
|
164
|
-
if(
|
|
164
|
+
if(process.env.build_env == 'localdebug'){
|
|
165
165
|
if(devServer?.hot&&devServer?.reactRefresh==true){
|
|
166
166
|
LOADER_JS[0].options.plugins.push(['react-refresh/babel'])//
|
|
167
167
|
}
|
|
@@ -522,11 +522,13 @@ const config={
|
|
|
522
522
|
plugins: plugins,
|
|
523
523
|
};
|
|
524
524
|
|
|
525
|
-
if(
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
525
|
+
if(process.env.build_env == 'localdebug'){
|
|
526
|
+
if(CLI_CONFIG?.cache){
|
|
527
|
+
config.cache = CLI_CONFIG.cache;
|
|
528
|
+
}
|
|
529
|
+
if(devServer?.hot != undefined){
|
|
530
|
+
config.devServer.hot = devServer.hot;
|
|
531
|
+
}
|
|
530
532
|
}
|
|
531
533
|
warn(`=====================webpack config=========================`);
|
|
532
534
|
console.log(config)
|
package/package.json
CHANGED
package/src/build.js
CHANGED
|
@@ -56,10 +56,11 @@ module.exports= async (options={})=> {
|
|
|
56
56
|
const tempWebpackConfigPath = path.resolve(tempWebpackDir,'webpack.config.js');
|
|
57
57
|
const tempStartShell = path.resolve(tempWebpackDir,'start.sh');
|
|
58
58
|
|
|
59
|
-
|
|
60
59
|
let projectPackage,webpackPackage;
|
|
61
60
|
|
|
62
61
|
let answer;
|
|
62
|
+
|
|
63
|
+
|
|
63
64
|
if(type=='dev'){
|
|
64
65
|
answer = await inquirer.prompt([
|
|
65
66
|
{
|
|
@@ -271,6 +272,33 @@ module.exports= async (options={})=> {
|
|
|
271
272
|
})
|
|
272
273
|
},options: { persistentOutput: true }
|
|
273
274
|
},
|
|
275
|
+
{
|
|
276
|
+
title:"建立node_modules",
|
|
277
|
+
task:async (ctx,task)=>{
|
|
278
|
+
return new Promise(resolve=>{
|
|
279
|
+
if(type=='dev'){
|
|
280
|
+
let _link_node_modules_to= path.resolve(projectPath,'node_modules');
|
|
281
|
+
let _link_node_modules_from= path.resolve(tempWebpackDir,"node_modules");
|
|
282
|
+
|
|
283
|
+
_link_node_modules_from = TransformWindowsPath(_link_node_modules_from);
|
|
284
|
+
_link_node_modules_to = TransformWindowsPath(_link_node_modules_to);
|
|
285
|
+
console.log(chalk.green.bold('_link_node_modules_to:'+_link_node_modules_to));
|
|
286
|
+
console.log(chalk.green.bold('_link_node_modules_from:'+_link_node_modules_from));
|
|
287
|
+
let _link_node_modules=`ln -s ${_link_node_modules_from} ${_link_node_modules_to}`;
|
|
288
|
+
if (IS_WINDOWS()) {
|
|
289
|
+
_link_node_modules=`mklink /D ¥${_link_node_modules_to} ${_link_node_modules_from} `;
|
|
290
|
+
}else{
|
|
291
|
+
_link_node_modules=`ln -s ${_link_node_modules_from} ${_link_node_modules_to}`;
|
|
292
|
+
}
|
|
293
|
+
task.output='执行link'
|
|
294
|
+
console.log(chalk.green.bold('执行_link_node_modules:'+_link_node_modules));
|
|
295
|
+
shelljs.exec(_link_node_modules);
|
|
296
|
+
}
|
|
297
|
+
resolve();
|
|
298
|
+
|
|
299
|
+
})
|
|
300
|
+
},options:{persistentOutput:true}
|
|
301
|
+
},
|
|
274
302
|
{
|
|
275
303
|
title:"执行build",
|
|
276
304
|
task:async (ctx,task)=>{
|
|
@@ -343,7 +371,8 @@ module.exports= async (options={})=> {
|
|
|
343
371
|
}
|
|
344
372
|
})
|
|
345
373
|
},options: { persistentOutput: true }
|
|
346
|
-
}
|
|
374
|
+
},
|
|
375
|
+
|
|
347
376
|
],
|
|
348
377
|
{
|
|
349
378
|
concurrent: false,
|
|
@@ -362,6 +391,7 @@ module.exports= async (options={})=> {
|
|
|
362
391
|
}
|
|
363
392
|
);
|
|
364
393
|
|
|
394
|
+
|
|
365
395
|
try{
|
|
366
396
|
await tasks.run();
|
|
367
397
|
}catch(err){
|