@nlabs/lex 1.48.3 → 1.48.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/.storybook/main.ts +25 -4
- 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 +2 -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 +80 -10
- 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 +8 -0
- package/dist/test-react/index.js +86 -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/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 +69 -0
- package/jest.config.template.cjs +63 -0
- package/jest.setup.js +18 -15
- package/jest.setup.template.js +18 -0
- package/package.json +24 -7
- package/tsconfig.build.json +8 -10
- package/tsconfig.lint.json +2 -2
- package/tsconfig.test.json +2 -2
- 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.config.lex.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import {existsSync} from 'fs';
|
|
2
|
-
import {resolve as pathResolve} from 'path';
|
|
3
|
-
import {URL} from 'url';
|
|
4
|
-
|
|
5
|
-
import {getNodePath} from './dist/utils/file.js';
|
|
6
|
-
|
|
7
|
-
const rootDir = process.cwd();
|
|
8
|
-
const { jest, sourceFullPath, targetEnvironment, useTypescript } = JSON.parse(
|
|
9
|
-
process.env.LEX_CONFIG || '{}'
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
const dirName = new URL('.', import.meta.url).pathname;
|
|
13
|
-
const nodePath = pathResolve(dirName, './node_modules');
|
|
14
|
-
const lexSetupFile = pathResolve(dirName, './jest.setup.js');
|
|
15
|
-
const projectSetupFile = pathResolve(rootDir, './jest.setup.js');
|
|
16
|
-
const setupFilesAfterEnv = [];
|
|
17
|
-
|
|
18
|
-
setupFilesAfterEnv.push(lexSetupFile);
|
|
19
|
-
|
|
20
|
-
if(existsSync(projectSetupFile)) {
|
|
21
|
-
setupFilesAfterEnv.push(projectSetupFile);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let testEnvironment = 'node';
|
|
25
|
-
let testEnvironmentOptions = {};
|
|
26
|
-
|
|
27
|
-
if(targetEnvironment === 'web') {
|
|
28
|
-
testEnvironment = 'jsdom';
|
|
29
|
-
testEnvironmentOptions = {
|
|
30
|
-
url: 'http://localhost'
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let moduleFileExtensions = ['js', 'json', 'cjs', 'mjs'];
|
|
35
|
-
let testRegex = '(/__tests__/.*|\\.(test|spec|integration))\\.(js)?$';
|
|
36
|
-
let transformIgnorePatterns = [];
|
|
37
|
-
|
|
38
|
-
if(useTypescript) {
|
|
39
|
-
moduleFileExtensions = ['js', 'ts', 'tsx', 'json', 'cjs', 'mjs'];
|
|
40
|
-
testRegex = '(/__tests__/.*|\\.(test|spec|integration))\\.(ts|tsx)?$';
|
|
41
|
-
transformIgnorePatterns = [];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const baseConfig = {
|
|
45
|
-
collectCoverage: true,
|
|
46
|
-
coverageDirectory: '<rootDir>/coverage',
|
|
47
|
-
coveragePathIgnorePatterns: [
|
|
48
|
-
'/node_modules/',
|
|
49
|
-
'/dist',
|
|
50
|
-
'/lib',
|
|
51
|
-
'__snapshots__',
|
|
52
|
-
'.d.ts'
|
|
53
|
-
],
|
|
54
|
-
coverageReporters: ['html', 'text'],
|
|
55
|
-
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
56
|
-
moduleDirectories: ['node_modules', nodePath],
|
|
57
|
-
moduleFileExtensions,
|
|
58
|
-
moduleNameMapper: {
|
|
59
|
-
'^chalk$': getNodePath('chalk/source/index.js'),
|
|
60
|
-
'^#ansi-styles$': getNodePath('chalk/node_modules/ansi-styles/index.js'),
|
|
61
|
-
'^#supports-color$': getNodePath('chalk/node_modules/supports-color/index.js'),
|
|
62
|
-
'\\.(css|jpg|png|svg|txt)$': pathResolve(dirName, './emptyModule')
|
|
63
|
-
},
|
|
64
|
-
modulePaths: [rootDir, `${rootDir}/node_modules`, nodePath, sourceFullPath],
|
|
65
|
-
resolver: pathResolve(dirName, './resolver.cjs'),
|
|
66
|
-
rootDir,
|
|
67
|
-
setupFiles: [
|
|
68
|
-
getNodePath('core-js'),
|
|
69
|
-
getNodePath('regenerator-runtime/runtime.js')
|
|
70
|
-
],
|
|
71
|
-
setupFilesAfterEnv,
|
|
72
|
-
testEnvironment,
|
|
73
|
-
testEnvironmentOptions,
|
|
74
|
-
testPathIgnorePatterns: ['/node_modules/', `${nodePath}/`],
|
|
75
|
-
testRegex,
|
|
76
|
-
transform: {
|
|
77
|
-
...(useTypescript ? {
|
|
78
|
-
'\\.tsx?$': [getNodePath('ts-jest/dist/index.js'), {
|
|
79
|
-
useESM: true,
|
|
80
|
-
tsconfig: {
|
|
81
|
-
useDefineForClassFields: true,
|
|
82
|
-
esModuleInterop: true,
|
|
83
|
-
allowSyntheticDefaultImports: true
|
|
84
|
-
}
|
|
85
|
-
}]
|
|
86
|
-
} : {
|
|
87
|
-
'\\.[jt]sx?$': getNodePath('babel-jest')
|
|
88
|
-
}),
|
|
89
|
-
'\\.(gql|graphql)$': getNodePath('jest-transform-graphql'),
|
|
90
|
-
'\\.mjs$': [getNodePath('ts-jest/dist/index.js'), {
|
|
91
|
-
useESM: true
|
|
92
|
-
}],
|
|
93
|
-
'\\.cjs$': getNodePath('babel-jest')
|
|
94
|
-
},
|
|
95
|
-
transformIgnorePatterns: [
|
|
96
|
-
'node_modules/(?!(chalk|@testing-library/jest-dom|zod|@nlabs)/)'
|
|
97
|
-
],
|
|
98
|
-
verbose: true
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const deepMerge = (target, source) => {
|
|
102
|
-
if(!source) return target;
|
|
103
|
-
const output = { ...target };
|
|
104
|
-
|
|
105
|
-
Object.keys(source).forEach(key => {
|
|
106
|
-
if(source[key] instanceof Object && key in target && target[key] instanceof Object && !Array.isArray(source[key]) && !Array.isArray(target[key])) {
|
|
107
|
-
output[key] = {...target[key], ...source[key]};
|
|
108
|
-
} else if(Array.isArray(source[key]) && Array.isArray(target[key])) {
|
|
109
|
-
output[key] = [...target[key], ...source[key]];
|
|
110
|
-
} else {
|
|
111
|
-
output[key] = source[key];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
return output;
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default deepMerge(baseConfig, jest);
|