npm install -g yo
npm install -g generator-tsmod
- Generate project scaffold. Also executes
npm init
if nopackage.json
found.
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-install
prevents runningnpm install
command.
yo tsmod:uninstall --no-install --force
- Update already generated project using auto created
yo:update
script frompackage.json
.
npm run yo:update
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
- Add
NPM_TOKEN
viaGitHub > Settings > Secrets
. (GitHub Actions workflow use it in Semantic Release step to publish your package to npm)
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. |
Script | Description |
---|---|
update-packages |
Update dependencies in all package.json files in templates. |
postinstall |
Install husky . |
Script | Command | Description |
---|---|---|
postreadme |
oclif-dev readme |
Inserts oclif documenatition into README.md after README.md is generated by readmeasy. |
yo tsmod:uninstall --force --no-install
Above 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.
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.
Packages: commitizen, cz-conventional-changelog
When you commit with Commitizen, you'll be prompted to fill out any required commit fields at commit time.
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.
standard-version --first-release
will tag a release without bumping the version
standard-version
will tag a release and bump the version
Packages: husky
Git hooks made easy. Husky can prevent bad git commit, git push and more. It is used here to execute
lint-staged
atprecommit
,commitlint
atcommit-msg
,commitizen
atprepare-commit-msg
(currently disabled, see this issue)
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 |
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 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.
.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
.