@nlabs/lex 2.0.3 → 2.0.5

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 CHANGED
@@ -10,24 +10,24 @@ Lex is the all-in-one development CLI that eliminates the complexity of modern R
10
10
 
11
11
  [![npm version](https://img.shields.io/npm/v/@nlabs/lex.svg?style=flat-square)](https://www.npmjs.com/package/@nlabs/lex)
12
12
  [![npm downloads](https://img.shields.io/npm/dm/@nlabs/lex.svg?style=flat-square)](https://www.npmjs.com/package/@nlabs/lex)
13
- [![Issues](http://img.shields.io/github/issues/nitrogenlabs/lex.svg?style=flat-square)](https://github.com/nitrogenlabs/lex/issues)
14
- [![TypeScript](https://badges.frapsoft.com/typescript/version/typescript-next.svg?v=101)](https://github.com/ellerbrock/typescript-badges/)
15
- [![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://opensource.org/licenses/MIT)
13
+ [![Documentation](https://img.shields.io/badge/docs-lex.nitrogenx.co-6d28d9?style=flat-square)](https://lex.nitrogenx.co)
14
+ [![Issues](https://img.shields.io/github/issues/nitrogenlabs/lex.svg?style=flat-square)](https://github.com/nitrogenlabs/lex/issues)
15
+ [![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)
16
16
  [![Chat](https://img.shields.io/discord/446122412715802649.svg)](https://discord.gg/nitrogenlabs)
17
17
 
18
18
  ## Why Lex?
19
19
 
20
20
  ### **Zero Configuration**
21
21
 
22
- - Works out of the box with any React project
22
+ - Provides conventions and defaults for React 19 projects
23
23
  - Vite-powered web builds with no required bundler config
24
24
  - No testing setup to configure
25
25
  - No build tools to manage
26
26
 
27
27
  ### **Lightning Fast**
28
28
 
29
- - SWC-powered compilation (10-100x faster than Babel)
30
- - Hot reloading development server
29
+ - SWC-powered TypeScript and JavaScript compilation
30
+ - Fast Vite development server
31
31
  - Optimized production builds
32
32
  - Parallel test execution
33
33
 
@@ -47,6 +47,8 @@ Lex is the all-in-one development CLI that eliminates the complexity of modern R
47
47
 
48
48
  ## Quick Start
49
49
 
50
+ Lex 2 requires Node.js 22 or newer.
51
+
50
52
  ```bash
51
53
  # Install Lex globally
52
54
  npm install -g @nlabs/lex
@@ -71,15 +73,16 @@ lex build --mode production
71
73
 
72
74
  Lex comes with everything you need for modern React development:
73
75
 
74
- | Tool | Purpose | Version |
75
- |------|---------|---------|
76
- | **SWC** | Lightning-fast TypeScript/JavaScript compiler | Latest |
77
- | **Vitest** | Testing framework | Latest |
78
- | **TypeScript** | Type safety | Latest |
79
- | **Vite** | Web development and production bundling | Latest |
80
- | **Storybook** | Component development | Latest |
81
- | **PostCSS** | CSS processing | Latest |
82
- | **ESLint** | Code linting | Latest |
76
+ | Tool | Purpose |
77
+ |------|---------|
78
+ | **SWC** | TypeScript/JavaScript compilation and Vite source transforms |
79
+ | **Vitest** | Unit and integration testing |
80
+ | **Playwright** | End-to-end testing |
81
+ | **TypeScript** | Type checking and declarations |
82
+ | **Vite** | Web development and production bundling |
83
+ | **Storybook** | React component development with Vite |
84
+ | **PostCSS and Tailwind CSS 4** | CSS processing |
85
+ | **ESLint** | Code linting |
83
86
 
84
87
  ## Commands Overview
85
88
 
@@ -87,59 +90,59 @@ Lex comes with everything you need for modern React development:
87
90
 
88
91
  | Command | Description | Quick Example |
89
92
  |---------|-------------|---------------|
90
- | [`lex init`](#init) | Create new React applications | `lex init my-app --typescript` |
91
- | [`lex create`](#create) | Generate project assets | `lex create view Dashboard` |
92
- | [`lex migrate`](#migrate) | Migrate existing projects | `lex migrate` |
93
+ | [`lex init`](src/commands/init/init.docs.md) | Create new React applications | `lex init my-app --typescript` |
94
+ | [`lex create`](src/commands/create/create.docs.md) | Generate project assets | `lex create view --outputName Dashboard` |
95
+ | [`lex migrate`](src/commands/migrate/migrate.docs.md) | Remove conflicting toolchain packages and reinstall | `lex migrate` |
93
96
 
94
97
  ### **Development**
95
98
 
96
99
  | Command | Description | Quick Example |
97
100
  |---------|-------------|---------------|
98
- | [`lex dev`](#dev) | Start development server | `lex dev --open` |
99
- | [`lex serverless-dev`](#serverless-dev) | Start serverless development server | `lex serverless-dev --host 0.0.0.0` |
100
- | [`lex compile`](#compile) | Compile TypeScript/JavaScript | `lex compile --watch` |
101
- | [`lex build`](#build) | Build for production | `lex build --mode production` |
101
+ | [`lex dev`](src/commands/dev/dev.docs.md) | Start the Vite development server | `lex dev --open` |
102
+ | [`lex serverless-dev`](src/commands/serverless-dev/serverless-dev.docs.md) | Start the local Lambda server | `lex serverless-dev --host 0.0.0.0` |
103
+ | [`lex serverless-deploy`](src/commands/serverless-deploy/serverless-deploy.docs.md) | Bundle and package a Lambda function | `lex serverless-deploy --entry src/handler.ts` |
104
+ | [`lex compile`](src/commands/compile/compile.docs.md) | Compile TypeScript/JavaScript with SWC | `lex compile --watch` |
105
+ | [`lex build`](src/commands/build/build.docs.md) | Build with Vite or SWC | `lex build --mode production` |
102
106
 
103
107
  ### **Testing & Quality**
104
108
 
105
109
  | Command | Description | Quick Example |
106
110
  |---------|-------------|---------------|
107
- | [`lex test`](#test) | Run Vitest tests | `lex test --watch` |
108
- | [`lex lint`](#lint) | Lint code with ESLint | `lex lint --fix` |
109
- | [`lex storybook`](#storybook) | Start Storybook | `lex storybook --open` |
111
+ | [`lex test`](src/commands/test/test.docs.md) | Run Vitest and Playwright tests | `lex test --unit` |
112
+ | [`lex lint`](src/commands/lint/lint.docs.md) | Lint code with ESLint | `lex lint --fix` |
113
+ | [`lex storybook`](src/commands/storybook/storybook.docs.md) | Start Storybook with React Vite defaults | `lex storybook --open` |
110
114
 
111
115
  ### **AI-Powered Features**
112
116
 
113
117
  | Command | Description | Quick Example |
114
118
  |---------|-------------|---------------|
115
- | [`lex ai`](#ai) | AI code assistance | `lex ai --task generate --prompt "Create a button component"` |
116
- | [`lex test`](#test) | AI test generation | `lex test --generate` |
117
- | [`lex build`](#build) | AI error fixing | `lex build --assist` |
119
+ | [`lex ai`](src/commands/ai/ai.docs.md) | AI code assistance | `lex ai --task generate --prompt "Create a button component"` |
120
+ | [`lex test`](src/commands/test/test.docs.md) | AI test generation | `lex test --generate` |
121
+ | [`lex build`](src/commands/build/build.docs.md) | AI build assistance | `lex build --assist` |
118
122
 
119
123
  ### **Package Management**
120
124
 
121
125
  | Command | Description | Quick Example |
122
126
  |---------|-------------|---------------|
123
- | [`lex update`](#update) | Update dependencies | `lex update --interactive` |
124
- | [`lex upgrade`](#upgrade) | Upgrade Lex itself | `lex upgrade` |
125
- | [`lex publish`](#publish) | Publish to npm | `lex publish --bump minor` |
127
+ | [`lex update`](src/commands/update/update.docs.md) | Update dependencies | `lex update --interactive` |
128
+ | [`lex upgrade`](src/commands/upgrade/upgrade.docs.md) | Upgrade Lex itself | `lex upgrade` |
129
+ | [`lex publish`](src/commands/publish/publish.docs.md) | Publish to npm | `lex publish --bump minor` |
126
130
 
127
131
  ### **Utilities**
128
132
 
129
133
  | Command | Description | Quick Example |
130
134
  |---------|-------------|---------------|
131
- | [`lex clean`](#clean) | Clean project files | `lex clean` |
132
- | [`lex copy`](#copy) | Copy files/directories | `lex copy src lib` |
133
- | [`lex config`](#config) | Show configurations | `lex config vite` |
134
- | [`lex versions`](#versions) | Show tool versions | `lex versions` |
135
- | [`lex link`](#link) | Check linked modules | `lex link` |
135
+ | [`lex clean`](src/commands/clean/clean.docs.md) | Clean project files | `lex clean` |
136
+ | [`lex config`](src/commands/config/config.docs.md) | Show resolved configurations | `lex config vite` |
137
+ | [`lex versions`](src/commands/versions/versions.docs.md) | Show tool versions | `lex versions` |
138
+ | [`lex linked`](src/commands/link/link.docs.md) | Check linked modules | `lex linked` |
136
139
 
137
140
  ## Core Features
138
141
 
139
142
  ### **Development Server**
140
143
 
141
144
  ```bash
142
- # Start with hot reloading
145
+ # Start the Vite development server
143
146
  lex dev --open
144
147
 
145
148
  # With bundle analyzer
@@ -161,6 +164,10 @@ export default {
161
164
 
162
165
  `--port` takes precedence over `dev.port`.
163
166
 
167
+ **Local Network Access**: Lex binds Vite to all network interfaces with `vite.server.host: '0.0.0.0'` and accepts all development hostnames with `vite.server.allowedHosts: true`. Use the private IP printed by `lex dev` or a local hostname such as `http://my-computer.local:4200` from another device on the same trusted network. To limit a project to the current machine, set `vite.server.host` to `'127.0.0.1'` and `vite.server.allowedHosts` to `['localhost']`.
168
+
169
+ **Development Caching**: Lex sends `no-store` response headers and forces Vite to refresh optimized dependencies each time the development server starts. Projects can override these defaults with `vite.server.headers` and `vite.optimizeDeps.force`.
170
+
164
171
  **Public IP Caching**: Lex automatically caches your public IP address for 1 week to reduce API calls. Use `--usePublicIp` to force refresh the cache when needed.
165
172
 
166
173
  **Static Assets**: If your HTML template references static assets with absolute paths, ensure they exist in the configured static directory.
@@ -225,7 +232,7 @@ lex build --analyze
225
232
  lex test
226
233
 
227
234
  # Watch mode
228
- lex test --watch
235
+ lex test --watch src
229
236
 
230
237
  # Generate tests with AI
231
238
  lex test --generate
@@ -241,7 +248,7 @@ lex test --config ./vitest.config.mjs
241
248
 
242
249
  - **Smart Configuration Merging**: Automatically merges your project's Vitest config with Lex's optimized defaults
243
250
  - **ESM Support**: Automatic detection and configuration for ES modules projects
244
- - **Automatic Setup**: Creates vitest.setup.js file if one doesn't exist
251
+ - **Setup Discovery**: Uses `vitest.setup.js` or a path supplied with `--setup` when present
245
252
  - **React JSX Automatic Runtime**: No need to import React in your test files
246
253
  - **TypeScript-First**: Optimized for TypeScript projects with specialized configs
247
254
 
@@ -268,31 +275,21 @@ lex ai --task generate --prompt "Create a user profile component"
268
275
  lex ai --task explain --file src/components/Button.tsx
269
276
 
270
277
  # Fix errors
271
- lex ai --task help --prompt "Fix this TypeScript error"
278
+ lex ai --task explain --prompt "Explain this TypeScript error and suggest a fix"
272
279
  ```
273
280
 
274
281
  ## Framework Support
275
282
 
276
- Lex works seamlessly with popular React frameworks and libraries:
277
-
278
- - ✅ **Create React App** - Migrate existing CRA projects
279
- - ✅ **Next.js** - Use Lex for testing and building
280
- - ✅ **Gatsby** - Integrate Lex workflows
281
- - ✅ **Vite** - Built-in web development and production bundling
282
- - ✅ **TypeScript** - Full TypeScript support out of the box
283
- - ✅ **Tailwind CSS** - Automatic Tailwind integration
284
- - ✅ **Storybook** - Built-in Storybook support
285
- - ✅ **Serverless** - Local AWS Lambda development with HTTP/WebSocket support
283
+ Lex's built-in web pipeline targets React 19 with Vite and Tailwind CSS 4. Lex also provides SWC compilation for Node, Lambda, and mobile targets; Vitest and Playwright test workflows; React Vite Storybook defaults; and local AWS Lambda HTTP, WebSocket, and GraphQL development.
286
284
 
287
285
  ## 🚀 Performance
288
286
 
289
287
  Lex is designed for speed and efficiency:
290
288
 
291
- - **SWC Integration** - 10-100x faster than Babel, faster than esbuild
292
- - **Smart Caching** - Intelligent caching for faster rebuilds
293
- - **Hot Reloading** - Instant feedback during development
289
+ - **Vite Development** - On-demand module transformation during development
290
+ - **SWC Compilation** - Fast non-web compilation and source transformation
294
291
  - **Tree Shaking** - Automatic dead code elimination
295
- - **Code Splitting** - Automatic code splitting for optimal loading
292
+ - **Code Splitting** - Native dynamic-import chunks for web production builds
296
293
 
297
294
  ## Configuration
298
295
 
@@ -311,7 +308,7 @@ export default {
311
308
  // AI configuration
312
309
  ai: {
313
310
  provider: 'openai',
314
- model: 'gpt-4'
311
+ model: 'gpt-4o'
315
312
  },
316
313
 
317
314
  // SWC configuration (defaults to ESM format)
@@ -348,7 +345,7 @@ Lex provides extensive configuration options through the `lex.config.js` file. H
348
345
  | `dev.port` | `number` | `3000` | Default port used by `lex dev` when `--port` is not passed | `dev: { port: 4200 }` |
349
346
  | `outputFile` | `string` | `undefined` | Specific output filename | `outputFile: 'bundle.js'` |
350
347
  | `outputFullPath` | `string` | `path.resolve('./lib')` | Absolute output path for build artifacts and static files. | `outputFullPath: '/absolute/build'` |
351
- | `outputHash` | `boolean` | `false` | Add hash to output filenames | `outputHash: true` |
348
+ | `outputHash` | `boolean` | Production mode | Add hashes to output filenames | `outputHash: true` |
352
349
  | `outputPath` | `string` | `'./lib'` | Output directory path | `outputPath: './build'` |
353
350
  | `packageManager` | `'npm' \| 'yarn'` | `'npm'` | Package manager to use | `packageManager: 'yarn'` |
354
351
  | `preset` | `'web' \| 'node' \| 'lambda' \| 'mobile'` | `'web'` | Project preset type | `preset: 'node'` |
@@ -365,7 +362,7 @@ Lex provides extensive configuration options through the `lex.config.js` file. H
365
362
  |--------|------|---------|-------------|---------|
366
363
  | `ai.apiKey` | `string` | `undefined` | API key for AI provider | `ai: { apiKey: 'sk-...' }` |
367
364
  | `ai.maxTokens` | `number` | `4000` | Maximum tokens for AI responses | `ai: { maxTokens: 8000 }` |
368
- | `ai.model` | `string` | `'gpt-4o'` | AI model to use | `ai: { model: 'gpt-4' }` |
365
+ | `ai.model` | `string` | `'gpt-4o'` | Model identifier passed to the provider | `ai: { model: 'gpt-4o' }` |
369
366
  | `ai.provider` | `'cursor' \| 'copilot' \| 'openai' \| 'anthropic' \| 'none'` | `'none'` | AI service provider | `ai: { provider: 'openai' }` |
370
367
  | `ai.temperature` | `number` | `0.1` | AI response creativity (0-1) | `ai: { temperature: 0.7 }` |
371
368
 
@@ -373,8 +370,7 @@ Lex provides extensive configuration options through the `lex.config.js` file. H
373
370
 
374
371
  SWC (Speedy Web Compiler) powers non-web compilation and Lex's source transformation inside Vite. SWC provides:
375
372
 
376
- - **10-100x faster** compilation than Babel
377
- - **Faster than esbuild** for TypeScript compilation
373
+ - **Fast native compilation** for TypeScript and JavaScript
378
374
  - **Zero configuration** - works out of the box
379
375
  - **ESM by default** - modern module format
380
376
  - **Automatic React JSX** transformation
@@ -385,7 +381,7 @@ SWC is automatically configured and doesn't require additional configuration in
385
381
  | Feature | Description | Default |
386
382
  |---------|-------------|---------|
387
383
  | **Output Format** | JavaScript module format | `esm` |
388
- | **Target** | JavaScript target version | `es2020` |
384
+ | **Target** | JavaScript target version | `es2023` |
389
385
  | **JSX Runtime** | React JSX transformation | `automatic` |
390
386
  | **React Compiler** | Optional React Compiler SWC plugin | `false` |
391
387
  | **Decorators** | TypeScript decorators support | `enabled` |
@@ -466,9 +462,13 @@ Vite is the default for `web` projects. Lex merges the `vite` object with its re
466
462
 
467
463
  | Option | Type | Default | Description | Example |
468
464
  |--------|------|---------|-------------|---------|
465
+ | `vite.server.allowedHosts` | `string[] \| true` | `true` | Hostnames accepted by the development server | `vite: { server: { allowedHosts: ['localhost'] } }` |
466
+ | `vite.server.host` | `string \| boolean` | `'0.0.0.0'` | Network interface used by the development server | `vite: { server: { host: '127.0.0.1' } }` |
469
467
  | `vite.staticPath` | `string` | `'./src/static'` | Static assets copied to the output root | `vite: { staticPath: './assets' }` |
470
468
  | `vite.*` | `Vite UserConfig` | `undefined` | Additional Vite configuration merged with Lex defaults | `vite: { base: '/app/' }` |
471
469
 
470
+ The network defaults are intended for trusted development environments. `allowedHosts: true` disables Vite's host allowlist, while the operating-system firewall controls whether the port is reachable from another device.
471
+
472
472
  Web builds provide dynamic-import code splitting, GraphQL document loading, PostCSS, source maps, and browser shims for `assert`, `buffer`, `http`, `https`, `os`, `path`, `process`, `stream`, `util`, and `vm`. `crypto` remains an empty browser shim, matching the previous Lex behavior.
473
473
 
474
474
  Lex also processes these conventional asset locations:
@@ -476,11 +476,11 @@ Lex also processes these conventional asset locations:
476
476
  | Source | Output | Behavior |
477
477
  |--------|--------|----------|
478
478
  | `vite.staticPath` | Output root | Recursively copied |
479
- | `src/images` | `images` | Copied and optimized |
480
- | `src/fonts` | `fonts` | Copied |
481
- | `src/docs` | `docs` | Copied |
482
- | `src/icons/*.svg` | `icons/icons.svg` | Combined into an optimized SVG sprite |
483
- | `src/images/logo.png` | Output root | Generates favicons, manifests, `open-graph.png`, and `twitter.png` |
479
+ | `<sourcePath>/images` | `images` | Copied and optimized |
480
+ | `<sourcePath>/fonts` | `fonts` | Copied |
481
+ | `<sourcePath>/docs` | `docs` | Copied |
482
+ | `<sourcePath>/icons/*.svg` | `icons/icons.svg` | Combined into an optimized SVG sprite |
483
+ | `<sourcePath>/images/logo.png` | Output root | Generates favicons, manifests, `open-graph.png`, and `twitter.png` |
484
484
 
485
485
  Production builds optimize GIF, JPEG, PNG, SVG, and WebP assets. Compressible CSS, HTML, JavaScript, JSON, SVG, text, and XML files of at least 8 KiB receive a `.gz` sidecar.
486
486
 
@@ -488,18 +488,18 @@ Production builds optimize GIF, JPEG, PNG, SVG, and WebP assets. Compressible CS
488
488
 
489
489
  Lex 2 is a breaking migration from Webpack to Vite for web projects. Non-web projects use SWC.
490
490
 
491
+ Follow the **[Lex 1 to Lex 2 migration guide](MIGRATION_V2.md)** for the complete upgrade process, including dependency cleanup, configuration mapping, dynamic imports, environment variables, polyfills, assets, Storybook, validation, and troubleshooting.
492
+
491
493
  Update the configuration property:
492
494
 
493
495
  ```javascript
494
- // Lex 1.x
495
- export default {
496
+ const lex1Config = {
496
497
  webpack: {
497
498
  staticPath: './src/static'
498
499
  }
499
500
  };
500
501
 
501
- // Lex 2.x
502
- export default {
502
+ const lex2Config = {
503
503
  vite: {
504
504
  staticPath: './src/static'
505
505
  }
@@ -524,7 +524,6 @@ export default {
524
524
 
525
525
  | Option | Type | Default | Description | Example |
526
526
  |--------|------|---------|-------------|---------|
527
- | `configFiles` | `string[]` | `[]` | Additional config files to include | `configFiles: ['./config/custom.js']` |
528
527
  | `copyFiles` | `string[]` | `[]` | Files to copy during build | `copyFiles: ['public/assets']` |
529
528
  | `env` | `object` | `null` | Environment variables | `env: { NODE_ENV: 'development' }` |
530
529
  | `gitUrl` | `string` | `undefined` | Git repository URL | `gitUrl: 'https://github.com/user/repo'` |
@@ -564,7 +563,7 @@ export default {
564
563
  ai: {
565
564
  provider: 'openai',
566
565
  apiKey: process.env.OPENAI_API_KEY,
567
- model: 'gpt-4',
566
+ model: 'gpt-4o',
568
567
  maxTokens: 8000,
569
568
  temperature: 0.3
570
569
  },
@@ -634,10 +633,7 @@ export default {
634
633
 
635
634
  If static assets return 404, verify that `vite.staticPath` exists and points to the intended directory.
636
635
 
637
- **Solution**: The `outputFullPath` directory should exist before starting the dev server. You can:
638
-
639
- - Run `lex build` first to create the output directory
640
- - Or ensure your `outputPath` configuration points to an existing directory
636
+ **Solution**: Put pass-through files in `vite.staticPath` (default: `src/static`) or use the conventional `images`, `fonts`, `docs`, and `icons` directories under `sourcePath`. Vite serves these source assets directly during development.
641
637
 
642
638
  #### Port Already in Use
643
639
 
@@ -650,7 +646,7 @@ If you get an "address already in use" error, another process is using the defau
650
646
  lsof -ti:3000 | xargs kill -9
651
647
 
652
648
  # Or use a different port
653
- lex dev --port 3000
649
+ lex dev --port 3001
654
650
  ```
655
651
 
656
652
  #### TypeScript Configuration Issues
@@ -672,35 +668,17 @@ If TypeScript compilation fails, ensure your `tsconfig.json` is properly configu
672
668
 
673
669
  #### Missing Static Assets Error
674
670
 
675
- If you see build errors about missing static assets, check that every path referenced by the HTML template exists.
676
-
677
- **Solution**: Either create the missing files or update your HTML template to use relative paths:
678
-
679
- ```html
680
- <!-- Instead of absolute paths -->
681
- <link rel="icon" href="/favicon.ico" />
682
- <link rel="manifest" href="/manifest.json" />
683
-
684
- <!-- Use relative paths -->
685
- <link rel="icon" href="favicon.ico" />
686
- <link rel="manifest" href="manifest.json" />
687
- ```
688
-
689
- Or create the missing files in your source directory:
690
-
691
- ```bash
692
- touch src/favicon.ico
693
- touch src/manifest.json
694
- mkdir -p src/images && touch src/images/logo-icon-64.png
695
- ```
671
+ If an asset referenced by HTML is missing, verify its source location. Files in `vite.staticPath` are served from `/`, while conventional directories retain their output prefix—for example, `<sourcePath>/images/banner.png` becomes `/images/banner.png`. Add `<sourcePath>/images/logo.png` when Lex should generate favicon and social-image assets automatically.
696
672
 
697
673
  ## Documentation
698
674
 
699
- - 📖 **[Full Documentation](http://lex.nitrogenlabs.com)** - Complete API reference
700
- - 🎯 **[Getting Started Guide](http://lex.nitrogenlabs.com/getting-started)** - Step-by-step tutorial
701
- - 🛠️ **[Configuration Guide](http://lex.nitrogenlabs.com/configuration)** - Customization options
702
- - 🤖 **[AI Features Guide](http://lex.nitrogenlabs.com/ai-features)** - AI-powered development
703
- - 🧪 **[Testing Guide](http://lex.nitrogenlabs.com/testing)** - Testing best practices
675
+ - **[Lex 1 to Lex 2 migration guide](MIGRATION_V2.md)**
676
+ - **[Vite build](src/commands/build/build.docs.md)** and **[development server](src/commands/dev/dev.docs.md)**
677
+ - **[Configuration](src/commands/config/config.docs.md)**
678
+ - **[Testing](src/commands/test/test.docs.md)** and **[linting](src/commands/lint/lint.docs.md)**
679
+ - **[Storybook](src/commands/storybook/README.md)**
680
+ - **[Serverless development](src/commands/serverless-dev/serverless-dev.docs.md)** and **[deployment](src/commands/serverless-deploy/serverless-deploy.docs.md)**
681
+ - **[AI commands](src/commands/ai/ai.docs.md)**
704
682
 
705
683
  ## Contributing
706
684
 
package/config.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "syntax": "typescript",
20
20
  "tsx": true
21
21
  },
22
- "target": "es2020",
22
+ "target": "es2023",
23
23
  "transform": {
24
24
  "react": {
25
25
  "runtime": "automatic"
@@ -28,10 +28,7 @@
28
28
  "externalHelpers": false,
29
29
  "keepClassNames": false,
30
30
  "loose": false,
31
- "minify": {
32
- "compress": true,
33
- "mangle": true
34
- }
31
+ "minify": false
35
32
  },
36
33
  "module": {
37
34
  "type": "es6",
@@ -40,8 +37,8 @@
40
37
  "lazy": false,
41
38
  "noInterop": false
42
39
  },
43
- "minify": true,
44
- "sourceMaps": false,
40
+ "minify": false,
41
+ "sourceMaps": "inline",
45
42
  "inlineSourcesContent": true,
46
43
  "isModule": true
47
44
  },
@@ -51,7 +48,6 @@
51
48
  "vitest": {},
52
49
  "outputHash": false,
53
50
  "useGraphQl": false,
54
- "configFiles": [],
55
51
  "copyFiles": [],
56
52
  "entryHTML": "index.html",
57
53
  "entryJs": "index.js",
Binary file
@@ -19,16 +19,13 @@ export default {
19
19
  // Use this section to configure AI features for lint --fix and ai commands
20
20
  ai: {
21
21
  // Available providers: 'cursor', 'copilot', 'openai', 'anthropic', 'none'
22
- provider: 'cursor',
22
+ provider: 'none',
23
23
 
24
24
  // API key for external providers (recommended to use environment variables)
25
25
  // apiKey: process.env.OPENAI_API_KEY,
26
26
 
27
- // Model configuration (specific to each provider)
28
- model: 'cursor-code', // For Cursor IDE
29
- // model: 'copilot-codex', // For GitHub Copilot
30
- // model: 'gpt-4o', // For OpenAI
31
- // model: 'claude-3-sonnet', // For Anthropic
27
+ // Model identifier passed to the selected provider
28
+ model: 'gpt-4o',
32
29
 
33
30
  // Optional parameters
34
31
  maxTokens: 4000,
@@ -57,7 +54,7 @@ export default {
57
54
  },
58
55
 
59
56
  // Target JavaScript version
60
- target: 'es2020', // 'es3', 'es5', 'es2015', 'es2016', 'es2017', 'es2018', 'es2019', 'es2020', 'es2021', 'es2022', 'es2023'
57
+ target: 'es2023',
61
58
 
62
59
  // Transform configuration
63
60
  transform: {
@@ -95,7 +92,7 @@ export default {
95
92
 
96
93
  // Environment configuration (optional)
97
94
  // env: {
98
- // targets: 'node >= 18', // Browser targets or Node.js version
95
+ // targets: 'node >= 22', // Browser targets or Node.js version
99
96
  // mode: 'usage', // 'usage' or 'entry'
100
97
  // coreJs: '3', // Core-js version
101
98
  // debug: false, // Debug mode
@@ -122,7 +119,7 @@ export default {
122
119
  // useTypescript: true,
123
120
  // swc: {
124
121
  // jsc: {
125
- // target: 'es2020',
122
+ // target: 'es2023',
126
123
  // parser: {
127
124
  // syntax: 'typescript',
128
125
  // tsx: true
@@ -136,7 +133,7 @@ export default {
136
133
  // useTypescript: true,
137
134
  // swc: {
138
135
  // jsc: {
139
- // target: 'es2020',
136
+ // target: 'es2023',
140
137
  // parser: {
141
138
  // syntax: 'typescript',
142
139
  // tsx: true,
package/lex.config.js CHANGED
@@ -2,8 +2,7 @@
2
2
  * Lex configuration file
3
3
  * This file contains configuration options for the Lex CLI tool
4
4
  *
5
- * Note: SWC has replaced esbuild as the default transpiler.
6
- * The 'swc' configuration section below replaces the old 'esbuild' configuration.
5
+ * Web projects build with Vite. Non-web projects compile with SWC.
7
6
  */
8
7
 
9
8
  export default {
@@ -20,24 +19,26 @@ export default {
20
19
  // Use this section to configure AI features for lint --fix and ai commands
21
20
  ai: {
22
21
  // Available providers: 'cursor', 'copilot', 'openai', 'anthropic', 'none'
23
- provider: 'cursor',
22
+ provider: 'none',
24
23
 
25
24
  // API key for external providers (recommended to use environment variables)
26
25
  // apiKey: process.env.OPENAI_API_KEY,
27
26
 
28
- // Model configuration (specific to each provider)
29
- model: 'cursor-code', // For Cursor IDE
30
- // model: 'copilot-codex', // For GitHub Copilot
31
- // model: 'gpt-4o', // For OpenAI
32
- // model: 'claude-3-sonnet', // For Anthropic
27
+ // Model identifier passed to the selected provider
28
+ model: 'gpt-4o',
33
29
 
34
30
  // Optional parameters
35
31
  maxTokens: 4000,
36
32
  temperature: 0.1
37
33
  },
38
34
 
39
- // SWC configuration (replaces esbuild)
40
- // SWC is now the default transpiler for all TypeScript/JavaScript compilation
35
+ // Vite configuration for web development and production builds
36
+ vite: {
37
+ base: '/',
38
+ staticPath: './src/static'
39
+ },
40
+
41
+ // SWC configuration for non-web compilation and Vite source transforms
41
42
  swc: {
42
43
  jsc: {
43
44
  parser: {
@@ -46,7 +47,7 @@ export default {
46
47
  decorators: true,
47
48
  dynamicImport: true
48
49
  },
49
- target: 'es2020',
50
+ target: 'es2023',
50
51
  transform: {
51
52
  react: {
52
53
  runtime: 'automatic'