Skip to content

Commit

Permalink
Update NPM scripts: watch and link
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpshr committed Nov 28, 2018
1 parent 4c0e08e commit 44e7b2b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ The **GABA** engine is a collection of platform-agnostic modules for creating se
- [Subscription](#subscription)
- [Composition](#composition)
- [TypeScript](#why-typescript)
- [Linking](#linking-during-development)
- [API documentation](#api-documentation)
- [License](#license)

Expand All @@ -39,7 +40,7 @@ The **GABA** engine is a collection of platform-agnostic modules for creating se
new NetworkStatusController(),
new TokenRatesController()
]);

datamodel.subscribe((state) => {/* data model has changed */});
```

Expand Down Expand Up @@ -305,6 +306,22 @@ TypeScript automatically transpiles the latest ECMAScript language features to a

All of these features of a statically-typed language like TypeScript combine to form codebases consisting of strict contractural relationships between every module in an application. Changes are less intimidating since unnoticed side effects are difficult to introduce, documentation can be generated with less verbose syntax (TSDoc is JSDoc without the types since it can infer them), editors provide autocompletion of both public module members and of local and NPM dependencies, and an upgrade to TypeScript can be incremental as demonstrated in this PR.

## Linking during development

Linking GABA into other projects involves a special NPM command to ensure that dependencies are not duplicated. This is because GABA ships modules that are transpiled but not bundled, and [NPM does not deduplicate](https://github.com/npm/npm/issues/7742) linked dependency trees.

1. Link GABA.

```sh
$ npm run build:link
```

2. Link into other projects.

```sh
$ npm link gaba
```

## API documentation

API documentation is auto-generated for the GABA package on every commit to the `master` branch.
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"lint": "tslint src/**/*.ts",
"test": "jest --coverage",
"format": "prettier **/*.ts --write --ignore-path=.gitignore",
"build": "tsc && cp package.json dist/.",
"build": "rm -rf dist && tsc && cp package.json dist/.",
"build:watch": "npm run build && tsc -w",
"build:link": "npm run build && cd dist && npm link && rm -rf node_modules && cd ..",
"doc": "typedoc src/ && touch docs/.nojekyll"
},
"jest": {
Expand Down

0 comments on commit 44e7b2b

Please sign in to comment.