@servicetitan/startup 23.5.2 → 24.0.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.
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +4 -5
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.js +1 -1
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/eslint.js +1 -1
- package/dist/cli/commands/eslint.js.map +1 -1
- package/dist/cli/commands/init.js +2 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/install.js +1 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/kendo-ui-license.js +1 -1
- package/dist/cli/commands/kendo-ui-license.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +1 -1
- package/dist/cli/commands/lint.d.ts.map +1 -1
- package/dist/cli/commands/lint.js +9 -11
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +12 -9
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/prepare-package.js +1 -1
- package/dist/cli/commands/prepare-package.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +5 -6
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/styles-check.d.ts.map +1 -1
- package/dist/cli/commands/styles-check.js +3 -1
- package/dist/cli/commands/styles-check.js.map +1 -1
- package/dist/cli/commands/tests.js +1 -1
- package/dist/cli/commands/tests.js.map +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/bundle.js +7 -6
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-npm.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +1 -0
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/eslint.js +3 -3
- package/dist/cli/utils/eslint.js.map +1 -1
- package/dist/cli/utils/get-module-type.js.map +1 -1
- package/dist/cli/utils/index.d.ts +1 -0
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +1 -0
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/is-module-installed.js.map +1 -1
- package/dist/cli/utils/lerna-exec.d.ts +11 -0
- package/dist/cli/utils/lerna-exec.d.ts.map +1 -0
- package/dist/cli/utils/lerna-exec.js +47 -0
- package/dist/cli/utils/lerna-exec.js.map +1 -0
- package/dist/cli/utils/publish.js.map +1 -1
- package/dist/cli/utils/set-node-options.js.map +1 -1
- package/dist/cli/utils/tcm.js +2 -2
- package/dist/cli/utils/tcm.js.map +1 -1
- package/dist/cli/utils/tsc.js +2 -2
- package/dist/cli/utils/tsc.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +3 -3
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +1 -1
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-destination-folders.js.map +1 -1
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.js +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/load-shared-dependencies.d.ts.map +1 -1
- package/dist/utils/load-shared-dependencies.js +1 -0
- package/dist/utils/load-shared-dependencies.js.map +1 -1
- package/dist/utils/log.js.map +1 -1
- package/dist/utils/read-json.js.map +1 -1
- package/dist/utils/to-array.js.map +1 -1
- package/dist/webpack/__mocks__/style-rules.d.ts +1 -1
- package/dist/webpack/__mocks__/style-rules.d.ts.map +1 -1
- package/dist/webpack/__mocks__/style-rules.js.map +1 -1
- package/dist/webpack/configs/amd-config.d.ts +1 -1
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +1 -1
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +1 -1
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +1 -1
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +1 -1
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +1 -1
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +1 -1
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +6 -0
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +1 -1
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/provide-react-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ts-checker-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +2 -2
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts +1 -1
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +1 -1
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +5 -4
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js +4 -4
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules/tsx-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +1 -1
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +1 -0
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +1 -1
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/contextify-request.js.map +1 -1
- package/dist/webpack/loaders/expose-loader/utils/stringify-request.js.map +1 -1
- package/dist/webpack/utils/bundle.js.map +1 -1
- package/dist/webpack/utils/feature-cohort.js.map +1 -1
- package/dist/webpack/utils/get-caller-filename.js.map +1 -1
- package/dist/webpack/utils/split-by-entry.js.map +1 -1
- package/dist/webpack/utils/testing/compile.js.map +1 -1
- package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
- package/dist/webpack/utils/testing/get-module-source.js.map +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js.map +1 -1
- package/dist/webpack/utils/testing/read-asset.js.map +1 -1
- package/package.json +27 -28
- package/src/cli/commands/__tests__/build.test.ts +10 -12
- package/src/cli/commands/__tests__/init.test.ts +1 -1
- package/src/cli/commands/__tests__/kendo-ui-license.test.ts +1 -3
- package/src/cli/commands/__tests__/lint.test.ts +5 -7
- package/src/cli/commands/__tests__/mfe-publish.test.ts +8 -8
- package/src/cli/commands/__tests__/start.test.ts +9 -11
- package/src/cli/commands/__tests__/styles-check.test.ts +19 -5
- package/src/cli/commands/build.ts +4 -6
- package/src/cli/commands/lint.ts +10 -15
- package/src/cli/commands/mfe-publish.ts +4 -4
- package/src/cli/commands/start.ts +5 -7
- package/src/cli/commands/styles-check.ts +7 -1
- package/src/cli/utils/__tests__/bundle.test.ts +4 -4
- package/src/cli/utils/__tests__/cli-os.test.ts +1 -1
- package/src/cli/utils/__tests__/lerna-exec.test.ts +64 -0
- package/src/cli/utils/index.ts +1 -0
- package/src/cli/utils/lerna-exec.ts +37 -0
- package/src/utils/__tests__/get-configuration.test.ts +1 -1
- package/src/utils/__tests__/log.test.ts +3 -3
- package/src/utils/load-shared-dependencies.ts +1 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +9 -1
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +2 -2
- package/src/webpack/configs/optimization-config.ts +6 -0
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +4 -2
- package/src/webpack/configs/rules/css-rules.ts +9 -5
- package/src/webpack/configs/rules-config.ts +1 -0
- package/src/webpack/utils/testing/get-compiler.ts +1 -1
- package/template-react18/packages/application/package.json +3 -3
- package/template-react18/packages/feature-a/package.json +3 -3
- package/template-react18/packages/feature-b/package.json +3 -3
- package/template-react18/packages/feature-c/package.json +3 -3
- package/tsconfig/base.json +3 -1
|
@@ -34,7 +34,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
34
34
|
jest.resetAllMocks();
|
|
35
35
|
jest.mocked(createWebpackConfig).mockReturnValue(createWebpackResult);
|
|
36
36
|
jest.mocked(webpack).mockImplementation((): any => compiler);
|
|
37
|
-
compiler = { close: jest.fn(callback => callback()) };
|
|
37
|
+
compiler = { close: jest.fn(callback => callback(null)) };
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
afterEach(() => vol.reset());
|
|
@@ -120,11 +120,11 @@ describe('[startup] Cli Utils', () => {
|
|
|
120
120
|
|
|
121
121
|
describe('when webpack reports unexpected results', () => {
|
|
122
122
|
beforeEach(() => {
|
|
123
|
-
jest.mocked(compiler.run)!.mockImplementation(callback => callback());
|
|
123
|
+
jest.mocked(compiler.run)!.mockImplementation(callback => callback(null));
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
test('returns error', () => {
|
|
127
|
-
expect(subject).rejects.
|
|
127
|
+
expect(subject).rejects.toThrow(/something went wrong/i);
|
|
128
128
|
});
|
|
129
129
|
});
|
|
130
130
|
|
|
@@ -270,7 +270,7 @@ describe('[startup] Cli Utils', () => {
|
|
|
270
270
|
});
|
|
271
271
|
|
|
272
272
|
const subject = async () => {
|
|
273
|
-
await expect(bundleWatch(options)).rejects.
|
|
273
|
+
await expect(bundleWatch(options)).rejects.toThrow('stopped');
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
test('runs webpack development server', async () => {
|
|
@@ -96,7 +96,7 @@ describe('[startup] Cli Utils (OS)', () => {
|
|
|
96
96
|
|
|
97
97
|
['', [], ['']].forEach(command =>
|
|
98
98
|
test(`throws error when called with ${JSON.stringify(command)}`, () => {
|
|
99
|
-
expect(() => subject(command)).
|
|
99
|
+
expect(() => subject(command)).toThrow();
|
|
100
100
|
})
|
|
101
101
|
);
|
|
102
102
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
|
|
3
|
+
import { log } from '../../../utils';
|
|
4
|
+
import { lernaExec } from '../lerna-exec';
|
|
5
|
+
|
|
6
|
+
jest.mock('execa');
|
|
7
|
+
|
|
8
|
+
describe(`${lernaExec.name}`, () => {
|
|
9
|
+
let args: Parameters<typeof lernaExec>[0];
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
jest.spyOn(log, 'info').mockImplementation(jest.fn()); // suppress log output
|
|
14
|
+
args = { cmd: 'foo' };
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const subject = () => lernaExec(args);
|
|
18
|
+
|
|
19
|
+
function expectExecaCalledWith(commandLine: string) {
|
|
20
|
+
const [cmd, ...args] = commandLine.split(' ');
|
|
21
|
+
expect(execa).toHaveBeenCalledWith(cmd, args, { stdio: 'inherit' });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
test('runs "lerna exec -- {cmd}" command', () => {
|
|
25
|
+
subject();
|
|
26
|
+
|
|
27
|
+
expectExecaCalledWith(`lerna exec -- ${args.cmd}`);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe.each([
|
|
31
|
+
{ arg: { parallel: true }, option: '--parallel' },
|
|
32
|
+
{ arg: { stream: true }, option: '--stream' },
|
|
33
|
+
{ arg: { bail: false }, option: '--no-bail' },
|
|
34
|
+
] as { arg: Partial<typeof args>; option: string }[])('with $arg', ({ arg, option }) => {
|
|
35
|
+
beforeEach(() => Object.assign(args, arg));
|
|
36
|
+
|
|
37
|
+
test(`runs "lerna exec ${option} -- {cmd}"`, () => {
|
|
38
|
+
subject();
|
|
39
|
+
|
|
40
|
+
expectExecaCalledWith(`lerna exec ${option} -- ${args.cmd}`);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
describe('with scope', () => {
|
|
45
|
+
beforeEach(() => (args.scope = ['foo', 'bar']));
|
|
46
|
+
|
|
47
|
+
test('runs "lerna exec --scope={scope-1} ... --scope={scope-N} -- {cmd}', () => {
|
|
48
|
+
subject();
|
|
49
|
+
|
|
50
|
+
const scopes = args.scope!.map(name => `--scope=${name}`).join(' ');
|
|
51
|
+
expectExecaCalledWith(`lerna exec ${scopes} -- ${args.cmd}`);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('with pass-thru arguments', () => {
|
|
56
|
+
beforeEach(() => (args['--'] = ['--foo bar', '--bax=qux']));
|
|
57
|
+
|
|
58
|
+
test('runs "lerna exec -- {cmd} {arguments}', () => {
|
|
59
|
+
subject();
|
|
60
|
+
|
|
61
|
+
expectExecaCalledWith(`lerna exec -- ${args.cmd} ${args['--']!.join(' ')}`);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
package/src/cli/utils/index.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './compile-sass';
|
|
|
8
8
|
export * from './eslint';
|
|
9
9
|
export * from './get-module-type';
|
|
10
10
|
export * from './is-module-installed';
|
|
11
|
+
export * from './lerna-exec';
|
|
11
12
|
export * from './set-node-options';
|
|
12
13
|
export * from './styles-copy';
|
|
13
14
|
export * from './tcm';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import execa from 'execa';
|
|
2
|
+
import { log } from '../../utils';
|
|
3
|
+
|
|
4
|
+
interface Args {
|
|
5
|
+
'bail'?: boolean;
|
|
6
|
+
'cmd': string;
|
|
7
|
+
'scope'?: string[];
|
|
8
|
+
'stream'?: boolean;
|
|
9
|
+
'parallel'?: boolean;
|
|
10
|
+
'--'?: string[];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function lernaExec(args: Args) {
|
|
14
|
+
const lernaArguments = [
|
|
15
|
+
'exec',
|
|
16
|
+
...getOptions(args),
|
|
17
|
+
'--',
|
|
18
|
+
...args.cmd.split(' '),
|
|
19
|
+
...(args['--'] ?? []).flatMap(arg => arg.split(' ')),
|
|
20
|
+
];
|
|
21
|
+
log.info(`Running ${[args.cmd, ...(args['--'] ?? [])].join(' ')}`);
|
|
22
|
+
await execa('lerna', lernaArguments, { stdio: 'inherit' });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function getOptions(args: Args) {
|
|
26
|
+
const result = (args.scope ?? []).map(name => `--scope=${name}`);
|
|
27
|
+
if (args.bail === false) {
|
|
28
|
+
result.push('--no-bail');
|
|
29
|
+
}
|
|
30
|
+
if (args.parallel) {
|
|
31
|
+
result.push('--parallel');
|
|
32
|
+
}
|
|
33
|
+
if (args.stream) {
|
|
34
|
+
result.push('--stream');
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
@@ -133,7 +133,7 @@ describe(`[startup] Utils`, () => {
|
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
test('logs error', () => {
|
|
136
|
-
expect(subject).
|
|
136
|
+
expect(subject).toThrow(error);
|
|
137
137
|
|
|
138
138
|
expect(log.error).toHaveBeenCalledWith(String(error));
|
|
139
139
|
});
|
|
@@ -146,7 +146,7 @@ describe(`[startup] Utils`, () => {
|
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
test('logs error', async () => {
|
|
149
|
-
await expect(subject).rejects.
|
|
149
|
+
await expect(subject).rejects.toThrow(error);
|
|
150
150
|
|
|
151
151
|
expect(log.error).toHaveBeenCalledWith(String(error));
|
|
152
152
|
});
|
|
@@ -156,7 +156,7 @@ describe(`[startup] Utils`, () => {
|
|
|
156
156
|
const subject = () => instance.foo;
|
|
157
157
|
|
|
158
158
|
test('logs nothing', () => {
|
|
159
|
-
expect(subject).
|
|
159
|
+
expect(subject).toThrow(error);
|
|
160
160
|
|
|
161
161
|
expect(log.error).not.toHaveBeenCalled();
|
|
162
162
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const getDefaultSharedDependencies = () => ({
|
|
2
2
|
'@servicetitan/design-system': 'SharedDependencies.ServiceTitan.DesignSystem',
|
|
3
|
+
'@servicetitan/anvil2': 'SharedDependencies.ServiceTitan.Anvil2',
|
|
3
4
|
'classnames': 'SharedDependencies.ClassNames',
|
|
4
5
|
'formstate': 'SharedDependencies.FormState',
|
|
5
6
|
'mobx': 'SharedDependencies.MobX',
|
|
@@ -108,6 +108,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
108
108
|
expect(subject().module?.rules).toContainEqual({
|
|
109
109
|
test: getModuleEntryPath(name),
|
|
110
110
|
loader: require.resolve('../loaders/expose-loader'),
|
|
111
|
+
type: 'javascript/auto',
|
|
111
112
|
options: { exposes: value },
|
|
112
113
|
});
|
|
113
114
|
});
|
|
@@ -133,7 +134,14 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
133
134
|
|
|
134
135
|
test('configures "design-system.css" rules', () => {
|
|
135
136
|
expect(subject().module?.rules).toContainEqual({
|
|
136
|
-
test: /design-system
|
|
137
|
+
test: /design-system\.css$/,
|
|
138
|
+
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('configures anvil2 css" rules', () => {
|
|
143
|
+
expect(subject().module?.rules).toContainEqual({
|
|
144
|
+
test: /@servicetitan\/anvil2\/.*\.css$/,
|
|
137
145
|
use: [MiniCssExtractPlugin.loader, 'css-loader'],
|
|
138
146
|
});
|
|
139
147
|
});
|
|
@@ -72,7 +72,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
72
72
|
...(embed ? [] : [`require('./design-system.css');`]),
|
|
73
73
|
`import { register } from '@servicetitan/web-components';`,
|
|
74
74
|
`import { App } from './app';`,
|
|
75
|
-
`register(App, ${embed}, { legacyRoot: ${legacyRoot} });`,
|
|
75
|
+
`register(App, ${embed}, { legacyRoot: ${legacyRoot}, sharedDependenciesNames: [] });`,
|
|
76
76
|
].join('\n');
|
|
77
77
|
|
|
78
78
|
let overrides: Parameters<typeof createWebpackConfig>[0];
|
|
@@ -289,7 +289,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
289
289
|
beforeEach(() => jest.mocked(getCallerFile).mockReturnValue(configFileName));
|
|
290
290
|
|
|
291
291
|
test('throws error', () => {
|
|
292
|
-
expect(subject).
|
|
292
|
+
expect(subject).toThrow(/cannot call createWebpackConfig/);
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
);
|
|
@@ -22,6 +22,12 @@ export function optimizationConfig(context: Context, _: Overrides): Result {
|
|
|
22
22
|
chunks: 'all',
|
|
23
23
|
enforce: true,
|
|
24
24
|
},
|
|
25
|
+
'anvil2': {
|
|
26
|
+
test: /@servicetitan\/anvil2\/.*\.css$/,
|
|
27
|
+
name: 'anvil2',
|
|
28
|
+
chunks: 'all',
|
|
29
|
+
enforce: true,
|
|
30
|
+
},
|
|
25
31
|
});
|
|
26
32
|
}
|
|
27
33
|
|
|
@@ -31,8 +31,10 @@ function designSystemCode() {
|
|
|
31
31
|
].join('\n');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function indexCode({ embed = false, isLegacyRoot }: Context) {
|
|
35
|
-
const options = `{ legacyRoot: ${isLegacyRoot}
|
|
34
|
+
function indexCode({ embed = false, isLegacyRoot, sharedDependencies }: Context) {
|
|
35
|
+
const options = `{ legacyRoot: ${isLegacyRoot}, sharedDependenciesNames: ${JSON.stringify(
|
|
36
|
+
Object.keys(sharedDependencies)
|
|
37
|
+
)} }`;
|
|
36
38
|
return [
|
|
37
39
|
...(embed ? [] : [`require('./design-system.css');`]),
|
|
38
40
|
`import { register } from '@servicetitan/web-components';`,
|
|
@@ -3,13 +3,15 @@ import { RuleSetRule } from 'webpack';
|
|
|
3
3
|
import { cssLoader, styleLoader } from '../loaders';
|
|
4
4
|
import { Context } from '../types';
|
|
5
5
|
|
|
6
|
+
const sharedCssDependencies = [/design-system\.css$/, /@servicetitan\/anvil2\/.*\.css$/];
|
|
7
|
+
|
|
6
8
|
export function cssRules(context: Context): RuleSetRule[] {
|
|
7
9
|
const { isExposeSharedDependencies, isProduction } = context;
|
|
8
10
|
|
|
9
11
|
const excludeCallback = (path: string) => {
|
|
10
12
|
return (
|
|
11
13
|
path.endsWith('.module.css') ||
|
|
12
|
-
(isExposeSharedDependencies &&
|
|
14
|
+
(isExposeSharedDependencies && sharedCssDependencies.some(regex => regex.test(path)))
|
|
13
15
|
);
|
|
14
16
|
};
|
|
15
17
|
|
|
@@ -26,10 +28,12 @@ export function cssRules(context: Context): RuleSetRule[] {
|
|
|
26
28
|
];
|
|
27
29
|
|
|
28
30
|
if (isExposeSharedDependencies && !isProduction) {
|
|
29
|
-
result.push(
|
|
30
|
-
test
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
result.push(
|
|
32
|
+
...sharedCssDependencies.map(test => ({
|
|
33
|
+
test,
|
|
34
|
+
use: [MiniCssExtractPlugin.loader, cssLoader(context)],
|
|
35
|
+
}))
|
|
36
|
+
);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
return result;
|
|
@@ -43,6 +43,7 @@ function sharedDependenciesRules(context: Context): RuleSetRule[] {
|
|
|
43
43
|
return Object.entries(sharedDependencies).map(([dependency, variable]) => ({
|
|
44
44
|
test: getModuleEntryPath(dependency),
|
|
45
45
|
loader: require.resolve('../loaders/expose-loader'),
|
|
46
|
+
type: 'javascript/auto',
|
|
46
47
|
options: { exposes: variable },
|
|
47
48
|
}));
|
|
48
49
|
}
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"feature-c": "^0.0.0",
|
|
20
20
|
"history": "~4.10.1",
|
|
21
21
|
"mobx": "~6.10.2",
|
|
22
|
-
"react": "^18.
|
|
23
|
-
"react-dom": "^18.
|
|
22
|
+
"react": "^18.3.1",
|
|
23
|
+
"react-dom": "^18.3.1",
|
|
24
24
|
"react-router-dom": "^5.3.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@testing-library/jest-dom": "^6.4.2",
|
|
29
29
|
"@testing-library/react": "^14.2.1",
|
|
30
30
|
"@testing-library/react-hooks": "^8.0.1",
|
|
31
|
-
"@types/react": "^18.
|
|
31
|
+
"@types/react": "^18.3.1",
|
|
32
32
|
"@types/react-dom": "^18.3.0",
|
|
33
33
|
"@types/react-router-dom": "^5.3.2"
|
|
34
34
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "^18.
|
|
10
|
-
"react-dom": "^18.
|
|
9
|
+
"react": "^18.3.1",
|
|
10
|
+
"react-dom": "^18.3.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "^18.
|
|
13
|
+
"@types/react": "^18.3.1",
|
|
14
14
|
"@types/react-dom": "^18.3.0"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "^18.
|
|
10
|
-
"react-dom": "^18.
|
|
9
|
+
"react": "^18.3.1",
|
|
10
|
+
"react-dom": "^18.3.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "^18.
|
|
13
|
+
"@types/react": "^18.3.1",
|
|
14
14
|
"@types/react-dom": "^18.3.0"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "^18.
|
|
10
|
-
"react-dom": "^18.
|
|
9
|
+
"react": "^18.3.1",
|
|
10
|
+
"react-dom": "^18.3.1"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "^18.
|
|
13
|
+
"@types/react": "^18.3.1",
|
|
14
14
|
"@types/react-dom": "^18.3.0"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
package/tsconfig/base.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig.json",
|
|
2
3
|
"compilerOptions": {
|
|
3
4
|
"incremental": true,
|
|
4
5
|
"target": "es6",
|
|
@@ -16,7 +17,8 @@
|
|
|
16
17
|
"useDefineForClassFields": true,
|
|
17
18
|
"emitDecoratorMetadata": true,
|
|
18
19
|
"forceConsistentCasingInFileNames": true,
|
|
19
|
-
"resolveJsonModule": true
|
|
20
|
+
"resolveJsonModule": true,
|
|
21
|
+
"skipLibCheck": true
|
|
20
22
|
},
|
|
21
23
|
"files": ["./types.d.ts"]
|
|
22
24
|
}
|