diff --git a/.nvmrc b/.nvmrc index 29ef05d..209e3ef 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.12 +20 diff --git a/package-lock.json b/package-lock.json index 57aad56..df4e837 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "ajv": "^7.2.4", "ajv-formats": "^2.1.1", "chalk": "^4.1.0", - "commander": "^7.0.0", + "commander": "^12.0.0", "consola": "^2.15.3", "fs-extra": "^10.0.0", "progress": "^2.0.3", @@ -29,7 +29,6 @@ "@semantic-release/github": "^8.0.2", "@semantic-release/npm": "^8.0.3", "@types/chalk": "^2.2.0", - "@types/commander": "^2.12.2", "@types/fs-extra": "^9.0.8", "@types/jest": "^26.0.20", "@types/node": "^14.14.25", @@ -1838,16 +1837,6 @@ "chalk": "*" } }, - "node_modules/@types/commander": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", - "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", - "deprecated": "This is a stub types definition for commander (https://github.com/tj/commander.js). commander provides its own type definitions, so you don't need @types/commander installed!", - "dev": true, - "dependencies": { - "commander": "*" - } - }, "node_modules/@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -3413,11 +3402,11 @@ } }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", + "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", "engines": { - "node": ">= 10" + "node": ">=18" } }, "node_modules/compare-func": { @@ -16328,15 +16317,6 @@ "chalk": "*" } }, - "@types/commander": { - "version": "2.12.2", - "resolved": "https://registry.npmjs.org/@types/commander/-/commander-2.12.2.tgz", - "integrity": "sha512-0QEFiR8ljcHp9bAbWxecjVRuAMr16ivPiGOw6KFQBVrVd0RQIcM3xKdRisH2EDWgVWujiYtHwhSkSUoAAGzH7Q==", - "dev": true, - "requires": { - "commander": "*" - } - }, "@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -17532,9 +17512,9 @@ } }, "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", + "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==" }, "compare-func": { "version": "2.0.0", diff --git a/package.json b/package.json index a0ebf77..47425f4 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,6 @@ "@semantic-release/github": "^8.0.2", "@semantic-release/npm": "^8.0.3", "@types/chalk": "^2.2.0", - "@types/commander": "^2.12.2", "@types/fs-extra": "^9.0.8", "@types/jest": "^26.0.20", "@types/node": "^14.14.25", @@ -69,7 +68,7 @@ "ajv": "^7.2.4", "ajv-formats": "^2.1.1", "chalk": "^4.1.0", - "commander": "^7.0.0", + "commander": "^12.0.0", "consola": "^2.15.3", "fs-extra": "^10.0.0", "progress": "^2.0.3", diff --git a/src/index.ts b/src/index.ts index 89a3c21..aa3a750 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,16 @@ import componentInstall from './handlers/componentInstall'; // Main program commands. program - .command('init [path]') + .enablePositionalOptions() + .option( + '-c --checkout ', + 'Commit, branch or tag of the base repository that should be checked out' + ); + +program + .command('init [path]', 'Initialize an Emulsify project', { + isDefault: true, + }) .option( '-m --machineName ', 'Machine-friendly name of the project you are initializing. If not provided, this will be automatically generated.' @@ -26,27 +35,25 @@ program '-p --platform ', 'Name of the platform Emulsify is being within. In some cases, Emulsify is able to automatically detect this. If it is not, Emulsify will prompt you to specify.' ) - .description('Initialize an Emulsify project', { - name: 'Name of the Emulsify project you are initializing. This should be a proper name, such as "Carmen Sandiego".', - path: 'Path to the folder in which you would like to to create your Emulsify project. For example, "./themes" will result in the Emulsify project being placed in ./themes/{name}', - }) .action(withProgressBar(init)); // System sub-commands. -const system = program - .command('system') - .description( - 'Parent command that contains sub-commands pertaining to systems' - ); +const system = program.command( + 'system', + 'Parent command that contains sub-commands pertaining to systems' +); system - .command('list') - .alias('ls') - .description( + .command( + 'list', 'Lists all of the available systems that Emulsify supports out-of-the-box' ) + .alias('ls') .action(systemList); system - .command('install [name]') + .command( + 'install [name]', + 'Install a system within an Emulsify project. You must specify either the name of an out-of-the-box system (such as compound), or a link to a git repository containing the system you want to install' + ) .option( '-r --repository ', 'Git repository containing the system you would like to install' @@ -59,29 +66,25 @@ system '-a --all', 'Use this to install all available components within the specified system. Without this flag, only the required system components will be installed.' ) - .description( - 'Install a system within an Emulsify project. You must specify either the name of an out-of-the-box system (such as compound), or a link to a git repository containing the system you want to install', - { - name: 'Name of the out-of-the-box system you would like to install', - } - ) .action(systemInstall); // Component sub-commands. -const component = program - .command('component') - .description( - 'Parent command that contains sub-commands pertaining to components' - ); +const component = program.command( + 'component', + 'Parent command that contains sub-commands pertaining to components' +); component - .command('list') - .alias('ls') - .description( + .command( + 'list', 'Lists all of the components that are available for installation within your project based on the system and variant you selected' ) + .alias('ls') .action(componentList); component - .command('install [name]') + .command( + 'install [name]', + "Install a component from within the current project's system and variant" + ) .option( '-f --force', 'Use this to overwrite a component that is already installed' @@ -91,9 +94,6 @@ component 'Use this to install all available components, rather than specifying a single component to install' ) .alias('i') - .description( - "Install a component from within the current project's system and variant" - ) .action(componentInstall); void program.parseAsync(process.argv);