Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init() {
// create the .gitGallery directory
fs.mkdirSync(galleryRoot);
// copy in the views directory
let sourceViews = path.join(__dirname, '../views');
let destViews = path.join(galleryRoot, 'views');
ncp(sourceViews, destViews, { "clobber": false }, error => { if (error) console.error(error); });
// add a gallery.json file
let gjFile = path.join(galleryRoot, 'gallery.json');
fsUtils.writeJson({ 'title': '', 'comment': '', 'showCanvas': false }, gjFile, { 'flag': 'wx' }, error => { if (error) console.log(error); });
// create/edit .gitignore file
let gitignore = path.join(galleryRoot, '../.gitignore');
fs.ensureFileSync(gitignore);
var rd = readline.createInterface({
input: fs.createReadStream(gitignore),
output: process.stdout,
terminal: false
});
let alreadyIgnored = false;
rd.on('line', function(line) {
if (line.indexOf('.gitGallery') >= 0)
function copyFiles() {
var mkdirp = require('mkdirp');
mkdirp('./definitions/' + val, function (e) {
if (e) {
console.log(e);
}
});
ncp.ncp("./node_modules/" + val, './definitions/' + val, {
filter: function (file) {
return (((fs.statSync(file).isDirectory() || file.includes('.d.ts') || file.endsWith('package.json'))
&& (!file.replace('node_modules', '').includes('node_modules')))
// && (file.search(/api[\\/]umd/) == -1)
&& (file.search('.git') == -1));
},
dereference: true
}, function (e) {
if (e) {
console.log(e, 'failed');
}
});
}
});
? "./" : dirPath1.substring(0, dirPath1.indexOf("/cordova")) + "/"
ncp(parentDir + "react-js/build", parentDir + "cordova/www", function (err) {
if (err) {
reco.setState({ error: true });
return console.error("ERROR ncp1, copy react-js/build tocordova/www : " + err);
}
reco.state.callBack_replaceWwwRootDir(); // callBack();
});
}
}
rmWwwRootDir(dirPath1);
} else {
let parentDir = dirPath1.startsWith("./cordova") ? "./" : dirPath1.substring(0, dirPath1.indexOf("/cordova")) + "/";
ncp(parentDir + "react-js/build", parentDir + "cordova/www", function (err) {
if (err) {
reco.setState({ error: true });
return console.error("ERROR ncp2, copy react-js/build tocordova/www : " + err);
}
reco.state.callBack_replaceWwwRootDir(); // callBack();
});
}
},
function setUpDevTools () {
const destinationFolderPath = path.join(path.dirname(__dirname), 'public', 'dashboard', 'devtools')
const destinationFolderExists = fs.existsSync(destinationFolderPath)
if (!destinationFolderExists) {
console.error(destinationFolderPath + ' folder doesn\'t exist, make sure you are in the right directory.')
process.exit(1)
}
const chromeDevTools = path.dirname(require.resolve('chrome-devtools-frontend/front_end/inspector.html'))
console.log('Destination folder: ' + destinationFolderPath)
ncp(chromeDevTools, destinationFolderPath, (err: any) => {
if (err) {
return console.error(err)
}
console.log('Done!!!')
})
}
copy("./build", "./export/engine", function () {
copy("./story", "./export", function () {
console.log("Exported WebStory Engine skeleton to export folder.");
});
});
}
function startNcp() {
ncp(source, dest, options, function(errList) {
if (errList) return cb(errList[0]);
rimraf(source, cb);
});
}
}
return new Promise((resolve) => {
ncp('config', configPath, function (err) {
if (err) {
throw new Error("Unable to copy config file to Electron dir " + err);
}
return resolve();
});
})
}
return new Promise((resolve, reject) =>
ncp(source, this.sandboxPath, err => {
if (err) return reject(err);
resolve();
})
);
return new Promise((resolve, reject) => {
ncp(source, target, error => {
if (error) {
return reject(error);
}
return resolve();
});
});
}
cli.on('skeleton *', function (args) {
header();
var dir = args._[1];
if (!_.isPathAbsolute(dir)){
dir = path.resolve(args.cwd, dir);
}
if (exists(dir)) {
log.error('Skeleton folder already exists.');
log.error(dir);
footerNotOk();
}
ncp(join(__dirname, '..', '..', '..', 'skeleton'), dir, function (err) {
if (err && err.length > 0) {
log.error(err[0].message);
footerNotOk();
}
log.info('Skeleton successfully created'.blue);
log.info(dir);
footerOk();
});
});