Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const stackName = getStackName(stackPath!);
const generator = await getPlopGenerator(stackPath!, paths.projectPath, stackName);
logger.info(`Running "${stackName}" code generation actions inside: ${paths.projectPath}`);
await runGenerator(generator, argv);
logger.info(`Initializing the repo in ${paths.projectPath}`);
pkg.install(argv.registry, paths.projectPath);
try {
execSync('git init', { cwd: paths.projectPath });
execSync('git add .', { cwd: paths.projectPath });
execSync('git commit -m "initial commit"', { cwd: paths.projectPath });
} catch (e) {
logger.warn('Looks like you may not have git installed or there was some sort of error initializing the git repo');
logger.info(`
Please make sure you have git installed and then issue the following:
cd ${paths.projectPath}
git init
git add .
git commit -m "initial commit"
`);
process.exit(1);
}
logger.info('All Set!');
});
argv.stack = stack;
}
let name = '';
if (!argv.name && !checkEmptyRepo(paths.projectPath)) {
const response = await prompts({
type: 'text',
name: 'name',
message: 'What is the name of the repo to create?',
validate: name => (!name ? false : true)
});
name = response.name;
paths.projectPath = path.join(paths.projectPath, name);
} else if (!argv.name) {
name = path.basename(paths.projectPath);
} else {
name = argv.name;
paths.projectPath = path.join(paths.projectPath, name);
}
argv.name = name;
const stackPath = await getStackPath(argv.stack, argv.registry);
logger.info(`Installing stack dependencies in ${stackPath}`);
pkg.ensureNpmrcIfRequired(argv.registry, stackPath!);
pkg.install(argv.registry, stackPath!);
const stackName = getStackName(stackPath!);
const generator = await getPlopGenerator(stackPath!, paths.projectPath, stackName);
const nextStepsMd = existsSync(postInitPath)
? readFileSync(postInitPath, 'utf-8').toString()
: `
You have successfully created a new repo based on the '${argv.stack}' template!
## Keeping Up-to-date
You can keep your build tools up-to-date by updating these two devDependencies:
* ${stackName}
* just-scripts
## Next Steps
To start developing code, you can start the innerloop dev server:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm'} start
You can build your project in production mode with these commands:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm run'} build
${existsSync(path.join(paths.projectPath, 'plopfile.js')) &&
`
This repository contains code generators that can be triggered by:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm run'} gen
`}`;
* ${stackName}
* just-scripts
## Next Steps
To start developing code, you can start the innerloop dev server:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm'} start
You can build your project in production mode with these commands:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm run'} build
${existsSync(path.join(paths.projectPath, 'plopfile.js')) &&
`
This repository contains code generators that can be triggered by:
cd ${paths.projectPath}
${pkg.getYarn() ? 'yarn' : 'npm run'} gen
`}`;
logger.info(prettyPrintMarkdown(nextStepsMd));
}
const { stack } = await prompts({
type: 'select',
name: 'stack',
message: 'What type of repo to create?',
choices: [
{ title: 'React App', value: 'just-stack-react' },
{ title: 'UI Fabric (React)', value: 'just-stack-uifabric' },
{ title: 'Basic TypeScript', value: 'just-stack-single-lib' },
...(pkg.getYarn() ? [{ title: 'Monorepo', value: 'just-stack-monorepo' }] : [])
]
});
argv.stack = stack;
}
let name = '';
if (!argv.name && !checkEmptyRepo(paths.projectPath)) {
const response = await prompts({
type: 'text',
name: 'name',
message: 'What is the name of the repo to create?',
validate: name => (!name ? false : true)
});
name = response.name;
paths.projectPath = path.join(paths.projectPath, name);
} else if (!argv.name) {
name = path.basename(paths.projectPath);
} else {
name = argv.name;
paths.projectPath = path.join(paths.projectPath, name);
}
argv.name = name;