Skip to content

nathan-andosen/node-module-seed

Repository files navigation

Test Coverage-shield-badge-1

Node Module Seed

A repo to kickstart your next typescript private node module.

Whats included:

Getting started

  1. To start your new node module using this seed app, clone this repo to a new directory:
git clone https://github.com/nathan-andosen/node-module-seed.git my-module-name
cd my-module-name
git remote rm origin
  1. Now you can start working on your module. Delete both classes in the /src directory and both of the spec files in the _/spec/ directory. IMPORTANT: Do not delete the always.spec.ts file just yet, you always need a spec file so that the generated output goes into the directory /compiled/src/. Once you create your own spec file, you can delete the always.spec.ts file.

Development

npm run init - Setup the app for development (run once after cloning)

npm run dev - Run this command when you want to work on this app. It will compile typescript, run tests and watch for file changes.

Distribution

npm run build -- -v <version> - Create a distribution build of the app.

-v (version) - [Optional] Either "patch", "minor" or "major". Increase the version number in the package.json file.

The build command creates a /compiled directory which has all the javascript compiled code and typescript definitions. As well, a /dist directory is created that contains a minified javascript file.

Testing

Tests are automatically ran when you do a build.

npm run test - Run the tests. The tests will be ran in a nodejs environment. You can run the tests in a browser environment by opening the file /spec/in-browser/SpecRunner.html.

Using the module

Typescript

import { ClassOne } from 'node-module-seed';
let classOne = new ClassOne();

Javascript (browser)

Simple include the minified file in your page. Webpack is used to compile the minified file, it places all the code into a global property called XApp. You can change this in the /webpack.config.js file.

<script src="dist/my-class.js" type="text/javascript"></script>

var classOne = new XApp.ClassOne();

License

MIT © Nathan Anderson

About

A repo to kickstart your next typescript node module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published