Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 111b2a6

Browse files
committed
resolves #116
1 parent a8598d0 commit 111b2a6

10 files changed

Lines changed: 90 additions & 77 deletions

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ This is a new tiny community, so if you don't get a response right away, it migh
170170

171171
## Dependencies:
172172

173-
* TypeScript >= 2.2
173+
* TypeScript >= 2.6
174174
* NodeJS >= 8.0
175175

176176
(among other things)
@@ -268,3 +268,31 @@ There are some properties in the environmental config that are used by the syste
268268
```
269269
Naturally, anything you define is available to you. You get access to the configuration through `SakuraApi.instsance.config`.
270270

271+
# Some tips for contributing to SakuraApi
272+
273+
## Dependencies
274+
To build this project you must have:
275+
276+
* npm 5+
277+
* node
278+
* docker
279+
* a bash compatible terminal
280+
281+
## Building the Project
282+
283+
* `npm run build`: builds the project and outputs the build to `lib/`
284+
* `npm start`: builds the project and continually monitors for changes, which trigger builds
285+
* `npm run start:test`: builds the project and continually monitors for changes, which trigger tests to be re-run (continual testing)
286+
* `doc:generate`: serves up the doc files -- do not commit these unless you are responsible for publishing a release
287+
288+
## Testing
289+
290+
* `npm test`: runs the full suite of tests
291+
* `npm run test:db`: runs the full suite of tests and preserves the DB (`docker ps`, connect via port 37001). This is helpful if you need to inspect the state of the database during test development
292+
* `npm run test:debug`: runs tests with `DEBUG=sapi:*,-sapi:*:verbose` set
293+
* `npm run test:verbose`: runs tests with `DEBUG=sapi:*` set
294+
* `npm run test:vverbose`: runs tests with `DEBUG=*` set
295+
296+
## Lint
297+
298+
* `npm run lint`

package.json

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,23 @@
1010
"lib/index.*"
1111
],
1212
"scripts": {
13-
"build": "rm -rf lib/ ; tsc && rsync -r --exclude=*.ts spec/ lib/spec",
14-
"coverage": "npm run docker:compose-test && npm run build && istanbul cover --include-all-sources node_modules/jasmine/bin/jasmine.js && docker-compose down && (open coverage/lcov-report/index.html || echo '')",
13+
"build": "./scripts/build.sh",
14+
"coverage": "./scripts/coverage.sh",
1515
"doc:generate": "./scripts/doc:generate.sh",
16-
"doc:serve": "nodemon --config nodemon.typedoc.json -e ts --exec 'npm run doc:generate && npm run http-server docs/ -- -a localhost -c-1'",
17-
"docker:compose-test": "(docker volume prune -f || echo \"skipped docker volume prune\") ; docker-compose up -d --remove-orphans",
18-
"http-server": "http-server",
16+
"doc:serve": "./scripts/doc:serve.sh",
17+
"docker:compose-test": "./scripts/docker:compose-test.sh",
1918
"install": "chmod +x scripts/*.* || true",
20-
"istanbul": "istanbul",
21-
"jasmine": "jasmine",
22-
"lint": "npm run build && npm run lint:code && npm run lint:tests",
23-
"lint:code": "echo 'CODE LINT' ; npm run tslint -- -t stylish -c tslint.json -p tsconfig.json",
24-
"lint:tests": "echo 'TEST LINT' ; npm run tslint -- -t stylish -c tslint.spec.json -p tsconfig.json",
25-
"nsp": "nsp",
26-
"prepublish": "npm test && npm run nsp check",
27-
"say:fail": "say 'fail' || echo ''",
28-
"say:pass": "say 'pass' || echo ''",
19+
"lint": "./scripts/lint.sh",
20+
"prepublish": "npm test && npx nsp check",
21+
"say:fail": "say 'fail' || echo 'fail'",
22+
"say:pass": "say 'pass' || echo 'pass'",
2923
"start": "nodemon --exec \"npm run build; echo build done\"",
3024
"start:test": "nodemon --exec \"npm test\"",
31-
"test": "npm run docker:compose-test && npm run build && ((npm run jasmine && npm run say:pass) || npm run say:fail) && docker-compose down",
32-
"test:db": "npm run docker:compose-test && npm run build && ((npm run jasmine && npm run say:pass) || npm run say:fail)",
33-
"test:trace": "npm test",
25+
"test": "./scripts/test.sh",
26+
"test:db": "./scripts/test.sh saveDb",
3427
"test:debug": "DEBUG=sapi:*,-sapi:*:verbose npm test",
3528
"test:verbose": "DEBUG=sapi:* npm test",
36-
"test:vverbose": "DEBUG=* npm test",
37-
"tsc": "tsc",
38-
"tslint": "tslint"
29+
"test:vverbose": "DEBUG=* npm test"
3930
},
4031
"repository": {
4132
"type": "git",

scripts/build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
rm -rf lib/
6+
npx tsc
7+
rsync -r --exclude=*.ts spec/ lib/spec

scripts/coverage.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
npm run docker:compose-test
5+
npm run build
6+
npx istanbul cover --include-all-sources node_modules/jasmine/bin/jasmine.js
7+
docker-compose down
8+
(open coverage/lcov-report/index.html || echo '')

scripts/doc:serve.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
nodemon --config nodemon.typedoc.json -e ts --exec 'npm run doc:generate && npx http-server docs/ -- -a localhost -c-1'

scripts/docker:compose-test.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
docker volume prune -f || echo \"skipped docker volume prune\"
5+
docker-compose up -d --remove-orphans

scripts/lint.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
npm run build
4+
npx tslint -t stylish -c tslint.json -p tsconfig.json

scripts/test.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
TEST_TYPE=${1:-clearDb}
6+
7+
npm run docker:compose-test
8+
npm run build
9+
((npx jasmine && npm run say:pass) || npm run say:fail)
10+
11+
if [ $TEST_TYPE != "saveDb" ]; then
12+
docker-compose down
13+
fi

tslint.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@
33
"defaultSeverity": "warning",
44
"rules": {
55
"curly": true,
6+
"interface-name": false,
67
"max-classes-per-file": false,
7-
"member-access": [
8-
true,
9-
"no-public"
10-
],
118
"max-line-length": [
129
true,
1310
128
1411
],
12+
"member-access": [
13+
true,
14+
"no-public"
15+
],
1516
"no-implicit-dependencies": [
1617
true,
1718
"dev"
1819
],
20+
"no-object-literal-type-assertion": false,
21+
"prefer-for-of": false,
22+
"prefer-object-spread": false,
1923
"quotemark": [
2024
true,
2125
"single",
@@ -28,14 +32,10 @@
2832
"singleline": "never"
2933
}
3034
],
31-
"interface-name": false,
32-
"prefer-object-spread": false,
3335
"variable-name": [
3436
true,
3537
"allow-leading-underscore"
36-
],
37-
"no-object-literal-type-assertion": false,
38-
"prefer-for-of": false
38+
]
3939
},
4040
"jsRules": {
4141
"curly": true

tslint.spec.json

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)