Skip to content

Commit 9f27789

Browse files
author
Piotr Oleś
committed
feat: 🎸 Add basic generators
Add basic generators for `app`, `config`, `library` and `structure`.
1 parent 24a219f commit 9f27789

54 files changed

Lines changed: 6797 additions & 7 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
coverage
3+
.idea
4+
.DS_Store
5+
6+
lib/generator/**/*.js
7+
lib/trait/*.js

LICENSE

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
MIT License
1+
The MIT License (MIT)
22

33
Copyright (c) 2019 Codibly
44

@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# generator-ts
2-
Yeoman generator for TypeScript projects
1+
# generator-codibly-ts
2+
3+
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
4+
[![commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
5+
[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)
6+
7+
> [Yeoman](https://yeoman.io/) generator for Codibly TypeScript projects 🧐
8+
9+
## Installation
10+
11+
As it's standard Yeoman generator, first you have to install yeoman
12+
and our generator (you need also yarn - as it's our default package manager):
13+
14+
```
15+
yarn global add yo generator-codibly-ts
16+
```
17+
18+
And that's it - you are ready to generate ✨
19+
20+
## Usage
21+
22+
To generate something use Yeoman command - it will guide you through the
23+
generation process:
24+
25+
```
26+
yo codibly-ts
27+
```
28+
29+
## Application
30+
31+
## License
32+
33+
MIT

lib/generator/app/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Generator from "yeoman-generator";
2+
import traits from "../../trait";
3+
4+
export = class AppGenerator extends Generator {
5+
public traits = traits(this);
6+
7+
public initializing() {
8+
this.composeWith(require.resolve("../package"), {});
9+
this.composeWith(require.resolve("../config-editor"), {});
10+
this.composeWith(require.resolve("../config-ignore"), {});
11+
this.composeWith(require.resolve("../config-test"), {});
12+
this.composeWith(require.resolve("../config-lint"), {});
13+
this.composeWith(require.resolve("../config-doc"), {});
14+
this.composeWith(require.resolve("../config-webpack"), {});
15+
}
16+
};

lib/generator/config-doc/index.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Generator from "yeoman-generator";
2+
import traits from "../../trait";
3+
4+
export = class ConfigDocGenerator extends Generator {
5+
public traits = traits(this);
6+
7+
public configuring() {
8+
// we have to add --ignoreCompilerErrors because of https://github.com/facebook/jest/issues/8218
9+
this.traits.extendPackageJson({
10+
scripts: {
11+
doc: this.traits.execEachPackage(
12+
"typedoc --out doc --mode file --ignoreCompilerErrors src"
13+
)
14+
},
15+
devDependencies: {
16+
typedoc: "^0.14.2"
17+
}
18+
});
19+
}
20+
21+
public writing() {
22+
this.traits.addGitIgnoreEntries(
23+
[
24+
"### TypeDoc",
25+
this.traits.usesLerna() ? "/packages/**/doc" : "/doc"
26+
].join("\n")
27+
);
28+
}
29+
30+
public install() {
31+
this.yarnInstall();
32+
}
33+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Generator from "yeoman-generator";
2+
3+
export = class ConfigEditorGenerator extends Generator {
4+
public writing() {
5+
this.fs.copy(
6+
this.templatePath(".editorconfig"),
7+
this.destinationPath(".editorconfig")
8+
);
9+
}
10+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Generator from "yeoman-generator";
2+
3+
export = class ConfigIgnoreGenerator extends Generator {
4+
public writing() {
5+
this.fs.copy(
6+
this.templatePath(".gitignore"),
7+
this.destinationPath(".gitignore")
8+
);
9+
}
10+
};
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
############
2+
# Created by .ignore support plugin (hsz.mobi)
3+
### Linux template
4+
*~
5+
6+
# temporary files which can be created if a process still has a handle open of a deleted file
7+
.fuse_hidden*
8+
9+
# Linux trash folder which might appear on any partition or disk
10+
.Trash-*
11+
12+
### macOS template
13+
# General
14+
.DS_Store
15+
.AppleDouble
16+
.LSOverride
17+
18+
# Icon must end with two \r
19+
Icon
20+
21+
# Thumbnails
22+
._*
23+
24+
### Node template
25+
# Logs
26+
logs
27+
*.log
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
32+
# Runtime data
33+
pids
34+
*.pid
35+
*.seed
36+
*.pid.lock
37+
38+
# Coverage directory used by tools like istanbul
39+
coverage
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Optional npm cache directory
46+
.npm
47+
48+
# Optional eslint cache
49+
.eslintcache
50+
51+
# Optional REPL history
52+
.node_repl_history
53+
54+
# Output of 'npm pack'
55+
*.tgz
56+
57+
# Yarn Integrity file
58+
.yarn-integrity
59+
60+
# dotenv environment variables file
61+
.env
62+
63+
# next.js build output
64+
.next
65+
66+
### JetBrains template
67+
.idea
68+
69+
# JIRA plugin
70+
atlassian-ide-plugin.xml
71+
72+
### Windows template
73+
# Windows thumbnail cache files
74+
Thumbs.db
75+
ehthumbs.db
76+
ehthumbs_vista.db
77+
78+
# Folder config file
79+
[Dd]esktop.ini
80+
81+
# Recycle Bin used on file shares
82+
$RECYCLE.BIN/
83+
84+
# Windows shortcuts
85+
*.lnk

0 commit comments

Comments
 (0)