chore: initialize @limitless/ui git repo + add AppShell
This brings the long-untracked @limitless/ui source tree under version
control. Until now /srv/k8s/templates/limitless-ui has been a plain
file: dependency consumed by gscChronos / gscCRM / gscAdmin, with
copies scattered across web/gsc{Portal,WWW,Aether,Register}/ and
apps/gsc{Meet,Share}/. None were git-tracked.
Treating /srv/k8s/templates/limitless-ui as the canonical going
forward; secondary copies should be replaced with this version
in their consumers' Dockerfiles when they next get touched.
Changes in this initial commit beyond the snapshot:
- Add src/layout/AppShell.tsx — runtime-loaded chrome (header,
sidebar, footer) backed by gsc-shell-api. Public surface:
AppShell, ShellProvider, useShell, ShellConfig types
Framework-agnostic (no Next.js dep). Apps pass appKey + apiUrl +
getToken; AppShell composes the existing PageShell / Navbar /
Sidebar / Footer primitives with API data.
- Re-export AppShell from src/index.ts.
- Fix build script: `tsc -p tsconfig.json --noEmit false`. The bare
`tsc` command was a no-op because tsconfig.json sets noEmit:true
for typecheck speed. Existing dist/ only existed because of an
earlier emit; clean rebuilds were silently broken.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
66
scripts/postbuild.cjs
Normal file
66
scripts/postbuild.cjs
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Post-build: copy CSS and fix ESM import extensions */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const distDir = path.join(__dirname, '..', 'dist');
|
||||
|
||||
// Copy CSS
|
||||
const cssSrc = path.join(__dirname, '..', 'src', 'styles.css');
|
||||
const cssDest = path.join(distDir, 'styles.css');
|
||||
fs.copyFileSync(cssSrc, cssDest);
|
||||
|
||||
// Fix ESM imports by adding .js extensions
|
||||
function fixImports(dir) {
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
fixImports(fullPath);
|
||||
} else if (entry.name.endsWith('.js')) {
|
||||
let content = fs.readFileSync(fullPath, 'utf8');
|
||||
|
||||
// Function to determine the correct extension
|
||||
const addExtension = (match, prefix, importPath, quote) => {
|
||||
// Check if the import path already has .js extension
|
||||
if (importPath.endsWith('.js')) {
|
||||
return match;
|
||||
}
|
||||
|
||||
// Check if this is a directory with an index.js
|
||||
const baseDir = path.dirname(fullPath);
|
||||
const targetPath = path.resolve(baseDir, importPath);
|
||||
|
||||
// Check if it's a directory with index.js
|
||||
if (fs.existsSync(targetPath) && fs.statSync(targetPath).isDirectory()) {
|
||||
if (fs.existsSync(path.join(targetPath, 'index.js'))) {
|
||||
return `${prefix}${importPath}/index.js${quote}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if adding .js makes it a valid file
|
||||
if (fs.existsSync(targetPath + '.js')) {
|
||||
return `${prefix}${importPath}.js${quote}`;
|
||||
}
|
||||
|
||||
return match;
|
||||
};
|
||||
|
||||
// Fix 'from' imports
|
||||
content = content.replace(
|
||||
/(from\s+['"])(\.\.?\/[^'"]+)(['"])/g,
|
||||
addExtension
|
||||
);
|
||||
|
||||
// Fix 'export * from' statements
|
||||
content = content.replace(
|
||||
/(export\s+\*\s+from\s+['"])(\.\.?\/[^'"]+)(['"])/g,
|
||||
addExtension
|
||||
);
|
||||
|
||||
fs.writeFileSync(fullPath, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fixImports(distDir);
|
||||
console.log('Post-build: CSS copied and ESM imports fixed');
|
||||
Reference in New Issue
Block a user