@nlabs/lex 1.54.2 → 1.55.0

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.
Files changed (58) hide show
  1. package/.github/copilot-instructions.md +4 -4
  2. package/README.md +25 -25
  3. package/__mocks__/LexConfig.js +9 -9
  4. package/__mocks__/boxen.js +1 -1
  5. package/__mocks__/build.js +6 -6
  6. package/__mocks__/compare-versions.js +1 -1
  7. package/__mocks__/compile.js +2 -2
  8. package/__mocks__/execa.js +2 -2
  9. package/__mocks__/latest-version.js +1 -1
  10. package/__mocks__/ora.js +13 -13
  11. package/__mocks__/versions.js +4 -4
  12. package/config.json +2 -2
  13. package/examples/lex.config.js +4 -4
  14. package/lex.config.js +4 -4
  15. package/lib/Button.stories.js +1 -1
  16. package/lib/LexConfig.d.ts +2 -9
  17. package/lib/LexConfig.js +2 -2
  18. package/lib/commands/ai/ai.js +2 -2
  19. package/lib/commands/clean/clean.js +1 -1
  20. package/lib/commands/config/config.js +14 -8
  21. package/lib/commands/copy/copy.js +1 -1
  22. package/lib/commands/create/create.js +1 -1
  23. package/lib/commands/dev/dev.js +1 -1
  24. package/lib/commands/init/init.js +1 -1
  25. package/lib/commands/link/link.js +1 -1
  26. package/lib/commands/lint/lint.js +1 -1
  27. package/lib/commands/migrate/migrate.js +2 -2
  28. package/lib/commands/serverless/serverless.js +1 -1
  29. package/lib/commands/storybook/storybook.js +1 -1
  30. package/lib/commands/test/test.d.ts +2 -0
  31. package/lib/commands/test/test.js +130 -117
  32. package/lib/commands/versions/versions.d.ts +1 -1
  33. package/lib/commands/versions/versions.js +3 -3
  34. package/lib/create/changelog.js +1 -1
  35. package/lib/lex.js +2 -2
  36. package/lib/test-react/index.d.ts +1 -1
  37. package/lib/test-react/index.js +2 -2
  38. package/lib/types.d.ts +1 -1
  39. package/lib/types.js +1 -1
  40. package/lib/utils/aiService.js +1 -1
  41. package/lib/utils/app.js +2 -2
  42. package/lib/vitest.d.js +3 -0
  43. package/package.json +41 -53
  44. package/resolver.cjs +11 -9
  45. package/tsconfig/reactNative.json +3 -2
  46. package/tsconfig.build.json +3 -3
  47. package/tsconfig.json +4 -3
  48. package/tsconfig.lint.json +3 -2
  49. package/tsconfig.template.json +3 -2
  50. package/tsconfig.test.json +4 -3
  51. package/vitest.config.d.mts +2 -0
  52. package/vitest.config.mjs +61 -0
  53. package/vitest.config.template.cjs +66 -0
  54. package/vitest.setup.template.js +19 -0
  55. package/jest.config.d.mts +0 -50
  56. package/jest.config.mjs +0 -72
  57. package/jest.config.template.cjs +0 -71
  58. package/jest.setup.template.js +0 -18
package/jest.config.d.mts DELETED
@@ -1,50 +0,0 @@
1
- declare namespace _default {
2
- let displayName: any;
3
- let testEnvironment: string;
4
- let moduleFileExtensions: string[];
5
- let moduleDirectories: string[];
6
- let moduleNameMapper: {
7
- '^(\\.{1,2}/.*)\\.js$': string;
8
- '^execa$': string;
9
- '^boxen$': string;
10
- '^chalk$': string;
11
- '^ora$': string;
12
- '^latest-version$': string;
13
- '^compare-versions$': string;
14
- '.*LexConfig.*': string;
15
- '.*build\\.js$': string;
16
- '.*versions\\.js$': string;
17
- '.*compile\\.js$': string;
18
- 'utils/file\\.js$': string;
19
- '.*/utils/file\\.js$': string;
20
- '^(\\.{1,2}/)*utils/file\\.js$': string;
21
- '.(css|less|scss|sass)$': string;
22
- '.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': string;
23
- };
24
- let rootDir: string;
25
- let transformIgnorePatterns: string[];
26
- let setupFilesAfterEnv: string[];
27
- let transform: {
28
- '^.+.js$|^.+.jsx$': (string | {
29
- presets: (string | (string | {
30
- targets: {
31
- node: string;
32
- };
33
- })[])[];
34
- })[];
35
- '^.+.ts$|^.+.tsx$': (string | {
36
- presets: (string | (string | {
37
- targets: {
38
- node: string;
39
- };
40
- })[])[];
41
- })[];
42
- };
43
- let testRegex: string;
44
- let collectCoverage: boolean;
45
- let coverageDirectory: string;
46
- let coveragePathIgnorePatterns: string[];
47
- let coverageReporters: string[];
48
- let verbose: boolean;
49
- }
50
- export default _default;
package/jest.config.mjs DELETED
@@ -1,72 +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
- import {readFileSync} from 'fs';
6
- import merge from 'lodash/merge.js';
7
- import {dirname, resolve} from 'path';
8
- import {fileURLToPath} from 'url';
9
-
10
- const filename = fileURLToPath(import.meta.url);
11
- const dirnamePath = dirname(filename);
12
- const pack = JSON.parse(readFileSync(resolve(dirnamePath, 'package.json'), 'utf8'));
13
-
14
- let projectJestConfig = null;
15
-
16
- if(process.env.LEX_CONFIG) {
17
- try {
18
- const lexConfig = JSON.parse(process.env.LEX_CONFIG);
19
- projectJestConfig = lexConfig.jest;
20
- } catch(error) {
21
- // eslint-disable-next-line no-console
22
- console.warn('Failed to parse LEX_CONFIG:', error.message);
23
- }
24
- }
25
-
26
- const baseConfig = {
27
- collectCoverage: true,
28
- coverageDirectory: '<rootDir>/coverage',
29
- coveragePathIgnorePatterns: [
30
- '/node_modules/',
31
- '/dist',
32
- '/lib',
33
- '__snapshots__',
34
- '.d.ts'
35
- ],
36
- coverageReporters: ['html', 'text'],
37
- displayName: pack.name,
38
- moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
39
- moduleNameMapper: {
40
- '^(\\.{1,2}/.*)\\.js$': '$1'
41
- },
42
- rootDir: process.cwd(),
43
- testEnvironment: 'node',
44
- testRegex: '(/__tests__/.*|\\.(test|spec|integration))\\.(ts|tsx)?$',
45
- transform: {
46
- '^.+\\.(t|j)sx?$': ['@swc/jest', {
47
- jsc: {
48
- parser: {
49
- decorators: true,
50
- dynamicImport: true,
51
- syntax: 'typescript',
52
- tsx: true
53
- },
54
- transform: {
55
- react: {
56
- runtime: 'automatic'
57
- }
58
- }
59
- },
60
- module: {
61
- type: 'es6'
62
- }
63
- }]
64
- },
65
- verbose: true
66
- };
67
-
68
- const finalConfig = projectJestConfig && Object.keys(projectJestConfig).length > 0
69
- ? merge(baseConfig, projectJestConfig)
70
- : baseConfig;
71
-
72
- export default finalConfig;
@@ -1,71 +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
-
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
- collectCoverage: true,
18
- coverageDirectory: '<rootDir>/coverage',
19
- coveragePathIgnorePatterns: [
20
- '/node_modules/',
21
- '/dist',
22
- '/lib',
23
- '__snapshots__',
24
- '.d.ts'
25
- ],
26
- coverageReporters: ['html', 'text'],
27
- moduleDirectories: ['node_modules', '<rootDir>'],
28
- moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'node'],
29
- moduleNameMapper: {
30
- '\\.(css|less|scss|sass)$': 'identity-obj-proxy',
31
- '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
32
- '^(\\.{1,2}/.*)\\.js$': '$1'
33
- },
34
- setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
35
- testEnvironment: 'jsdom',
36
- testRegex: '(/__tests__/.*|\\.(test|spec|integration))\\.(ts|tsx|js|jsx)?$',
37
- transform: {
38
- '^.+\\.(t|j)sx?$': ['@swc/jest', {
39
- jsc: {
40
- parser: {
41
- decorators: true,
42
- dynamicImport: true,
43
- syntax: 'typescript',
44
- tsx: true
45
- },
46
- transform: {
47
- react: {
48
- runtime: 'automatic'
49
- }
50
- }
51
- },
52
- module: {
53
- type: 'es6'
54
- }
55
- }]
56
- },
57
- transformIgnorePatterns: [
58
- 'node_modules/(?!(strip-indent|chalk|@testing-library/jest-dom|zod|@nlabs|@nlabs/arkhamjs|@nlabs/utils|@nlabs/lex)/.*)'
59
- ],
60
- verbose: true
61
- };
62
-
63
- // Merge with Lex config if available
64
- if(lexConfig && lexConfig.jest) {
65
- module.exports = {
66
- ...baseConfig,
67
- ...lexConfig.jest
68
- };
69
- } else {
70
- module.exports = baseConfig;
71
- }
@@ -1,18 +0,0 @@
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
- }));