Skip to content

Enable tsc watch in projects scaffolded by lb4 CLI tool #1259

@bajtos

Description

@bajtos

Description / Steps to reproduce / Feature proposal

Our old extension starter repository has a neat dev setup that enables quick red-green-refactor cycles by leveraging incremental transpilation via tsc --watch, see DEVELOPING.md:

Visual Studio Code

  • Start the build task (Cmd+Shift+B), it will run TypeScript compiler in backround, watching and recompiling files as you change them. Compilation errors will be shown in the VSCode's "PROBLEMS" window.

  • Execute "Test and lint" task (Cmd+Shift+T) to re-run the test suite and lint the code for both programming and style errors. Linting errors will be shown in VSCode's "PROBLEMS" window. Failed tests are printed to terminal output only.

  • Run npm test explicitly before committing your changes. This will execute the same sequence as our CI server does.

We should update the empty project template used by our CLI tooling to include similar configuration.

It's important to enable tsc --watch not only for people using VisualStudio Code, but also for users of different editors/IDEs. See the extension starter repo for inspiration: Other editors/IDEs

Acceptance criteria

Modify the project template in packages/cli to:

  • Add build:watch and test:dev scripts to package.json, see the [starter repo](https://github.com/strongloop/loopback4-extension-starter/blob/e9062ca01f9bff28d6d2ebe077cba84c242ae96e/package.json
  • Add VS Code task configuration, see the starter repo. Consider adding VSCode settings file too.
  • Add Developing.md document to the scaffolded applicationexplaining users our envisioned dev workflow, I think it's enough to mostly copy the contents from the starter repo.
  • Optionally: when scaffolding a new application, ask the user whether they want to scaffold VSCode configuration files (settings, tasks).
    The steps above should be applied to all relevant CLI project templates.
  • Add/update existing examples with the new scripts and config files

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

Labels

CLIdeveloper-experienceIssues affecting ease of use and overall experience of LB users

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions