Skip to content

Commit fa17972

Browse files
Piotr Oleśpiotr-oles
authored andcommitted
feat: 🎸 upgrade application generator
1 parent 5fcc050 commit fa17972

24 files changed

Lines changed: 266 additions & 67 deletions

File tree

‎generators/app/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ export = class AppGenerator extends Generator {
88
this.composeWith(require.resolve("../package"), {});
99
this.composeWith(require.resolve("../config-editor"), {});
1010
this.composeWith(require.resolve("../config-ignore"), {});
11+
this.composeWith(require.resolve("../config-typescript"), {});
1112
this.composeWith(require.resolve("../config-test"), {});
1213
this.composeWith(require.resolve("../config-lint"), {});
13-
this.composeWith(require.resolve("../config-doc"), {});
1414
this.composeWith(require.resolve("../config-webpack"), {});
1515
}
1616
};

‎generators/config-lint/index.ts‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export = class ConfigLintGenerator extends Generator {
1919
commit: "./node_modules/.bin/git-cz"
2020
},
2121
devDependencies: {
22-
"@commitlint/config-conventional": "^7.5.0",
23-
commitlint: "^7.5.2",
22+
"@commitlint/config-conventional": "^8.0.0",
23+
commitlint: "^8.0.0",
2424
"git-cz": "^3.0.1",
2525
husky: "^2.3.0",
2626
"lint-staged": "^8.1.0",
@@ -58,9 +58,8 @@ export = class ConfigLintGenerator extends Generator {
5858
}
5959

6060
public writing() {
61-
this.fs.copy(
62-
this.templatePath("tslint.json"),
63-
this.destinationPath("tslint.json")
61+
["tslint.json", "changelog.config.js"].forEach(file =>
62+
this.fs.copy(this.templatePath(file), this.destinationPath(file))
6463
);
6564
}
6665

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = {
2+
list: ['feat', 'fix', 'refactor', 'perf', 'test', 'chore', 'docs'],
3+
maxMessageLength: 64,
4+
minMessageLength: 3,
5+
questions: ['type', 'subject', 'body', 'breaking', 'issues'],
6+
types: {
7+
feat: {
8+
description: 'A new feature',
9+
value: 'feat'
10+
},
11+
fix: {
12+
description: 'A bug fix',
13+
value: 'fix'
14+
},
15+
refactor: {
16+
description: 'A code change that neither adds a feature or fixes a bug',
17+
value: 'refactor'
18+
},
19+
perf: {
20+
description: 'A code change that improves performance',
21+
value: 'perf'
22+
},
23+
test: {
24+
description: 'Adding missing tests',
25+
value: 'test'
26+
},
27+
chore: {
28+
description: 'Build process, CI or auxiliary tool changes',
29+
value: 'chore'
30+
},
31+
docs: {
32+
description: 'Documentation only changes',
33+
value: 'docs'
34+
}
35+
}
36+
};

‎generators/config-rollup/index.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ export = class ConfigRollupGenerator extends Generator {
2323
}
2424

2525
public writing() {
26-
this.fs.copy(
27-
this.templatePath("rollup.config.js"),
28-
this.destinationPath("rollup.config.js")
26+
["rollup.config.js", "src/index.ts"].forEach(file =>
27+
this.fs.copy(this.templatePath(file), this.destinationPath(file))
2928
);
3029
this.traits.addGitIgnoreEntries(
3130
["### Rollup", "/lib", ".rpt2_cache"].join("\n")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// tslint:disable-next-line
2+
console.log("Hello world");

‎generators/config-test/index.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export = class ConfigTestGenerator extends Generator {
2626
);
2727
}
2828

29+
public writing() {
30+
this.fs.copy(
31+
this.templatePath("src/index.spec.ts"),
32+
this.destinationPath("src/index.spec.ts")
33+
);
34+
}
35+
2936
public install() {
3037
this.yarnInstall();
3138
}
File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Generator from "yeoman-generator";
2+
import traits from "../../traits";
3+
4+
export = class TypeScriptConfigGenerator extends Generator {
5+
public traits = traits(this);
6+
7+
public configuring() {
8+
this.traits.extendPackageJson({
9+
devDependencies: {
10+
tslib: "^1.9.3",
11+
typescript: "^3.4.5"
12+
}
13+
});
14+
}
15+
16+
public writing() {
17+
this.fs.copy(
18+
this.templatePath("tsconfig.json"),
19+
this.destinationPath("tsconfig.json")
20+
);
21+
}
22+
23+
public install() {
24+
this.yarnInstall();
25+
}
26+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "esnext",
5+
"lib": ["dom", "es6", "scripthost"],
6+
"jsx": "react",
7+
"sourceMap": true,
8+
"outDir": "./dist",
9+
"rootDir": "./src",
10+
"importHelpers": true,
11+
"skipLibCheck": true,
12+
"skipDefaultLibCheck": true,
13+
"strict": true,
14+
15+
"moduleResolution": "node",
16+
"baseUrl": "./src",
17+
"esModuleInterop": true,
18+
19+
"sourceRoot": "./src"
20+
}
21+
}

‎generators/config-webpack/index.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ export = class WebpackConfigGenerator extends Generator {
1313
devDependencies: {
1414
"@types/webpack": "^4.4.24",
1515
"@types/webpack-env": "^1.13.7",
16-
"clean-webpack-plugin": "^1.0.1",
17-
"file-loader": "^3.0.1",
18-
"fork-ts-checker-webpack-plugin": "^0.5.2",
16+
"clean-webpack-plugin": "^3.0.0",
17+
"file-loader": "^4.0.0",
18+
"fork-ts-checker-webpack-plugin": "^1.3.5",
1919
"html-webpack-plugin": "^3.2.0",
2020
"robotstxt-webpack-plugin": "^5.0.0",
21-
"ts-loader": "^5.3.3",
21+
"ts-loader": "^6.0.2",
2222
"tsconfig-paths-webpack-plugin": "^3.2.0",
2323
webpack: "^4.29.0",
2424
"webpack-cli": "^3.2.1",
@@ -28,10 +28,9 @@ export = class WebpackConfigGenerator extends Generator {
2828
}
2929

3030
public writing() {
31-
this.fs.copy(
32-
this.templatePath("webpack.config.js"),
33-
this.destinationPath("webpack.config.js")
34-
);
31+
["webpack.config.js", "src/index.tsx", "src/index.html"].forEach(file => {
32+
this.fs.copy(this.templatePath(file), this.destinationPath(file));
33+
});
3534
}
3635

3736
public install() {

0 commit comments

Comments
 (0)