-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dependencies and configuration files
- Loading branch information
Showing
12 changed files
with
142 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
const parserOpts = require('./parser-opts') | ||
const writerOpts = require('./writer-opts') | ||
|
||
export default { | ||
parserOpts, | ||
writerOpts | ||
module.exports = { | ||
parserOpts: require('./parser-opts'), | ||
writerOpts: require('./writer-opts') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,6 @@ | ||
import conventionalChangelog from './changelog' | ||
import recommendedBumpOpts from './recommended-bump' | ||
import parserOpts from './parser-opts' | ||
import writerOpts from './writer-opts' | ||
|
||
export { | ||
conventionalChangelog, | ||
parserOpts, | ||
recommendedBumpOpts, | ||
writerOpts | ||
} | ||
module.exports = async () => ({ | ||
conventionalChangelog: require('./changelog'), | ||
parserOpts: require('./parser-opts'), | ||
recommendedBumpOpts: require('./recommended-bump'), | ||
writerOpts: require('./writer-opts') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,101 @@ | ||
import fs from 'fs' | ||
import path from 'path' | ||
import dedent from 'dedent' | ||
import fs, { writeFile, writeFileSync } from 'fs' | ||
import path, { resolve } from 'path' | ||
import exec from '../../../utils/exec' | ||
import commit from '../../../utils/commit' | ||
import initFakeGit from '../../../utils/init-fake-git' | ||
import { writeFileSync } from '../../fs/src' | ||
|
||
const config = require('../src') | ||
const createPreset = require('../dist') | ||
const conventionalChangelogCore = require('conventional-changelog-core') | ||
|
||
if (!fs.existsSync(path.join(__dirname, './dist'))) { | ||
fs.mkdirSync(path.join(__dirname, './dist')) | ||
} | ||
|
||
if (process.platform === 'win32') { | ||
test.todo('Skip conventional-changelog-config tests on Windows OS') | ||
} else { | ||
if (!fs.existsSync(path.join(__dirname, '../changelog-dist'))) { | ||
fs.mkdirSync(path.join(__dirname, '../changelog-dist')) | ||
} | ||
initFakeGit() | ||
describe('techor preset', () => { | ||
initFakeGit() | ||
test('changelog', async () => { | ||
await testAronChangelog( | ||
[ | ||
'Fix(CSS): `@media` and `@supports` doesn\'t transform `|` to ` ` #198', | ||
'Build: First build setup', | ||
'CI(Travis): Add TravisCI pipeline', | ||
'New: Amazing new module', | ||
'Fix(Compiler): Avoid a bug', | ||
'Fix: Content not changed', | ||
'Fix(Vite): HMR causes page reloaded', | ||
'Breaking(API): Rename `extend` parameters', | ||
'Fix(Normal.css): Layout shift', | ||
'Breaking: Remove `configure()` method', | ||
'Perf(`ngOptions`): Make it faster #1 #2', | ||
'Drop(Syntax): Use `fg:color` instead of ~~`font:color`~~', | ||
'Update(Contact): Address and tel', | ||
'Drop(Commitlint Config): Remove `header-max-length` rule', | ||
'Improve(UI): Call to action', | ||
['Perf(`ngOptions`): Make it faster', ' #1 #2'], | ||
'Docs: Add `font-size` demo', | ||
'Revert(`ngOptions`): Bad commit', | ||
'Revert \\"Fix(Repo): PeerDependencies -> Dependencies\\"\n\nThis reverts commit 123.\n', | ||
'Chore: Move directory', | ||
'Misc: Delete unused file', | ||
'Upgrade: Bump `@dummy/package` from 7.1.2 to 8.0.0', | ||
'Fix(*): Oops!', | ||
'Feat(Awesome): Addresses the issue brought up in #133', | ||
'Feat(API): New option for test #88', | ||
'Feat(Search): Issue brought up by @1aron! on Friday', | ||
'Revert \\"Fix: Content not changed\\"', | ||
'new: lowercase type', | ||
'New: lowercase summary', | ||
'New starts with `New` and sentense case' | ||
], | ||
(changelog) => { | ||
expect(changelog).toMatch('[@hparra](https://github.com/hparra)') | ||
expect(changelog).toMatch('Amazing new module') | ||
expect(changelog).toMatch('Compiler') | ||
expect(changelog).toMatch('Avoid a bug') | ||
expect(changelog).toMatch('Make it faster') | ||
expect(changelog).toMatch('[#1](https://github.com/conventional-changelog/conventional-changelog/issues/1) [#2](https://github.com/conventional-changelog/conventional-changelog/issues/2)') | ||
expect(changelog).toMatch('New Features') | ||
expect(changelog).toMatch('Bug Fixes') | ||
expect(changelog).toMatch('Performance Upgrades') | ||
expect(changelog).toMatch('`ngOptions`') | ||
expect(changelog).toMatch('Bad commit') | ||
expect(changelog).not.toMatch('Delete unused file') | ||
expect(changelog).not.toMatch('First build setup') | ||
expect(changelog).not.toMatch('Add TravisCI pipeline') | ||
expect(changelog).not.toMatch('Continuously integrated.') | ||
expect(changelog).not.toMatch('CI') | ||
expect(changelog).not.toMatch('Build') | ||
expect(changelog).not.toMatch('Chore') | ||
expect(changelog).not.toMatch('*** - **') | ||
expect(changelog).not.toMatch(': Not backward compatible.') | ||
// should replace #[0-9]+ with GitHub issue URL | ||
expect(changelog).toMatch('[#133](https://github.com/conventional-changelog/conventional-changelog/issues/133)') | ||
// should remove the issues that already appear in the subject | ||
expect(changelog).toMatch('[#88](https://github.com/conventional-changelog/conventional-changelog/issues/88)') | ||
// should replace @username with GitHub user URL | ||
expect(changelog).toMatch('[@1aron](https://github.com/1aron)') | ||
|
||
}, { changelogFileName: 'CHANGELOG.md' }) | ||
[ | ||
'Fix(CSS): `@media` and `@supports` doesn\'t transform `|` to ` ` #198', | ||
'Build : First build setup', | ||
'CI(Travis): Add TravisCI pipeline', | ||
'New: Amazing new module', | ||
'Fix(Compiler): Avoid a bug', | ||
'Fix: Content not changed', | ||
'Fix(Vite): HMR causes page reloaded', | ||
'Breaking(API): Rename `extend` parameters', | ||
'Fix(Normal.css): Layout shift', | ||
'Breaking: Remove `configure()` method', | ||
'Perf(`ngOptions`): Make it faster #1 #2', | ||
'Drop(Syntax): Use `fg:color` instead of ~~`font:color`~~', | ||
'Update(Contact): Address and tel', | ||
'Drop(Commitlint Config): Remove `header-max-length` rule', | ||
'Improve(UI): Call to action', | ||
['Perf(`ngOptions`): Make it faster', ' #1 #2'], | ||
'Docs: Add `font-size` demo', | ||
'Revert(`ngOptions`): Bad commit', | ||
'Revert \\"Fix(Repo): PeerDependencies -> Dependencies\\"\n\nThis reverts commit 123.\n', | ||
'Chore: Move directory', | ||
'Misc: Delete unused file', | ||
'Upgrade: Bump `@dummy/package` from 7.1.2 to 8.0.0', | ||
'Fix(*): Oops!', | ||
'Feat(Awesome): Addresses the issue brought up in #133', | ||
'Feat(API): New option for test #88', | ||
'Feat(Search): Issue brought up by @1aron! on Friday', | ||
'Revert \\"Fix: Content not changed\\"', | ||
'new: lowercase type', | ||
'New: lowercase summary', | ||
'New starts with `New` and sentense case' | ||
].forEach((message) => commit(message)) | ||
for await (let chunk of conventionalChangelogCore({ | ||
config: await createPreset(), | ||
cwd: process.cwd() | ||
})) { | ||
chunk = chunk.toString() | ||
writeFile(resolve(__dirname, './dist/CHANGELOG-1.md'), chunk, () => { }) | ||
expect(chunk).toMatch('[@hparra](https://github.com/hparra)') | ||
expect(chunk).toMatch('Amazing new module') | ||
expect(chunk).toMatch('Compiler') | ||
expect(chunk).toMatch('Avoid a bug') | ||
expect(chunk).toMatch('Make it faster') | ||
expect(chunk).toMatch('[#1](https://github.com/conventional-changelog/conventional-changelog/issues/1) [#2](https://github.com/conventional-changelog/conventional-changelog/issues/2)') | ||
expect(chunk).toMatch('New Features') | ||
expect(chunk).toMatch('Bug Fixes') | ||
expect(chunk).toMatch('Performance Upgrades') | ||
expect(chunk).toMatch('`ngOptions`') | ||
expect(chunk).toMatch('Bad commit') | ||
expect(chunk).not.toMatch('Delete unused file') | ||
expect(chunk).not.toMatch('First build setup') | ||
expect(chunk).not.toMatch('Add TravisCI pipeline') | ||
expect(chunk).not.toMatch('Continuously integrated.') | ||
expect(chunk).not.toMatch('CI') | ||
expect(chunk).not.toMatch('Build') | ||
expect(chunk).not.toMatch('Chore') | ||
expect(chunk).not.toMatch('*** - **') | ||
expect(chunk).not.toMatch(': Not backward compatible.') | ||
// should replace #[0-9]+ with GitHub issue URL | ||
expect(chunk).toMatch('[#133](https://github.com/conventional-changelog/conventional-changelog/issues/133)') | ||
// should remove the issues that already appear in the subject | ||
expect(chunk).toMatch('[#88](https://github.com/conventional-changelog/conventional-changelog/issues/88)') | ||
// should replace @username with GitHub user URL | ||
expect(chunk).toMatch('[@1aron](https://github.com/1aron)') | ||
} | ||
}, 10000) | ||
|
||
test('should work if there is a semver tag', async () => { | ||
exec('git tag v1.0.0') | ||
await testAronChangelog( | ||
['Feat: `it` alias for `test`'], | ||
(changelog) => { | ||
expect(changelog).toMatch('`it` alias for `test`') | ||
// not to include provious changes | ||
expect(changelog).not.toMatch('Breaking Changes') | ||
}, { changelogFileName: 'CHANGELOG.more.md' }) | ||
commit('Feat: `it` alias for `test`') | ||
for await (let chunk of conventionalChangelogCore({ | ||
cwd: process.cwd() | ||
})) { | ||
chunk = chunk.toString() | ||
writeFile(resolve(__dirname, './dist/CHANGELOG-2.md'), chunk, () => { }) | ||
expect(chunk).toMatch('`it` alias for `test`') | ||
// not to include provious changes | ||
expect(chunk).not.toMatch('Breaking Changes') | ||
} | ||
}, 10000) | ||
}) | ||
} | ||
|
||
export function testAronChangelog(commits, handle: (changelog: string) => void, { changelogFileName, pkg }: any) { | ||
return new Promise<void>((resolve) => { | ||
commits.forEach((eachCommit) => commit(eachCommit)) | ||
conventionalChangelogCore({ | ||
config, | ||
pkg | ||
}) | ||
.on('data', changelogChunk => { | ||
const changelog = changelogChunk.toString() | ||
writeFileSync(path.join(__dirname, 'dist', changelogFileName), dedent(changelog)) | ||
handle(changelog) | ||
}) | ||
.on('error', (error) => { | ||
console.log(error) | ||
resolve() | ||
}) | ||
.on('close', () => resolve()) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.