generator-tsmod v2.0.0
generator-tsmod
Installation
npm install -g yo
npm install -g generator-tsmodSynopsis
- Generate project scaffold. Also executes
npm initif nopackage.jsonfound.
yo tsmod- Generate project scaffold with additional options.
yo tsmod --vuepress --typedoc --license MIT --no-coverage --no-import-helpers --no-typedoc --no-not-sync- Remove generated but unmodified files safely.
--no-installprevents runningnpm installcommand.
yo tsmod:uninstall --no-install --force- Update already generated project using auto created
yo:updatescript frompackage.json.
npm run yo:updateFeatures Overview
This is a yeoman generator which is used to create TypeScript project. It features:
- Uninstall
- semantic-release
- EditorConfig
- ESLint
- Prettier
- Git
- GitHub Actions
- .gitignore
- .gitattributes
- Commitizen
- commitlint
- husky
- Jest
- lint-staged
- readmeasy
- TypeDoc
- TypeScript
- VuePress
Details
Notes
- Add
NPM_TOKENviaGitHub > Settings > Secrets. (GitHub Actions workflow use it in Semantic Release step to publish your package to npm)
Scripts from package.json
For Projects
| Script | Description |
|---|---|
release | See below Update README, add changed files to git and push. Github Actions releases your code. |
yo:update | Uninstall and re-generate project safely. |
execute | Run given source file. |
watch | Run given source file and watch for changes to re-run. |
lint | Lint and format source code. |
format | Format all supported files (source code, css, graphql etc.). |
test | Test project. Use -- --no-coverage --watch for watching. |
readme | Update README.md file using readmeasy. |
build | Build project using TypeScript. -- --watch for watching. |
docs:build | Build VuePress for production. Can be used by netlify for building. |
docs:dev | Starts VuePress development web site. (TypeDoc should be updated manually during development.) |
typedoc:html | Generate TypeDoc HTML documentation web site into api-docs-html directory. |
typedoc:md | Generate VuePress compatible Markdown from TypeDoc comments into api-docs-md directory. (Renames all index.md files (i.e. for Index class) as index2.md, because VuePress throws error for index.md files) |
typedoc:single-md | Generates Markdown files from TypeDoc and concatenates them into api.md file. |
For Internal Use
| Script | Description |
|---|---|
update-packages | Update dependencies in all package.json files in templates. |
postinstall | Install husky. |
TODO
| Script | Command | Description |
|---|---|---|
postreadme | oclif-dev readme | Inserts oclif documenatition into README.md after README.md is generated by readmeasy. |
Features
Uninstall
yo tsmod:uninstall --force --no-installAbove command removes non-user modifiable files and other files not modified by user from project. Also removes added configurations if they are not modified by user. To track modifications, this module uses Yeoman config file .yo-rc.json. --no-install prevents npm install usually not mandatory after dependencies are removed, to speed up uninstall.
Semantic Release
Fully automated version management and package publishing. semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package. This removes the immediate connection between human emotions and version numbers, strictly following the Semantic Versioning specification.
Used in .github/workflows/main.yml release step.
Commitizen
Packages: commitizen, cz-conventional-changelog
When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time.
Commit Lint & Standard Version
Packages: @commitlint/cli & @commitlint/config-conventional, standard-version,
commitlint checks if your commit messages meet the conventional commit format.
Standard Version: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
Commitlint: Checks if your commit messages meet the conventional commit format.
First Release
standard-version --first-release will tag a release without bumping the version
standard-version will tag a release and bump the version
Husky
Packages: husky
Git hooks made easy. Husky can prevent bad git commit, git push and more. It is used here to execute
lint-stagedatprecommit,commitlintatcommit-msg,commitizenatprepare-commit-msg(currently disabled, see this issue)
Lint Staged
Packages: lint-staged
Run linters against staged git files, so non-changed files are excluded from linters.
| File Type | What |
|---|---|
js, ts | Lint, test, coverage |
json, md, css etc. | Format |
rc, json | Lint |
Documentation
TypeDoc
TypeDoc TypeDoc converts comments in TypeScript source code into rendered HTML documentation. Also it is possible to create multiple Markdown files using typedoc-plugin-markdown plugin. Using concat-md it is possible to create single Markdown file.
VuePress
VuePress is used to create documentation web sites. vuepress-bar is used to generate VuePress menu. Also TypeDoc HTML and typedoc-plugin-markdown generated API docs is included in VuePress site.
Netlify may be used to publish documentation.
Additional Notes
.npmignore (or lack of)
.npmignore is not used, because this file overrides .gitignore and may results unpredictable behavior. Instead of using a blacklist for node modules, it is safer to write
whitelisted files to be published in files key in package.json.
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago