zitejs 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/auth/index.js +0 -8
- package/dist/cjs/check/index.js +74 -0
- package/dist/cjs/cli.js +7 -1
- package/dist/esm/auth/index.d.ts +1 -13
- package/dist/esm/auth/index.js +1 -6
- package/dist/esm/check/index.d.ts +1 -0
- package/dist/esm/check/index.js +71 -0
- package/dist/esm/cli.js +7 -1
- package/package.json +11 -16
package/dist/cjs/auth/index.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAuth = useAuth;
|
|
4
|
-
exports.getCurrentUser = getCurrentUser;
|
|
5
|
-
function useAuth() {
|
|
6
|
-
throw new Error('useAuth() is only available in the Zite runtime.');
|
|
7
|
-
}
|
|
8
|
-
function getCurrentUser() {
|
|
9
|
-
throw new Error('getCurrentUser() is only available in the Zite runtime.');
|
|
10
|
-
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCheck = runCheck;
|
|
4
|
+
const child_process_1 = require("child_process");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function findAppDirs() {
|
|
8
|
+
const appsDir = 'apps';
|
|
9
|
+
if (!(0, fs_1.existsSync)(appsDir))
|
|
10
|
+
return [];
|
|
11
|
+
return (0, fs_1.readdirSync)(appsDir, { withFileTypes: true })
|
|
12
|
+
.filter(d => d.isDirectory())
|
|
13
|
+
.map(d => d.name);
|
|
14
|
+
}
|
|
15
|
+
function run(cmd, cwd) {
|
|
16
|
+
try {
|
|
17
|
+
const output = (0, child_process_1.execSync)(cmd, {
|
|
18
|
+
cwd,
|
|
19
|
+
encoding: 'utf-8',
|
|
20
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
21
|
+
});
|
|
22
|
+
return { ok: true, output };
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
const e = err;
|
|
26
|
+
return { ok: false, output: (e.stderr ?? '') + (e.stdout ?? '') };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async function runCheck() {
|
|
30
|
+
const appDirs = findAppDirs();
|
|
31
|
+
if (appDirs.length === 0) {
|
|
32
|
+
console.error('No apps found in apps/ directory.');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
let allPassed = true;
|
|
36
|
+
for (const app of appDirs) {
|
|
37
|
+
const appPath = (0, path_1.join)('apps', app);
|
|
38
|
+
console.log(`\n── ${app} ──`);
|
|
39
|
+
const tsconfigPath = (0, path_1.join)(appPath, 'tsconfig.json');
|
|
40
|
+
if ((0, fs_1.existsSync)(tsconfigPath)) {
|
|
41
|
+
process.stdout.write(' tsc --noEmit ... ');
|
|
42
|
+
const tsc = run(`npx tsc --noEmit -p ${tsconfigPath}`, '.');
|
|
43
|
+
if (tsc.ok) {
|
|
44
|
+
console.log('✓');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log('✗');
|
|
48
|
+
console.log(tsc.output.trim().split('\n').map(l => ` ${l}`).join('\n'));
|
|
49
|
+
allPassed = false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const viteConfig = (0, path_1.join)(appPath, 'vite.config.ts');
|
|
53
|
+
if ((0, fs_1.existsSync)(viteConfig)) {
|
|
54
|
+
process.stdout.write(' vite build ... ');
|
|
55
|
+
const vite = run('npx vite build', appPath);
|
|
56
|
+
if (vite.ok) {
|
|
57
|
+
console.log('✓');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.log('✗');
|
|
61
|
+
console.log(vite.output.trim().split('\n').map(l => ` ${l}`).join('\n'));
|
|
62
|
+
allPassed = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log('');
|
|
67
|
+
if (allPassed) {
|
|
68
|
+
console.log('All apps pass.');
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
console.log('Some apps failed.');
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
package/dist/cjs/cli.js
CHANGED
|
@@ -50,14 +50,20 @@ async function main() {
|
|
|
50
50
|
await runDev();
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
|
+
case 'check': {
|
|
54
|
+
const { runCheck } = await Promise.resolve().then(() => __importStar(require('./check/index.js')));
|
|
55
|
+
await runCheck();
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
53
58
|
default:
|
|
54
59
|
console.error(command
|
|
55
60
|
? `Unknown command: ${command}`
|
|
56
|
-
: 'Usage: zitejs <sync|dev>');
|
|
61
|
+
: 'Usage: zitejs <sync|dev|check>');
|
|
57
62
|
console.error('');
|
|
58
63
|
console.error('Commands:');
|
|
59
64
|
console.error(' sync Generate .zite/db.ts and .zite/api.ts from your database schema');
|
|
60
65
|
console.error(' dev Run sync then watch for changes (like npx convex dev)');
|
|
66
|
+
console.error(' check Run tsc --noEmit and vite build for all apps');
|
|
61
67
|
process.exit(1);
|
|
62
68
|
}
|
|
63
69
|
}
|
package/dist/esm/auth/index.d.ts
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
id: string;
|
|
3
|
-
email?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
[key: string]: unknown;
|
|
6
|
-
}
|
|
7
|
-
export declare function useAuth(): {
|
|
8
|
-
user: ZiteUser | null;
|
|
9
|
-
isLoading: boolean;
|
|
10
|
-
authLoading: boolean;
|
|
11
|
-
logout: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare function getCurrentUser(): ZiteUser | null;
|
|
1
|
+
export {};
|
package/dist/esm/auth/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCheck(): Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
2
|
+
import { existsSync, readdirSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
function findAppDirs() {
|
|
5
|
+
const appsDir = 'apps';
|
|
6
|
+
if (!existsSync(appsDir))
|
|
7
|
+
return [];
|
|
8
|
+
return readdirSync(appsDir, { withFileTypes: true })
|
|
9
|
+
.filter(d => d.isDirectory())
|
|
10
|
+
.map(d => d.name);
|
|
11
|
+
}
|
|
12
|
+
function run(cmd, cwd) {
|
|
13
|
+
try {
|
|
14
|
+
const output = execSync(cmd, {
|
|
15
|
+
cwd,
|
|
16
|
+
encoding: 'utf-8',
|
|
17
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
18
|
+
});
|
|
19
|
+
return { ok: true, output };
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
const e = err;
|
|
23
|
+
return { ok: false, output: (e.stderr ?? '') + (e.stdout ?? '') };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function runCheck() {
|
|
27
|
+
const appDirs = findAppDirs();
|
|
28
|
+
if (appDirs.length === 0) {
|
|
29
|
+
console.error('No apps found in apps/ directory.');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
let allPassed = true;
|
|
33
|
+
for (const app of appDirs) {
|
|
34
|
+
const appPath = join('apps', app);
|
|
35
|
+
console.log(`\n── ${app} ──`);
|
|
36
|
+
const tsconfigPath = join(appPath, 'tsconfig.json');
|
|
37
|
+
if (existsSync(tsconfigPath)) {
|
|
38
|
+
process.stdout.write(' tsc --noEmit ... ');
|
|
39
|
+
const tsc = run(`npx tsc --noEmit -p ${tsconfigPath}`, '.');
|
|
40
|
+
if (tsc.ok) {
|
|
41
|
+
console.log('✓');
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
console.log('✗');
|
|
45
|
+
console.log(tsc.output.trim().split('\n').map(l => ` ${l}`).join('\n'));
|
|
46
|
+
allPassed = false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
const viteConfig = join(appPath, 'vite.config.ts');
|
|
50
|
+
if (existsSync(viteConfig)) {
|
|
51
|
+
process.stdout.write(' vite build ... ');
|
|
52
|
+
const vite = run('npx vite build', appPath);
|
|
53
|
+
if (vite.ok) {
|
|
54
|
+
console.log('✓');
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
console.log('✗');
|
|
58
|
+
console.log(vite.output.trim().split('\n').map(l => ` ${l}`).join('\n'));
|
|
59
|
+
allPassed = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
console.log('');
|
|
64
|
+
if (allPassed) {
|
|
65
|
+
console.log('All apps pass.');
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.log('Some apps failed.');
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
}
|
package/dist/esm/cli.js
CHANGED
|
@@ -15,14 +15,20 @@ async function main() {
|
|
|
15
15
|
await runDev();
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
|
+
case 'check': {
|
|
19
|
+
const { runCheck } = await import('./check/index.js');
|
|
20
|
+
await runCheck();
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
18
23
|
default:
|
|
19
24
|
console.error(command
|
|
20
25
|
? `Unknown command: ${command}`
|
|
21
|
-
: 'Usage: zitejs <sync|dev>');
|
|
26
|
+
: 'Usage: zitejs <sync|dev|check>');
|
|
22
27
|
console.error('');
|
|
23
28
|
console.error('Commands:');
|
|
24
29
|
console.error(' sync Generate .zite/db.ts and .zite/api.ts from your database schema');
|
|
25
30
|
console.error(' dev Run sync then watch for changes (like npx convex dev)');
|
|
31
|
+
console.error(' check Run tsc --noEmit and vite build for all apps');
|
|
26
32
|
process.exit(1);
|
|
27
33
|
}
|
|
28
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zitejs",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "The Zite framework — build apps on Zite Database",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/runtime/index.js",
|
|
@@ -22,31 +22,16 @@
|
|
|
22
22
|
"require": "./dist/cjs/caller/index.js",
|
|
23
23
|
"default": "./dist/esm/caller/index.js"
|
|
24
24
|
},
|
|
25
|
-
"./db": {
|
|
26
|
-
"types": "./dist/esm/db/index.d.ts",
|
|
27
|
-
"import": "./dist/esm/db/index.js",
|
|
28
|
-
"require": "./dist/cjs/db/index.js"
|
|
29
|
-
},
|
|
30
25
|
"./runtime": {
|
|
31
26
|
"types": "./dist/esm/runtime/index.d.ts",
|
|
32
27
|
"import": "./dist/esm/runtime/index.js",
|
|
33
28
|
"require": "./dist/cjs/runtime/index.js"
|
|
34
29
|
},
|
|
35
|
-
"./api": {
|
|
36
|
-
"types": "./dist/esm/api/index.d.ts",
|
|
37
|
-
"import": "./dist/esm/api/index.js",
|
|
38
|
-
"require": "./dist/cjs/api/index.js"
|
|
39
|
-
},
|
|
40
30
|
"./backend": {
|
|
41
31
|
"types": "./dist/esm/backend/index.d.ts",
|
|
42
32
|
"import": "./dist/esm/backend/index.js",
|
|
43
33
|
"require": "./dist/cjs/backend/index.js"
|
|
44
34
|
},
|
|
45
|
-
"./auth": {
|
|
46
|
-
"types": "./dist/esm/auth/index.d.ts",
|
|
47
|
-
"import": "./dist/esm/auth/index.js",
|
|
48
|
-
"require": "./dist/cjs/auth/index.js"
|
|
49
|
-
},
|
|
50
35
|
"./upload": {
|
|
51
36
|
"types": "./dist/esm/upload/index.d.ts",
|
|
52
37
|
"import": "./dist/esm/upload/index.js",
|
|
@@ -78,8 +63,18 @@
|
|
|
78
63
|
"files": [
|
|
79
64
|
"dist"
|
|
80
65
|
],
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": ">=18"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"react": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
81
74
|
"devDependencies": {
|
|
82
75
|
"@types/node": "^25.9.1",
|
|
76
|
+
"@types/react": "^19.0.0",
|
|
77
|
+
"react": "^19.0.0",
|
|
83
78
|
"typescript": "^5.4.0",
|
|
84
79
|
"vitest": "^3.0.0"
|
|
85
80
|
},
|