@nlabs/lex 1.48.4 → 1.48.6
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/.vscode/settings.json +1 -1
- package/README.md +293 -22
- package/__mocks__/compare-versions.js +3 -0
- package/__mocks__/fileMock.js +1 -0
- package/__mocks__/latest-version.js +1 -0
- package/__mocks__/react-markdown.js +12 -0
- package/babel.config.json +7 -1
- package/dist/Button.stories.d.ts +19 -0
- package/dist/LexConfig.d.ts +84 -0
- package/dist/LexConfig.js +1 -4
- package/dist/commands/ai/ai.d.ts +17 -0
- package/dist/commands/ai/index.d.ts +8 -0
- package/dist/commands/build/build.d.ts +18 -0
- package/dist/commands/clean/clean.d.ts +7 -0
- package/dist/commands/compile/compile.d.ts +2 -0
- package/dist/commands/config/config.d.ts +7 -0
- package/dist/commands/config/config.js +2 -2
- package/dist/commands/copy/copy.d.ts +6 -0
- package/dist/commands/create/create.d.ts +8 -0
- package/dist/commands/dev/dev.d.ts +11 -0
- package/dist/commands/init/init.d.ts +9 -0
- package/dist/commands/link/link.d.ts +6 -0
- package/dist/commands/lint/autofix.d.ts +2 -0
- package/dist/commands/lint/lint.d.ts +39 -0
- package/dist/commands/migrate/migrate.d.ts +7 -0
- package/dist/commands/publish/publish.d.ts +12 -0
- package/dist/commands/storybook/storybook.d.ts +13 -0
- package/dist/commands/storybook/storybook.js +3 -5
- package/dist/commands/test/test.d.ts +50 -0
- package/dist/commands/test/test.js +75 -11
- package/dist/commands/update/update.d.ts +9 -0
- package/dist/commands/upgrade/upgrade.d.ts +7 -0
- package/dist/commands/versions/versions.d.ts +13 -0
- package/dist/create/changelog.d.ts +6 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +2 -1
- package/dist/lex.d.ts +2 -0
- package/dist/test-react/index.d.ts +6 -0
- package/dist/test-react/index.js +84 -0
- package/dist/types.d.ts +5 -0
- package/dist/utils/aiService.d.ts +9 -0
- package/dist/utils/app.d.ts +45 -0
- package/dist/utils/deepMerge.d.ts +11 -0
- package/dist/utils/deepMerge.js +24 -0
- package/dist/utils/file.d.ts +8 -0
- package/dist/utils/file.js +9 -3
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/reactShim.d.ts +4 -0
- package/dist/utils/reactShim.js +82 -2
- package/jest.config.d.mts +50 -0
- package/jest.config.mjs +66 -0
- package/jest.config.template.cjs +63 -0
- package/jest.setup.template.js +18 -0
- package/package.json +30 -10
- package/tsconfig.build.json +9 -11
- package/tsconfig.json +1 -1
- package/tsconfig.lint.json +3 -3
- package/tsconfig.template.json +2 -2
- package/tsconfig.test.json +3 -3
- package/TYPESCRIPT_CONFIGS.md +0 -103
- package/dist/dist/LexConfig.d.ts +0 -119
- package/dist/dist/utils/file.d.ts +0 -8
- package/dist/dist/utils/log.d.ts +0 -1
- package/dist/jest.config.lex.d.ts +0 -2
- package/jest.config.cjs +0 -43
- package/jest.config.lex.js +0 -118
- package/jest.setup.js +0 -31
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-Present, Nitrogen Labs, Inc.
|
|
3
|
+
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Read Jest config from LEX_CONFIG environment variable if available
|
|
7
|
+
let lexConfig = null;
|
|
8
|
+
if(process.env.LEX_CONFIG) {
|
|
9
|
+
try {
|
|
10
|
+
lexConfig = JSON.parse(process.env.LEX_CONFIG);
|
|
11
|
+
} catch(error) {
|
|
12
|
+
console.warn('Failed to parse LEX_CONFIG:', error.message);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const baseConfig = {
|
|
17
|
+
testEnvironment: 'jsdom',
|
|
18
|
+
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
|
|
19
|
+
moduleNameMapper: {
|
|
20
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
21
|
+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
22
|
+
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js'
|
|
23
|
+
},
|
|
24
|
+
transformIgnorePatterns: [
|
|
25
|
+
'node_modules/(?!(strip-indent|chalk|@testing-library/jest-dom|zod|@nlabs|@nlabs/arkhamjs|@nlabs/utils|@nlabs/lex)/.*)'
|
|
26
|
+
],
|
|
27
|
+
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
|
|
28
|
+
transform: {
|
|
29
|
+
'^.+\\.ts$|^.+\\.tsx$': ['ts-jest', {
|
|
30
|
+
useESM: false,
|
|
31
|
+
tsconfig: 'tsconfig.test.json'
|
|
32
|
+
}],
|
|
33
|
+
'^.+\\.js$|^.+\\.jsx$': ['babel-jest', {
|
|
34
|
+
presets: [
|
|
35
|
+
['@babel/preset-env', {targets: {node: 'current'}}],
|
|
36
|
+
'@babel/preset-react'
|
|
37
|
+
]
|
|
38
|
+
}]
|
|
39
|
+
},
|
|
40
|
+
moduleDirectories: ['node_modules', '<rootDir>'],
|
|
41
|
+
testRegex: '(/__tests__/.*|\\.(test|spec|integration))\\.(ts|tsx|js|jsx)?$',
|
|
42
|
+
collectCoverage: true,
|
|
43
|
+
coverageDirectory: '<rootDir>/coverage',
|
|
44
|
+
coveragePathIgnorePatterns: [
|
|
45
|
+
'/node_modules/',
|
|
46
|
+
'/dist',
|
|
47
|
+
'/lib',
|
|
48
|
+
'__snapshots__',
|
|
49
|
+
'.d.ts'
|
|
50
|
+
],
|
|
51
|
+
coverageReporters: ['html', 'text'],
|
|
52
|
+
verbose: true
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// Merge with Lex config if available
|
|
56
|
+
if(lexConfig && lexConfig.jest) {
|
|
57
|
+
module.exports = {
|
|
58
|
+
...baseConfig,
|
|
59
|
+
...lexConfig.jest
|
|
60
|
+
};
|
|
61
|
+
} else {
|
|
62
|
+
module.exports = baseConfig;
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require('@testing-library/jest-dom');
|
|
2
|
+
|
|
3
|
+
global.ResizeObserver = jest.fn().mockImplementation(() => ({
|
|
4
|
+
observe: jest.fn(),
|
|
5
|
+
unobserve: jest.fn(),
|
|
6
|
+
disconnect: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
global.matchMedia = jest.fn().mockImplementation(query => ({
|
|
10
|
+
matches: false,
|
|
11
|
+
media: query,
|
|
12
|
+
onchange: null,
|
|
13
|
+
addListener: jest.fn(),
|
|
14
|
+
removeListener: jest.fn(),
|
|
15
|
+
addEventListener: jest.fn(),
|
|
16
|
+
removeEventListener: jest.fn(),
|
|
17
|
+
dispatchEvent: jest.fn(),
|
|
18
|
+
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nlabs/lex",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.6",
|
|
4
4
|
"description": "Lex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
".": {
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"require": "./index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./test-react": {
|
|
15
|
+
"types": "./dist/test-react/index.d.ts",
|
|
16
|
+
"import": "./dist/test-react/index.js",
|
|
17
|
+
"require": "./dist/test-react/index.js"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"types": "./dist/index.d.ts",
|
|
@@ -39,12 +44,12 @@
|
|
|
39
44
|
"build": "NODE_ENV=production && rm -rf dist && esbuild $(find src -name '*.ts' -not -name '*.test.ts' -not -name '*.spec.ts') --platform=node --outdir=./dist --sourcemap=inline --target=node22 --format=esm --packages=external && npm run declarations",
|
|
40
45
|
"build:all": "npm run build && npm run build:ai",
|
|
41
46
|
"build:ai": "NODE_ENV=production && esbuild src/commands/ai/*.ts --platform=node --outdir=./dist/commands/ai --sourcemap=inline --target=node22 --format=esm --packages=external",
|
|
42
|
-
"declarations": "tsc
|
|
47
|
+
"declarations": "tsc -p tsconfig.build.json",
|
|
43
48
|
"clean": "rm -rf dist node_modules package-lock.json *.log coverage",
|
|
44
49
|
"compile": "tsc -p tsconfig.build.json",
|
|
45
50
|
"env": "LEX_CONFIG='{\"useTypescript\":true}'",
|
|
46
|
-
"lint": "eslint ./src --fix
|
|
47
|
-
"lint:ai": "node ./dist/lex.js lint --fix
|
|
51
|
+
"lint": "eslint ./src --fix",
|
|
52
|
+
"lint:ai": "node ./dist/lex.js lint --fix",
|
|
48
53
|
"lint:rebuild": "npm run build && npm run lint:ai",
|
|
49
54
|
"prepublishOnly": "npm run build",
|
|
50
55
|
"publish:major": "npm version major && npm publish",
|
|
@@ -52,6 +57,19 @@
|
|
|
52
57
|
"publish:patch": "npm version patch && npm publish",
|
|
53
58
|
"test": "NODE_ENV=test && npm run lint && npm run test:unit",
|
|
54
59
|
"test:unit": "NODE_ENV=test npm run env && npx jest",
|
|
60
|
+
"test:integration": "NODE_ENV=test && npx jest --testPathPattern=integration",
|
|
61
|
+
"test:cli": "NODE_ENV=test && npx jest --testPathPattern=cli",
|
|
62
|
+
"test:commands": "NODE_ENV=test && npm run test:cli && npm run test:integration",
|
|
63
|
+
"test:coverage": "NODE_ENV=test && npx jest --coverage --coverageDirectory=coverage --coverageReporters=text --coverageReporters=lcov --coverageReporters=html",
|
|
64
|
+
"test:coverage:upload": "codecov",
|
|
65
|
+
"type-check": "tsc --noEmit --project tsconfig.lint.json",
|
|
66
|
+
"type-check:build": "tsc --noEmit --project tsconfig.build.json",
|
|
67
|
+
"type-check:test": "tsc --noEmit --project tsconfig.test.json",
|
|
68
|
+
"package": "npm run build && npm pack",
|
|
69
|
+
"ci:install": "npm ci",
|
|
70
|
+
"ci:test": "npm run lint && npm run type-check && npm run test:unit",
|
|
71
|
+
"ci:build": "npm run build && npm run package",
|
|
72
|
+
"ci:deploy": "npm run prepublishOnly",
|
|
55
73
|
"update": "npm-check-updates -i",
|
|
56
74
|
"watch": "NODE_ENV=development rm -rf dist && npm run compile -w"
|
|
57
75
|
},
|
|
@@ -81,13 +99,14 @@
|
|
|
81
99
|
"@storybook/react-webpack5": "^9.0.17",
|
|
82
100
|
"@tailwindcss/postcss": "4.1.11",
|
|
83
101
|
"@testing-library/jest-dom": "^6.6.3",
|
|
102
|
+
"@testing-library/react": "^16.3.0",
|
|
84
103
|
"@typescript-eslint/eslint-plugin": "^8.37.0",
|
|
85
104
|
"@typescript-eslint/parser": "^8.37.0",
|
|
86
105
|
"acorn": "^8.15.0",
|
|
87
106
|
"ajv": "^8.17.1",
|
|
88
107
|
"assert": "^2.1.0",
|
|
89
108
|
"autoprefixer": "^10.4.21",
|
|
90
|
-
"babel-jest": "^
|
|
109
|
+
"babel-jest": "^29.7.0",
|
|
91
110
|
"babel-loader": "^10.0.0",
|
|
92
111
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
93
112
|
"babel-plugin-transform-import-meta": "^2.3.3",
|
|
@@ -111,6 +130,7 @@
|
|
|
111
130
|
"eslint": "^9.31.0",
|
|
112
131
|
"eslint-config-styleguidejs": "^4.0.22",
|
|
113
132
|
"execa": "9.6.0",
|
|
133
|
+
"expect": "^29.7.0",
|
|
114
134
|
"exports-loader": "^5.0.0",
|
|
115
135
|
"favicons-webpack-plugin": "^6.0.1",
|
|
116
136
|
"file-loader": "^6.2.0",
|
|
@@ -134,7 +154,7 @@
|
|
|
134
154
|
"luxon": "^3.7.1",
|
|
135
155
|
"net": "^1.0.2",
|
|
136
156
|
"npm-check-updates": "^18.0.1",
|
|
137
|
-
"openai": "^5.
|
|
157
|
+
"openai": "^5.10.1",
|
|
138
158
|
"ora": "8.2.0",
|
|
139
159
|
"os-browserify": "^0.3.0",
|
|
140
160
|
"path-browserify": "^1.0.1",
|
|
@@ -159,8 +179,6 @@
|
|
|
159
179
|
"resolve": "^1.22.10",
|
|
160
180
|
"rimraf": "^6.0.1",
|
|
161
181
|
"semver": "^7.7.2",
|
|
162
|
-
"source-map-loader": "^5.0.0",
|
|
163
|
-
"source-map-support": "^0.5.21",
|
|
164
182
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
165
183
|
"static-site-generator-webpack-plugin": "^3.4.2",
|
|
166
184
|
"storybook": "^9.0.17",
|
|
@@ -170,7 +188,6 @@
|
|
|
170
188
|
"svg-spritemap-webpack-plugin": "^4.7.0",
|
|
171
189
|
"svgo": "4.0.0",
|
|
172
190
|
"tls": "^0.0.1",
|
|
173
|
-
"ts-jest": "^29.4.0",
|
|
174
191
|
"ts-node": "^10.9.2",
|
|
175
192
|
"tsconfig-paths-webpack-plugin": "^4.2.0",
|
|
176
193
|
"typescript": "5.8.3",
|
|
@@ -186,7 +203,10 @@
|
|
|
186
203
|
"webpack-plugin-serve": "^1.6.0"
|
|
187
204
|
},
|
|
188
205
|
"devDependencies": {
|
|
189
|
-
"@
|
|
206
|
+
"@babel/plugin-transform-react-jsx": "^7.27.1",
|
|
207
|
+
"@babel/runtime": "^7.27.6",
|
|
208
|
+
"@babel/runtime-corejs3": "^7.28.0",
|
|
209
|
+
"@types/jest": "^29.5.14",
|
|
190
210
|
"@types/luxon": "^3.6.2",
|
|
191
211
|
"@types/node": "^24.0.14",
|
|
192
212
|
"@types/ora": "^3.2.0",
|
package/tsconfig.build.json
CHANGED
|
@@ -3,18 +3,15 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"allowJs": true,
|
|
5
5
|
"allowSyntheticDefaultImports": true,
|
|
6
|
-
"baseUrl": "./src",
|
|
7
6
|
"declaration": true,
|
|
8
|
-
"emitDeclarationOnly":
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
9
8
|
"esModuleInterop": true,
|
|
10
|
-
"experimentalDecorators": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
9
|
"inlineSourceMap": true,
|
|
13
10
|
"isolatedModules": true,
|
|
14
|
-
"jsx": "react",
|
|
11
|
+
"jsx": "react-jsx",
|
|
15
12
|
"lib": [
|
|
16
|
-
"
|
|
17
|
-
"
|
|
13
|
+
"dom",
|
|
14
|
+
"ESNext"
|
|
18
15
|
],
|
|
19
16
|
"module": "NodeNext",
|
|
20
17
|
"moduleResolution": "NodeNext",
|
|
@@ -22,14 +19,14 @@
|
|
|
22
19
|
"noImplicitReturns": true,
|
|
23
20
|
"noImplicitThis": true,
|
|
24
21
|
"noUnusedLocals": false,
|
|
25
|
-
"outDir": "./dist",
|
|
26
22
|
"pretty": true,
|
|
27
|
-
"removeComments": true,
|
|
28
23
|
"resolveJsonModule": true,
|
|
24
|
+
"outDir": "./dist",
|
|
25
|
+
"rootDir": "./src",
|
|
29
26
|
"skipLibCheck": true,
|
|
30
|
-
"strict": true,
|
|
31
27
|
"target": "ESNext",
|
|
32
28
|
"types": [
|
|
29
|
+
"jest",
|
|
33
30
|
"node"
|
|
34
31
|
]
|
|
35
32
|
},
|
|
@@ -43,6 +40,7 @@
|
|
|
43
40
|
"**/__tests__/**",
|
|
44
41
|
"**/__mocks__/**",
|
|
45
42
|
"dist",
|
|
46
|
-
"node_modules"
|
|
43
|
+
"node_modules",
|
|
44
|
+
"jest.config.mjs"
|
|
47
45
|
]
|
|
48
46
|
}
|
package/tsconfig.json
CHANGED
package/tsconfig.lint.json
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"allowJs": true,
|
|
5
5
|
"allowSyntheticDefaultImports": true,
|
|
6
6
|
"baseUrl": "./src",
|
|
7
|
-
"declaration":
|
|
8
|
-
"emitDeclarationOnly":
|
|
7
|
+
"declaration": true,
|
|
8
|
+
"emitDeclarationOnly": true,
|
|
9
9
|
"esModuleInterop": true,
|
|
10
10
|
"experimentalDecorators": true,
|
|
11
11
|
"forceConsistentCasingInFileNames": true,
|
|
12
12
|
"inlineSourceMap": false,
|
|
13
13
|
"isolatedModules": true,
|
|
14
|
-
"jsx": "react",
|
|
14
|
+
"jsx": "react-jsx",
|
|
15
15
|
"lib": [
|
|
16
16
|
"ESNext",
|
|
17
17
|
"DOM"
|
package/tsconfig.template.json
CHANGED
package/tsconfig.test.json
CHANGED
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
"allowJs": true,
|
|
4
4
|
"allowSyntheticDefaultImports": true,
|
|
5
5
|
"baseUrl": "./src",
|
|
6
|
-
"declaration":
|
|
7
|
-
"emitDeclarationOnly":
|
|
6
|
+
"declaration": true,
|
|
7
|
+
"emitDeclarationOnly": true,
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"experimentalDecorators": true,
|
|
10
10
|
"forceConsistentCasingInFileNames": true,
|
|
11
11
|
"inlineSourceMap": true,
|
|
12
12
|
"isolatedModules": true,
|
|
13
|
-
"jsx": "react",
|
|
13
|
+
"jsx": "react-jsx",
|
|
14
14
|
"lib": [
|
|
15
15
|
"ESNext",
|
|
16
16
|
"DOM"
|
package/TYPESCRIPT_CONFIGS.md
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
# TypeScript Configurations in Lex
|
|
2
|
-
|
|
3
|
-
Lex now uses specialized TypeScript configurations for different commands to optimize performance and functionality.
|
|
4
|
-
|
|
5
|
-
## Configuration Files
|
|
6
|
-
|
|
7
|
-
### 1. `tsconfig.build.json` - For Compilation and Building
|
|
8
|
-
|
|
9
|
-
Used by: `lex compile`, `lex build`
|
|
10
|
-
|
|
11
|
-
**Purpose:** Optimized for compilation and bundling with ESM output.
|
|
12
|
-
|
|
13
|
-
**Key Features:**
|
|
14
|
-
|
|
15
|
-
- ESM module format (`"module": "ESNext"`)
|
|
16
|
-
- Declaration file generation (`"declaration": true`)
|
|
17
|
-
- Source maps for debugging (`"inlineSourceMap": true`)
|
|
18
|
-
- Strict type checking (`"strict": true`)
|
|
19
|
-
- Excludes test files for faster compilation
|
|
20
|
-
|
|
21
|
-
**Use Cases:**
|
|
22
|
-
|
|
23
|
-
- Building production bundles
|
|
24
|
-
- Generating type declarations
|
|
25
|
-
- Compiling source code for distribution
|
|
26
|
-
|
|
27
|
-
### 2. `tsconfig.lint.json` - For Static Analysis
|
|
28
|
-
|
|
29
|
-
Used by: `lex lint`
|
|
30
|
-
|
|
31
|
-
**Purpose:** Optimized for static analysis and linting.
|
|
32
|
-
|
|
33
|
-
**Key Features:**
|
|
34
|
-
|
|
35
|
-
- No emission (`"noEmit": true`)
|
|
36
|
-
- Strict unused variable checking (`"noUnusedLocals": true`)
|
|
37
|
-
- Disabled pretty printing for faster analysis
|
|
38
|
-
- Excludes test files to focus on source code
|
|
39
|
-
- ESLint-friendly settings
|
|
40
|
-
|
|
41
|
-
**Use Cases:**
|
|
42
|
-
|
|
43
|
-
- Static type checking
|
|
44
|
-
- Code quality analysis
|
|
45
|
-
- Linting with ESLint + TypeScript
|
|
46
|
-
|
|
47
|
-
### 3. `tsconfig.test.json` - For Testing
|
|
48
|
-
|
|
49
|
-
Used by: `lex test`
|
|
50
|
-
|
|
51
|
-
**Purpose:** Optimized for testing environment.
|
|
52
|
-
|
|
53
|
-
**Key Features:**
|
|
54
|
-
|
|
55
|
-
- Includes test files (`**/*.test.*`, `**/*.spec.*`)
|
|
56
|
-
- Jest types included (`"types": ["jest", "node"]`)
|
|
57
|
-
- Relaxed strict mode for test flexibility (`"strict": false`)
|
|
58
|
-
- Source maps for debugging tests
|
|
59
|
-
- Coverage reporting support
|
|
60
|
-
|
|
61
|
-
**Use Cases:**
|
|
62
|
-
|
|
63
|
-
- Running unit tests
|
|
64
|
-
- Integration testing
|
|
65
|
-
- Test debugging and coverage
|
|
66
|
-
|
|
67
|
-
## Automatic Configuration
|
|
68
|
-
|
|
69
|
-
Lex automatically creates these configuration files when needed:
|
|
70
|
-
|
|
71
|
-
1. **First run:** If no specialized config exists, Lex creates it from templates
|
|
72
|
-
2. **Fallback:** If specialized config doesn't exist, falls back to default `tsconfig.json`
|
|
73
|
-
3. **Custom configs:** You can override any config by creating your own version
|
|
74
|
-
|
|
75
|
-
## Migration from Single Config
|
|
76
|
-
|
|
77
|
-
If you're migrating from a single `tsconfig.json`:
|
|
78
|
-
|
|
79
|
-
1. **Keep your existing config:** It will be used as a fallback
|
|
80
|
-
2. **Customize specialized configs:** Modify the generated configs for your needs
|
|
81
|
-
3. **Gradual adoption:** Commands will automatically use the appropriate config
|
|
82
|
-
|
|
83
|
-
## Customization
|
|
84
|
-
|
|
85
|
-
You can customize any of these configurations:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
// tsconfig.build.json - Customize for your build needs
|
|
89
|
-
{
|
|
90
|
-
"extends": "../../tsconfig.base.json",
|
|
91
|
-
"compilerOptions": {
|
|
92
|
-
"outDir": "./lib", // Custom output directory
|
|
93
|
-
"target": "ES2020" // Custom target
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Benefits
|
|
99
|
-
|
|
100
|
-
1. **Performance:** Each config is optimized for its specific use case
|
|
101
|
-
2. **Clarity:** Clear separation of concerns between compilation, linting, and testing
|
|
102
|
-
3. **Flexibility:** Easy to customize each workflow independently
|
|
103
|
-
4. **Compatibility:** Maintains backward compatibility with existing setups
|
package/dist/dist/LexConfig.d.ts
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
export class LexConfig {
|
|
2
|
-
static config: {
|
|
3
|
-
ai: {
|
|
4
|
-
provider: string;
|
|
5
|
-
model: string;
|
|
6
|
-
maxTokens: number;
|
|
7
|
-
temperature: number;
|
|
8
|
-
};
|
|
9
|
-
configFiles: any[];
|
|
10
|
-
copyFiles: any[];
|
|
11
|
-
entryHTML: string;
|
|
12
|
-
entryJs: string;
|
|
13
|
-
esbuild: {
|
|
14
|
-
minify: boolean;
|
|
15
|
-
treeShaking: boolean;
|
|
16
|
-
drop: string[];
|
|
17
|
-
pure: string[];
|
|
18
|
-
legalComments: string;
|
|
19
|
-
splitting: boolean;
|
|
20
|
-
metafile: boolean;
|
|
21
|
-
sourcemap: boolean;
|
|
22
|
-
};
|
|
23
|
-
env: any;
|
|
24
|
-
jest: {};
|
|
25
|
-
outputFullPath: string;
|
|
26
|
-
outputHash: boolean;
|
|
27
|
-
outputPath: string;
|
|
28
|
-
packageManager: string;
|
|
29
|
-
preset: string;
|
|
30
|
-
sourceFullPath: string;
|
|
31
|
-
sourcePath: string;
|
|
32
|
-
targetEnvironment: string;
|
|
33
|
-
useGraphQl: boolean;
|
|
34
|
-
useTypescript: boolean;
|
|
35
|
-
webpack: {};
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Get the Lex package root directory, handling both development and installed environments
|
|
39
|
-
*/
|
|
40
|
-
static getLexDir(): string;
|
|
41
|
-
static set useTypescript(value: any);
|
|
42
|
-
static updateConfig(updatedConfig: any): {
|
|
43
|
-
ai: {
|
|
44
|
-
provider: string;
|
|
45
|
-
model: string;
|
|
46
|
-
maxTokens: number;
|
|
47
|
-
temperature: number;
|
|
48
|
-
};
|
|
49
|
-
configFiles: any[];
|
|
50
|
-
copyFiles: any[];
|
|
51
|
-
entryHTML: string;
|
|
52
|
-
entryJs: string;
|
|
53
|
-
esbuild: {
|
|
54
|
-
minify: boolean;
|
|
55
|
-
treeShaking: boolean;
|
|
56
|
-
drop: string[];
|
|
57
|
-
pure: string[];
|
|
58
|
-
legalComments: string;
|
|
59
|
-
splitting: boolean;
|
|
60
|
-
metafile: boolean;
|
|
61
|
-
sourcemap: boolean;
|
|
62
|
-
};
|
|
63
|
-
env: any;
|
|
64
|
-
jest: {};
|
|
65
|
-
outputFullPath: string;
|
|
66
|
-
outputHash: boolean;
|
|
67
|
-
outputPath: string;
|
|
68
|
-
packageManager: string;
|
|
69
|
-
preset: string;
|
|
70
|
-
sourceFullPath: string;
|
|
71
|
-
sourcePath: string;
|
|
72
|
-
targetEnvironment: string;
|
|
73
|
-
useGraphQl: boolean;
|
|
74
|
-
useTypescript: boolean;
|
|
75
|
-
webpack: {};
|
|
76
|
-
};
|
|
77
|
-
static addConfigParams(cmd: any, params: any): void;
|
|
78
|
-
static parseConfig(cmd: any, isRoot?: boolean): Promise<void>;
|
|
79
|
-
static checkTypescriptConfig(): void;
|
|
80
|
-
static checkCompileTypescriptConfig(): void;
|
|
81
|
-
static checkLintTypescriptConfig(): void;
|
|
82
|
-
static checkTestTypescriptConfig(): void;
|
|
83
|
-
}
|
|
84
|
-
export namespace defaultConfigValues {
|
|
85
|
-
namespace ai {
|
|
86
|
-
let provider: string;
|
|
87
|
-
let model: string;
|
|
88
|
-
let maxTokens: number;
|
|
89
|
-
let temperature: number;
|
|
90
|
-
}
|
|
91
|
-
let configFiles: any[];
|
|
92
|
-
let copyFiles: any[];
|
|
93
|
-
let entryHTML: string;
|
|
94
|
-
let entryJs: string;
|
|
95
|
-
namespace esbuild {
|
|
96
|
-
let minify: boolean;
|
|
97
|
-
let treeShaking: boolean;
|
|
98
|
-
let drop: string[];
|
|
99
|
-
let pure: string[];
|
|
100
|
-
let legalComments: string;
|
|
101
|
-
let splitting: boolean;
|
|
102
|
-
let metafile: boolean;
|
|
103
|
-
let sourcemap: boolean;
|
|
104
|
-
}
|
|
105
|
-
let env: any;
|
|
106
|
-
let jest: {};
|
|
107
|
-
let outputFullPath: string;
|
|
108
|
-
let outputHash: boolean;
|
|
109
|
-
let outputPath: string;
|
|
110
|
-
let packageManager: string;
|
|
111
|
-
let preset: string;
|
|
112
|
-
let sourceFullPath: string;
|
|
113
|
-
let sourcePath: string;
|
|
114
|
-
let targetEnvironment: string;
|
|
115
|
-
let useGraphQl: boolean;
|
|
116
|
-
let useTypescript: boolean;
|
|
117
|
-
let webpack: {};
|
|
118
|
-
}
|
|
119
|
-
export function getTypeScriptConfigPath(configName: any): string;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export function findTailwindCssPath(): string;
|
|
2
|
-
export function getDirName(): any;
|
|
3
|
-
export function getFilePath(relativePath: any): any;
|
|
4
|
-
export function getLexPackageJsonPath(): string;
|
|
5
|
-
export function getNodePath(moduleName: any): any;
|
|
6
|
-
export function relativeFilePath(filename: any, dirPath?: string, backUp?: number): any;
|
|
7
|
-
export function relativeNodePath(filename: any, dirPath?: string, backUp?: number): any;
|
|
8
|
-
export function resolveBinaryPath(binaryName: any, packageName: any): string;
|
package/dist/dist/utils/log.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function log(message: any, type?: string, quiet?: boolean): void;
|
package/jest.config.cjs
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2018-Present, Nitrogen Labs, Inc.
|
|
3
|
-
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
4
|
-
*/
|
|
5
|
-
const pack = require('./package.json');
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
displayName: pack.name,
|
|
9
|
-
testEnvironment: 'node',
|
|
10
|
-
extensionsToTreatAsEsm: ['.ts'],
|
|
11
|
-
moduleFileExtensions: ['js', 'ts', 'tsx', 'json'],
|
|
12
|
-
moduleNameMapper: {
|
|
13
|
-
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
14
|
-
// Mock problematic ES modules
|
|
15
|
-
'^execa$': '<rootDir>/__mocks__/execa.js',
|
|
16
|
-
'^boxen$': '<rootDir>/__mocks__/boxen.js',
|
|
17
|
-
'^chalk$': '<rootDir>/__mocks__/chalk.js',
|
|
18
|
-
'^ora$': '<rootDir>/__mocks__/ora.js',
|
|
19
|
-
// Mock modules that use import.meta.url
|
|
20
|
-
'.*LexConfig.*': '<rootDir>/__mocks__/LexConfig.js',
|
|
21
|
-
'.*build\\.js$': '<rootDir>/__mocks__/build.js',
|
|
22
|
-
'.*versions\\.js$': '<rootDir>/__mocks__/versions.js',
|
|
23
|
-
'.*compile\\.js$': '<rootDir>/__mocks__/compile.js',
|
|
24
|
-
// Mock file utility to avoid import.meta.url issues
|
|
25
|
-
'utils/file\\.js$': '<rootDir>/__mocks__/file.js',
|
|
26
|
-
'.*/utils/file\\.js$': '<rootDir>/__mocks__/file.js',
|
|
27
|
-
'^(\\.{1,2}/)*utils/file\\.js$': '<rootDir>/__mocks__/file.js',
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
rootDir: './',
|
|
31
|
-
testMatch: ['<rootDir>/**/*.test.ts*'],
|
|
32
|
-
transform: {
|
|
33
|
-
'^.+\\.ts$|^.+\\.tsx$': ['babel-jest', {
|
|
34
|
-
presets: [
|
|
35
|
-
['@babel/preset-env', {targets: {node: 'current'}}],
|
|
36
|
-
'@babel/preset-typescript'
|
|
37
|
-
]
|
|
38
|
-
}]
|
|
39
|
-
},
|
|
40
|
-
collectCoverage: false,
|
|
41
|
-
transformIgnorePatterns: [],
|
|
42
|
-
setupFilesAfterEnv: ['./jest.setup.js']
|
|
43
|
-
};
|