**refactor: consolidate folder structure and improve compatibility**

### Changes:
- **rollup.config.js**:
  - Merged and reformatted `nodeBuiltins` definition for cleaner code.
  - Updated `input` path from `examples/browser_compatible_exports.ts` to `demo/browser_compatible_exports.ts`.
  - Reformatted `replace` plugin configuration for better readability.

- **.github/workflows/deploy-demo.yml**:
  - Updated deployment folder from `examples` to `demo`.

- **Renamed**:
  - `examples/browser_compatible_exports.ts` → `demo/browser_compatible_exports.ts`.

- **scripts/generate-version.js**:
  - Removed unnecessary semicolons for consistent formatting.

### Purpose:
Aligned folder structure by migrating from `examples` to `demo` for uniformity and better organization. Improved code readability and formatting across configurations and scripts.
This commit is contained in:
David Snelling 2025-06-23 10:58:48 -07:00
parent 151aeb1e87
commit 37c4da58f7
4 changed files with 34 additions and 37 deletions

View file

@ -11,12 +11,7 @@ const nodeModuleShims = () => {
name: 'node-module-shims',
resolveId(source) {
// List of Node.js built-in modules to shim
const nodeBuiltins = [
'fs',
'path',
'util',
'child_process'
]
const nodeBuiltins = ['fs', 'path', 'util', 'child_process']
if (nodeBuiltins.includes(source)) {
// Return a virtual module ID for the shim
@ -99,7 +94,7 @@ globalThis.__ENV__ = {
`
},
browser: {
input: 'examples/browser_compatible_exports.ts',
input: 'demo/browser_compatible_exports.ts',
outputPrefix: 'brainy',
tsconfig: './tsconfig.browser.json',
declaration: false,
@ -135,12 +130,14 @@ export default {
],
plugins: [
// Add environment replacement for unified build
...(buildType === 'unified' ? [
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production')
})
] : []),
...(buildType === 'unified'
? [
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify('production')
})
]
: []),
// Add our custom plugins
fixThisReferences(),
nodeModuleShims(),