Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
await fs.move(path.join(dest, 'gitignore'), path.join(dest, '.gitignore'))
}
if (fs.pathExistsSync(path.join(dest, 'gitignore'))) {
fs.removeSync(path.join(dest, 'gitignore'))
}
if (isCLI) {
console.log(
`Installing dependencies with: ${
isYarn
? chalk.hex(ChalkColor.yarn)('Yarn')
: chalk.hex(ChalkColor.npm)('NPM')
}...`
)
// We install react-static separately to ensure we always have the latest stable release
execSync(`cd "${name}" && ${isYarn ? 'yarn' : 'npm install'}`)
console.log('')
}
timeEnd(chalk.green(`[\u2713] Project "${name}" created`))
console.log(`
${chalk.green('To get started:')}
cd "${name}" ${
!isCLI
? `&& ${
isYarn
? chalk.hex(ChalkColor.yarn)('yarn')
: chalk.hex(ChalkColor.npm)('npm install')
}`
: ''
async function main() {
let frameworks = process.argv.length<=2 ? [] : process.argv.slice(2,process.argv.length);
if (frameworks.length === 0) {
console.log("usage: rebuild.js [directory1, directory2, ...]");
} else {
for (let framework of frameworks) {
let dir = path.resolve(path.join('..','frameworks',framework));
console.log("rebuilding "+framework+" in directory ", dir);
if (!fs.existsSync(dir)) throw "ERROR: directory "+dir+" not found";
else {
console.log("running rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules");
try {
exec('rm -rf package-lock.json yarn.lock dist elm-stuff bower_components node_modules', {
cwd: dir,
stdio: 'inherit'
});
} catch {}
console.log("running npm install && npm run build-prod");
exec('npm install && npm run build-prod', {
cwd: path.resolve(dir),
stdio: 'inherit'
});
}
}
exec('npm run index', {
stdio: 'inherit'
});
let frameworkNames = frameworks.join(" ");
function convertToPNG(iconName: string, iconPath: string) {
try {
const version = execSync('convert --version')
.toString()
.trim();
if (!version) {
console.warn('Cannot find ImageMagick');
return null;
}
const tmpFile = temp.openSync({ prefix: iconName, suffix: '.png' });
execSync(`convert ${iconPath} -transparent white ${tmpFile.path}`);
return tmpFile.path;
} catch (error) {
console.warn(error);
}
return null;
}
const execute = cmd => execSync(cmd, {stdio: "inherit"});
var filename;
if (platform === 'linux') {
filename = platforms[platform][arch];
} else {
filename = platforms[platform];
}
execSync('curl -L -O --fail https://github.com/theodi/csvlint.sh/releases/download/'+ csvlintVersion +'/' + filename);
if (platform == "win32") {
execSync('unzip ' + filename);
execSync('mv csvlint-'+ csvlintVersion +'-win32/ bin/');
execSync('rm csvlint-'+ csvlintVersion +'-win32.zip');
} else {
execSync('mkdir bin/');
execSync('tar -zxf '+ filename +' -C bin/ --strip=1');
execSync('rm csvlint-'+ csvlintVersion +'-*.tar.gz');
}
};
function checkout() {
log.info('Checkout and push a new branch for publishing...');
execSync(`git checkout -b publish-${nextVersion}`);
execSync('git add .');
execSync(`git commit -m "release(${nextVersion}): release ${nextVersion}"`);
execSync(`git push origin publish-${nextVersion}`);
log.success('Please go to GitHub and make a pull request.');
log.success('Bye!');
}
function generateTypeScriptDefinition(){
//generate the d.ts file
execSync(`./node_modules/.bin/jsdoc -c ${resolve(__dirname, "./.tsdoc.json")}`);
//append an export to the end
appendFileSync(resolve(__dirname, "../tone.d.ts"), "\nexport = Tone;");
}
function exec(command) {
execSync(command, {
stdio: [0, 1, 2]
});
}
var job = (str, options) => {
if (options == null) {
options = {
cwd: working_path
};
} else {
if (options.cwd == null) {
options.cwd = working_path;
}
}
var output = cp.execSync(str, options).toString();
return output;
};
var moment = require('moment');
var execSync = require('child_process').execSync;
var exec = require('child_process').exec;
var argv = require('yargs').argv;
var logFile = '/tmp/crashdump';
var lastCrashDescription = '/tmp/lastcrash';
var description = 'Unknown';
var fs = require('fs-extra');
if (process.argv[2] != undefined) {
description = "'" + process.argv[2] + "'";
}
var now = moment().format('YYYY-MM-DD HH:mm');
var sinceTime = moment().subtract(1, 'minutes').format('YYYY-MM-DD HH:mm');
var minuteDump = execSync('/usr/bin/sudo /bin/journalctl --since="' + sinceTime + '" > /tmp/crashdump', {uid: 1000, gid: 1000});
var releaseDump = execSync('cat /etc/os-release >> /tmp/crashdump', {uid: 1000, gid: 1000});
var variant = getVariant();
try {
var lastReport = fs.readJSONSync(lastCrashDescription, {uid: 1000, gid: 1000}).description;
} catch (e) {
var lastReport = 'last';
}
if (lastReport != description) {
sendCrashReport();
}
function sendCrashReport () {
var command = "/usr/bin/curl -X POST -H 'Content-Type: multipart/form-data'" +
" -F 'logFile=@" + logFile + "'" +