adc-hd-wallet v0.0.2
TODO
- Add CI configuration.
- Not clear yet whether package.json is complete (see also
Specifics of npm's package.json handling):
- Does it make sense to compile everything into a single JS file (this would also affect tsconfig.json)?
- Do we need to list all files that should go into the package?
- Add API documentation.
- Add instructions how to use node modules under development with npm link.
- Review tslint.json (probably needs adjustments during development) and create one for release builds (see TODOs in tslint.json).
- Sometimes,
.js
files show up in the root (index.js
) and thesrc
andspec
trees. However, they should only appear in thedist
tree. I haven't yet found out how this happens. It may be an artifact of my WebStorm configuration. - Select a license and add to package.json/LICENSE.md.
Possibly exclude the tests from the module. They should be excluded through
.npmignore
, but according to this,.npmignore
doesn't ignore files that are listed in thefiles
option in package.json, even though it should. A
Package Structure and Usage
index.ts
,src
: Published sources. Theindex.ts
in the root folder seems to be required, and it seems to make sense to use it as the main entry point.spec
: Tests. This is the default location for Jasmine.dist
: Build artifacts.- Notes to the script commands in package.json:
- Run the commands with
npm run <command>
. (npm run test
can be abbreviated tonpm test
.) lint
: Run a TypeScript linter.build-debug
: Run a debug build.build-debug-watch
: Watch for changes and continuously build.build-release
: Run a release build.test-only
: Run only the tests.watch
: Alias forbuild-debug-watch
.clean
: Delete build artifacts.build
: Standard build command (runs a release build).pretest
: Standard command that runs beforetest
. Runslint
.test
: Standard test command (runslint
throughpretest
andtest-only
).prepublish
: Standard command that runs beforepublish
. Runsbuild
(a release build).
- Run the commands with
Installation Notes
At least on Windows, node modules that install executables (for example
cordova
,ionic
,tsc
,tslint
,jasmine
,alm
,babel
,gulp-cli
,yo
) must be installed globally, possibly in addition to be installed locally. The executable that is run is only the one from the global installation (on a typical Windows installation, these are in%APPDATA%\npm
). I don't think a local installation even installs the required Windows executables (typically.cmd
scripts).I don't know how this works on OS X. There seem to be Linux-style executable scripts in
thebin
directories of local installations, but they don't seem to be on the path.The dev dependencies of this project that install executables and that need to be installed globally are listed below; all of them are used across multiple of our projects:
typescript
(installstsc
)tslint
jasmine
jasmine-ts
trash-cli
Notes for Creating TypeScript Node Modules
- node-typescript-boilerplate: Helpful boilerplate project. (Test setup is based on Jest and Travis.)
- TypeScript with NodeJS:
A page from a Typescript book about creating an node module. (Uses
ts-node
andnodemon
to execute a command on change.) - Writing a Node.js module in TypeScript: A tutorial that takes you through the creation of a TypeScript node module.
- Publishing: The page about publishing from the official TypeScript documentation.
- package.json: engines & engineStrict - and how to use them:
Helpful notes about the fields
engines
andengineStrict
in package.json. - How to create strongly-typed npm packages: Some helpful info around TypeScript usage in node modules.
- 5 things to know when writing a TypeScript NPM module:
Helpful tips, with a configuration based on
gulp
. Boilerplate project in How to write a NPM module using TypeScript.