kn-cli 1.0.103 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/build.js +32 -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.104",
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,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){