Skip to content

Commit

Permalink
Release :: Beech Anhinga (#32)
Browse files Browse the repository at this point in the history
Release :: Beech Anhinga
  • Loading branch information
edlb authored Jan 7, 2019
2 parents cd4ebf0 + 260d10b commit cedf87e
Show file tree
Hide file tree
Showing 65 changed files with 3,001 additions and 2,734 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"object-curly-newline": [2, { "consistent": true }],
"object-shorthand": [2, "never"],
"prefer-promise-reject-errors": 0,
"semi": [2, "never", { "beforeStatementContinuationChars": "always" }],
"sort-keys": [2, "asc", { "caseSensitive": false, "natural": true }],
"space-before-function-paren": [2, "never"]
"space-before-function-paren": [2, { "anonymous": "never", "asyncArrow": "always", "named": "never" }]
},
"settings": {
"import/resolver": "node"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Git flow + GitHub PRs = <3
### Options
| CLI | Description |
| ---------------------------- | ------------------------------------------------------------------- |
| `--branches.beta <value>` | Latest beta branch |
| `--branches.develop <value>` | Develop branch |
| `--branches.doc <value>` | Documentation branches prefix |
| `--branches.feature <value>` | Feature branches prefix |
Expand Down Expand Up @@ -102,7 +103,7 @@ Start, publish or finish a hotfix.
| `<number>` | Hotfix pull request number |

#### Init
Make your repository ready for `releaseman` by creating the develop branch, an initial release and labels.
Make your repository ready for `releaseman` by creating develop and latest-beta branches, an initial release and labels.

`releaseman init`

Expand Down
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
{
"dependencies": {
"del-cli": "^1.1.0",
"lodash": "^4.17.4",
"node-fetch": "^1.7.3",
"rollup": "^0.54.0",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-executable": "^1.1.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-uglify": "^2.0.1",
"spawn-sync": "^1.0.15",
"uglify-es": "^3.3.7",
"yargs": "^10.1.1"
"lodash": "^4.17.11",
"node-fetch": "^2.3.0",
"rollup": "^1.0.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-executable": "^1.3.0",
"rollup-plugin-json": "^3.1.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-terser": "^4.0.1",
"spawn-sync": "^2.0.0",
"yargs": "^12.0.5"
},
"description": "Git flow + GitHub PRs = <3",
"devDependencies": {
"eslint": "^4.15.0",
"eslint-config-airbnb-base": "^12.1.0",
"eslint": "^5.12.0",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.8.0"
"eslint-plugin-import": "^2.14.0"
},
"license": "MIT",
"main": "lib/releaseman",
Expand All @@ -28,8 +27,8 @@
"url": "https://github.com/ToucanToco/releaseman.git"
},
"scripts": {
"lint": "eslint src/**.js",
"postinstall": "del bin && rollup -c"
"lint": "eslint \"src/**/*.js\" \"*.js\"",
"postinstall": "del bin && rollup -c --silent"
},
"version": "0.7.1"
"version": "1.0.0"
}
20 changes: 11 additions & 9 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import commonjs from 'rollup-plugin-commonjs';
import executable from 'rollup-plugin-executable';
import json from 'rollup-plugin-json';
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
import commonjs from 'rollup-plugin-commonjs'
import executable from 'rollup-plugin-executable'
import json from 'rollup-plugin-json'
import nodeResolve from 'rollup-plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'

export default {
external: [
Expand All @@ -17,14 +16,17 @@ export default {
format: 'cjs'
},
plugins: [
json(),
json({
compact: true,
preferConst: true
}),
nodeResolve({
extensions: ['.js', '.json']
}),
commonjs({
extensions: ['.js', '.json']
}),
uglify({}, minify),
terser(),
executable()
]
};
}
36 changes: 15 additions & 21 deletions src/actions/create-branch.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
import { ASSIGN_DATA } from '../mutations';
import { logInfo, logTaskStart } from '../log';
import { logInfo, logTaskStart } from '../log'

const CREATE_BRANCH = 'CREATE_BRANCH';
const CREATE_BRANCH = 'CREATE_BRANCH'

const createBranch = ({ commit, getters, state }, isSkipped) => {
logTaskStart('Create branch');
const createBranch = ({ getters }) => async ({ base, head, isSkipped }) => {
logTaskStart('Create branch')

if (isSkipped) {
return undefined;
return undefined
}

logInfo(`Creating branch \`${
state.data.head
}\` from \`${
state.data.base
}\`...`);
logInfo(`Creating branch \`${head}\` from \`${base}\`...`)

return getters.github.branches.create({
base: state.data.base,
head: state.data.head
const branch = await getters.query('branches.create')({
base: base,
head: head
})
.then(({ branch, url }) => {
logInfo(url);

return commit(ASSIGN_DATA, { branch: branch });
});
};
logInfo(branch.url)

export { CREATE_BRANCH };
export default createBranch;
return branch
}

export { CREATE_BRANCH }
export default createBranch
43 changes: 20 additions & 23 deletions src/actions/create-labels.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,29 @@
import map from 'lodash/fp/map';
import reject from 'lodash/fp/reject';
import { ASSIGN_DATA } from '../mutations';
import { logInfo, logTaskStart } from '../log';
import map from 'lodash/fp/map'
import { logInfo, logTaskStart } from '../log'

const CREATE_LABELS = 'CREATE_LABELS';
const CREATE_LABELS = 'CREATE_LABELS'

const createLabels = ({ commit, getters, state }, isSkipped) => {
logTaskStart('Create labels');
const createLabels = ({ getters }) => async ({ isSkipped, labels }) => {
logTaskStart('Create labels')

if (isSkipped) {
return undefined;
return undefined
}

logInfo('Creating labels...');
logInfo('Creating labels...')

return Promise.all(
map((label) => (
getters.github.labels.create(label)
.then(({ name, url }) => {
logInfo(`${name}: ${url}`);
const createdLabels = await Promise.all(
map(async (label) => {
const createdLabel = await getters.query('labels.create')(label)

return commit(ASSIGN_DATA, {
labels: reject(['name', name])(state.data.labels)
});
})
))(state.data.labels)
);
};
logInfo(`${createdLabel.name}: ${createdLabel.url}`)

export { CREATE_LABELS };
export default createLabels;
return createdLabel
})(labels)
)

return createdLabels
}

export { CREATE_LABELS }
export default createLabels
48 changes: 24 additions & 24 deletions src/actions/create-pull-request.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import { ASSIGN_DATA } from '../mutations';
import { logInfo, logTaskStart } from '../log';
import { logInfo, logTaskStart } from '../log'

const CREATE_PULL_REQUEST = 'CREATE_PULL_REQUEST';
const CREATE_PULL_REQUEST = 'CREATE_PULL_REQUEST'

const createPullRequest = ({ commit, getters, state }, isSkipped) => {
logTaskStart('Create pull request');
const createPullRequest = ({ getters }) => async ({
base,
changelog,
head,
isSkipped,
name
}) => {
logTaskStart('Create pull request')

if (isSkipped) {
return undefined;
return undefined
}

logInfo(`Creating pull request for \`${
state.data.head
}\` into \`${
state.data.base
}\`...`);

return getters.github.pullRequests.create({
base: state.data.base,
changelog: state.data.changelog.text,
head: state.data.head,
name: state.data.name
logInfo(`Creating pull request for \`${head}\` into \`${base}\`...`)

const pullRequest = await getters.query('pullRequests.create')({
base: base,
changelog: changelog,
head: head,
name: name
})
.then(({ number, url }) => {
logInfo(url);

return commit(ASSIGN_DATA, { number: number });
});
};
logInfo(pullRequest.url)

return pullRequest
}

export { CREATE_PULL_REQUEST };
export default createPullRequest;
export { CREATE_PULL_REQUEST }
export default createPullRequest
49 changes: 27 additions & 22 deletions src/actions/create-release.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
import { ASSIGN_DATA } from '../mutations';
import { logInfo, logTaskStart } from '../log';
import { logInfo, logTaskStart } from '../log'

const CREATE_RELEASE = 'CREATE_RELEASE';
const CREATE_RELEASE = 'CREATE_RELEASE'

const createRelease = ({ commit, getters, state }, isSkipped) => {
logTaskStart('Create release');
const createRelease = ({ getters }) => async ({
branch,
changelog,
isPrerelease,
isSkipped,
name,
tag
}) => {
logTaskStart('Create release')

if (isSkipped) {
return undefined;
return undefined
}

logInfo(`Creating new ${
state.data.isPrerelease
isPrerelease
? 'prerelease'
: 'release'
}...`);

return getters.github.releases.create({
branch: state.data.branch,
changelog: state.data.changelog.text,
isPrerelease: state.data.isPrerelease,
name: state.data.name,
tag: state.data.tag
}...`)

const release = await getters.query('releases.create')({
branch: branch,
changelog: changelog,
isPrerelease: isPrerelease,
name: name,
tag: tag
})
.then(({ tag, url }) => {
logInfo(url);

return commit(ASSIGN_DATA, { tag: tag });
});
};
logInfo(release.url)

return release
}

export { CREATE_RELEASE };
export default createRelease;
export { CREATE_RELEASE }
export default createRelease
22 changes: 12 additions & 10 deletions src/actions/delete-branch.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { logInfo, logTaskStart } from '../log';
import { logInfo, logTaskStart } from '../log'

const DELETE_BRANCH = 'DELETE_BRANCH';
const DELETE_BRANCH = 'DELETE_BRANCH'

const deleteBranch = ({ getters, state }, isSkipped) => {
logTaskStart('Delete branch');
const deleteBranch = ({ getters }) => async ({ isSkipped, name }) => {
logTaskStart('Delete branch')

if (isSkipped) {
return undefined;
return undefined
}

logInfo(`Deleting branch \`${state.data.branch}\`...`);
logInfo(`Deleting branch \`${name}\`...`)

return getters.github.branches.delete({ branch: state.data.branch });
};
await getters.query('branches.delete')({ name: name })

export { DELETE_BRANCH };
export default deleteBranch;
return undefined
}

export { DELETE_BRANCH }
export default deleteBranch
29 changes: 29 additions & 0 deletions src/actions/find-pull-request.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { logInfo, logTaskStart } from '../log'

const FIND_PULL_REQUEST = 'FIND_PULL_REQUEST'

const findPullRequest = ({ getters }) => async ({
base,
head,
isSkipped
}) => {
logTaskStart('Find pull request')

if (isSkipped) {
return undefined
}

logInfo(`Searching pull request for \`${head}\` into \`${base}\`...`)

const pullRequest = await getters.query('pullRequests.find')({
base: base,
head: head
})

logInfo(pullRequest.number)

return pullRequest
}

export { FIND_PULL_REQUEST }
export default findPullRequest
Loading

0 comments on commit cedf87e

Please sign in to comment.