Skip to content

Commit 659d43c

Browse files
committed
adding code
1 parent b8930a7 commit 659d43c

File tree

5 files changed

+64
-7
lines changed

5 files changed

+64
-7
lines changed

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
cache:
3+
directories:
4+
- ~/.npm
5+
notifications:
6+
email: true
7+
node_js:
8+
- '8'
9+
before_script:
10+
- npm prune
11+
after_success:
12+
- npm run semantic-release
13+
branches:
14+
except:
15+
- /^v\d+\.\d+\.\d+$/

package.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@cypress/commit-info",
33
"description": "Collects Git commit info from CI or from CLI",
4-
"version": "1.0.0",
4+
"version": "0.0.0-development",
55
"author": "Gleb Bahmutov <[email protected]>",
66
"bugs": "https://github.com/cypress-io/commit-info/issues",
77
"config": {
@@ -60,21 +60,38 @@
6060
"secure": "nsp check",
6161
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
6262
"test": "npm run unit",
63-
"unit": "mocha src/*-spec.js"
63+
"unit": "mocha src/*-spec.js",
64+
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
6465
},
6566
"release": {
66-
"analyzeCommits": "simple-commit-message"
67+
"analyzeCommits": "simple-commit-message",
68+
"generateNotes": "github-post-release",
69+
"verifyRelease": {
70+
"path": "dont-crack",
71+
"test-against": []
72+
}
6773
},
6874
"devDependencies": {
6975
"ban-sensitive-files": "1.9.0",
7076
"dependency-check": "2.9.1",
7177
"deps-ok": "1.2.1",
78+
"dont-crack": "1.2.1",
7279
"git-issues": "1.3.1",
80+
"github-post-release": "1.13.1",
7381
"license-checker": "15.0.0",
7482
"mocha": "4.0.1",
7583
"nsp": "2.8.1",
7684
"pre-git": "3.15.3",
7785
"prettier-standard": "7.0.3",
86+
"semantic-release": "8.2.0",
87+
"simple-commit-message": "3.3.2",
7888
"standard": "10.0.3"
89+
},
90+
"dependencies": {
91+
"chdir-promise": "0.6.2",
92+
"check-more-types": "2.24.0",
93+
"debug": "3.1.0",
94+
"execa": "0.8.0",
95+
"lazy-ass": "1.6.0"
7996
}
8097
}

src/commit-info-spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
'use strict'
22

3-
43
/* eslint-env mocha */
54
const commitInfo = require('.')
65

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

3+
function commitInfo (folder) {
4+
folder = folder || process.cwd()
5+
}
36

4-
5-
module.exports = true
6-
7+
module.exports = { commitInfo }

src/utils.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const chdir = require('chdir-promise')
2+
const execa = require('execa')
3+
const debug = require('debug')('commit-info')
4+
const la = require('lazy-ass')
5+
const is = require('check-more-types')
6+
7+
const prop = name => object => object[name]
8+
const emptyString = () => ''
9+
10+
const runGitCommand = (pathToRepo, gitCommand) => {
11+
la(is.unemptyString(pathToRepo), 'missing repo path', pathToRepo)
12+
la(is.unemptyString(gitCommand), 'missing git command', gitCommand)
13+
la(gitCommand.startsWith('git'), 'invalid git command', gitCommand)
14+
15+
const runGit = () => execa.shell(gitCommand).then(prop('stdout'))
16+
17+
debug('running git command: %s', gitCommand)
18+
return chdir
19+
.to(pathToRepo)
20+
.then(runGit)
21+
.tap(chdir.back)
22+
.catch(emptyString)
23+
}
24+
25+
module.exports = { runGitCommand }

0 commit comments

Comments
 (0)