Skip to content

Commit f7bd90d

Browse files
build: improve run scripts
- turn of sync for env var SKIP_SYNC in example app - rename scripts to `yarn dev` to be compatible with admin-bro - add `yarn check:all` script - turn off logging for tests
1 parent 0f35c90 commit f7bd90d

File tree

5 files changed

+67
-3
lines changed

5 files changed

+67
-3
lines changed

config/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ module.exports = {
66
database: process.env.POSTGRES_DATABASE || 'database_test',
77
host: process.env.POSTGRES_HOST || 'localhost',
88
dialect: 'postgres',
9+
logging: false,
910
},
1011
}

example-app/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"build": "tsc",
88
"start": "yarn build && node build/index.js",
9-
"start:dev": "concurrently \"yarn build --watch\" \"nodemon --ext '.js' --watch ../build --watch ./build --ignore 'cypress/**/*.js' node build/src/index.js\"",
9+
"dev": "SKIP_SYNC=true concurrently \"wait-on build/src/index.js && nodemon --ext '.js' --watch ../build --watch ./build --ignore 'cypress/**/*.js' node build/src/index.js\" \"yarn build --watch\"",
1010
"cypress:open": "cypress open",
1111
"cypress:run": "cypress run"
1212
},
@@ -16,7 +16,8 @@
1616
"cypress": "^4.11.0",
1717
"nodemon": "^2.0.4",
1818
"ts-node": "^8.10.2",
19-
"typescript": "^3.9.7"
19+
"typescript": "^3.9.7",
20+
"wait-on": "^5.2.0"
2021
},
2122
"dependencies": {
2223
"@admin-bro/express": "^3.0.0",

example-app/src/connect.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ const connect = async (): Promise<Sequelize> => {
2727
console.error('Unable to connect to the database:', error)
2828
}
2929

30-
await sequelize.sync({ force: true })
30+
if (!process.env.SKIP_SYNC) {
31+
await sequelize.sync({ force: true })
32+
}
3133
return sequelize
3234
}
3335

example-app/yarn.lock

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,6 +1119,35 @@
11191119
resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.8.2.tgz#576ff7fb1230185b619a75d258cbc98f0867a8dc"
11201120
integrity sha512-rLu3wcBWH4P5q1CGoSSH/i9hrXs7SlbRLkoq9IGuoPYNGQvDJ3pt/wmOM+XgYjIDRMVIdkUWt0RsfzF50JfnCw==
11211121

1122+
"@hapi/address@^4.1.0":
1123+
version "4.1.0"
1124+
resolved "https://registry.yarnpkg.com/@hapi/address/-/address-4.1.0.tgz#d60c5c0d930e77456fdcde2598e77302e2955e1d"
1125+
integrity sha512-SkszZf13HVgGmChdHo/PxchnSaCJ6cetVqLzyciudzZRT0jcOouIF/Q93mgjw8cce+D+4F4C1Z/WrfFN+O3VHQ==
1126+
dependencies:
1127+
"@hapi/hoek" "^9.0.0"
1128+
1129+
"@hapi/formula@^2.0.0":
1130+
version "2.0.0"
1131+
resolved "https://registry.yarnpkg.com/@hapi/formula/-/formula-2.0.0.tgz#edade0619ed58c8e4f164f233cda70211e787128"
1132+
integrity sha512-V87P8fv7PI0LH7LiVi8Lkf3x+KCO7pQozXRssAHNXXL9L1K+uyu4XypLXwxqVDKgyQai6qj3/KteNlrqDx4W5A==
1133+
1134+
"@hapi/hoek@^9.0.0":
1135+
version "9.1.0"
1136+
resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.1.0.tgz#6c9eafc78c1529248f8f4d92b0799a712b6052c6"
1137+
integrity sha512-i9YbZPN3QgfighY/1X1Pu118VUz2Fmmhd6b2n0/O8YVgGGfw0FbUYoA97k7FkpGJ+pLCFEDLUmAPPV4D1kpeFw==
1138+
1139+
"@hapi/pinpoint@^2.0.0":
1140+
version "2.0.0"
1141+
resolved "https://registry.yarnpkg.com/@hapi/pinpoint/-/pinpoint-2.0.0.tgz#805b40d4dbec04fc116a73089494e00f073de8df"
1142+
integrity sha512-vzXR5MY7n4XeIvLpfl3HtE3coZYO4raKXW766R6DZw/6aLqR26iuZ109K7a0NtF2Db0jxqh7xz2AxkUwpUFybw==
1143+
1144+
"@hapi/topo@^5.0.0":
1145+
version "5.0.0"
1146+
resolved "https://registry.yarnpkg.com/@hapi/topo/-/topo-5.0.0.tgz#c19af8577fa393a06e9c77b60995af959be721e7"
1147+
integrity sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw==
1148+
dependencies:
1149+
"@hapi/hoek" "^9.0.0"
1150+
11221151
"@samverschueren/stream-to-observable@^0.3.0":
11231152
version "0.3.0"
11241153
resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz#ecdf48d532c58ea477acfcab80348424f8d0662f"
@@ -3129,6 +3158,17 @@ jest-worker@^26.0.0:
31293158
merge-stream "^2.0.0"
31303159
supports-color "^7.0.0"
31313160

3161+
joi@^17.1.1:
3162+
version "17.2.1"
3163+
resolved "https://registry.yarnpkg.com/joi/-/joi-17.2.1.tgz#e5140fdf07e8fecf9bc977c2832d1bdb1e3f2a0a"
3164+
integrity sha512-YT3/4Ln+5YRpacdmfEfrrKh50/kkgX3LgBltjqnlMPIYiZ4hxXZuVJcxmsvxsdeHg9soZfE3qXxHC2tMpCCBOA==
3165+
dependencies:
3166+
"@hapi/address" "^4.1.0"
3167+
"@hapi/formula" "^2.0.0"
3168+
"@hapi/hoek" "^9.0.0"
3169+
"@hapi/pinpoint" "^2.0.0"
3170+
"@hapi/topo" "^5.0.0"
3171+
31323172
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
31333173
version "4.0.0"
31343174
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
@@ -4441,6 +4481,13 @@ rxjs@^6.3.3, rxjs@^6.5.2:
44414481
dependencies:
44424482
tslib "^1.9.0"
44434483

4484+
rxjs@^6.5.5:
4485+
version "6.6.3"
4486+
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.3.tgz#8ca84635c4daa900c0d3967a6ee7ac60271ee552"
4487+
integrity sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==
4488+
dependencies:
4489+
tslib "^1.9.0"
4490+
44444491
safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
44454492
version "5.1.2"
44464493
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
@@ -5176,6 +5223,17 @@ void-elements@^2.0.1:
51765223
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
51775224
integrity sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=
51785225

5226+
wait-on@^5.2.0:
5227+
version "5.2.0"
5228+
resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-5.2.0.tgz#6711e74422523279714a36d52cf49fb47c9d9597"
5229+
integrity sha512-U1D9PBgGw2XFc6iZqn45VBubw02VsLwnZWteQ1au4hUVHasTZuFSKRzlTB2dqgLhji16YVI8fgpEpwUdCr8B6g==
5230+
dependencies:
5231+
axios "^0.19.2"
5232+
joi "^17.1.1"
5233+
lodash "^4.17.19"
5234+
minimist "^1.2.5"
5235+
rxjs "^6.5.5"
5236+
51795237
warning@^4.0.2, warning@^4.0.3:
51805238
version "4.0.3"
51815239
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
"types": "index.d.ts",
77
"scripts": {
88
"build": "tsc",
9+
"dev": "tsc --watch",
910
"test": "mocha -r ts-node/register src/*.spec.ts",
11+
"check:all": "yarn build && yarn test && yarn lint",
1012
"cover": "NODE_ENV=test ./node_modules/nyc/bin/nyc.js --reporter=html -x=spec -x=coverage --all=true npm test",
1113
"sequelize": "sequelize",
1214
"lint": "eslint ./src/**/*.ts",

0 commit comments

Comments
 (0)