UNPKG

waka-pm

Version:

a pnpm supplement for enforcing consistent versions across all workspaces

124 lines 3.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cmd_ts_1 = require("cmd-ts"); const file_1 = require("./file"); const subcmd_1 = require("./subcmd"); const eject_1 = require("./subcmd/eject"); const rootDir = (0, file_1.identifyRootDir)(); const scriptCmd = 'waka-pm'; const configPath = (0, cmd_ts_1.option)({ description: 'path to waka config file', long: 'config', short: 'c', type: cmd_ts_1.string, defaultValue: () => '', }); const initCmd = (0, cmd_ts_1.command)({ name: 'init', description: 'Initialize waka yaml files within the monorepo', args: {}, handler: async () => { await (0, subcmd_1.initFn)(rootDir); }, }); const importCmd = (0, cmd_ts_1.command)({ name: 'import', description: 'Import dependencies from package.json into waka.yaml files', args: { registerAll: (0, cmd_ts_1.flag)({ description: 'register all dependencies in root registry', short: 'r', long: 'register-all', }), acceptLatest: (0, cmd_ts_1.flag)({ description: 'for all dependencies of the same name but different versions in the monorepo, assign to the latest defined version', short: 'l', long: 'accept-latest', }), }, handler: async (args) => { await (0, subcmd_1.importFn)(rootDir, args); }, }); const applyCmd = (0, cmd_ts_1.command)({ name: 'apply', description: 'Apply waka.yaml files to package.json files', args: { configPath, noSkipCI: (0, cmd_ts_1.flag)({ description: 'do not skip applying waka changes when the CI environment variable is set to true', long: 'no-skip-ci', }), }, handler: async (args) => { await (0, subcmd_1.applyFn)(rootDir, args); }, }); const installCmd = (0, cmd_ts_1.command)({ name: 'install', description: 'install new dependencies and update waka.yaml files', args: { packageName: (0, cmd_ts_1.positional)({ description: 'package to install', displayName: 'package', }), configPath, workspace: (0, cmd_ts_1.option)({ description: 'workspace to install to', long: 'workspace', short: 'w', type: cmd_ts_1.string, defaultValue: () => '', }), saveDev: (0, cmd_ts_1.flag)({ description: 'save as dev dependency', long: 'save-dev', short: 'D', }), savePeer: (0, cmd_ts_1.flag)({ description: 'save as dev dependency', long: 'save-peer', short: 'P', }), saveOpt: (0, cmd_ts_1.flag)({ description: 'save as dev dependency', long: 'save-opt', short: 'O', }), noRegister: (0, cmd_ts_1.flag)({ description: 'do not register dependency in root registry', long: 'no-register', short: 'N', }), }, handler: async (args) => { await (0, subcmd_1.installFn)(rootDir, args); }, }); const ejectCmd = (0, cmd_ts_1.command)({ name: 'eject', description: 'eject waka from the project, remove all waka configuration', args: { confirm: (0, cmd_ts_1.flag)({ description: 'confirm the file removal', long: 'confirm', short: 'c', }), }, handler: async (args) => { await (0, eject_1.ejectFn)(rootDir, args); }, }); const app = (0, cmd_ts_1.subcommands)({ name: scriptCmd, cmds: { init: initCmd, import: importCmd, apply: applyCmd, install: installCmd, eject: ejectCmd, }, }); // eslint-disable-next-line @typescript-eslint/no-floating-promises (0, cmd_ts_1.run)(app, process.argv.slice(2)); //# sourceMappingURL=waka-cli.js.map