Skip to content

Commit 6c0137b

Browse files
committed
fix: update test script in package.json files to exit with code 0 for no tests specified
feat: implement UUID generation polyfill in hot-reload.ts for better compatibility
1 parent 56509a3 commit 6c0137b

5 files changed

Lines changed: 18 additions & 6 deletions

File tree

examples/app-crm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dev": "objectstack dev",
1414
"build": "objectstack compile objectstack.config.ts dist/crm.json",
1515
"typecheck": "tsc --noEmit",
16-
"test": "echo \"Error: no test specified\" && exit 1"
16+
"test": "echo \"No test specified\" && exit 0"
1717
},
1818
"dependencies": {
1919
"@objectstack/spec": "workspace:*"

examples/app-host/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"dev": "tsx src/index.ts",
77
"build": "tsc --noEmit",
88
"typecheck": "tsc --noEmit",
9-
"test": "echo \"Error: no test specified\" && exit 1",
9+
"test": "echo \"No test specified\" && exit 0",
1010
"clean": "rm -rf dist node_modules"
1111
},
1212
"dependencies": {

examples/app-react-crud/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dev": "pnpm msw:init && vite",
1010
"build": "pnpm msw:init && tsc && vite build",
1111
"typecheck": "tsc --noEmit",
12-
"test": "echo \"Error: no test specified\" && exit 1",
12+
"test": "echo \"No test specified\" && exit 0",
1313
"preview": "vite preview"
1414
},
1515
"dependencies": {

examples/app-todo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dev": "objectstack dev",
1414
"build": "objectstack compile objectstack.config.ts dist/objectstack.json",
1515
"typecheck": "tsc --noEmit",
16-
"test": "echo \"Error: no test specified\" && exit 1"
16+
"test": "echo \"No test specified\" && exit 0"
1717
},
1818
"dependencies": {
1919
"@objectstack/client": "workspace:*",

packages/core/src/hot-reload.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ import type {
44
} from '@objectstack/spec/system';
55
import type { ObjectLogger } from './logger.js';
66
import type { Plugin } from './types.js';
7-
import { randomUUID } from 'crypto';
7+
8+
// Polyfill for UUID generation to support both Node.js and Browser
9+
const generateUUID = () => {
10+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
11+
return crypto.randomUUID();
12+
}
13+
// Basic UUID v4 fallback
14+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
15+
const r = Math.random() * 16 | 0;
16+
const v = c === 'x' ? r : (r & 0x3 | 0x8);
17+
return v.toString(16);
18+
});
19+
};
820

921
/**
1022
* Plugin State Manager
@@ -40,7 +52,7 @@ class PluginStateManager {
4052
},
4153
};
4254

43-
const snapshotId = randomUUID();
55+
const snapshotId = generateUUID();
4456

4557
switch (config.stateStrategy) {
4658
case 'memory':

0 commit comments

Comments
 (0)