Skip to content

Commit

Permalink
fix: cli version mismatch on publish (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc MacLeod authored Mar 28, 2019
1 parent d6e0f2d commit 44c4d5c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
20 changes: 17 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
"node": ">=8.3.0"
},
"scripts": {
"build": "sl-scripts build && oclif-dev manifest && node ./scripts/prepare-cli",
"build.binary": "yarn build && cp yarn.lock dist && cd dist && yarn && pkg . --out-path ./bin",
"build": "sl-scripts build && node ./scripts/prepare-cli",
"build.binary": "yarn build && yarn build.manifest && cp yarn.lock dist && cd dist && yarn && pkg . --out-path ./bin",
"build.docs": "sl-scripts build:typedoc",
"build.manifest": "cd dist && oclif-dev manifest",
"commit": "git-cz",
"lint": "tslint 'src/**/*.ts'",
"lint.fix": "yarn lint --fix",
Expand Down Expand Up @@ -72,6 +73,7 @@
"devDependencies": {
"@oclif/dev-cli": "^1",
"@oclif/test": "^1",
"@semantic-release/exec": "^3.3.2",
"@stoplight/scripts": "^5.1.0",
"@types/chalk": "^2.2.0",
"@types/jest": "24.0.x",
Expand Down Expand Up @@ -112,7 +114,19 @@
]
},
"release": {
"extends": "@stoplight/scripts/release"
"pkgRoot": "dist",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
"@semantic-release/github",
[
"@semantic-release/exec",
{
"prepareCmd": "yarn build.manifest"
}
]
]
},
"pkg": {
"scripts": [
Expand Down
9 changes: 3 additions & 6 deletions scripts/prepare-cli.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const { copySync, moveSync, readJSONSync, writeJSONSync } = require('fs-extra');
const { copySync, readJSONSync, writeFileSync } = require('fs-extra');
const { resolve } = require('path');

const cwd = process.cwd();

// copy bin directory over
copySync(resolve(cwd, 'bin'), resolve(cwd, 'dist', 'bin'));

// move generated manifest
moveSync(resolve(cwd, 'oclif.manifest.json'), resolve(cwd, 'dist', 'oclif.manifest.json'));

// update the dist package.json file with cli properties
const pkgPath = resolve(cwd, 'dist', 'package.json');
const pkg = readJSONSync(pkgPath);
Expand All @@ -24,7 +21,7 @@ pkg.oclif = {
};

// write it back
writeJSONSync(pkgPath, pkg);
writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));

// tslint-disable-next-line no-console
console.log("updated dist folder with cli related files and changes");
console.log('updated dist folder with cli related files and changes');
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,18 @@
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-2.2.0.tgz#ee9d5a09c9969eade1ec864776aeda5c5cddbbf0"
integrity sha512-9Tj/qn+y2j+sjCI3Jd+qseGtHjOAeg7dU2/lVcqIQ9TV3QDaDXDYXcoOHU+7o2Hwh8L8ymL4gfuO7KxDs3q2zg==

"@semantic-release/exec@^3.3.2":
version "3.3.2"
resolved "https://registry.yarnpkg.com/@semantic-release/exec/-/exec-3.3.2.tgz#33fb6001ddeaed4364975fa981bfd7306db7eabb"
integrity sha512-CzJnsTXYKY4LZ16WVEq/bt4OLzoiFf0DymCeMUZ5fthPHDbKprzky4+VIwaSDbRgLVEqRVeUD4gYVmlAeaWNCA==
dependencies:
"@semantic-release/error" "^2.1.0"
aggregate-error "^2.0.0"
debug "^4.0.0"
execa "^1.0.0"
lodash "^4.17.4"
parse-json "^4.0.0"

"@semantic-release/[email protected]":
version "7.0.8"
resolved "https://registry.yarnpkg.com/@semantic-release/git/-/git-7.0.8.tgz#b9e1af094a19d4e96974b90a969ad0e6782c8727"
Expand Down

0 comments on commit 44c4d5c

Please sign in to comment.