Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config,
);
// Get src directory from template URL if provided
let srcPath = templateJsPath;
if (config.typescript) {
srcPath = templateTsPath;
}
if (config.template) {
dirObject = tmpDirSync();
await downloadFromGitHub(config.template, dirObject.name);
srcPath = dirObject.name;
}
// This copies the src/ directory
await copyTemplateDir(
srcPath,
config.targetDirectory,
config,
);
// Rename plugins
if (!dirObject) {
const ext = config.typescript ? 'tsx' : 'js';
fs.renameSync(
join(config.targetDirectory, `src/DemoPlugin.${ext}`),
join(config.targetDirectory, `src/${config.pluginClassName}.${ext}`),
);
}
return true;
const promise = progress('Creating project directory', async () => {
// This copies the core such as public/ and craco config.
await copyTemplateDir(
templateCorePath,
config.targetDirectory,
config,
);
// Get src directory from template URL if provided
let srcPath = templateJsPath;
if (config.typescript) {
srcPath = templateTsPath;
}
if (config.template) {
dirObject = tmpDirSync();
await downloadFromGitHub(config.template, dirObject.name);
srcPath = dirObject.name;
}