UNPKG

npm-pkg-kit

Version:

CLI tool to simplify NPM package creation by generating boilerplate setup

26 lines (25 loc) 950 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const shelljs_1 = require("shelljs"); const files_1 = require("../../utils/files"); const tsconfig_1 = __importDefault(require("../tpl/cli/tsconfig")); function default_1(dir) { const pack = files_1.readJSON(dir, 'package.json'); const install = [ `cd ${dir} &&`, 'npm i -D', 'typescript', '@types/node', ].join(' '); pack.scripts.lint = 'run-s lint:*'; pack.scripts['lint:tsc'] = 'tsc --noEmit'; pack.scripts['lint:prettier'] = "prettier --config .prettierrc.json --write 'src/**/*.ts'"; files_1.writeJSON(dir, 'tsconfig.json', tsconfig_1.default, 2); files_1.writeJSON(dir, 'package.json', pack, 2); shelljs_1.exec(install); } exports.default = default_1;