@crstn/neos-cli
Version:
CLI for the Neos CMS.
40 lines (39 loc) • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("@oclif/command");
const shelljs_1 = require("shelljs");
class Download extends command_1.Command {
async run() {
var _a, _b, _c;
const { args, flags } = this.parse(Download);
const projectName = (_a = args.project_name) !== null && _a !== void 0 ? _a : '.';
const neosPackageName = (_b = flags.neos_package_name) !== null && _b !== void 0 ? _b : '';
const composerPackageName = (_c = flags.composer_package_name) !== null && _c !== void 0 ? _c : '';
shelljs_1.exec(`git clone git@github.com:code-q-web-factory/Neos-Skeleton.git ${projectName}`);
if (projectName !== '.') {
shelljs_1.cd(`${projectName}`);
}
if (neosPackageName) {
shelljs_1.mv(`./DistributionPackages/CodeQ.Site`, `./DistributionPackages/${neosPackageName}`);
shelljs_1.exec(`find ./DistributionPackages/${neosPackageName} -type f | xargs sed -i '' "s/CodeQ\\.Site/${neosPackageName}/g"`);
}
if (composerPackageName) {
shelljs_1.exec(`find . -type f -name 'composer.json' | xargs sed -i '' "s/codeq\\/site/${composerPackageName}/g"`);
}
shelljs_1.rm(`-Rf`, `docs`);
shelljs_1.rm(`-rf`, `.git`);
shelljs_1.exec(`git init`);
shelljs_1.exec(`composer install`);
}
}
exports.default = Download;
Download.description = 'download boilerplate for new projects';
Download.examples = [
`$ neos download --neos_package_name="YourCompany.Site" --composer_package_name="yourcompany\\/site"`,
];
Download.flags = {
help: command_1.flags.help({ char: 'h' }),
neos_package_name: command_1.flags.string({ char: 'n', description: 'new site package name', env: 'NEOS_PACKAGE_NAME' }),
composer_package_name: command_1.flags.string({ char: 'c', description: 'new composer package name', env: 'COMPOSER_PACKAGE_NAME' }),
};
Download.args = [{ name: 'project_name' }];