auto-watch-pages
Advanced tools
Comparing version 1.1.4 to 1.1.5
const path = require('path'); | ||
const _ = require('lodash'); | ||
const cryptoFun = require('./cryptoFun'); | ||
const importList = []; | ||
@@ -16,5 +17,11 @@ | ||
const newPath = newPathArray.join('/'); | ||
let routerNmae = newPathArray.join('/'); | ||
let importName = pathArray[pathArray.length - 1]; | ||
let hash = ''; | ||
routerNmae = '/' + routerNmae.substring(0, routerNmae.length - fileKey.length).toLowerCase(); | ||
importName = importName.substring(0, importName.length - 3); | ||
hash = cryptoFun(importName + new Date().getTime()); | ||
@@ -27,3 +34,5 @@ // 当删除文件时删除对象 | ||
name: importName, | ||
path: newPath | ||
path: newPath, | ||
routerNmae, | ||
hash | ||
}) | ||
@@ -30,0 +39,0 @@ } |
const path = require('path'); | ||
const _ = require('lodash'); | ||
const cryptoFun = require('./cryptoFun'); | ||
const importList = []; | ||
@@ -18,6 +19,9 @@ | ||
importName = importName.substring(0, importName.length - 3); | ||
importName = cryptoFun(importName + new Date().getTime()); | ||
// 当删除文件时删除对象 | ||
if (event === 'unlink') { | ||
importList = _.remove(importList, (obj) => obj.name !== importName); | ||
_.remove(importList, (obj) => obj.name === importName); | ||
} else { | ||
@@ -24,0 +28,0 @@ importList.push({ |
@@ -14,2 +14,3 @@ #!/usr/bin/env node | ||
const watchPages = watcher({ | ||
@@ -16,0 +17,0 @@ watchDirPath: config.dirPath, // 监测目录路径 |
{ | ||
"name": "auto-watch-pages", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
const template= require('lodash').template; | ||
const fs = require('fs-extra'); | ||
const argv = process.argv; | ||
const param = argv[2]; | ||
const chokidar = require('chokidar'); | ||
@@ -11,2 +13,4 @@ const outputFile = function (buildFilePaths, tempFilePaths, tempDatas) { | ||
fs.outputFileSync(bfp, template(temp)(data)); | ||
console.log(bfp + ': write file complete!') | ||
}) | ||
@@ -34,2 +38,6 @@ } | ||
outputFile(buildFilePaths, tempFilePaths, tempDatas); | ||
if (param === '-prod') { | ||
watcher.close(); | ||
} | ||
ready = true; | ||
@@ -36,0 +44,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6471
139