UNPKG

npm-submodules

Version:

Simple way to manage typescipt and angular2 submodules from one repository

68 lines (67 loc) 2.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // import { TsmOptions } from '../types'; const utils_1 = require("../utils"); const tasks_1 = require("../tasks"); const link_command_1 = require("./link.command"); /** * Heavily inspired by https://github.com/sindresorhus/np * */ const execa = require('execa'); const Listr = require("listr"); function run(cli, { buildCommand }) { const { project, verbose, tag, access, anyBranch, skipCleanup, skipGitCheck, yarn, yolo, skipPublish } = cli.flags; return utils_1.findSubmodules(project) .then((opts) => { const tasks = new Listr([ { title: 'Git checks', task: () => tasks_1.prepublishGitCheck({ anyBranch }), skip: () => skipGitCheck || yolo }, // test command { title: 'Installing dependencies', task: () => new Listr(tasks_1.npmInstall({ skipCleanup, yarn })), skip: () => yolo }, { title: 'Running unit tests tests', task: () => execa('npm', ['test']), skip: () => yolo }, // e2e command { title: 'Build submodules for e2e', task: () => buildCommand({ project, verbose, clean: true, local: true }), skip: () => yolo }, { title: 'Link submodules', task: () => link_command_1.npmLinkCommand({ project, local: true, deep: true, verbose, yarn, here: true }), skip: () => yolo }, // publish // set numeric package version before publish { title: 'Build submodules for publish', task: () => buildCommand({ project, verbose, clean: true, local: false }) }, { title: 'Publish all submodules', task: () => new Listr(opts.map(opt => ({ title: `npm publish (${opt.pkg.name}) (from: ${opt.dist})`, task: () => tasks_1.npmPublish({ yarn, cwd: opt.dist, tag, access }) }))), skip: () => skipPublish }, { title: 'Pushing tags', task: () => execa('git', ['push', '--follow-tags']), skip: () => true } ], { renderer: verbose ? 'verbose' : 'default' }); return tasks.run(); }); } exports.run = run;