UNPKG

869 BJavaScriptView Raw
1const path = require('path');
2const fs = require('fs-extra');
3function recordOptions (options,_input,_output) {
4 if (!options.input || !options.output || !options.type) return
5 let configPath = path.join(options.input,`./antmove.config.js`)
6 options = JSON.parse(JSON.stringify(options))
7 options.input =_input;
8 options.output = _output;
9 delete options.remote;
10 delete options.defaultInput;
11 options = JSON.stringify(options,null,4)
12 let _options = `module.exports =
13${options}
14 `
15 fs.outputFile(configPath , _options)
16}
17
18function returnOptions (res) {
19 let _path = path.join(res, './antmove.config.js');
20 let isExist = fs.existsSync(_path);
21 if (isExist) {
22 let _options = require(_path);
23 return _options
24 } else {
25 return false
26 }
27}
28module.exports = {
29 recordOptions,
30 returnOptions
31}
\No newline at end of file