Skip to content

Commit

Permalink
Merge pull request #15 from qiwi/pr_to_upstream
Browse files Browse the repository at this point in the history
feat: run publish step in parallel
  • Loading branch information
dhoulb authored Jun 2, 2020
2 parents 561a8e6 + 0cd49ba commit 545781c
Show file tree
Hide file tree
Showing 27 changed files with 3,629 additions and 3,139 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017,
"ecmaVersion": 2019,
"experimentalObjectRestSpread": true
},
"extends": [
Expand Down
4 changes: 2 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"tabWidth": 4,
"useTabs": true,
"printWidth": 120,
"parser": "babylon",
"parser": "babel",
"proseWrap": "never"
}
}
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ language: node_js

branches:
only:
- master
- master

cache: yarn

jobs:
include:
- stage: test
node_js: "8"
- stage: test
node_js: "10"
- stage: release
Expand All @@ -18,4 +16,4 @@ jobs:
deploy:
provider: script
skip_cleanup: true
script: yarn run semantic-release
script: yarn run semantic-release
35 changes: 2 additions & 33 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,5 @@
#!/usr/bin/env node

// Execa hook.
if (process.argv.includes("--execasync")) {
require("../lib/execaHook").hook();
}
const runner = require("./runner");

// Imports.
const getWorkspacesYarn = require("../lib/getWorkspacesYarn");
const multiSemanticRelease = require("../lib/multiSemanticRelease");

// Get directory.
const cwd = process.cwd();

// Catch errors.
try {
// Get list of package.json paths according to Yarn workspaces.
const paths = getWorkspacesYarn(cwd);

// Do multirelease (log out any errors).
multiSemanticRelease(paths, {}, { cwd }).then(
() => {
// Success.
process.exit(0);
},
error => {
// Log out errors.
console.error(`[multi-semantic-release]:`, error);
process.exit(1);
}
);
} catch (error) {
// Log out errors.
console.error(`[multi-semantic-release]:`, error);
process.exit(1);
}
runner(process.argv);
37 changes: 37 additions & 0 deletions bin/runner.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = (argv) => {
// Imports.
const getWorkspacesYarn = require("../lib/getWorkspacesYarn");
const multiSemanticRelease = require("../lib/multiSemanticRelease");
const multisemrelPkgJson = require("../package.json");
const semrelPkgJson = require("semantic-release/package.json");

// Get directory.
const cwd = process.cwd();

// Catch errors.
try {
console.log(`multi-semantic-release version: ${multisemrelPkgJson.version}`);
console.log(`semantic-release version: ${semrelPkgJson.version}`);

// Get list of package.json paths according to Yarn workspaces.
const paths = getWorkspacesYarn(cwd);
console.log("yarn paths", paths);

// Do multirelease (log out any errors).
multiSemanticRelease(paths, {}, { cwd }).then(
() => {
// Success.
process.exit(0);
},
(error) => {
// Log out errors.
console.error(`[multi-semantic-release]:`, error);
process.exit(1);
}
);
} catch (error) {
// Log out errors.
console.error(`[multi-semantic-release]:`, error);
process.exit(1);
}
};
7 changes: 2 additions & 5 deletions lib/blork.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
const { existsSync, lstatSync } = require("fs");
const { checker, check, add, ValueError } = require("blork");
const { Signale } = require("signale");
const { Writable } = require("stream");
const { WritableStreamBuffer } = require("stream-buffers");

// Get some checkers.
const isAbsolute = checker("absolute");
const isObject = checker("object");
const isString = checker("string");

// Add a directory checker.
add(
"directory",
v => isAbsolute(v) && existsSync(v) && lstatSync(v).isDirectory(),
(v) => isAbsolute(v) && existsSync(v) && lstatSync(v).isDirectory(),
"directory that exists in the filesystem"
);

// Add a writable stream checker.
add(
"stream",
// istanbul ignore next (not important)
v => v instanceof Writable || v instanceof WritableStreamBuffer,
(v) => v instanceof Writable || v instanceof WritableStreamBuffer,
"instance of stream.Writable or WritableStreamBuffer"
);

Expand Down
2 changes: 1 addition & 1 deletion lib/cleanPath.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { normalize, isAbsolute, join } = require("path");
const { check } = require("blork");
const { check } = require("./blork");

/**
* Normalize and make a path absolute, optionally using a custom CWD.
Expand Down
Loading

0 comments on commit 545781c

Please sign in to comment.