UNPKG

851 BJavaScriptView Raw
1"use strict";
2
3var fs = require("fs"),
4 path = require("path"),
5 glob = require("glob"),
6 opts = {
7 cwd: path.join(__dirname, "..", "brackets-srv")
8 },
9 logFile = "./install.log",
10 exists = fs.existsSync(logFile),
11 conts;
12
13if (exists) {
14 conts = fs.readFileSync(logFile, { encoding: "utf8" });
15 fs.unlinkSync(logFile);
16}
17
18if (!conts) {
19 glob("**/node_modules", opts, function (err, files) {
20 if (err) {
21 throw err;
22 }
23
24 if (files) {
25 files.sort(function (a, b) {
26 return b.length - a.length;
27 });
28
29 files.forEach(function (file) {
30 file = path.join(opts.cwd, file);
31 fs.renameSync(file, file + "_");
32 console.log("file: " + file + "_");
33 });
34 }
35 });
36}