2.0.0 • Published 2 years ago

generator-tsmod v2.0.0

Weekly downloads
64
License
MIT
Repository
github
Last release
2 years ago

generator-tsmod

Installation

npm install -g yo
npm install -g generator-tsmod

Synopsis

  • Generate project scaffold. Also executes npm init if no package.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 running npm install command.
yo tsmod:uninstall --no-install --force
  • Update already generated project using auto created yo:update script from package.json.
npm run yo:update

Features Overview

This is a yeoman generator which is used to create TypeScript project. It features:

Details

Notes

  • Add NPM_TOKEN via GitHub > Settings > Secrets. (GitHub Actions workflow use it in Semantic Release step to publish your package to npm)

Scripts from package.json

For Projects

ScriptDescription
releaseSee below Update README, add changed files to git and push. Github Actions releases your code.
yo:updateUninstall and re-generate project safely.
executeRun given source file.
watchRun given source file and watch for changes to re-run.
lintLint and format source code.
formatFormat all supported files (source code, css, graphql etc.).
testTest project. Use -- --no-coverage --watch for watching.
readmeUpdate README.md file using readmeasy.
buildBuild project using TypeScript. -- --watch for watching.
docs:buildBuild VuePress for production. Can be used by netlify for building.
docs:devStarts VuePress development web site. (TypeDoc should be updated manually during development.)
typedoc:htmlGenerate TypeDoc HTML documentation web site into api-docs-html directory.
typedoc:mdGenerate 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-mdGenerates Markdown files from TypeDoc and concatenates them into api.md file.

For Internal Use

ScriptDescription
update-packagesUpdate dependencies in all package.json files in templates.
postinstallInstall husky.

TODO

ScriptCommandDescription
postreadmeoclif-dev readmeInserts oclif documenatition into README.md after README.md is generated by readmeasy.

Features

Uninstall

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.

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-staged at precommit,
  • commitlint at commit-msg,
  • commitizen at prepare-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 TypeWhat
js, tsLint, test, coverage
json, md, css etc.Format
rc, jsonLint

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.

2.0.0

2 years ago

1.9.1

3 years ago

1.9.0

3 years ago

1.8.1

3 years ago

1.8.0

3 years ago

1.7.2

3 years ago

1.7.1

3 years ago

1.7.0

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.4

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.5

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.7

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago