New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New CLI options, custom tags range and tests. #31
Changes from 7 commits
4325524
9b5c550
6531ecb
eb6c290
ecb8520
f321146
cb3e835
a8ef94b
588e350
6ce33e0
b00790d
d7f698c
0408bcb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{ | ||
"presets": ["es2015"] | ||
"presets": ["es2015"], | ||
"plugins": ["transform-object-rest-spread"] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,8 @@ | |
"indent": ["error", 2] | ||
}, | ||
"env": { | ||
"es6": true, | ||
"jest": true, | ||
"node": true | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
lib | ||
node_modules | ||
*.swp | ||
coverage | ||
.changelog |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
src | ||
**/__mocks__/** |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,10 @@ | |
"lerna-changelog": "cli.js" | ||
}, | ||
"scripts": { | ||
"build": "babel src -d lib", | ||
"build": "npm run clean && babel src --out-dir lib --ignore src/__mocks__/GithubAPI.js,src/__mocks__/Changelog.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if there is a better way of doing this... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can just ignore in npmignore/files? (I normally but all tests in a test folder not like jest so not sure) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The problem is if I keep those mocked folders is that they will be present in jest-haste-map: duplicate manual mock found:
Module name: GithubAPI
Duplicate Mock path: /Users/emmenko/dev/src/lerna-changelog/src/__mocks__/GithubAPI.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in:
/Users/emmenko/dev/src/lerna-changelog/src/__mocks__/GithubAPI.js
Please delete one of the following two files:
/Users/emmenko/dev/src/lerna-changelog/lib/__mocks__/GithubAPI.js
/Users/emmenko/dev/src/lerna-changelog/src/__mocks__/GithubAPI.js
jest-haste-map: duplicate manual mock found:
Module name: Changelog
Duplicate Mock path: /Users/emmenko/dev/src/lerna-changelog/src/__mocks__/Changelog.js
This warning is caused by two manual mock files with the same file name.
Jest will use the mock file found in:
/Users/emmenko/dev/src/lerna-changelog/src/__mocks__/Changelog.js
Please delete one of the following two files:
/Users/emmenko/dev/src/lerna-changelog/lib/__mocks__/Changelog.js
/Users/emmenko/dev/src/lerna-changelog/src/__mocks__/Changelog.js There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now I wonder how our jest + babel projects are doing it then? @cpojer if have ideas There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't publish Jest's mocks to npm. They are internal to Jest, I suggest you do the same. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also found this thread from you @cpojer where you mention
Do you still recommend to use them or to "wait until they're fixed"? Besides the publishing part, what about compiled sources from babel? Should we manually ignore those or is there a better way of doing it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I recommend using them within one project but I do not recommend publishing them to npm. |
||
"clean": "rimraf lib", | ||
"test": "eslint index.js cli.js src/", | ||
"lint": "eslint index.js cli.js src", | ||
"test": "jest", | ||
"prepublish": "npm run build" | ||
}, | ||
"repository": { | ||
|
@@ -27,16 +28,22 @@ | |
}, | ||
"homepage": "https://github.com/lerna/lerna-changelog#readme", | ||
"devDependencies": { | ||
"babel-cli": "^6.9.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"eslint": "^2.10.2", | ||
"rimraf": "^2.5.2" | ||
"babel-cli": "^6.18.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-jest": "^18.0.0", | ||
"babel-plugin-transform-object-rest-spread": "6.20.2", | ||
"babel-preset-es2015": "^6.18.0", | ||
"eslint": "^3.13.1", | ||
"jest": "^18.1.0", | ||
"lerna": "^2.0.0-beta.32", | ||
"rimraf": "^2.5.4" | ||
}, | ||
"peerDependencies": { | ||
"lerna": "^2.0.0-beta.8" | ||
}, | ||
"dependencies": { | ||
"chalk": "^1.1.3", | ||
"mkdirp": "^0.5.1" | ||
"mkdirp": "^0.5.1", | ||
"yargs": "^6.6.0" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,30 +4,32 @@ import mkdirp from "mkdirp"; | |
import ConfigurationError from "./ConfigurationError"; | ||
|
||
export default class ApiDataCache { | ||
constructor(host, {rootPath, cacheDir}) { | ||
constructor(host, { rootPath, cacheDir }) { | ||
this.host = host; | ||
const dir = this.dir = cacheDir && path.join(rootPath, cacheDir, host); | ||
|
||
if (dir) { | ||
try { | ||
mkdirp.sync(dir); | ||
} catch (e) { | ||
throw new ConfigurationError(`Can't use cacheDir "${cacheDir}" (${e.message})`); | ||
throw new ConfigurationError( | ||
`Can't use cacheDir "${cacheDir}" (${e.message})` | ||
); | ||
} | ||
} | ||
} | ||
|
||
get(type, key) { | ||
if (!this.dir) return; | ||
if (!this.dir) | ||
return; | ||
try { | ||
return fs.readFileSync(this.fn(type, key), "utf-8"); | ||
} catch (e) { | ||
// Pass. | ||
} | ||
} catch (e) {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this violating some linter rule? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not really, I just used auto-formatting from prettier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh. That sort of thing is generally better to do in a dedicated PR. Makes it easier to pick out relevant changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah this is similar to the eslint comment I made above - we should just use the babel eslint config or w.e separately There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know, my bad. I usually also prefer to do it in a separate PR. I'll revert those changes, no problem There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted extra changes here a8ef94b |
||
} | ||
|
||
set(type, key, data) { | ||
if (!this.dir) return; | ||
if (!this.dir) | ||
return; | ||
return fs.writeFileSync(this.fn(type, key), data); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the eslint config we should just use https://github.com/babel/eslint-config-babel. I would do this in a new pr after this is merged so its easier to review