0.0.35 • Published 5 months ago

generator-typescript-backbone-by-ridesz v0.0.35

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
5 months ago

Generator TypeScript Backbone by Ridesz

:warning: This repository is under development and not yet ready for production use. :warning:

TypeScript project generator (with partial "regeneration" feature) based on my personal preference.

Please use the more specific generators built based on this one.

How to start?

You need to create and clone a GitLab project (https://gitlab.com).

Then please run the following command in the project folder:

npx generator-typescript-backbone-by-ridesz@latest

How to continue?

To upgrade with the newest version of the generator:

npm run project:upgrade

Major version upgrades can be painfull. You may need to answer questions, run extra commands manually, so please read the console messages carefully.

You can also regenerate a few things with the last version of the generator you used (no upgrade):

npm run project:regenerate

My personal preference

I believe there is no perfect project configuration.

But this is my current favoruite one:

  • Git as version control system
  • GitLab as repository (private runner support, selfhosting is possible, etc.)
  • TypeScript as main language (for client or server side or both)
  • EcmaScript module resolution (avoid to use commonjs)
  • JavaScript is avoidable (TypeScript for nearly everything like scripts, configs, etc.)
  • NPM as package manager
  • ESLint as linter and Prettier as the formatter
  • Husky and lint-staged as git hooks
  • Visual Studio Code as editor
  • Some additional checks on the source code (code duplication, dead code, circular imports)

This can change by time or by generator.

Project folder structure

This can differ but I mostly prefer the following parts:

  • src for source files
  • test for unit test files
  • script for script files
  • config for configuration files
  • report for report outputs (like test coverage, dependency graphs, etc.), Git ignored and its content can be deleted
  • generated or other preferred you chose for the regeneratable files (will be purged every time you run the generator)
  • And a few things in the root (package.json, tsconfig.json, README.md, .gitignore, .gitlab-ci.yml, etc.)

Typical difference can be where the emitted code will be created: for a library this would be a lib folder, but for a top level project this would be more like a dist folder. It depends on the given generator.

Please keep it in your mind that the content of the regeneratable folder will be purged and recreated every time you run the generator.

Partial regeneration

  • A specific folder with some potentially useful stuff will always be deleted and recreated
  • A project:renegerate and a project:upgrade package.json script will be maintained
  • Some files will be created if they are missing (for example a required config file)
  • Some files will be created if the target folders are empty (for example a dummy index.ts in the src folder)
  • Some dependencies will be automatically updated

Optional generator arguments

You can use the following arguments to fine tune the run of the generator:

  • --verbose: print info level messages too
  • --force: overwrite everything without asking confirmation
  • --silent: don't ask questions
  • --regeneratedFolder: custom name for the regenerative folder

Usage on an existing project

There is no support for this.

What you can do is to temporarily remove most of your files (if you have configured version control for them), then you can run the generator and finally carefully bring back what you need.

Yeoman is under the hood

This generator is just a Yeoman generator (https://yeoman.io/) with extra steps.

You can - if you wish - install the generator project globally (which is necessary for Yeoman) and then run it with Yeoman (the generator- prefix missing for reason):

npm i -g generator-typescript-backbone-by-ridesz@latest && npx yo typescript-backbone-by-ridesz

Alternative way with temporary install:

npx --package=yo@latest --package=generator-typescript-backbone-by-ridesz@latest -c "yo typescript-backbone-by-ridesz"

About the development

Running this package locally on your machine for dev purposes is not simple.

Both npm link and npx run yeoman:regenerate were broken for me.

So I pack and install globally like this:

npm pack && npm i -g ./generator-typescript-backbone-by-ridesz-0.0.35.tgz

Then I run this (without the @latest postfix because it is also broken):

npx generator-typescript-backbone-by-ridesz

It is your responsibility to maintain your globally installed versions and solve conflicts.

If you are interested more, please see the README_DEV.md for more details.

0.0.35

5 months ago

0.0.34

5 months ago

0.0.21

6 months ago

0.0.22

6 months ago

0.0.23

6 months ago

0.0.24

6 months ago

0.0.25

6 months ago

0.0.30

6 months ago

0.0.31

6 months ago

0.0.32

6 months ago

0.0.33

6 months ago

0.0.26

6 months ago

0.0.27

6 months ago

0.0.28

6 months ago

0.0.29

6 months ago

0.0.20

6 months ago

0.0.13

6 months ago

0.0.14

6 months ago

0.0.15

6 months ago

0.0.16

6 months ago

0.0.17

6 months ago

0.0.18

6 months ago

0.0.19

6 months ago

0.0.10

6 months ago

0.0.11

6 months ago

0.0.12

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.4

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago