Skip to content

Commit a8ce25f

Browse files
authored
refactor: modernize SSCCE (#218)
* refactor: modernize * refactor: modernize sscce * feat: add docker images * build: update ci * refactor: remove .idea * refactor: update tsconfig/gitignore * build: use node 14 * build: disable linter on sscce file * docs: document the need to install pg-hstore if using DataTypes.HSTORE * docs: update documentation * feat: run against Sequelize 6 & 7 on node 10 to 16 * fix: make start:x scripts work in cjs * fix: ignore internal ts error * ci: dedupe CI runs * docs: update references to sscce.ts
1 parent cb84939 commit a8ce25f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+843
-464
lines changed

.eslintrc.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
{
2-
"env": {
3-
"es6": true,
4-
"node": true
5-
},
6-
"parserOptions": {
7-
"ecmaVersion": 10
8-
},
92
"extends": [
10-
"eslint:recommended",
11-
"plugin:node/recommended"
3+
"@ephys/eslint-config-typescript",
4+
"@ephys/eslint-config-typescript/node"
125
],
136
"rules": {
14-
"no-unused-vars": "off",
15-
"node/no-unpublished-require": "off"
16-
}
7+
"unicorn/prefer-node-protocol": "off",
8+
"no-console": "off",
9+
"import/order": "off",
10+
"prefer-object-has-own": "off",
11+
"unicorn/prefer-at": "off",
12+
"@typescript-eslint/no-unused-expressions": "off",
13+
14+
// we still have to support node 10 while Sequelize 6 remains alive
15+
"unicorn/prefer-module": "off",
16+
"unicorn/prefer-top-level-await": "off"
17+
},
18+
"ignorePatterns": ["src/*"]
1719
}

.github/workflows/ci.yml

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: CI
2-
on: [push, pull_request]
2+
on: [pull_request]
33

44
env:
55
SEQ_DB: sequelize_test
@@ -11,28 +11,30 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
combination: ['v5', 'v6', 'v6 with TS']
15-
name: SQLite (${{ matrix.combination }})
14+
# node 10 is the minimum supported version for Sequelize 6
15+
# node 14 is the minimum supported version for Sequelize 7
16+
# node 16 is latest LTS (to keep updated)
17+
node: [10, 14, 16]
18+
name: SQLite (sequelize 6 & 7, node ${{ matrix.node }})
1619
runs-on: ubuntu-latest
1720
env:
1821
DIALECT: sqlite
19-
CI_COMBINATION: ${{ matrix.combination }}
2022
steps:
2123
- uses: actions/checkout@v2
2224
- uses: actions/setup-node@v1
2325
with:
24-
node-version: 12.x
26+
node-version: 14.x
2527
- run: /bin/bash ./setup/prepare-ci.sh
2628
- name: Execute SSCCE
27-
run: npm run ci
29+
run: npm run _test
2830
test-postgres:
2931
strategy:
3032
fail-fast: false
3133
matrix:
3234
postgres-version: [9.5, 10] # Does not work with 12
3335
native: [true, false]
34-
combination: ['v5', 'v6', 'v6 with TS']
35-
name: Postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }} (${{ matrix.combination }})
36+
node: [10, 14, 16]
37+
name: Postgres ${{ matrix.postgres-version }}${{ matrix.native && ' (native)' || '' }} (sequelize 6 & 7, node ${{ matrix.node }})
3638
runs-on: ubuntu-latest
3739
services:
3840
postgres:
@@ -46,25 +48,24 @@ jobs:
4648
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
4749
env:
4850
DIALECT: ${{ matrix.native && 'postgres-native' || 'postgres' }}
49-
CI_COMBINATION: ${{ matrix.combination }}
5051
steps:
5152
- run: PGPASSWORD=sequelize_test psql -h localhost -p 5432 -U sequelize_test sequelize_test -c '\l'
5253
- uses: actions/checkout@v2
53-
- uses: actions/setup-node@v1
54+
- uses: actions/setup-node@v3
5455
with:
55-
node-version: 12.x
56+
node-version: ${{ matrix.node }}
5657
- run: /bin/bash ./setup/prepare-ci.sh
5758
- name: Execute SSCCE
58-
run: npm run ci
59+
run: npm run _test
5960
test-mysql-mariadb:
6061
strategy:
6162
fail-fast: false
6263
matrix:
64+
node: [10, 14, 16]
6365
db:
6466
- '{ name: "MySQL 5.7", image: "mysql:5.7", dialect: "mysql" }'
6567
- '{ name: "MariaDB 10.3", image: "mariadb:10.3", dialect: "mariadb" }'
66-
combination: ['v5', 'v6', 'v6 with TS']
67-
name: ${{ fromJson(matrix.db).name }} (${{ matrix.combination }})
68+
name: ${{ fromJson(matrix.db).name }} (node ${{ matrix.node }})
6869
runs-on: ubuntu-latest
6970
services:
7071
mysql:
@@ -79,23 +80,22 @@ jobs:
7980
options: --health-cmd="mysqladmin -usequelize_test -psequelize_test status" --health-interval 10s --health-timeout 5s --health-retries 5 --tmpfs /var/lib/mysql:rw
8081
env:
8182
DIALECT: ${{ fromJson(matrix.db).dialect }}
82-
CI_COMBINATION: ${{ matrix.combination }}
8383
steps:
8484
- run: mysql --host 127.0.0.1 --port 3306 -uroot -psequelize_test -e "GRANT ALL ON *.* TO 'sequelize_test'@'%' with grant option; FLUSH PRIVILEGES;"
8585
- uses: actions/checkout@v2
86-
- uses: actions/setup-node@v1
86+
- uses: actions/setup-node@v3
8787
with:
88-
node-version: 12.x
88+
node-version: ${{ matrix.node }}
8989
- run: /bin/bash ./setup/prepare-ci.sh
9090
- name: Execute SSCCE
91-
run: npm run ci
91+
run: npm run _test
9292
test-mssql:
9393
strategy:
9494
fail-fast: false
9595
matrix:
96+
node: [10, 14, 16]
9697
mssql-version: [2017, 2019]
97-
combination: ['v5', 'v6', 'v6 with TS']
98-
name: MSSQL ${{ matrix.mssql-version }} (${{ matrix.combination }})
98+
name: MSSQL ${{ matrix.mssql-version }} (sequelize 6 & 7, node ${{ matrix.node }})
9999
runs-on: ubuntu-latest
100100
services:
101101
mssql:
@@ -113,13 +113,12 @@ jobs:
113113
--health-retries 10
114114
env:
115115
DIALECT: mssql
116-
CI_COMBINATION: ${{ matrix.combination }}
117116
steps:
118117
- run: /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password12!" -Q "CREATE DATABASE sequelize_test; ALTER DATABASE sequelize_test SET READ_COMMITTED_SNAPSHOT ON;"
119118
- uses: actions/checkout@v2
120-
- uses: actions/setup-node@v1
119+
- uses: actions/setup-node@v3
121120
with:
122-
node-version: 12.x
121+
node-version: ${{ matrix.node }}
123122
- run: /bin/bash ./setup/prepare-ci.sh
124123
- name: Execute SSCCE
125-
run: npm run ci
124+
run: npm run _test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
node_modules
22
npm-debug.log
3-
ts-dist
43
yarn.lock
4+
.idea

package.json

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,57 @@
11
{
2-
"name": "sequelize-sscce",
3-
"description": "SSCCE repository for Sequelize",
4-
"version": "0.0.0-development",
2+
"private": true,
53
"engines": {
64
"node": ">=10.0.0"
75
},
8-
"private": true,
6+
"type": "commonjs",
97
"license": "MIT",
108
"dependencies": {
119
"chai": "^4",
1210
"chai-as-promised": "^7",
1311
"chai-datetime": "^1",
14-
"chalk": "^2",
15-
"cross-env": "^5",
16-
"fs-jetpack": "^2",
17-
"is-plain-object": "^3",
18-
"json-stringify-safe": "^5",
19-
"lodash.defaults": "^4",
12+
"chalk": "^4.1.2",
13+
"cross-env": "^7",
14+
"fs-jetpack": "^4",
2015
"sequelize": "^6",
21-
"sinon": "^9",
16+
"@sequelize/core": "^7.0.0-alpha.10",
17+
"sinon": "^13",
2218
"sinon-chai": "^3"
2319
},
2420
"scripts": {
25-
"start": "cross-env LOCAL_SSCCE=true DIALECT=sqlite node setup/runner.js",
26-
"ts-prep": "del-cli ts-dist && tsc && node setup/ts-setup.js",
27-
"ts": "npm run ts-prep && cross-env LOCAL_TS_RUN=true npm start",
28-
"do-replace": "node setup/lib-replacements.js --do",
29-
"undo-replace": "node setup/lib-replacements.js --undo",
30-
"ci": "node setup/runner.js",
31-
"lint": "eslint ."
21+
"_test": "ts-node setup/runner.ts",
22+
"test:sqlite": "cross-env DIALECT=sqlite npm run _test",
23+
"test:postgres": "cross-env DIALECT=postgres npm run _test",
24+
"test:postgres-native": "cross-env DIALECT=postgres-native npm run _test",
25+
"test:mariadb": "cross-env DIALECT=mariadb npm run _test",
26+
"test:mysql": "cross-env DIALECT=mysql npm run _test",
27+
"test:mssql": "cross-env DIALECT=mssql npm run _test",
28+
"start:mariadb": "bash setup/mariadb/10.3/start.sh",
29+
"start:mysql": "bash setup/mysql/8.0/start.sh",
30+
"start:postgres": "bash setup/postgres/10/start.sh",
31+
"start:mssql": "bash setup/mssql/2019/start.sh",
32+
"stop:mariadb": "bash setup/mariadb/10.3/stop.sh",
33+
"stop:mysql": "bash setup/mysql/8.0/stop.sh",
34+
"stop:postgres": "bash setup/postgres/10/stop.sh",
35+
"stop:mssql": "bash setup/mssql/2019/stop.sh",
36+
"do-replace": "node setup/lib-replacements.ts --do",
37+
"undo-replace": "node setup/lib-replacements.ts --undo",
38+
"lint": "eslint . --fix"
3239
},
3340
"devDependencies": {
34-
"@types/bluebird": "*",
41+
"@ephys/eslint-config-typescript": "^14.1.1",
3542
"@types/chai": "^4",
3643
"@types/chai-as-promised": "^7",
37-
"@types/chai-datetime": "^0.0.36",
44+
"@types/chai-datetime": "^0.0.37",
45+
"@types/lodash": "^4.14.178",
3846
"@types/node": "^10",
39-
"@types/sinon": "^9",
47+
"@types/sinon": "^10",
4048
"@types/sinon-chai": "^3",
4149
"@types/validator": "*",
42-
"@typescript-eslint/eslint-plugin": "2.16.0",
43-
"@typescript-eslint/parser": "2.16.0",
44-
"del-cli": "^3",
45-
"eslint": "^6",
46-
"eslint-plugin-node": "^10",
47-
"sqlite3": "^4",
48-
"typescript": "~4.1"
50+
"del-cli": "^4",
51+
"eslint": "^8",
52+
"lodash": "^4.17.21",
53+
"sqlite3": "^5",
54+
"ts-node": "^10.4.0",
55+
"typescript": "~4.5"
4956
}
5057
}

0 commit comments

Comments
 (0)