0.0.9 • Published 4 years ago

@zlog360/docker-compose v0.0.9

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

node-ts-seed

Seed for your NodeJS applications made with TypeScript and leveraging Visual Studio Code debugging tools.

Getting starting

git clone git@github.com:ludohenin/node-ts-seed.git {my-project-folder}
cd {my-project-folder}
rm -rf .git
git init
npm install
npm run typings -- -install

npm test -- -w

# Enjoy!

Note that this project doesn't rely on any global dependencies.

Files to update

  • package.json (name, author, repository ...)
  • typings.json (name)
  • Readme.md

npm scripts available

  • build: compiles the app into dist folder
  • lint: runs tslint for src and tests folders
  • test: runs mocha test without any compilation needed (uses ts-node)
  • tsc: proxy to the locally installed typescript package
  • typings: proxy to the locally installed typings package

tsconfig Files

The seed comes with two tsconfig files to enable greater dev experience in Visual Studio Code by enabling debuggig from source while running mocha tests:

  • tsconfig.json: default configuration file used by IDE for type checking, Intellisense and development build (opt-in)
  • tsconfig.src.json: configuration file used to compile the app for distribution

Visula Studio Code features

  • vscode build-in build tasks setup (build & build.dist)
    • build: development build, sets --watch for continuous incremental compilation. This tasks builds src and tests folder to dev which is used by vscode debugging tools.
    • build.dist to compile the src folder only to dist folder.
  • vscode debug configured (launch)
    • launch.json is set to run mocha test while debugging

Running test

# optional pass a reporter or any other mocha options.
npm test -- --reporter list

Note about tests fixtures

Because asset files won't be copied to the compilation output directory, when using the debugging tools, their path must be absolute.

const FIXTURE_BASE_DIR = path.join(process.cwd(), 'tests', 'fixtures');
const myFixtureFile = path.join(FIXTURE_BASE_DIR, 'fixture.yaml');

Resources

License

MIT