@famgia/omnify-react-sso 0.0.1
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/README.md +76 -0
- package/dist/index.cjs +503 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +429 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/index.cjs +503 -0
- package/dist/schemas/index.cjs.map +1 -0
- package/dist/schemas/index.d.cts +744 -0
- package/dist/schemas/index.d.ts +744 -0
- package/dist/schemas/index.js +429 -0
- package/dist/schemas/index.js.map +1 -0
- package/package.json +83 -0
- package/scripts/build-schemas.ts +92 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
/**
|
|
3
|
+
* Build script to generate TypeScript types from SSO schemas
|
|
4
|
+
*
|
|
5
|
+
* This script:
|
|
6
|
+
* 1. Copies latest SSO schemas from omnify-client-laravel-sso
|
|
7
|
+
* 2. Runs `npx omnify generate --types-only` to create TypeScript types
|
|
8
|
+
* 3. Outputs to src/schemas/ for bundling
|
|
9
|
+
*
|
|
10
|
+
* Note: schemas/ folder is gitignored - it's refreshed on each build
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { cpSync, existsSync, mkdirSync, rmSync, readdirSync } from 'fs';
|
|
14
|
+
import { execSync } from 'child_process';
|
|
15
|
+
import { resolve, dirname } from 'path';
|
|
16
|
+
import { fileURLToPath } from 'url';
|
|
17
|
+
|
|
18
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
+
const __dirname = dirname(__filename);
|
|
20
|
+
const packageRoot = resolve(__dirname, '..');
|
|
21
|
+
|
|
22
|
+
// Paths
|
|
23
|
+
const ssoSchemasSource = resolve(packageRoot, '../omnify-client-laravel-sso/database/schemas/Sso');
|
|
24
|
+
const schemasTarget = resolve(packageRoot, 'schemas');
|
|
25
|
+
const typesOutput = resolve(packageRoot, 'src/schemas');
|
|
26
|
+
const enumOutput = resolve(packageRoot, 'src/enum');
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
console.log('๐ง Building SSO schema types...');
|
|
30
|
+
console.log('');
|
|
31
|
+
|
|
32
|
+
// 1. Clean previous builds
|
|
33
|
+
console.log('๐งน Cleaning previous builds...');
|
|
34
|
+
if (existsSync(schemasTarget)) {
|
|
35
|
+
rmSync(schemasTarget, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
if (existsSync(typesOutput)) {
|
|
38
|
+
rmSync(typesOutput, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
if (existsSync(enumOutput)) {
|
|
41
|
+
rmSync(enumOutput, { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// 2. Copy latest SSO schemas from laravel-sso
|
|
45
|
+
console.log('๐ฆ Copying latest schemas from omnify-client-laravel-sso...');
|
|
46
|
+
if (!existsSync(ssoSchemasSource)) {
|
|
47
|
+
console.error('โ SSO schemas not found at:', ssoSchemasSource);
|
|
48
|
+
console.error('');
|
|
49
|
+
console.error('Make sure omnify-client-laravel-sso is available at:');
|
|
50
|
+
console.error(' ../omnify-client-laravel-sso/database/schemas/Sso');
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
mkdirSync(schemasTarget, { recursive: true });
|
|
55
|
+
cpSync(ssoSchemasSource, schemasTarget, { recursive: true });
|
|
56
|
+
console.log('โ
Copied SSO schemas to:', schemasTarget);
|
|
57
|
+
|
|
58
|
+
// List copied files
|
|
59
|
+
const schemaFiles = readdirSync(schemasTarget).filter(f => f.endsWith('.yaml') || f.endsWith('.yml'));
|
|
60
|
+
console.log(` Found ${schemaFiles.length} schema files:`);
|
|
61
|
+
schemaFiles.forEach(f => console.log(` - ${f}`));
|
|
62
|
+
console.log('');
|
|
63
|
+
|
|
64
|
+
// 3. Generate TypeScript types using omnify CLI
|
|
65
|
+
console.log('โ๏ธ Running omnify generate --types-only...');
|
|
66
|
+
try {
|
|
67
|
+
execSync('npx omnify generate --types-only', {
|
|
68
|
+
cwd: packageRoot,
|
|
69
|
+
stdio: 'inherit',
|
|
70
|
+
env: {
|
|
71
|
+
...process.env,
|
|
72
|
+
OMNIFY_SKIP_POSTINSTALL: '1',
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log('โ
TypeScript types generated successfully');
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error('โ Failed to generate TypeScript types');
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
console.log('');
|
|
83
|
+
console.log('โจ Done!');
|
|
84
|
+
console.log('');
|
|
85
|
+
console.log('๐ Note: schemas/ folder is gitignored.');
|
|
86
|
+
console.log(' It will be refreshed from laravel-sso on each build.');
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
main().catch((error) => {
|
|
90
|
+
console.error(error);
|
|
91
|
+
process.exit(1);
|
|
92
|
+
});
|