@craftnotion/init-project
Version:
A CLI tool to initialize a new project with AdonisJS, NextJS, NestJS, React Native, Strapi, TypeScript, Husky, Git-CZ and more.
84 lines (83 loc) • 2.93 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const inquirer_1 = __importDefault(require("inquirer"));
const base_1 = require("../base");
class Angular extends base_1.Base {
static supportedPackageManagers = ['npm', 'yarn', 'pnpm'];
node = '18.19.1';
constructor(data) {
let { projectName, packageManager } = data;
super(`npx -p @angular/cli ng new ${projectName} --package-manager=${packageManager}`);
}
async handle() {
// Project options
const projectOptions = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'routing',
message: 'Include routing?',
},
{
type: 'list',
name: 's',
message: 'Styles:',
choices: [
{ name: 'inline', value: true },
{ name: 'separate', value: false },
],
},
{
type: 'list',
name: 't',
message: 'Template:',
choices: [
{ name: 'inline', value: true },
{ name: 'separate', value: false },
],
},
{
type: 'input',
name: 'prefix',
message: 'Selector prefix (optional)',
},
{
type: 'list',
name: 'type',
message: 'Type of application required ?',
choices: ['standalone', 'strict', 'minimal'],
},
{
type: 'list',
name: 'style',
message: 'Which stylesheet format would you like to use? ',
choices: ['css', 'scss', 'sass', 'less'],
default: 'css',
},
]);
let type = projectOptions.type;
delete projectOptions.type;
this.updateCommand('alias', 'skip-git');
this.updateCommand('alias', { [type]: true });
this.updateCommand('alias', projectOptions);
const otherOptions = await inquirer_1.default.prompt([
{
type: 'confirm',
name: 'skip-tests',
message: 'Include unit testing (Karma/Jasmine)?',
when: type !== 'minimal',
},
{
type: 'confirm',
name: 'ssr',
message: 'Creates an application with Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering) enabled',
default: false,
},
]);
this.updateCommand('alias', otherOptions);
await this.scaffold();
}
}
exports.default = Angular;