Skip to content

Commit a6eda26

Browse files
committed
feat(*): change
Changed templates and dependencies. Added commitizen if semantic release is used BREAKING CHANGE: New dependencies and changed some templates
1 parent be2c319 commit a6eda26

File tree

8 files changed

+10162
-6058
lines changed

8 files changed

+10162
-6058
lines changed

saofile.js

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,17 @@ module.exports = {
1414
];
1515
if (this.answers.tests) {
1616
scripts.push('\t\t"test": "jest && npm run build"');
17+
} else {
18+
scripts.push(
19+
'\t\t"test": "echo \\"Warn: No test specified\\" && exit 0"'
20+
);
1721
}
1822
if (this.answers.semanticrelease) {
19-
scripts.push('\t\t"semantic-release": "semantic-release"');
23+
scripts.push(
24+
'\t\t"semantic-release": "semantic-release"',
25+
'\t\t"travis-deploy-once": "travis-deploy-once"',
26+
'\t\t"cz": "git-cz"'
27+
);
2028
}
2129

2230
const devDependencies = [
@@ -31,7 +39,6 @@ module.exports = {
3139
'\t\t"@types/hoist-non-react-statics": "^3.3.1"',
3240
'\t\t"@types/react": "^16.8.5"',
3341
'\t\t"@types/react-dom": "^16.8.2"',
34-
'\t\t"cz-conventional-changelog": "3.0.2"',
3542
'\t\t"lodash": "^4.17.15"',
3643
'\t\t"tslint": "^5.13.0"',
3744
'\t\t"tslint-config-prettier": "^1.18.0"',
@@ -61,6 +68,7 @@ module.exports = {
6168
process.exit(1);
6269
}
6370
devDependencies.push('\t\t"semantic-release": "^15.13.31"');
71+
devDependencies.push('\t\t"commitizen": "^4.0.3"');
6472
}
6573

6674
const pmRun = this.answers.pm === "yarn" ? "yarn" : "npm run";
@@ -90,11 +98,11 @@ module.exports = {
9098
templateDir: "templates",
9199
filters: {
92100
"__tests__/**": "tests",
93-
"jest.config.js": "tests",
94-
"travis.yml": "semanticrelease",
101+
jest_config_js: "tests",
102+
travis_yml: "semanticrelease",
95103
releaserc: "semanticrelease",
96-
"_yarn.lock": 'pm=="yarn"',
97-
"_package-lock_json": 'pm=="npm"'
104+
_yarn_lock: 'pm=="yarn"',
105+
_package_lock_json: 'pm=="npm"'
98106
}
99107
}
100108
];
@@ -104,13 +112,14 @@ module.exports = {
104112
patterns: {
105113
gitignore: ".gitignore",
106114
babelrc: ".babelrc",
107-
"travis.yml": ".travis.yml",
108-
releaserc: ".release.rc",
115+
travis_yml: ".travis.yml",
116+
jest_config_js: "jest.config.js",
117+
releaserc: ".releaserc",
109118
_package_json: "package.json",
110119
_tsconfig_json: "tsconfig.json",
111120
_tslint_json: "tslint.json",
112-
"_yarn.lock": "yarn.lock",
113-
"_package-lock_json": "package-lock.json"
121+
_yarn_lock: "yarn.lock",
122+
_package_lock_json: "package-lock.json"
114123
}
115124
});
116125

@@ -120,6 +129,8 @@ module.exports = {
120129
this.gitInit();
121130
await this.npmInstall({ npmClient: this.answers.pm });
122131
if (this.answers.semanticrelease) {
132+
// @TODO console log
133+
// install semantic release cli
123134
let options = ["add", "semantic-release-cli"];
124135
if (this.answers.pm === "npm") {
125136
options[0] = "install";
@@ -128,10 +139,12 @@ module.exports = {
128139
cwd: this.outDir,
129140
stdio: "inherit"
130141
});
142+
// Setup semantic release
131143
spawn.sync("./node_modules/.bin/semantic-release-cli", ["setup"], {
132144
cwd: this.outDir,
133145
stdio: "inherit"
134146
});
147+
// Remove semantic release cli
135148
options[0] = "remove";
136149
if (this.answers.pm === "npm") {
137150
options[0] = "uninstall";
@@ -140,6 +153,15 @@ module.exports = {
140153
cwd: this.outDir,
141154
stdio: "inherit"
142155
});
156+
// Setup commitizen
157+
spawn.sync(
158+
"./node_modules/.bin/commitizen",
159+
["init", "cz-conventional-changelog"],
160+
{
161+
cwd: this.outDir,
162+
stdio: "inherit"
163+
}
164+
);
143165
}
144166
}
145167
};

0 commit comments

Comments
 (0)