Skip to content

Commit

Permalink
Merge pull request #55 from spiltcoffee/semantic-release
Browse files Browse the repository at this point in the history
fix: fixed semantic-release

... hopefully
  • Loading branch information
spiltcoffee authored Mar 10, 2019
2 parents 7647db8 + 74131e8 commit 05ca5c3
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 172 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@ test-results

# nearley.js
packages/@postdfm/dfm2ast/src/grammar.ts

#local npm configuration
.npmrc
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"version": "1.0.0",
"independent": true,
"version": "independent",
"packages": ["packages/*"]
}
27 changes: 15 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"description": "Provides an API for easily transforming Delphi Forms",
"scripts": {
"list": "lerna ls --json",
"bootstrap": "lerna bootstrap --force-local",
"eslint": "eslint --ignore-path .gitignore \"**/*.js\"",
"tslint": "tslint \"**/*.ts\"",
Expand All @@ -16,11 +17,15 @@
"format:check": "yarn prettier --check",
"compile": "lerna run compile",
"test": "jest --coverage",
"release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\${version}' --repositoryUrl ssh://git@github.com/spiltcoffee/postdfm.git"
"release": "semantic-release"
},
"devDependencies": {
"@commitlint/config-conventional": "^7.5.0",
"@commitlint/config-lerna-scopes": "^7.5.1",
"@semantic-release/commit-analyzer": "^6.1.0",
"@semantic-release/git": "^7.0.8",
"@semantic-release/npm": "^5.1.4",
"@semantic-release/release-notes-generator": "^7.1.4",
"@types/jest": "^24.0.11",
"@types/nearley": "^2.11.0",
"@types/node": "^11.11.0",
Expand All @@ -30,33 +35,28 @@
"eslint-config-prettier": "^4.1.0",
"eslint-plugin-jest": "^22.3.0",
"eslint-plugin-node": "^8.0.1",
"execa": "^1.0.0",
"husky": "^1.3.1",
"jest": "^24.0.0",
"jest-junit": "^6.3.0",
"lerna": "^3.13.1",
"lint-staged": "^8.1.5",
"nearley": "^2.16.0",
"prettier": "^1.16.4",
"semantic-release": "~15.9.0",
"semantic-release-monorepo": "^6.1.1",
"read-pkg": "^5.0.0",
"semantic-release": "^15.13.3",
"ts-jest": "^24.0.0",
"tslint": "^5.13.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.3.3333"
},
"greenkeeper": {
"ignore": [
"semantic-release"
]
},
"release": {
"branch": "master"
"typescript": "^3.3.3333",
"write-pkg": "^3.2.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-lerna-changelog"
}
},
"files": [],
"lint-staged": {
"*.{json,yml,md}": [
"prettier --ignore-path .gitignore --write",
Expand All @@ -78,5 +78,8 @@
"pre-commit": "lint-staged && yarn test",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"engines": {
"node": ">=7.6.0"
}
}
1 change: 1 addition & 0 deletions packages/postdfm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "postdfm",
"version": "1.0.0",
"private": true,
"description": "Provides an API for easily transforming Delphi Forms",
"main": "index.js",
"keywords": [
Expand Down
38 changes: 38 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const path = require("path");
const execa = require("execa");

const pkgs = JSON.parse(execa.shellSync("yarn run -s list").stdout);

const tarballDir = path.resolve(__dirname, "dist");

module.exports = {
branch: "master",
repositoryUrl: "ssh://git@github.com/spiltcoffee/postdfm.git",
plugins: [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"./release/dependency",
{ pkgs: pkgs.map(({ name, location }) => ({ name, location })) }
],
...pkgs.map(({ location: pkgRoot }) => [
"@semantic-release/npm",
{
pkgRoot,
tarballDir
}
]),
[
"@semantic-release/github",
{
assets: [
{
path: path.resolve(tarballDir, "*.tgz"),
label: "Deployed Tarballs"
}
]
}
],
"@semantic-release/git"
]
};
27 changes: 27 additions & 0 deletions release/dependency.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const readPkg = require("read-pkg");
const writePkg = require("write-pkg");

async function prepare(pluginConfig, context) {
for (const pkg of pluginConfig.pkgs) {
const pkgJson = await readPkg({ cwd: pkg.location, normalize: false });

if (pkgJson.dependencies) {
pkgJson.dependencies = Object.entries(pkgJson.dependencies).reduce(
(dependencies, [depName, depVersion]) => {
dependencies[depName] = pluginConfig.pkgs.some(
({ name }) => name === depName
)
? `^${context.nextRelease.version}`
: depVersion;

return dependencies;
},
{}
);
}

await writePkg(pkg.location, pkgJson, { normalize: false });
}
}

module.exports = { prepare };
Loading

0 comments on commit 05ca5c3

Please sign in to comment.