Skip to content

Commit 71e8afc

Browse files
committed
fix(commit-convention): exported the commit-convention functionality through the public api
1 parent 3b8d31d commit 71e8afc

File tree

10 files changed

+46
-56
lines changed

10 files changed

+46
-56
lines changed

.eslintrc.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@ extends:
33
- '@form8ion'
44
- '@form8ion/cucumber'
55
- '@form8ion/mocha'
6-
7-
rules:
8-
no-restricted-exports:
9-
- error
10-
- restrictedNamedExports:
11-
- then

src/commit-convention/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/commit-convention/scaffolder.js

Lines changed: 0 additions & 45 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/commit-convention/scaffolder-test.js renamed to src/scaffolder-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {assert} from 'chai';
66

77
import * as commitizenScaffolder from './commitizen';
88
import * as commitlintScaffolder from './commitlint';
9-
import scaffoldCommitConvention from './index';
9+
import scaffoldCommitConvention from './scaffolder';
1010

1111
suite('commit-convention scaffolder', () => {
1212
let sandbox;

src/scaffolder.js

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,45 @@
1-
export default function () {
2-
return undefined;
1+
import deepmerge from 'deepmerge';
2+
import {projectTypes} from '@form8ion/javascript-core';
3+
4+
import scaffoldCommitizen from './commitizen';
5+
import scaffoldCommitlint from './commitlint';
6+
7+
export default async function ({projectRoot, projectType, configs, pathWithinParent}) {
8+
const detailsForProjectsPublishedToARegistry = [projectTypes.PACKAGE, projectTypes.CLI].includes(projectType) ? {
9+
packageProperties: {version: '0.0.0-semantically-released'},
10+
badges: {
11+
contribution: {
12+
'semantic-release': {
13+
img: 'https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release',
14+
text: 'semantic-release: angular',
15+
link: 'https://github.com/semantic-release/semantic-release'
16+
}
17+
}
18+
}
19+
} : {};
20+
21+
if (pathWithinParent) return detailsForProjectsPublishedToARegistry;
22+
23+
const [commitizenResults, commitlintResults] = await Promise.all([
24+
scaffoldCommitizen({projectRoot}),
25+
configs.commitlint && scaffoldCommitlint({projectRoot, config: configs.commitlint})
26+
]);
27+
28+
return deepmerge.all([
29+
commitizenResults,
30+
...commitlintResults ? [commitlintResults] : [],
31+
{
32+
vcsIgnore: {files: [], directories: []},
33+
badges: {
34+
contribution: {
35+
'commit-convention': {
36+
img: 'https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg',
37+
text: 'Conventional Commits',
38+
link: 'https://conventionalcommits.org'
39+
}
40+
}
41+
}
42+
},
43+
detailsForProjectsPublishedToARegistry
44+
]);
345
}

test/integration/features/step_definitions/common-steps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ When('the project is scaffolded', async function () {
1616
node_modules: stubbedNodeModules
1717
});
1818

19-
await scaffold({projectRoot: process.cwd()});
19+
await scaffold({projectRoot: process.cwd(), configs: {}});
2020
});

0 commit comments

Comments
 (0)