@servicetitan/startup 22.21.0 → 23.1.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 +1 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +1 -0
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts +1 -0
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +1 -0
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/init.d.ts +8 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +25 -3
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/start.d.ts +1 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +1 -0
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts +1 -0
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +11 -5
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/compile-sass.d.ts +1 -1
- package/dist/cli/utils/compile-sass.d.ts.map +1 -1
- package/dist/cli/utils/compile-sass.js +13 -5
- package/dist/cli/utils/compile-sass.js.map +1 -1
- package/dist/cli/utils/tcm.d.ts.map +1 -1
- package/dist/cli/utils/tcm.js +14 -7
- package/dist/cli/utils/tcm.js.map +1 -1
- package/dist/utils/get-jest-config.d.ts.map +1 -1
- package/dist/utils/get-jest-config.js +18 -13
- package/dist/utils/get-jest-config.js.map +1 -1
- package/dist/webpack/configs/rules/tsx-rules.d.ts +1 -1
- package/dist/webpack/configs/rules/tsx-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/tsx-rules.js +10 -8
- package/dist/webpack/configs/rules/tsx-rules.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +1 -0
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +2 -2
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +3 -2
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js +1 -1
- package/dist/webpack/utils/testing/normalize-errors.js.map +1 -1
- package/package.json +15 -13
- package/src/cli/commands/__tests__/build.test.ts +14 -0
- package/src/cli/commands/__tests__/init.test.ts +48 -17
- package/src/cli/commands/__tests__/start.test.ts +14 -0
- package/src/cli/commands/build.ts +2 -0
- package/src/cli/commands/bundle-package.ts +2 -0
- package/src/cli/commands/init.ts +26 -12
- package/src/cli/commands/start.ts +2 -0
- package/src/cli/utils/__tests__/tcm.test.ts +15 -6
- package/src/cli/utils/bundle.ts +14 -5
- package/src/cli/utils/compile-sass.ts +3 -7
- package/src/cli/utils/tcm.ts +13 -11
- package/src/utils/__tests__/get-jest-config.test.ts +15 -38
- package/src/utils/get-jest-config.ts +32 -45
- package/src/webpack/__tests__/create-webpack-config.test.ts +25 -3
- package/src/webpack/configs/rules/tsx-rules.ts +13 -9
- package/src/webpack/configs/types.ts +1 -0
- package/src/webpack/create-webpack-config.ts +3 -2
- package/src/webpack/loaders/expose-loader/__tests__/__snapshots__/index.test.ts.snap +14 -14
- package/src/webpack/types.ts +3 -2
- package/src/webpack/utils/testing/normalize-errors.ts +1 -1
- package/template/package.json +3 -3
- package/template/packages/application/package.json +6 -0
- package/template/packages/application/src/__tests__/app.test.tsx +1 -1
- package/template/packages/application/src/app.tsx +4 -3
- package/template-react18/packages/application/package.json +35 -0
- package/template-react18/packages/application/src/index.tsx +9 -0
- package/template-react18/packages/feature-a/package.json +19 -0
- package/template-react18/packages/feature-b/package.json +19 -0
- package/template-react18/packages/feature-c/package.json +19 -0
|
@@ -4,39 +4,34 @@ import { JestConfiguration, getJestConfiguration } from './get-configuration';
|
|
|
4
4
|
import { getDestinationFolders } from './get-destination-folders';
|
|
5
5
|
import { toArray } from './to-array';
|
|
6
6
|
|
|
7
|
-
const getJestConfigBase = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const getJestConfigBase = ({
|
|
8
|
+
coveragePathIgnorePatterns = [],
|
|
9
|
+
setupFiles = [],
|
|
10
|
+
testPathIgnorePatterns = [],
|
|
11
|
+
}: {
|
|
12
|
+
coveragePathIgnorePatterns?: string[];
|
|
13
|
+
setupFiles?: string[];
|
|
14
|
+
testPathIgnorePatterns?: string[];
|
|
15
|
+
}) => {
|
|
14
16
|
const transform = {
|
|
15
17
|
'^.+\\.jsx?$': [
|
|
16
18
|
'babel-jest',
|
|
17
19
|
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
18
20
|
],
|
|
19
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
21
|
+
'^.+\\.tsx?$': ['ts-jest', { tsconfig: './tsconfig.test.json' }],
|
|
20
22
|
};
|
|
21
23
|
const moduleNameMapper = {
|
|
22
24
|
'\\.(css|scss|less|png|svg|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$': 'identity-obj-proxy',
|
|
23
25
|
};
|
|
24
|
-
const globals = {
|
|
25
|
-
'ts-jest': {
|
|
26
|
-
tsconfig: './tsconfig.test.json',
|
|
27
|
-
},
|
|
28
|
-
...globalsOverrides,
|
|
29
|
-
};
|
|
30
26
|
|
|
31
27
|
return {
|
|
32
28
|
verbose: true,
|
|
33
29
|
testEnvironment: 'jsdom',
|
|
34
30
|
testRunner: 'jest-circus/runner',
|
|
35
|
-
transformIgnorePatterns: ['node_modules/(
|
|
31
|
+
transformIgnorePatterns: ['node_modules/(?!(@servicetitan|@react-hook|nanoid|axios)/)'],
|
|
36
32
|
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
37
|
-
transform
|
|
38
|
-
moduleNameMapper
|
|
39
|
-
globals: stringify ? JSON.stringify(globals) : globals,
|
|
33
|
+
transform,
|
|
34
|
+
moduleNameMapper,
|
|
40
35
|
testPathIgnorePatterns: [
|
|
41
36
|
'\\.yalc',
|
|
42
37
|
...getDestinationFolders(),
|
|
@@ -54,21 +49,14 @@ const getJestConfigBase = (
|
|
|
54
49
|
* Jest config files.
|
|
55
50
|
*/
|
|
56
51
|
export const getJestConfig = (): JestConfiguration => {
|
|
57
|
-
const {
|
|
58
|
-
|
|
59
|
-
setupFiles = [],
|
|
60
|
-
coveragePathIgnorePatterns = [],
|
|
61
|
-
globals = {},
|
|
62
|
-
...config
|
|
63
|
-
} = { ...getJestConfiguration() };
|
|
52
|
+
const { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, ...config } =
|
|
53
|
+
getJestConfiguration() as Record<string, any>;
|
|
64
54
|
return {
|
|
65
|
-
...getJestConfigBase(
|
|
66
|
-
false,
|
|
67
|
-
testPathIgnorePatterns,
|
|
68
|
-
setupFiles,
|
|
55
|
+
...getJestConfigBase({
|
|
69
56
|
coveragePathIgnorePatterns,
|
|
70
|
-
|
|
71
|
-
|
|
57
|
+
setupFiles,
|
|
58
|
+
testPathIgnorePatterns,
|
|
59
|
+
}),
|
|
72
60
|
...config,
|
|
73
61
|
};
|
|
74
62
|
};
|
|
@@ -77,24 +65,23 @@ export const getJestConfig = (): JestConfiguration => {
|
|
|
77
65
|
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
78
66
|
*/
|
|
79
67
|
export const getJestConfigCLI = (args: Config.Argv): Config.Argv => {
|
|
80
|
-
const {
|
|
81
|
-
testPathIgnorePatterns = [],
|
|
82
|
-
setupFiles = [],
|
|
83
|
-
coveragePathIgnorePatterns = [],
|
|
84
|
-
globals = {},
|
|
85
|
-
...config
|
|
86
|
-
} = {
|
|
68
|
+
const { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, globals, ...config } = {
|
|
87
69
|
...getJestConfiguration(),
|
|
88
70
|
...args,
|
|
89
71
|
};
|
|
72
|
+
|
|
73
|
+
const { collectCoverageFrom, moduleNameMapper, transform, ...rest } = getJestConfigBase({
|
|
74
|
+
coveragePathIgnorePatterns,
|
|
75
|
+
setupFiles,
|
|
76
|
+
testPathIgnorePatterns,
|
|
77
|
+
});
|
|
78
|
+
|
|
90
79
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
globals
|
|
97
|
-
),
|
|
80
|
+
collectCoverageFrom: JSON.stringify(collectCoverageFrom),
|
|
81
|
+
globals: JSON.stringify(globals),
|
|
82
|
+
moduleNameMapper: JSON.stringify(moduleNameMapper),
|
|
83
|
+
transform: JSON.stringify(transform),
|
|
84
|
+
...rest,
|
|
98
85
|
...config,
|
|
99
86
|
};
|
|
100
87
|
};
|
|
@@ -231,7 +231,19 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
231
231
|
});
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
function
|
|
234
|
+
function itConfiguresCodeCoverage() {
|
|
235
|
+
test('configures ".tsx" rules to use coverage-istanbul-loader', () => {
|
|
236
|
+
expect(subject().module?.rules).toEqual(
|
|
237
|
+
expect.arrayContaining([
|
|
238
|
+
expect.objectContaining({
|
|
239
|
+
test: /\.tsx?$/,
|
|
240
|
+
use: expect.arrayContaining(['@jsdevtools/coverage-istanbul-loader']),
|
|
241
|
+
}),
|
|
242
|
+
])
|
|
243
|
+
);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function itConfiguresESBuildLoader() {
|
|
235
247
|
test('configures ".tsx" rules to use esbuild-loader', () => {
|
|
236
248
|
expect(subject().module?.rules).toContainEqual({
|
|
237
249
|
test: /\.tsx?$/,
|
|
@@ -265,16 +277,26 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
|
|
|
265
277
|
expect(subject().plugins).toContainEqual(new ProvidePlugin({ React: 'react' }));
|
|
266
278
|
});
|
|
267
279
|
}
|
|
280
|
+
describe('with --code-coverage command line argument', () => {
|
|
281
|
+
beforeEach(() => Object.assign(argv, { 'code-coverage': true }));
|
|
282
|
+
itConfiguresCodeCoverage();
|
|
283
|
+
});
|
|
284
|
+
describe('with codeCoverage option', () => {
|
|
285
|
+
beforeEach(() => {
|
|
286
|
+
options = { codeCoverage: true };
|
|
287
|
+
});
|
|
288
|
+
itConfiguresCodeCoverage();
|
|
289
|
+
});
|
|
268
290
|
describe('with --esbuild command line argument', () => {
|
|
269
291
|
beforeEach(() => Object.assign(argv, { esbuild: true }));
|
|
270
|
-
|
|
292
|
+
itConfiguresESBuildLoader();
|
|
271
293
|
itConfiguresReactToLoadAutomatically();
|
|
272
294
|
});
|
|
273
295
|
describe('with esbuild option', () => {
|
|
274
296
|
beforeEach(() => {
|
|
275
297
|
options = { esbuild: true };
|
|
276
298
|
});
|
|
277
|
-
|
|
299
|
+
itConfiguresESBuildLoader();
|
|
278
300
|
itConfiguresReactToLoadAutomatically();
|
|
279
301
|
});
|
|
280
302
|
describe('with experimental-bundlers option', () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RuleSetRule } from 'webpack';
|
|
1
|
+
import { RuleSetRule, RuleSetUseItem } from 'webpack';
|
|
2
2
|
import { Context } from '../types';
|
|
3
3
|
|
|
4
|
-
export function tsxRules({ esbuild, experimentalBundlers }: Context): RuleSetRule[] {
|
|
4
|
+
export function tsxRules({ codeCoverage, esbuild, experimentalBundlers }: Context): RuleSetRule[] {
|
|
5
5
|
let loader: Record<string, any> = {
|
|
6
6
|
loader: 'ts-loader',
|
|
7
7
|
options: { transpileOnly: true },
|
|
@@ -34,11 +34,15 @@ export function tsxRules({ esbuild, experimentalBundlers }: Context): RuleSetRul
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
const rule = {
|
|
38
|
+
test: /\.tsx?$/,
|
|
39
|
+
exclude: /node_modules/,
|
|
40
|
+
use: [loader] as RuleSetUseItem[],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
if (codeCoverage) {
|
|
44
|
+
rule.use.unshift('@jsdevtools/coverage-istanbul-loader');
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return [rule];
|
|
44
48
|
}
|
|
@@ -41,10 +41,11 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
|
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
const context: Context = {
|
|
44
|
+
codeCoverage: options.codeCoverage ?? !!(argv as Arguments)['code-coverage'],
|
|
44
45
|
destination,
|
|
45
|
-
esbuild: options.esbuild ?? !!(argv as Arguments).esbuild
|
|
46
|
+
esbuild: options.esbuild ?? !!(argv as Arguments).esbuild,
|
|
46
47
|
experimentalBundlers:
|
|
47
|
-
options.experimentalBundlers ?? !!(argv as Arguments)['experimental-bundlers']
|
|
48
|
+
options.experimentalBundlers ?? !!(argv as Arguments)['experimental-bundlers'],
|
|
48
49
|
isCustomStyleRules: isCustomStyleRules(),
|
|
49
50
|
isExposeSharedDependencies: isExposeSharedDependencies(),
|
|
50
51
|
isProduction: configuration.mode === 'production',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`expose-loader should work for a nested property for a global object: errors 1`] = `
|
|
3
|
+
exports[`expose-loader should work for a nested property for a global object: errors 1`] = `[]`;
|
|
4
4
|
|
|
5
5
|
exports[`expose-loader should work for a nested property for a global object: module 1`] = `
|
|
6
|
-
"var ___EXPOSE_LOADER_IMPORT___ = require(
|
|
7
|
-
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require(
|
|
6
|
+
"var ___EXPOSE_LOADER_IMPORT___ = require("-!./configuration.expose-loader.js");
|
|
7
|
+
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require("../../runtime/get-global-this.ts");
|
|
8
8
|
var ___EXPOSE_LOADER_STORAGE_KEY___ = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
9
9
|
if (___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] === undefined) {
|
|
10
10
|
___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] = Object.assign(
|
|
@@ -48,7 +48,7 @@ ___EXPOSE_LOADER_GLOBAL_THIS___.SharedDependencies.Configuration = new Proxy(
|
|
|
48
48
|
if (prop === 'getStorage') {
|
|
49
49
|
return Reflect.get(target, prop, receiver);
|
|
50
50
|
}
|
|
51
|
-
return getModule(require.resolveWeak(
|
|
51
|
+
return getModule(require.resolveWeak("-!./configuration.expose-loader.js"))
|
|
52
52
|
},
|
|
53
53
|
}
|
|
54
54
|
);
|
|
@@ -57,8 +57,8 @@ module.exports = ___EXPOSE_LOADER_IMPORT___;
|
|
|
57
57
|
`;
|
|
58
58
|
|
|
59
59
|
exports[`expose-loader should work for a nested property for a global object: result 1`] = `
|
|
60
|
-
|
|
61
|
-
"configuration":
|
|
60
|
+
{
|
|
61
|
+
"configuration": {
|
|
62
62
|
"get": [Function],
|
|
63
63
|
"set": [Function],
|
|
64
64
|
"version": "1.0.0",
|
|
@@ -66,13 +66,13 @@ Object {
|
|
|
66
66
|
}
|
|
67
67
|
`;
|
|
68
68
|
|
|
69
|
-
exports[`expose-loader should work for a nested property for a global object: warnings 1`] = `
|
|
69
|
+
exports[`expose-loader should work for a nested property for a global object: warnings 1`] = `[]`;
|
|
70
70
|
|
|
71
|
-
exports[`expose-loader should work: errors 1`] = `
|
|
71
|
+
exports[`expose-loader should work: errors 1`] = `[]`;
|
|
72
72
|
|
|
73
73
|
exports[`expose-loader should work: module 1`] = `
|
|
74
|
-
"var ___EXPOSE_LOADER_IMPORT___ = require(
|
|
75
|
-
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require(
|
|
74
|
+
"var ___EXPOSE_LOADER_IMPORT___ = require("-!./configuration.expose-loader.js");
|
|
75
|
+
var ___EXPOSE_LOADER_GLOBAL_THIS___ = require("../../runtime/get-global-this.ts");
|
|
76
76
|
var ___EXPOSE_LOADER_STORAGE_KEY___ = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
77
77
|
if (___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] === undefined) {
|
|
78
78
|
___EXPOSE_LOADER_GLOBAL_THIS___[___EXPOSE_LOADER_STORAGE_KEY___] = Object.assign(
|
|
@@ -113,7 +113,7 @@ ___EXPOSE_LOADER_GLOBAL_THIS___.Configuration = new Proxy(
|
|
|
113
113
|
if (prop === 'getStorage') {
|
|
114
114
|
return Reflect.get(target, prop, receiver);
|
|
115
115
|
}
|
|
116
|
-
return getModule(require.resolveWeak(
|
|
116
|
+
return getModule(require.resolveWeak("-!./configuration.expose-loader.js"))
|
|
117
117
|
},
|
|
118
118
|
}
|
|
119
119
|
);
|
|
@@ -122,8 +122,8 @@ module.exports = ___EXPOSE_LOADER_IMPORT___;
|
|
|
122
122
|
`;
|
|
123
123
|
|
|
124
124
|
exports[`expose-loader should work: result 1`] = `
|
|
125
|
-
|
|
126
|
-
"configuration":
|
|
125
|
+
{
|
|
126
|
+
"configuration": {
|
|
127
127
|
"get": [Function],
|
|
128
128
|
"set": [Function],
|
|
129
129
|
"version": "1.0.0",
|
|
@@ -131,4 +131,4 @@ Object {
|
|
|
131
131
|
}
|
|
132
132
|
`;
|
|
133
133
|
|
|
134
|
-
exports[`expose-loader should work: warnings 1`] = `
|
|
134
|
+
exports[`expose-loader should work: warnings 1`] = `[]`;
|
package/src/webpack/types.ts
CHANGED
|
@@ -4,11 +4,12 @@ import { PluginOptions as MiniCssExtractPlugInOptions } from 'mini-css-extract-p
|
|
|
4
4
|
import { Configuration } from 'webpack';
|
|
5
5
|
|
|
6
6
|
export interface Options {
|
|
7
|
-
embed?: boolean;
|
|
8
7
|
buildStat?: boolean;
|
|
9
|
-
|
|
8
|
+
codeCoverage?: boolean;
|
|
9
|
+
embed?: boolean;
|
|
10
10
|
esbuild?: boolean;
|
|
11
11
|
experimentalBundlers?: boolean;
|
|
12
|
+
name?: string;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface Overrides {
|
|
@@ -14,5 +14,5 @@ function removeCWD(str: string) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function normalizeErrors(errors: WebpackError[]) {
|
|
17
|
-
return errors.map(error => removeCWD(error.
|
|
17
|
+
return errors.map(error => removeCWD(error.message.split('\n').slice(0, 2).join('\n')));
|
|
18
18
|
}
|
package/template/package.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"description": "Multi-package web application template",
|
|
5
5
|
"private": true,
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
8
|
-
"npm": ">=
|
|
7
|
+
"node": ">=18",
|
|
8
|
+
"npm": ">=10"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"bootstrap": "npx --yes @servicetitan/startup install",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "startup test"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@servicetitan/startup": ">=22.
|
|
20
|
+
"@servicetitan/startup": ">=22.21.0"
|
|
21
21
|
},
|
|
22
22
|
"workspaces": [
|
|
23
23
|
"packages/*"
|
|
@@ -8,11 +8,17 @@
|
|
|
8
8
|
"scripts": {},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@servicetitan/design-system": "^12.10.0",
|
|
11
|
+
"@servicetitan/hash-browser-router": "^22.15.0",
|
|
11
12
|
"@servicetitan/link-item": "^23.1.0",
|
|
13
|
+
"@servicetitan/log-service": "^22.15.0",
|
|
12
14
|
"@servicetitan/react-ioc": "^22.15.0",
|
|
15
|
+
"@servicetitan/web-components": "^22.15.0",
|
|
16
|
+
"axios": "^0.27.2",
|
|
13
17
|
"feature-a": "^0.0.0",
|
|
14
18
|
"feature-b": "^0.0.0",
|
|
15
19
|
"feature-c": "^0.0.0",
|
|
20
|
+
"history": "~4.10.1",
|
|
21
|
+
"mobx": "~6.10.0",
|
|
16
22
|
"react": "^17.0.2",
|
|
17
23
|
"react-dom": "^17.0.2",
|
|
18
24
|
"react-router-dom": "^5.3.0"
|
|
@@ -18,7 +18,7 @@ describe(`${App.name}`, () => {
|
|
|
18
18
|
|
|
19
19
|
const routes = Object.entries({
|
|
20
20
|
MainPage: '/',
|
|
21
|
-
SecondPage: '
|
|
21
|
+
SecondPage: '/#/second-page',
|
|
22
22
|
}).map(([component, path]) => ({ component, path }));
|
|
23
23
|
|
|
24
24
|
describe.each(routes)('when location is $path', ({ component, path }) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StrictMode, FC } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { Switch, Route } from 'react-router-dom';
|
|
3
|
+
import { HashBrowserRouter } from '@servicetitan/hash-browser-router';
|
|
3
4
|
import { SideNav, Frame, Page, Sidebar } from '@servicetitan/design-system';
|
|
4
5
|
import { SideNavLinkItem } from '@servicetitan/link-item';
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ import './app.css';
|
|
|
10
11
|
|
|
11
12
|
export const App: FC = () => (
|
|
12
13
|
<StrictMode>
|
|
13
|
-
<
|
|
14
|
+
<HashBrowserRouter>
|
|
14
15
|
<Frame>
|
|
15
16
|
<Page
|
|
16
17
|
sidebar={
|
|
@@ -39,6 +40,6 @@ export const App: FC = () => (
|
|
|
39
40
|
</Switch>
|
|
40
41
|
</Page>
|
|
41
42
|
</Frame>
|
|
42
|
-
</
|
|
43
|
+
</HashBrowserRouter>
|
|
43
44
|
</StrictMode>
|
|
44
45
|
);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "application",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": true,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"scripts": {},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@servicetitan/design-system": "^14.0.0",
|
|
11
|
+
"@servicetitan/hash-browser-router": "^22.15.0",
|
|
12
|
+
"@servicetitan/link-item": "^23.1.0",
|
|
13
|
+
"@servicetitan/log-service": "^22.15.0",
|
|
14
|
+
"@servicetitan/react-ioc": "^22.15.0",
|
|
15
|
+
"@servicetitan/web-components": "^22.15.0",
|
|
16
|
+
"axios": "^0.27.2",
|
|
17
|
+
"feature-a": "^0.0.0",
|
|
18
|
+
"feature-b": "^0.0.0",
|
|
19
|
+
"feature-c": "^0.0.0",
|
|
20
|
+
"history": "~4.10.1",
|
|
21
|
+
"mobx": "~6.10.0",
|
|
22
|
+
"react": "^18.2.0",
|
|
23
|
+
"react-dom": "^18.2.0",
|
|
24
|
+
"react-router-dom": "^5.3.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@servicetitan/testing-library": "^0.3.0",
|
|
28
|
+
"@testing-library/jest-dom": "^6.4.2",
|
|
29
|
+
"@testing-library/react": "^14.2.1",
|
|
30
|
+
"@testing-library/react-hooks": "^8.0.1",
|
|
31
|
+
"@types/react": "^18.2.55",
|
|
32
|
+
"@types/react-dom": "^18.2.19",
|
|
33
|
+
"@types/react-router-dom": "^5.3.2"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "feature-a",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": true,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"react": "^18.2.0",
|
|
10
|
+
"react-dom": "^18.2.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/react": "^18.2.55",
|
|
14
|
+
"@types/react-dom": "^18.2.19"
|
|
15
|
+
},
|
|
16
|
+
"cli": {
|
|
17
|
+
"webpack": false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "feature-b",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": true,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"react": "^18.2.0",
|
|
10
|
+
"react-dom": "^18.2.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/react": "^18.2.55",
|
|
14
|
+
"@types/react-dom": "^18.2.19"
|
|
15
|
+
},
|
|
16
|
+
"cli": {
|
|
17
|
+
"webpack": false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "feature-c",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": true,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"typings": "./dist/index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"react": "^18.2.0",
|
|
10
|
+
"react-dom": "^18.2.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/react": "^18.2.55",
|
|
14
|
+
"@types/react-dom": "^18.2.19"
|
|
15
|
+
},
|
|
16
|
+
"cli": {
|
|
17
|
+
"webpack": false
|
|
18
|
+
}
|
|
19
|
+
}
|