Skip to content

Commit 033290f

Browse files
committed
Merge remote-tracking branch 'origin/dev' into refactor/policy-definition
2 parents fb71f2d + aade41d commit 033290f

File tree

12 files changed

+59
-16
lines changed

12 files changed

+59
-16
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
*.bat text=auto eol=crlf

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,24 @@ I want to think you first for considering contributing to ZenStack 🙏🏻. It'
55
## Prerequisites
66

77
- [Node.js](https://nodejs.org/): v18 or above
8-
- [pnpm](https://pnpm.io/): latest version
8+
- [pnpm](https://pnpm.io/): v8.x
9+
10+
If you want to run the tests, you should be aware that some of the integration tests run against postgres. These tests will attempt to set up and subsequently their own database, so you'll need to provide a connection details for a postgres user with at least those permissions. To provide connection details, you can configure the following environment variables or provide them when executing `pnpm test` commands.
11+
12+
- `ZENSTACK_TEST_DB_USER`: The postgres username, for a user with permission to create/drop databases. Default: `postgres`.
13+
- `ZENSTACK_TEST_DB_PASS`: Password for said user. Default: `abc123`.
14+
- `ZENSTACK_TEST_DB_NAME`: Default database to connect onto. This database isn't used any further, so it's recommended to just use the default `postgres` database. Default: `postgres`.
15+
- `ZENSTACK_TEST_DB_HOST`: Hostname or IP to connect onto. Default: `localhost`.
16+
- `ZENSTACK_TEST_DB_PORT`: Port number to connect onto. Default: `5432`.
917

1018
## Get started
1119

20+
1. (Windows only) Your environment should support symlinks, by enabling "Developer mode" in `Settings => System => For developers` (Windows 10/11 only) and setting the `core.symlinks` setting in git to `true`. For more info [refer to this StackOverflow answer](https://stackoverflow.com/questions/5917249/git-symbolic-links-in-windows/59761201#59761201).
21+
22+
```pwsh
23+
git config --global core.symlinks true
24+
```
25+
1226
1. Make a fork of the repository
1327
1428
Make sure all branches are included.

packages/ide/jetbrains/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
"homepage": "https://zenstack.dev",
77
"private": true,
88
"scripts": {
9-
"build": "./gradlew buildPlugin"
9+
"build": "run-script-os",
10+
"build:win32": "gradlew.bat buildPlugin",
11+
"build:default": "./gradlew buildPlugin"
1012
},
1113
"author": "ZenStack Team",
1214
"license": "MIT",
1315
"devDependencies": {
14-
"zenstack": "workspace:*",
15-
"@zenstackhq/language": "workspace:*"
16+
"@zenstackhq/language": "workspace:*",
17+
"run-script-os": "^1.1.6",
18+
"zenstack": "workspace:*"
1619
}
1720
}

packages/language/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"generate": "langium generate && npx ts-node script/generate-plist.ts",
1010
"watch": "concurrently \"langium generate --watch\" \"tsc --watch\"",
1111
"lint": "eslint src --ext ts",
12-
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json 'syntaxes/**/*' dist && pnpm pack dist --pack-destination ../../../.build",
12+
"build": "pnpm lint --max-warnings=0 && pnpm clean && pnpm generate && tsc && copyfiles -F ./README.md ./LICENSE ./package.json \"syntaxes/**/*\" dist && pnpm pack dist --pack-destination ../../../.build",
1313
"prepublishOnly": "pnpm build"
1414
},
1515
"publishConfig": {

packages/plugins/trpc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"clean": "rimraf dist",
13-
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE 'res/**/*' dist && pnpm pack dist --pack-destination ../../../../.build",
13+
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE \"res/**/*\" dist && pnpm pack dist --pack-destination ../../../../.build",
1414
"watch": "tsc --watch",
1515
"lint": "eslint src --ext ts",
1616
"test": "jest",

packages/runtime/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"scripts": {
1111
"clean": "rimraf dist",
12-
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup-browser.config.ts && tsup-node --config ./tsup-cross.config.ts && copyfiles ./package.json ./README.md ../../LICENSE dist && copyfiles -u1 'res/**/*' dist && pnpm pack dist --pack-destination '../../../.build'",
12+
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && tsup-node --config ./tsup-browser.config.ts && tsup-node --config ./tsup-cross.config.ts && copyfiles ./package.json ./README.md ../../LICENSE dist && copyfiles -u1 \"res/**/*\" dist && pnpm pack dist --pack-destination ../../../.build",
1313
"watch": "concurrently \"tsc --watch\" \"tsup-node --config ./tsup-browser.config.ts --watch\" \"tsup-node --config ./tsup-cross.config.ts --watch\"",
1414
"lint": "eslint src --ext ts",
1515
"prepublishOnly": "pnpm build"

packages/schema/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"vscode:prepublish": "pnpm bundle",
8181
"vscode:package": "pnpm bundle && vsce package --no-dependencies",
8282
"clean": "rimraf dist",
83-
"build": "pnpm clean && pnpm lint --max-warnings=0 && tsc && copyfiles -F \"bin/*\" dist && copyfiles ./README-global.md ./LICENSE ./package.json dist && renamer --replace \"README.md\" dist/README-global.md && copyfiles -u 1 \"src/res/*\" dist && node build/post-build.js && pnpm pack dist --pack-destination '../../../.build'",
83+
"build": "pnpm clean && pnpm lint --max-warnings=0 && tsc && copyfiles -F \"bin/*\" dist && copyfiles ./README-global.md ./LICENSE ./package.json dist && renamer --replace \"README.md\" dist/README-global.md && copyfiles -u 1 \"src/res/*\" dist && node build/post-build.js && pnpm pack dist --pack-destination ../../../.build",
8484
"bundle": "rimraf bundle && pnpm lint --max-warnings=0 && node build/bundle.js --minify",
8585
"watch": "tsc --watch",
8686
"lint": "eslint src tests --ext ts",

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"scripts": {
77
"clean": "rimraf dist",
88
"lint": "eslint src --ext ts",
9-
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./LICENSE ./README.md dist && pnpm pack dist --pack-destination '../../../.build'",
9+
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./LICENSE ./README.md dist && pnpm pack dist --pack-destination ../../../.build",
1010
"watch": "tsc --watch",
1111
"prepublishOnly": "pnpm build"
1212
},

packages/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"homepage": "https://zenstack.dev",
77
"scripts": {
88
"clean": "rimraf dist",
9-
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination '../../../.build'",
9+
"build": "pnpm lint --max-warnings=0 && pnpm clean && tsc && copyfiles ./package.json ./README.md ./LICENSE dist && pnpm pack dist --pack-destination ../../../.build",
1010
"watch": "tsc --watch",
1111
"lint": "eslint src --ext ts",
1212
"test": "jest",

packages/testtools/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"clean": "rimraf dist",
1313
"lint": "eslint src --ext ts",
14-
"build": "pnpm lint && pnpm clean && tsc && copyfiles ./package.json ./LICENSE ./README.md dist && pnpm pack dist --pack-destination '../../../.build'",
14+
"build": "pnpm lint && pnpm clean && tsc && copyfiles ./package.json ./LICENSE ./README.md dist && pnpm pack dist --pack-destination ../../../.build",
1515
"watch": "tsc --watch",
1616
"prepublishOnly": "pnpm build"
1717
},

packages/testtools/src/db.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
import { Pool } from 'pg';
22

3-
const USERNAME = 'postgres';
4-
const PASSWORD = 'abc123';
3+
const USERNAME = process.env.ZENSTACK_TEST_DB_USER || 'postgres';
4+
const PASSWORD = process.env.ZENSTACK_TEST_DB_PASS || 'abc123';
5+
const CONNECTION_DB = process.env.ZENSTACK_TEST_DB_NAME || 'postgres';
6+
const HOST = process.env.ZENSTACK_TEST_DB_HOST || 'localhost';
7+
const PORT = (process.env.ZENSTACK_TEST_DB_PORT ? parseInt(process.env.ZENSTACK_TEST_DB_PORT) : null) || 5432;
8+
9+
function connect() {
10+
return new Pool({
11+
user: USERNAME,
12+
password: PASSWORD,
13+
database: CONNECTION_DB,
14+
host: HOST,
15+
port: PORT
16+
});
17+
}
518

619
export async function createPostgresDb(db: string) {
7-
const pool = new Pool({ user: USERNAME, password: PASSWORD });
20+
const pool = connect();
821
await pool.query(`DROP DATABASE IF EXISTS "${db}";`);
922
await pool.query(`CREATE DATABASE "${db}";`);
10-
return `postgresql://${USERNAME}:${PASSWORD}@localhost:5432/${db}`;
23+
await pool.end();
24+
return `postgresql://${USERNAME}:${PASSWORD}@${HOST}:${PORT}/${db}`;
1125
}
1226

1327
export async function dropPostgresDb(db: string) {
14-
const pool = new Pool({ user: USERNAME, password: PASSWORD });
28+
const pool = connect();
1529
await pool.query(`DROP DATABASE IF EXISTS "${db}";`);
30+
await pool.end();
1631
}

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)