@servicetitan/startup 27.3.0 → 27.4.0-canary.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/get-branch-configs.d.ts +4 -0
- package/dist/cli/commands/get-branch-configs.d.ts.map +1 -0
- package/dist/cli/commands/get-branch-configs.js +13 -0
- package/dist/cli/commands/get-branch-configs.js.map +1 -0
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +4 -2
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +39 -9
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/mfe-package-clean.d.ts +13 -0
- package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -0
- package/dist/cli/commands/mfe-package-clean.js +113 -0
- package/dist/cli/commands/mfe-package-clean.js.map +1 -0
- package/dist/cli/commands/mfe-package-publish.d.ts +20 -0
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -0
- package/dist/cli/commands/mfe-package-publish.js +153 -0
- package/dist/cli/commands/mfe-package-publish.js.map +1 -0
- package/dist/cli/commands/mfe-publish.d.ts +4 -29
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +1 -213
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/utils/assets-copy.d.ts.map +1 -1
- package/dist/cli/utils/assets-copy.js +3 -3
- package/dist/cli/utils/assets-copy.js.map +1 -1
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +10 -11
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-os.d.ts +9 -2
- package/dist/cli/utils/cli-os.d.ts.map +1 -1
- package/dist/cli/utils/cli-os.js +16 -8
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/cli/utils/styles-copy.d.ts.map +1 -1
- package/dist/cli/utils/styles-copy.js +3 -3
- package/dist/cli/utils/styles-copy.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +2 -1
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +5 -0
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-exposed-dependencies.d.ts +7 -0
- package/dist/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/utils/get-exposed-dependencies.js +10 -0
- package/dist/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/utils/get-folders.js +2 -2
- package/dist/utils/get-folders.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +4 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +2 -9
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +15 -5
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/types.d.ts +16 -0
- package/dist/webpack/configs/types.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
- package/dist/webpack/configs/utils/generate-metadata.js +3 -3
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
- package/package.json +9 -15
- package/src/cli/commands/__tests__/init.test.ts +108 -28
- package/src/cli/commands/__tests__/mfe-package-clean.test.ts +1 -1
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +77 -7
- package/src/cli/commands/get-branch-configs.ts +8 -0
- package/src/cli/commands/get-command.ts +3 -1
- package/src/cli/commands/init.ts +40 -10
- package/src/cli/commands/mfe-package-clean.ts +132 -0
- package/src/cli/commands/mfe-package-publish.ts +189 -0
- package/src/cli/commands/mfe-publish.ts +5 -294
- package/src/cli/utils/__tests__/assets-copy.test.ts +3 -7
- package/src/cli/utils/__tests__/bundle.test.ts +45 -6
- package/src/cli/utils/__tests__/cli-os.test.ts +41 -6
- package/src/cli/utils/__tests__/styles-copy.test.ts +3 -7
- package/src/cli/utils/assets-copy.ts +3 -3
- package/src/cli/utils/bundle.ts +14 -20
- package/src/cli/utils/cli-os.ts +20 -8
- package/src/cli/utils/styles-copy.ts +3 -3
- package/src/index.ts +2 -0
- package/src/utils/__tests__/get-configuration.test.ts +6 -0
- package/src/utils/get-configuration.ts +6 -1
- package/src/utils/get-exposed-dependencies.ts +19 -0
- package/src/utils/get-folders.ts +1 -1
- package/src/utils/index.ts +1 -0
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +47 -13
- package/src/webpack/__tests__/create-webpack-config.test.ts +10 -0
- package/src/webpack/configs/dev-server-config.ts +7 -2
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +6 -16
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +17 -5
- package/src/webpack/configs/types.ts +19 -0
- package/src/webpack/configs/utils/generate-metadata.ts +5 -5
- package/template/.eslintrc.json +0 -3
- package/template/.gitignore +0 -21
- package/template/.npmrc +0 -3
- package/template/.prettierrc +0 -9
- package/template/.stylelintignore +0 -1
- package/template/.stylelintrc.json +0 -3
- package/template/.vscode/extensions.json +0 -18
- package/template/.vscode/settings.json +0 -4
- package/template/lerna.json +0 -4
- package/template/package.json +0 -32
- package/template/packages/application/package.json +0 -35
- package/template/packages/application/src/__tests__/app.test.tsx +0 -33
- package/template/packages/application/src/app.css +0 -3
- package/template/packages/application/src/app.tsx +0 -45
- package/template/packages/application/src/design-system.css +0 -3
- package/template/packages/application/src/index.tsx +0 -8
- package/template/packages/application/src/main-page.tsx +0 -5
- package/template/packages/application/src/second-page.tsx +0 -5
- package/template/packages/application/tsconfig.json +0 -13
- package/template/packages/feature-a/package.json +0 -19
- package/template/packages/feature-a/src/index.ts +0 -0
- package/template/packages/feature-a/tsconfig.json +0 -9
- package/template/packages/feature-b/package.json +0 -19
- package/template/packages/feature-b/src/index.ts +0 -0
- package/template/packages/feature-b/tsconfig.json +0 -9
- package/template/packages/feature-c/package.json +0 -19
- package/template/packages/feature-c/src/index.ts +0 -0
- package/template/packages/feature-c/tsconfig.json +0 -9
- package/template/setupTests.ts +0 -27
- package/template/tsconfig.test.json +0 -5
- package/template-react18/packages/application/package.json +0 -35
- package/template-react18/packages/application/src/index.tsx +0 -9
- package/template-react18/packages/feature-a/package.json +0 -19
- package/template-react18/packages/feature-b/package.json +0 -19
- package/template-react18/packages/feature-c/package.json +0 -19
- package/tsconfig.json +0 -13
|
@@ -4,9 +4,10 @@ import { Configuration } from 'webpack';
|
|
|
4
4
|
import {
|
|
5
5
|
PackageType,
|
|
6
6
|
allowedWebpackDevServerOptions,
|
|
7
|
-
getConfiguration,
|
|
8
7
|
getPackageName,
|
|
9
8
|
getPackages,
|
|
9
|
+
getWebpackConfiguration,
|
|
10
|
+
isDevServerDisabled,
|
|
10
11
|
log,
|
|
11
12
|
pick,
|
|
12
13
|
} from '../../utils';
|
|
@@ -23,6 +24,10 @@ export function devServerConfig(context: Context, overrides: Overrides): Result
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const watchOptions = watchOptionsConfig();
|
|
27
|
+
if (isDevServerDisabled()) {
|
|
28
|
+
return { watchOptions };
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
const devServer = {
|
|
27
32
|
hot: false,
|
|
28
33
|
port: 8080,
|
|
@@ -41,7 +46,7 @@ export function devServerConfig(context: Context, overrides: Overrides): Result
|
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
function getDevServerConfig() {
|
|
44
|
-
const webpack =
|
|
49
|
+
const webpack = getWebpackConfiguration();
|
|
45
50
|
/* istanbul ignore next: debug only */
|
|
46
51
|
log.debug('dev-server-config', () => JSON.stringify({ webpack }, null, 2));
|
|
47
52
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DefinePlugin } from 'webpack';
|
|
2
|
-
import { getPackageDependencyVersion } from '../../../utils';
|
|
2
|
+
import { getExposedDependencies, getPackageDependencyVersion } from '../../../utils';
|
|
3
3
|
import { Context, Overrides } from '../types';
|
|
4
4
|
|
|
5
5
|
export function defineExposedDependenciesPlugin(context: Context, _: Overrides) {
|
|
@@ -8,22 +8,12 @@ export function defineExposedDependenciesPlugin(context: Context, _: Overrides)
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
const exposedDependencies = getExposedDependencies(sharedDependencies, dependency =>
|
|
12
|
+
getPackageDependencyVersion(dependency, packageData.dependencies?.[dependency])
|
|
13
|
+
);
|
|
14
|
+
|
|
11
15
|
return new DefinePlugin({
|
|
12
16
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
EXPOSED_DEPENDENCIES: JSON.stringify(
|
|
14
|
-
Object.entries(sharedDependencies).reduce(
|
|
15
|
-
(result, [dependency, variable]) =>
|
|
16
|
-
Object.assign(result, {
|
|
17
|
-
[dependency]: {
|
|
18
|
-
version: getPackageDependencyVersion(
|
|
19
|
-
dependency,
|
|
20
|
-
packageData.dependencies?.[dependency]
|
|
21
|
-
),
|
|
22
|
-
variable,
|
|
23
|
-
},
|
|
24
|
-
}),
|
|
25
|
-
{}
|
|
26
|
-
)
|
|
27
|
-
),
|
|
17
|
+
EXPOSED_DEPENDENCIES: JSON.stringify(exposedDependencies),
|
|
28
18
|
});
|
|
29
19
|
}
|
|
@@ -15,9 +15,11 @@ export function virtualModulesPlugin(context: Context, _: Overrides) {
|
|
|
15
15
|
[indexPath]: indexCode(context),
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
if (needsToIncludeDesignSystem(context)) {
|
|
19
|
+
const designSystemPath = path.join(process.cwd(), `${source}/design-system.css`);
|
|
20
|
+
if (!fs.existsSync(designSystemPath)) {
|
|
21
|
+
modules[designSystemPath] = designSystemCode();
|
|
22
|
+
}
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
return new VirtualModulesPlugin(modules);
|
|
@@ -31,14 +33,24 @@ function designSystemCode() {
|
|
|
31
33
|
].join('\n');
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
function indexCode(
|
|
36
|
+
function indexCode(context: Context) {
|
|
37
|
+
const { embed = false, isLegacyRoot, sharedDependencies } = context;
|
|
35
38
|
const options = `{ legacyRoot: ${isLegacyRoot}, sharedDependenciesNames: ${JSON.stringify(
|
|
36
39
|
Object.keys(sharedDependencies)
|
|
37
40
|
)} }`;
|
|
38
41
|
return [
|
|
39
|
-
...(
|
|
42
|
+
...(needsToIncludeDesignSystem(context) ? [`require('./design-system.css');`] : []),
|
|
40
43
|
`import { register } from '@servicetitan/web-components';`,
|
|
41
44
|
`import { App } from './app';`,
|
|
42
45
|
`register(App, ${embed}, ${options});`,
|
|
43
46
|
].join('\n');
|
|
44
47
|
}
|
|
48
|
+
|
|
49
|
+
function needsToIncludeDesignSystem({ embed, packageData, sharedDependencies }: Context) {
|
|
50
|
+
return (
|
|
51
|
+
// Depends on design system
|
|
52
|
+
!!packageData.dependencies['@servicetitan/design-system'] &&
|
|
53
|
+
// ... and is not light bundle with private copy of design system
|
|
54
|
+
!(embed && !!sharedDependencies['@servicetitan/design-system'])
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -13,7 +13,26 @@ export interface Context extends Options {
|
|
|
13
13
|
isProduction: boolean;
|
|
14
14
|
isWebComponent: boolean;
|
|
15
15
|
minify?: MinifyOptions;
|
|
16
|
+
name: string;
|
|
16
17
|
packageData: ReturnType<typeof getPackageData>;
|
|
17
18
|
sharedDependencies: ReturnType<typeof loadSharedDependencies>;
|
|
18
19
|
source: string;
|
|
19
20
|
}
|
|
21
|
+
|
|
22
|
+
export interface EntryPoint {
|
|
23
|
+
css?: string[];
|
|
24
|
+
js?: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface EntryPoints {
|
|
28
|
+
full?: EntryPoint;
|
|
29
|
+
light?: EntryPoint;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface Metadata {
|
|
33
|
+
name: string;
|
|
34
|
+
bundledWith: Record<string, string>;
|
|
35
|
+
sharedDependencies: Record<string, string>;
|
|
36
|
+
dependencies: Record<string, string>;
|
|
37
|
+
entrypoints: EntryPoints;
|
|
38
|
+
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { log, getStartupVersion, readJsonSafe } from '../../../utils';
|
|
4
|
-
import { Context } from '../types';
|
|
4
|
+
import { Context, Metadata } from '../types';
|
|
5
5
|
|
|
6
6
|
import { getWebComponentsVersion } from './get-web-components-version';
|
|
7
7
|
|
|
8
8
|
export function generateMetadata(context: Context) {
|
|
9
9
|
const { destination, name, packageData, sharedDependencies } = context;
|
|
10
|
-
const outputFile = `./${destination}/metadata.json`;
|
|
11
10
|
|
|
12
|
-
if (!fs.existsSync(
|
|
13
|
-
fs.mkdirSync(
|
|
11
|
+
if (!fs.existsSync(destination)) {
|
|
12
|
+
fs.mkdirSync(destination, { recursive: true });
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
const full = readJsonSafe(path.join(destination, 'bundle', 'full', 'entrypoints.json'));
|
|
17
16
|
const light = readJsonSafe(path.join(destination, 'bundle', 'light', 'entrypoints.json'));
|
|
18
|
-
const metadata = {
|
|
17
|
+
const metadata: Metadata = {
|
|
19
18
|
name,
|
|
20
19
|
bundledWith: {
|
|
21
20
|
'@servicetitan/startup': getStartupVersion(),
|
|
@@ -26,6 +25,7 @@ export function generateMetadata(context: Context) {
|
|
|
26
25
|
entrypoints: { ...(full ? { full } : {}), ...(light ? { light } : {}) },
|
|
27
26
|
};
|
|
28
27
|
|
|
28
|
+
const outputFile = path.join(destination, 'metadata.json');
|
|
29
29
|
fs.writeFileSync(outputFile, JSON.stringify(metadata, null, 2), 'utf8');
|
|
30
30
|
|
|
31
31
|
/* istanbul ignore next: debug only */
|
package/template/.eslintrc.json
DELETED
package/template/.gitignore
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Mac-related stuff
|
|
2
|
-
._.DS_Store/
|
|
3
|
-
.DS_Store/
|
|
4
|
-
*.DS_Store
|
|
5
|
-
|
|
6
|
-
# Node.js
|
|
7
|
-
node_modules/
|
|
8
|
-
|
|
9
|
-
# yalc store
|
|
10
|
-
.yalc/
|
|
11
|
-
yalc.lock
|
|
12
|
-
|
|
13
|
-
#SonarQube
|
|
14
|
-
.scannerwork/
|
|
15
|
-
|
|
16
|
-
*.css.d.ts
|
|
17
|
-
*.less.d.ts
|
|
18
|
-
*.scss.d.ts
|
|
19
|
-
/coverage/
|
|
20
|
-
dist/
|
|
21
|
-
*.tsbuildinfo
|
package/template/.npmrc
DELETED
package/template/.prettierrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/coverage
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
|
3
|
-
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
|
4
|
-
|
|
5
|
-
// List of extensions which should be recommended for users of this workspace.
|
|
6
|
-
"recommendations": [
|
|
7
|
-
"dbaeumer.vscode-eslint",
|
|
8
|
-
"esbenp.prettier-vscode",
|
|
9
|
-
"stylelint.vscode-stylelint",
|
|
10
|
-
"editorconfig.editorconfig",
|
|
11
|
-
"yoavbls.pretty-ts-errors",
|
|
12
|
-
"streetsidesoftware.code-spell-checker",
|
|
13
|
-
"eamodio.gitlens",
|
|
14
|
-
"pomber.git-file-history"
|
|
15
|
-
],
|
|
16
|
-
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
|
17
|
-
"unwantedRecommendations": []
|
|
18
|
-
}
|
package/template/lerna.json
DELETED
package/template/package.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "root",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"description": "Multi-package web application template",
|
|
5
|
-
"private": true,
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=18",
|
|
8
|
-
"npm": ">=10"
|
|
9
|
-
},
|
|
10
|
-
"scripts": {
|
|
11
|
-
"bootstrap": "npx --yes @servicetitan/startup install",
|
|
12
|
-
"prestart": "npm run bootstrap",
|
|
13
|
-
"start": "startup start",
|
|
14
|
-
"prebuild": "npm run bootstrap",
|
|
15
|
-
"build": "startup build",
|
|
16
|
-
"lint": "startup lint",
|
|
17
|
-
"test": "startup test"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@servicetitan/startup": ">=22.21.0"
|
|
21
|
-
},
|
|
22
|
-
"workspaces": [
|
|
23
|
-
"packages/*"
|
|
24
|
-
],
|
|
25
|
-
"cli": {
|
|
26
|
-
"test": {
|
|
27
|
-
"setupFilesAfterEnv": [
|
|
28
|
-
"./setupTests.ts"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
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": "^13.4.3",
|
|
11
|
-
"@servicetitan/hash-browser-router": "^24.1.0",
|
|
12
|
-
"@servicetitan/link-item": "^26.1.0",
|
|
13
|
-
"@servicetitan/log-service": "^24.1.0",
|
|
14
|
-
"@servicetitan/react-ioc": "^24.1.0",
|
|
15
|
-
"@servicetitan/web-components": "^24.1.0",
|
|
16
|
-
"axios": "^0.28.1",
|
|
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.2",
|
|
22
|
-
"react": "^17.0.2",
|
|
23
|
-
"react-dom": "^17.0.2",
|
|
24
|
-
"react-router-dom": "^5.3.0"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@servicetitan/testing-library": "^1.2.0",
|
|
28
|
-
"@testing-library/jest-dom": "^5.17.0",
|
|
29
|
-
"@testing-library/react": "^12.1.5",
|
|
30
|
-
"@testing-library/react-hooks": "^8.0.1",
|
|
31
|
-
"@types/react": "^17.0.37",
|
|
32
|
-
"@types/react-dom": "^17.0.11",
|
|
33
|
-
"@types/react-router-dom": "^5.3.2"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { mockComponent, mockLocation } from '@servicetitan/testing-library';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import { App } from '../app';
|
|
5
|
-
|
|
6
|
-
jest.mock('../main-page', () => mockComponent('MainPage'));
|
|
7
|
-
jest.mock('../second-page', () => mockComponent('SecondPage'));
|
|
8
|
-
|
|
9
|
-
describe(`${App.name}`, () => {
|
|
10
|
-
const subject = () => render(<App />);
|
|
11
|
-
|
|
12
|
-
test('renders sidebar', () => {
|
|
13
|
-
subject();
|
|
14
|
-
|
|
15
|
-
expect(screen.getByRole('link', { name: 'Main page' })).toBeInTheDocument();
|
|
16
|
-
expect(screen.getByRole('link', { name: 'Second page' })).toBeInTheDocument();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const routes = Object.entries({
|
|
20
|
-
MainPage: '/',
|
|
21
|
-
SecondPage: '/#/second-page',
|
|
22
|
-
}).map(([component, path]) => ({ component, path }));
|
|
23
|
-
|
|
24
|
-
describe.each(routes)('when location is $path', ({ component, path }) => {
|
|
25
|
-
beforeEach(() => mockLocation(path));
|
|
26
|
-
|
|
27
|
-
test(`renders <${component} />`, () => {
|
|
28
|
-
subject();
|
|
29
|
-
|
|
30
|
-
expect(screen).toContainComponent(component);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { StrictMode, FC } from 'react';
|
|
2
|
-
import { Switch, Route } from 'react-router-dom';
|
|
3
|
-
import { HashBrowserRouter } from '@servicetitan/hash-browser-router';
|
|
4
|
-
import { SideNav, Frame, Page, Sidebar } from '@servicetitan/design-system';
|
|
5
|
-
import { SideNavLinkItem } from '@servicetitan/link-item';
|
|
6
|
-
|
|
7
|
-
import { SecondPage } from './second-page';
|
|
8
|
-
import { MainPage } from './main-page';
|
|
9
|
-
import './design-system.css';
|
|
10
|
-
import './app.css';
|
|
11
|
-
|
|
12
|
-
export const App: FC = () => (
|
|
13
|
-
<StrictMode>
|
|
14
|
-
<HashBrowserRouter>
|
|
15
|
-
<Frame>
|
|
16
|
-
<Page
|
|
17
|
-
sidebar={
|
|
18
|
-
<Sidebar localStorageKey="sidebar-application">
|
|
19
|
-
<Sidebar.Section padding="y">
|
|
20
|
-
<SideNav title="Application">
|
|
21
|
-
<SideNavLinkItem pathname="/" exact>
|
|
22
|
-
Main page
|
|
23
|
-
</SideNavLinkItem>
|
|
24
|
-
<SideNavLinkItem pathname="/second-page">
|
|
25
|
-
Second page
|
|
26
|
-
</SideNavLinkItem>
|
|
27
|
-
</SideNav>
|
|
28
|
-
</Sidebar.Section>
|
|
29
|
-
</Sidebar>
|
|
30
|
-
}
|
|
31
|
-
maxWidth="wide"
|
|
32
|
-
>
|
|
33
|
-
<Switch>
|
|
34
|
-
<Route path="/" exact>
|
|
35
|
-
<MainPage />
|
|
36
|
-
</Route>
|
|
37
|
-
<Route path="/second-page">
|
|
38
|
-
<SecondPage />
|
|
39
|
-
</Route>
|
|
40
|
-
</Switch>
|
|
41
|
-
</Page>
|
|
42
|
-
</Frame>
|
|
43
|
-
</HashBrowserRouter>
|
|
44
|
-
</StrictMode>
|
|
45
|
-
);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@servicetitan/startup/tsconfig/base",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
"rootDir": "src"
|
|
6
|
-
},
|
|
7
|
-
"include": ["src/**/*"],
|
|
8
|
-
"references": [
|
|
9
|
-
{ "path": "../feature-a" },
|
|
10
|
-
{ "path": "../feature-b" },
|
|
11
|
-
{ "path": "../feature-c" }
|
|
12
|
-
]
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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": "^17.0.2",
|
|
10
|
-
"react-dom": "^17.0.2"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@types/react": "^17.0.37",
|
|
14
|
-
"@types/react-dom": "^17.0.11"
|
|
15
|
-
},
|
|
16
|
-
"cli": {
|
|
17
|
-
"webpack": false
|
|
18
|
-
}
|
|
19
|
-
}
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
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": "^17.0.2",
|
|
10
|
-
"react-dom": "^17.0.2"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@types/react": "^17.0.37",
|
|
14
|
-
"@types/react-dom": "^17.0.11"
|
|
15
|
-
},
|
|
16
|
-
"cli": {
|
|
17
|
-
"webpack": false
|
|
18
|
-
}
|
|
19
|
-
}
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
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": "^17.0.2",
|
|
10
|
-
"react-dom": "^17.0.2"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@types/react": "^17.0.37",
|
|
14
|
-
"@types/react-dom": "^17.0.11"
|
|
15
|
-
},
|
|
16
|
-
"cli": {
|
|
17
|
-
"webpack": false
|
|
18
|
-
}
|
|
19
|
-
}
|
|
File without changes
|
package/template/setupTests.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import '@servicetitan/testing-library';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
|
|
4
|
-
Object.defineProperties(window, {
|
|
5
|
-
location: { value: window.location, writable: true, configurable: true },
|
|
6
|
-
matchMedia: {
|
|
7
|
-
value: jest.fn().mockImplementation(query => ({
|
|
8
|
-
matches: false,
|
|
9
|
-
media: query,
|
|
10
|
-
onChange: null,
|
|
11
|
-
addEventListener: jest.fn(),
|
|
12
|
-
removeEventListener: jest.fn(),
|
|
13
|
-
dispatchEvent: jest.fn(),
|
|
14
|
-
})),
|
|
15
|
-
writable: true,
|
|
16
|
-
configurable: true,
|
|
17
|
-
},
|
|
18
|
-
ResizeObserver: {
|
|
19
|
-
value: jest.fn().mockImplementation(() => ({
|
|
20
|
-
disconnect: jest.fn(),
|
|
21
|
-
observe: jest.fn(),
|
|
22
|
-
unobserve: jest.fn(),
|
|
23
|
-
})),
|
|
24
|
-
writable: true,
|
|
25
|
-
configurable: true,
|
|
26
|
-
},
|
|
27
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
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": "^24.1.0",
|
|
12
|
-
"@servicetitan/link-item": "^26.1.0",
|
|
13
|
-
"@servicetitan/log-service": "^24.1.0",
|
|
14
|
-
"@servicetitan/react-ioc": "^24.1.0",
|
|
15
|
-
"@servicetitan/web-components": "^24.1.0",
|
|
16
|
-
"axios": "^0.28.1",
|
|
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.2",
|
|
22
|
-
"react": "^18.3.1",
|
|
23
|
-
"react-dom": "^18.3.1",
|
|
24
|
-
"react-router-dom": "^5.3.0"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@servicetitan/testing-library": "^1.2.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.3.3",
|
|
32
|
-
"@types/react-dom": "^18.3.0",
|
|
33
|
-
"@types/react-router-dom": "^5.3.2"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
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.3.1",
|
|
10
|
-
"react-dom": "^18.3.1"
|
|
11
|
-
},
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@types/react": "^18.3.3",
|
|
14
|
-
"@types/react-dom": "^18.3.0"
|
|
15
|
-
},
|
|
16
|
-
"cli": {
|
|
17
|
-
"webpack": false
|
|
18
|
-
}
|
|
19
|
-
}
|