kn-cli 1.0.103 → 1.0.105

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +36 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.103",
3
+ "version": "1.0.105",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
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,37 @@ 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:'+_link_node_modules
294
+ console.log(chalk.green.bold('执行_link_node_modules:'+_link_node_modules));
295
+ let req= shelljs.exec(_link_node_modules);
296
+ if(req.code!=0){
297
+ console.log(chalk.red.bold('执行link异常:'+req.stdout));
298
+ console.log(chalk.red.bold('执行link异常:'+req.stderr));
299
+ }
300
+ }
301
+ resolve();
302
+
303
+ })
304
+ },options:{persistentOutput:true}
305
+ },
274
306
  {
275
307
  title:"执行build",
276
308
  task:async (ctx,task)=>{
@@ -343,7 +375,8 @@ module.exports= async (options={})=> {
343
375
  }
344
376
  })
345
377
  },options: { persistentOutput: true }
346
- }
378
+ },
379
+
347
380
  ],
348
381
  {
349
382
  concurrent: false,
@@ -362,6 +395,7 @@ module.exports= async (options={})=> {
362
395
  }
363
396
  );
364
397
 
398
+
365
399
  try{
366
400
  await tasks.run();
367
401
  }catch(err){