Skip to content

Commit b8dbed4

Browse files
authored
Merge pull request #4 from zenstack-hq/feat/code-gen
feat: implement runtime code generation and refine zmodel schema
2 parents e697066 + 0233926 commit b8dbed4

File tree

141 files changed

+15294
-2388
lines changed

Some content is hidden

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

141 files changed

+15294
-2388
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
auto-install-peers=true
2+
git-checks=false

.vscode/launch.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55
{
66
"version": "0.2.0",
77
"configurations": [
8+
{
9+
"name": "Generate for Todo Sample",
10+
"program": "${workspaceFolder}/packages/schema/bin/cli",
11+
"cwd": "${workspaceFolder}/samples/todo/",
12+
"args": [
13+
"generate",
14+
"${workspaceFolder}/samples/todo/schema.zmodel",
15+
"--destination",
16+
"${workspaceFolder}/samples/todo/.zenstack"
17+
],
18+
"request": "launch",
19+
"skipFiles": ["<node_internals>/**"],
20+
"type": "node"
21+
},
822
{
923
"name": "Attach",
1024
"port": 9229,

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
"version": "1.0.0",
44
"description": "",
55
"main": "index.js",
6-
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
8-
},
6+
"scripts": {},
97
"keywords": [],
108
"author": "",
119
"license": "ISC"

packages/internal/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/lib
2+
/tests/coverage/

packages/internal/jest.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* For a detailed explanation regarding each configuration property and type check, visit:
3+
* https://jestjs.io/docs/configuration
4+
*/
5+
6+
import tsconfig from './tsconfig.json';
7+
const moduleNameMapper = require('tsconfig-paths-jest')(tsconfig);
8+
9+
export default {
10+
// Automatically clear mock calls, instances, contexts and results before every test
11+
clearMocks: true,
12+
13+
// Indicates whether the coverage information should be collected while executing the test
14+
collectCoverage: true,
15+
16+
// The directory where Jest should output its coverage files
17+
coverageDirectory: 'tests/coverage',
18+
19+
// An array of regexp pattern strings used to skip coverage collection
20+
coveragePathIgnorePatterns: ['/node_modules/', '/tests/'],
21+
22+
// Indicates which provider should be used to instrument code for coverage
23+
coverageProvider: 'v8',
24+
25+
// A list of reporter names that Jest uses when writing coverage reports
26+
coverageReporters: ['json', 'text', 'lcov', 'clover'],
27+
28+
// A map from regular expressions to paths to transformers
29+
transform: { '^.+\\.tsx?$': 'ts-jest' },
30+
31+
moduleNameMapper,
32+
};

packages/internal/package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "@zenstackhq/internal",
3+
"version": "0.1.6",
4+
"description": "ZenStack internal runtime library",
5+
"main": "lib/index.js",
6+
"types": "lib/index.d.ts",
7+
"scripts": {
8+
"build": "tsc",
9+
"watch": "tsc --watch",
10+
"test": "jest",
11+
"prepublishOnly": "pnpm build"
12+
},
13+
"keywords": [],
14+
"author": "",
15+
"license": "ISC",
16+
"files": [
17+
"lib/**/*"
18+
],
19+
"dependencies": {
20+
"bcryptjs": "^2.4.3",
21+
"deepcopy": "^2.1.0",
22+
"swr": "^1.3.0"
23+
},
24+
"peerDependencies": {
25+
"next": "12.3.1",
26+
"react": "^17.0.2 || ^18",
27+
"react-dom": "^17.0.2 || ^18"
28+
},
29+
"devDependencies": {
30+
"@types/bcryptjs": "^2.4.2",
31+
"@types/jest": "^29.0.3",
32+
"@types/node": "^14.18.29",
33+
"jest": "^29.0.3",
34+
"ts-jest": "^29.0.1",
35+
"ts-node": "^10.9.1",
36+
"tsc-alias": "^1.7.0",
37+
"tsconfig-paths-jest": "^0.0.1",
38+
"typescript": "^4.6.2"
39+
}
40+
}

0 commit comments

Comments
 (0)