Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
destination: destinationDirectory,
});
}
// pretty shitty but have to put this last because it has a meaningful deploy script
if (isSemanticRelease) {
await writeSemanticReleaseTemplates({
templateValues,
destination: destinationDirectory,
});
}
const packageJSONLocation = `${destinationDirectory}/package.json`;
const packageJSON = fse.readJsonSync(packageJSONLocation, 'utf8');
normalizePackageData(packageJSON);
fse.writeJsonSync(packageJSONLocation, sortPackageJSON(packageJSON), 'utf8');
console.log(chalk.bold.cyanBright('⌛ 🤞 Installing packages'));
await spawn('npm', ['install'], { cwd: destinationDirectory, stdio: 'inherit' });
await spawn('git', ['init'], { cwd: destinationDirectory, stdio: 'inherit' });
console.log(chalk.bold.magentaBright('🥝 🍋 🍐 🍓 🍊 🍍 🍰 Installation complete! 🍒 🍈 🍇 🍉 🍏 🍎 🍌'));
console.log();
console.log(`🎭 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('jest')} ${chalk.bold.magentaBright('tests')}: ${chalk.bold.cyanBright('npm run test')} `);
console.log(`🏗️ ${chalk.bold.magentaBright('Build')} ${chalk.bold.blueBright('rollup.js')} ${chalk.bold.magentaBright('library')}: ${chalk.bold.cyanBright('npm run build')}`);
console.log(`👕 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('eslint')}: ${chalk.bold.cyanBright('npm run lint')}`);
if (isReact) {
console.log(`📖 ${chalk.bold.magentaBright('Run')} ${chalk.bold.blueBright('Storybook')}: ${chalk.bold.cyanBright('npm run storybook')}`);
}
constructor(pkgJsonPath: string | Object) {
if (typeof pkgJsonPath === "string") {
this.pkgJsonPath = pkgJsonPath;
// $FlowFixMe(dynamic-require)
this.pkgJson = require(pkgJsonPath);
} else {
this.pkgJsonPath = "";
this.pkgJson = pkgJsonPath;
}
this.pkgJsonNormalized = JSON.parse(JSON.stringify(this.pkgJson)); // Deep clone
normalize(this.pkgJsonNormalized);
}
const readPkgSync = (dir: string): PkgJson => {
const pkgJsonPath = join(dir, "package.json");
const data = readFileSync(pkgJsonPath, "utf-8");
const pkgJson: PkgJson = JSON.parse(data);
normalize(pkgJson);
return pkgJson;
};