Socket
Socket
Sign inDemoInstall

@pie-framework/build-helper

Package Overview
Dependencies
Maintainers
2
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pie-framework/build-helper - npm Package Compare versions

Comparing version 1.4.0 to 2.0.0

lib/changelog.d.ts

23

lib/commands.d.ts

@@ -9,12 +9,15 @@ /// <reference types="node" />

bin(n: any): any;
staticToNow(dir: string, alias?: string): void;
runCmd(cmd: any, opts?: any): Buffer | string | undefined;
runCmds(cmds: string[], opts?: any): (Buffer | string | undefined)[];
isGitTreeClean(): boolean;
release(): void;
build(): void;
clean(): void;
lint(): void;
babel(): void;
test(): void;
staticToNow(dir: string, alias?: string): Promise<any>;
runCmd(cmd: any, opts?: any): Promise<Buffer | string | undefined>;
runCmds(cmds: string[], opts?: any): Promise<(Buffer | string | undefined)[]>;
isGitTreeClean(): Promise<boolean>;
beforePublish(): Promise<any>;
afterPublish(): Promise<any>;
release(): Promise<void>;
build(): Promise<void>;
clean(): Promise<(string | Buffer)[]>;
lint(): Promise<(string | Buffer)[]>;
babel(): Promise<(string | Buffer)[]>;
test(): Promise<(string | Buffer)[]>;
execute(): any;
}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const deploy_to_now_1 = require("./deploy-to-now");
const { execSync } = require('child_process');
const exec_1 = require("./exec");
const changelog_1 = require("./changelog");
const { resolve } = require('path');

@@ -31,3 +40,3 @@ const debug = require('debug');

const token = process.env.NOW_TOKEN;
deploy_to_now_1.deployToNow(dir, token, alias, this.p.now, this.dryRun);
return deploy_to_now_1.deployToNow(dir, token, alias, this.p.now, this.dryRun);
}

@@ -37,52 +46,84 @@ runCmd(cmd, opts = {}) {

if (this.dryRun) {
return undefined;
return Promise.resolve(undefined);
}
return execSync(cmd, Object.assign({ stdio: 'inherit' }, opts));
return exec_1.execPromise(cmd, Object.assign({ stdio: 'inherit' }, opts));
}
runCmds(cmds, opts = {}) {
return cmds.map(c => this.runCmd(c, opts));
return Promise.all(cmds.map(c => this.runCmd(c, opts)));
}
isGitTreeClean() {
log('[isGitTreeClean]');
const d = this.runCmd('git diff');
if (this.dryRun || !d) {
return true;
return __awaiter(this, void 0, void 0, function* () {
log('[isGitTreeClean]');
const d = yield this.runCmd('git diff');
if (this.dryRun || !d) {
return true;
}
return d && d.toString && d.toString() === '';
});
}
beforePublish() {
if (this.args.next) {
const dir = resolve(this.projectRoot, 'packages');
log('[beforePublish] dir:', dir);
return changelog_1.buildNextChangelogs(dir);
}
return d && d.toString && d.toString() === '';
else {
return Promise.resolve(undefined);
}
}
afterPublish() {
if (this.args.next) {
const dir = resolve(this.projectRoot, 'packages');
log('[afterPublish] dir:', dir);
return changelog_1.rmNextChangelogs(dir);
}
return Promise.resolve(undefined);
}
release() {
cmdLog('----> release');
const { TRAVIS, TRAVIS_BRANCH, GITHUB_TOKEN, TRAVIS_REPO_SLUG } = process.env;
if (TRAVIS) {
invariant(TRAVIS_BRANCH, 'TRAVIS_BRANCH env var must be defined');
invariant(GITHUB_TOKEN, 'GITHUB_TOKEN env var must be defined');
invariant(TRAVIS_REPO_SLUG, 'TRAVIS_REPO_SLUG env var must be defined');
log('-----> running in TRAVIS - checkout the branch (detached head doesnt work with lerna)');
this.runCmds([
`git remote set-url origin https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git`,
`git checkout ${TRAVIS_BRANCH}`,
'git rev-parse --short HEAD'
]);
if (!this.isGitTreeClean()) {
this.runCmds([
`git commit . -m "[travis skip] commit post install tree"`
return __awaiter(this, void 0, void 0, function* () {
cmdLog('----> release');
const { TRAVIS, TRAVIS_BRANCH, GITHUB_TOKEN, TRAVIS_REPO_SLUG } = process.env;
if (TRAVIS) {
invariant(TRAVIS_BRANCH, 'TRAVIS_BRANCH env var must be defined');
invariant(GITHUB_TOKEN, 'GITHUB_TOKEN env var must be defined');
invariant(TRAVIS_REPO_SLUG, 'TRAVIS_REPO_SLUG env var must be defined');
log('-----> running in TRAVIS - checkout the branch (detached head doesnt work with lerna)');
yield this.runCmds([
`git remote set-url origin https://${GITHUB_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git`,
`git checkout ${TRAVIS_BRANCH}`,
'git rev-parse --short HEAD'
]);
if (!(yield this.isGitTreeClean())) {
yield this.runCmds([
`git commit . -m "[travis skip] commit post install tree"`
]);
}
yield this.runCmds([`git status`]);
}
this.runCmds([`git status`]);
}
this.build();
const releaseCmd = `${this.p.lerna} publish --conventional-commits --yes ${this.args.next ? '--canary --preid next --dist-tag next' : ''}`;
this.runCmds([releaseCmd]);
yield this.build();
if (!this.args.skipPublishHooks) {
yield this.beforePublish();
}
const releaseCmd = `${this.p.lerna} publish --conventional-commits ${this.args.interactive ? '' : '--yes'} ${this.args.next
? '--canary --preid next --dist-tag next --include-merged-tags'
: ''}`;
yield this.runCmds([releaseCmd]);
if (!this.args.skipPublishHooks) {
yield this.afterPublish();
}
});
}
build() {
this.clean();
this.lint();
this.babel();
this.test();
return __awaiter(this, void 0, void 0, function* () {
yield this.clean();
yield this.lint();
yield this.babel();
yield this.test();
});
}
clean() {
this.runCmds([`${this.p.lerna} exec -- rm -fr lib`]);
return this.runCmds([`${this.p.lerna} exec -- rm -fr lib`]);
}
lint() {
this.runCmds([
return this.runCmds([
`${this.p.lerna} exec -- ${this.p.eslint} --ignore-path ${this.p.eslintignore} --ext .js --ext .jsx src`

@@ -93,3 +134,3 @@ ]);

console.log('>> babel override for babel 7');
this.runCmds([
return this.runCmds([
`${this.p.lerna} exec -- ${this.p.babel} --ignore '**/__test__/**','**/__tests__/**' src -d lib --copy-files --source-maps --root-mode upward`

@@ -99,6 +140,18 @@ ]);

test() {
this.runCmds([`${this.p.jest}`]);
return this.runCmds([`${this.p.jest}`]);
}
execute() {
const knownActions = this.args._.filter(a => this[a]);
if (knownActions.length !== this.args._.length) {
return Promise.reject(new Error(`unknown actions: ${this.args._}`));
}
return knownActions.reduce((acc, action) => {
return acc.then(() => {
log(`execute ${action}..`);
return this[action]();
});
}, Promise.resolve({}));
}
}
exports.Commands = Commands;
//# sourceMappingURL=commands.js.map

@@ -1,1 +0,1 @@

export declare const deployToNow: (dir: any, token: any, alias?: string, nowPath?: string, dryRun?: boolean) => string;
export declare const deployToNow: (dir: any, token: any, alias?: string, nowPath?: string, dryRun?: boolean) => Promise<string>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
const debug_1 = require("debug");
const exec_1 = require("./exec");
const log = debug_1.default('build-helper:deploy-to-now');
const runCmd = (c, dryRun, opts = {}) => {
const runCmd = (c, dryRun, opts = {}) => __awaiter(this, void 0, void 0, function* () {
log(c);

@@ -11,3 +19,3 @@ if (dryRun) {

}
const result = child_process_1.execSync(c, opts);
const result = yield exec_1.execPromise(c, opts);
log(c, 'result:', result);

@@ -20,6 +28,6 @@ if (result) {

}
};
exports.deployToNow = (dir, token, alias, nowPath = 'now', dryRun = false) => {
});
exports.deployToNow = (dir, token, alias, nowPath = 'now', dryRun = false) => __awaiter(this, void 0, void 0, function* () {
const deployCmd = `${nowPath} ${dir} ${token ? `--token=${token}` : ''} --public`;
const url = runCmd(deployCmd, dryRun);
const url = yield runCmd(deployCmd, dryRun);
log('url: ', url);

@@ -31,6 +39,6 @@ if (!url) {

const aliasCmd = `${nowPath} alias ${url} ${alias} ${token ? `--token=${token}` : ''}`;
const result = runCmd(aliasCmd, dryRun || !url, { stdio: 'inherit' });
const result = yield runCmd(aliasCmd, dryRun || !url, { stdio: 'inherit' });
return result;
}
};
});
//# sourceMappingURL=deploy-to-now.js.map
import { processFix } from './process-fix';
import { watch } from './babel-multiple';
export { getUnreleasedChangelog, getPackages, rmNextChangelogs, buildNextChangelogs } from './changelog';
export { deployToNow } from './deploy-to-now';
export { processFix, watch };
export { Commands } from './commands';

@@ -7,2 +7,7 @@ "use strict";

exports.watch = babel_multiple_1.watch;
var changelog_1 = require("./changelog");
exports.getUnreleasedChangelog = changelog_1.getUnreleasedChangelog;
exports.getPackages = changelog_1.getPackages;
exports.rmNextChangelogs = changelog_1.rmNextChangelogs;
exports.buildNextChangelogs = changelog_1.buildNextChangelogs;
var deploy_to_now_1 = require("./deploy-to-now");

@@ -9,0 +14,0 @@ exports.deployToNow = deploy_to_now_1.deployToNow;

{
"name": "@pie-framework/build-helper",
"version": "1.4.0",
"version": "2.0.0",
"description": "",

@@ -14,3 +14,5 @@ "main": "lib/index.js",

"dependencies": {
"debug": "^4.1.1"
"debug": "^4.1.1",
"fs-extra": "^7.0.1",
"conventional-changelog-core": "^3.1.6"
},

@@ -17,0 +19,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc