@makano/rew 1.2.12 → 1.2.21
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/rew/cli/cli.js +6 -0
- package/lib/rew/cli/utils.js +9 -1
- package/lib/rew/pkgs/conf.js +8 -1
- package/lib/rew/pkgs/rune.js +2 -2
- package/package.json +1 -1
package/lib/rew/cli/cli.js
CHANGED
@@ -243,6 +243,7 @@ yargs(hideBin(process.argv))
|
|
243
243
|
describe: 'Package of the app to uninstall',
|
244
244
|
type: 'string',
|
245
245
|
}).option('all', {
|
246
|
+
alias: 'a',
|
246
247
|
describe: 'Remove the configs as well',
|
247
248
|
type: 'boolean',
|
248
249
|
});
|
@@ -310,6 +311,11 @@ yargs(hideBin(process.argv))
|
|
310
311
|
describe: 'Translate to js',
|
311
312
|
type: 'boolean',
|
312
313
|
})
|
314
|
+
.option('single', {
|
315
|
+
alias: 's',
|
316
|
+
describe: 'Build single file(don\'t build imports)',
|
317
|
+
type: 'boolean',
|
318
|
+
})
|
313
319
|
.option('remove', {
|
314
320
|
alias: 'r',
|
315
321
|
describe: 'Remove all coffee',
|
package/lib/rew/cli/utils.js
CHANGED
@@ -181,6 +181,14 @@ module.exports = {
|
|
181
181
|
file: path.join(installPath, c.install.build.file)
|
182
182
|
});
|
183
183
|
}
|
184
|
+
if(c.install.commands){
|
185
|
+
for(let command of c.install.commands){
|
186
|
+
execSync(command.replace(/\$installPath/g, installPath));
|
187
|
+
}
|
188
|
+
}
|
189
|
+
if(c.install.file){
|
190
|
+
run(path.join(installPath, c.install.file));
|
191
|
+
}
|
184
192
|
}
|
185
193
|
rl.close();
|
186
194
|
} else {
|
@@ -236,7 +244,7 @@ module.exports = {
|
|
236
244
|
|
237
245
|
function processFile(filePath, importsArray) {
|
238
246
|
const content = readFile(filePath);
|
239
|
-
const imports = extractImports(content);
|
247
|
+
const imports = argv.single ? [] : extractImports(content);
|
240
248
|
|
241
249
|
imports.forEach((importStatement) => {
|
242
250
|
const importedFilePath = path.resolve(path.dirname(filePath), importStatement.url);
|
package/lib/rew/pkgs/conf.js
CHANGED
@@ -49,9 +49,16 @@ module.exports = (context) => ({
|
|
49
49
|
const fileRoot = path.join(rootPath, name);
|
50
50
|
const exists = fs.existsSync(fileRoot);
|
51
51
|
return {
|
52
|
-
|
52
|
+
write(value, ifExists) {
|
53
53
|
if (!fs.existsSync(path.dirname(fileRoot))) fs.mkdirSync(path.dirname(fileRoot), { recursive: true });
|
54
|
+
if(ifExists && fs.existsSync(fileRoot)) return this;
|
54
55
|
fs.writeFileSync(fileRoot, value || defaultValue);
|
56
|
+
return this;
|
57
|
+
},
|
58
|
+
read(s){
|
59
|
+
let file = fs.readFileSync(fileRoot);
|
60
|
+
return typeof s == "string" ? file.toString() :
|
61
|
+
typeof s == "object" ? file.toJSON() : file;
|
55
62
|
},
|
56
63
|
fileRoot,
|
57
64
|
exists,
|
package/lib/rew/pkgs/rune.js
CHANGED