@servicetitan/startup 22.3.0 → 22.5.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/init.js +1 -1
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/tests.d.ts.map +1 -1
- package/dist/cli/commands/tests.js +2 -35
- package/dist/cli/commands/tests.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jest/index.d.ts +2 -0
- package/dist/jest/index.d.ts.map +1 -0
- package/dist/jest/index.js +9 -0
- package/dist/jest/index.js.map +1 -0
- package/dist/utils/get-configuration.d.ts +2 -2
- 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-jest-config.d.ts +12 -0
- package/dist/utils/get-jest-config.d.ts.map +1 -0
- package/dist/utils/get-jest-config.js +70 -0
- package/dist/utils/get-jest-config.js.map +1 -0
- 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/package.json +14 -14
- package/src/cli/commands/init.ts +1 -1
- package/src/cli/commands/tests.ts +3 -47
- package/src/index.ts +1 -0
- package/src/jest/index.ts +5 -0
- package/src/utils/get-configuration.ts +1 -1
- package/src/utils/get-jest-config.ts +76 -0
- package/src/utils/index.ts +1 -0
- package/template/package.json +1 -1
- package/template/packages/application/package.json +8 -8
- package/template/packages/application/src/app.css +0 -4
- package/template/packages/application/src/app.tsx +1 -0
- package/template/packages/application/src/design-system.css +3 -0
- package/template/packages/feature-a/package.json +4 -4
- package/template/packages/feature-b/package.json +4 -4
- package/template/packages/feature-c/package.json +4 -4
|
@@ -30,7 +30,7 @@ const utils_1 = require("../../utils");
|
|
|
30
30
|
class Init {
|
|
31
31
|
execute() {
|
|
32
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
yield util_1.default.promisify(cpx_1.default.copy)(path_1.default.resolve(__dirname, '../../../template/**/{
|
|
33
|
+
yield util_1.default.promisify(cpx_1.default.copy)(path_1.default.resolve(__dirname, '../../../template/**/{.*,*,.*/*}'), process.cwd());
|
|
34
34
|
if (fs_1.default.existsSync(path_1.default.join(process.cwd(), '.npmignore'))) {
|
|
35
35
|
fs_1.default.renameSync(path_1.default.join(process.cwd(), '.npmignore'), path_1.default.join(process.cwd(), '.gitignore'));
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,8CAAsB;AACtB,gDAAwB;AACxB,gDAAwB;AAExB,uCAAwC;AAGxC,MAAa,IAAI;IAEP,OAAO;;YACT,MAAM,cAAI,CAAC,SAAS,CAAC,aAAG,CAAC,IAAI,CAAC,CAC1B,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,8CAAsB;AACtB,gDAAwB;AACxB,gDAAwB;AAExB,uCAAwC;AAGxC,MAAa,IAAI;IAEP,OAAO;;YACT,MAAM,cAAI,CAAC,SAAS,CAAC,aAAG,CAAC,IAAI,CAAC,CAC1B,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kCAAkC,CAAC,EAC3D,OAAO,CAAC,GAAG,EAAE,CAChB,CAAC;YAEF,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CAAC,EAAE;gBACvD,YAAE,CAAC,UAAU,CACT,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,EACtC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,YAAY,CAAC,CACzC,CAAC;aACL;QACL,CAAC;KAAA;CACJ;AAbG;IADC,iBAAS;;;;mCAaT;AAdL,oBAeC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tests.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC;AAE5B;;GAEG;AACH,qBAAa,KAAM,YAAW,OAAO;IACrB,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,MAAM,CAAC,IAAI;IAG/B,OAAO;CAWhB"}
|
|
@@ -17,23 +17,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
17
17
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
21
|
-
var t = {};
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
23
|
-
t[p] = s[p];
|
|
24
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
25
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
26
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
27
|
-
t[p[i]] = s[p[i]];
|
|
28
|
-
}
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
-
};
|
|
34
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
21
|
exports.Tests = void 0;
|
|
36
|
-
const path_1 = __importDefault(require("path"));
|
|
37
22
|
const core_1 = require("@jest/core");
|
|
38
23
|
const utils_1 = require("../../utils");
|
|
39
24
|
/**
|
|
@@ -50,26 +35,8 @@ class Tests {
|
|
|
50
35
|
}
|
|
51
36
|
execute() {
|
|
52
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const
|
|
54
|
-
const { results: { success }, } = yield (0, core_1.runCLI)(
|
|
55
|
-
'^.+\\.jsx?$': [
|
|
56
|
-
'babel-jest',
|
|
57
|
-
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
58
|
-
],
|
|
59
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
60
|
-
}), transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'], moduleNameMapper: JSON.stringify({
|
|
61
|
-
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
62
|
-
}), modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'], globals: JSON.stringify({
|
|
63
|
-
'ts-jest': {
|
|
64
|
-
tsconfig: './tsconfig.test.json',
|
|
65
|
-
},
|
|
66
|
-
}), testPathIgnorePatterns: [
|
|
67
|
-
...(0, utils_1.getDestinationFolders)(),
|
|
68
|
-
...(0, utils_1.toArray)(testPathIgnorePatterns),
|
|
69
|
-
], setupFiles: [
|
|
70
|
-
path_1.default.join(__dirname, '../../../jest/setup.js'),
|
|
71
|
-
...(0, utils_1.toArray)(setupFiles),
|
|
72
|
-
] }, config), [process.cwd()]);
|
|
38
|
+
const jestConfig = (0, utils_1.getJestConfigCLI)(this.args);
|
|
39
|
+
const { results: { success }, } = yield (0, core_1.runCLI)(jestConfig, [process.cwd()]);
|
|
73
40
|
if (!success) {
|
|
74
41
|
// eslint-disable-next-line require-atomic-updates
|
|
75
42
|
process.exitCode = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tests.js","sourceRoot":"","sources":["../../../src/cli/commands/tests.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,qCAAoC;AACpC,uCAA0D;AAG1D;;GAEG;AACH,MAAa,KAAK;IACd,YAAoB,IAAiB;;;;;mBAAjB;;IAAoB,CAAC;IAGnC,OAAO;;YACT,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC/C,MAAM,EACF,OAAO,EAAE,EAAE,OAAO,EAAE,GACvB,GAAG,MAAM,IAAA,aAAM,EAAC,UAAU,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAE9C,IAAI,CAAC,OAAO,EAAE;gBACV,kDAAkD;gBAClD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;aACxB;QACL,CAAC;KAAA;CACJ;AAXG;IADC,iBAAS;;;;oCAWT;AAdL,sBAeC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./webpack"), exports);
|
|
18
|
+
__exportStar(require("./jest"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,yCAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,gBAAgB,yCAE/B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createJestConfig = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
function createJestConfig() {
|
|
6
|
+
return (0, utils_1.getJestConfig)();
|
|
7
|
+
}
|
|
8
|
+
exports.createJestConfig = createJestConfig;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/jest/index.ts"],"names":[],"mappings":";;;AAAA,oCAAyC;AAEzC,SAAgB,gBAAgB;IAC5B,OAAO,IAAA,qBAAa,GAAE,CAAC;AAC3B,CAAC;AAFD,4CAEC"}
|
|
@@ -2,7 +2,7 @@ import { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-serv
|
|
|
2
2
|
import { ESLint } from 'eslint';
|
|
3
3
|
import { LinterOptions } from 'stylelint';
|
|
4
4
|
import { Config } from '@jest/types';
|
|
5
|
-
declare const allowedWebpackDevServerOptions: readonly ["headers", "port", "proxy"];
|
|
5
|
+
declare const allowedWebpackDevServerOptions: readonly ["headers", "port", "proxy", "contentBase"];
|
|
6
6
|
declare type ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;
|
|
7
7
|
export interface WebpackConfiguration extends Omit<Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>, 'proxy'> {
|
|
8
8
|
'custom-style-rules'?: boolean;
|
|
@@ -32,7 +32,7 @@ export declare function getConfiguration(location?: string): Configuration;
|
|
|
32
32
|
export declare function isBundle(location?: string): boolean;
|
|
33
33
|
export declare function isCustomStyleRules(): boolean;
|
|
34
34
|
export declare function isExposeSharedDependencies(): boolean;
|
|
35
|
-
export declare function getDevServerConfiguration(): Pick<WebpackDevServerConfiguration, "headers" | "port" | "proxy"> | undefined;
|
|
35
|
+
export declare function getDevServerConfiguration(): Pick<WebpackDevServerConfiguration, "headers" | "port" | "proxy" | "contentBase"> | undefined;
|
|
36
36
|
export declare function isWebComponent(): boolean;
|
|
37
37
|
export declare function isLegacy(location?: string): boolean;
|
|
38
38
|
export declare function getESLintConfiguration(): ESLintConfiguration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,QAAA,MAAM,8BAA8B,
|
|
1
|
+
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAIrC,QAAA,MAAM,8BAA8B,s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YAQzC;AAUD,wBAAgB,yBAAyB,kGAqBxC;AAED,wBAAgB,cAAc,YAE7B;AAED,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,WAEzC;AAED,wBAAgB,sBAAsB,wBAErC;AAED,wBAAgB,yBAAyB,2BAExC;AAED,wBAAgB,oBAAoB,sBAEnC;AAED,wBAAgB,oBAAoB,YAQnC"}
|
|
@@ -7,7 +7,7 @@ exports.isStyleCheckDisabled = exports.getJestConfiguration = exports.getStyleli
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const _1 = require(".");
|
|
10
|
-
const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy'];
|
|
10
|
+
const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'contentBase'];
|
|
11
11
|
function getConfiguration(location = './') {
|
|
12
12
|
var _a;
|
|
13
13
|
return (_a = (0, _1.readJson)(path_1.default.join(location, 'package.json')).cli) !== null && _a !== void 0 ? _a : {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.js","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAOxB,wBAA6B;AAE7B,MAAM,8BAA8B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"get-configuration.js","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAOxB,wBAA6B;AAE7B,MAAM,8BAA8B,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAU,CAAC;AAqC5F,SAAgB,gBAAgB,CAAC,QAAQ,GAAG,IAAI;;IAC5C,OAAO,MAAA,IAAA,WAAQ,EAAC,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,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@@
|
|
|
1
|
+
import { Config } from '@jest/types';
|
|
2
|
+
import { JestConfiguration } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
5
|
+
* Jest config files.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getJestConfig: () => JestConfiguration;
|
|
8
|
+
/**
|
|
9
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
10
|
+
*/
|
|
11
|
+
export declare const getJestConfigCLI: (args: Config.Argv) => Config.Argv;
|
|
12
|
+
//# sourceMappingURL=get-jest-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-jest-config.d.ts","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAA+C,iBAAiB,EAAW,MAAM,GAAG,CAAC;AAyC5F;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,iBAUhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,OAAO,IAAI,KAAG,OAAO,IAa3D,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getJestConfigCLI = exports.getJestConfig = void 0;
|
|
18
|
+
const path_1 = __importDefault(require("path"));
|
|
19
|
+
const _1 = require(".");
|
|
20
|
+
const getJestConfigBase = (stringify, testPathIgnorePatterns = [], setupFiles = []) => {
|
|
21
|
+
const transform = {
|
|
22
|
+
'^.+\\.jsx?$': [
|
|
23
|
+
'babel-jest',
|
|
24
|
+
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
25
|
+
],
|
|
26
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
27
|
+
};
|
|
28
|
+
const moduleNameMapper = {
|
|
29
|
+
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
30
|
+
};
|
|
31
|
+
const globals = {
|
|
32
|
+
'ts-jest': {
|
|
33
|
+
tsconfig: './tsconfig.test.json',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
return {
|
|
37
|
+
verbose: true,
|
|
38
|
+
testEnvironment: 'jsdom',
|
|
39
|
+
testRunner: 'jest-circus/runner',
|
|
40
|
+
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
41
|
+
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
42
|
+
transform: stringify ? JSON.stringify(transform) : transform,
|
|
43
|
+
moduleNameMapper: stringify ? JSON.stringify(moduleNameMapper) : moduleNameMapper,
|
|
44
|
+
globals: stringify ? JSON.stringify(globals) : globals,
|
|
45
|
+
testPathIgnorePatterns: [
|
|
46
|
+
'\\.yalc',
|
|
47
|
+
...(0, _1.getDestinationFolders)(),
|
|
48
|
+
...(0, _1.toArray)(testPathIgnorePatterns),
|
|
49
|
+
],
|
|
50
|
+
setupFiles: [path_1.default.join(__dirname, '../../jest/setup.js'), ...(0, _1.toArray)(setupFiles)],
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
55
|
+
* Jest config files.
|
|
56
|
+
*/
|
|
57
|
+
const getJestConfig = () => {
|
|
58
|
+
const _a = Object.assign({}, (0, _1.getJestConfiguration)()), { testPathIgnorePatterns = [], setupFiles = [] } = _a, config = __rest(_a, ["testPathIgnorePatterns", "setupFiles"]);
|
|
59
|
+
return Object.assign(Object.assign({}, getJestConfigBase(false, testPathIgnorePatterns, setupFiles)), config);
|
|
60
|
+
};
|
|
61
|
+
exports.getJestConfig = getJestConfig;
|
|
62
|
+
/**
|
|
63
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
64
|
+
*/
|
|
65
|
+
const getJestConfigCLI = (args) => {
|
|
66
|
+
const _a = Object.assign(Object.assign({}, (0, _1.getJestConfiguration)()), args), { testPathIgnorePatterns = [], setupFiles = [] } = _a, config = __rest(_a, ["testPathIgnorePatterns", "setupFiles"]);
|
|
67
|
+
return Object.assign(Object.assign({}, getJestConfigBase(true, testPathIgnorePatterns, setupFiles)), config);
|
|
68
|
+
};
|
|
69
|
+
exports.getJestConfigCLI = getJestConfigCLI;
|
|
70
|
+
//# sourceMappingURL=get-jest-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-jest-config.js","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,gDAAwB;AAExB,wBAA4F;AAE5F,MAAM,iBAAiB,GAAG,CACtB,SAAkB,EAClB,yBAAmC,EAAE,EACrC,aAAuB,EAAE,EACC,EAAE;IAC5B,MAAM,SAAS,GAAG;QACd,aAAa,EAAE;YACX,YAAY;YACZ,EAAE,OAAO,EAAE,CAAC,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,EAAE;SACzE;QACD,aAAa,EAAE,SAAS;KAC3B,CAAC;IACF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AEG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAiB,EAAe,EAAE;IAC/D,MAAM,qCAKC,IAAA,uBAAoB,GAAE,GACtB,IAAI,CACV,EAPK,EACF,sBAAsB,GAAG,EAAE,EAC3B,UAAU,GAAG,EAAE,OAKlB,EAJM,MAAM,cAHP,wCAIL,CAGA,CAAC;IACF,uCACO,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,EAAE,UAAU,CAAC,GAC3D,MAAM,EACX;AACN,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -24,4 +24,5 @@ __exportStar(require("./log"), exports);
|
|
|
24
24
|
__exportStar(require("./read-json"), exports);
|
|
25
25
|
__exportStar(require("./to-array"), exports);
|
|
26
26
|
__exportStar(require("./load-shared-dependencies"), exports);
|
|
27
|
+
__exportStar(require("./get-jest-config"), exports);
|
|
27
28
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,4DAA0C;AAC1C,gDAA8B;AAC9B,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,wCAAsB;AACtB,8CAA4B;AAC5B,6CAA2B;AAC3B,6DAA2C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,4DAA0C;AAC1C,gDAA8B;AAC9B,qDAAmC;AACnC,iDAA+B;AAC/B,qDAAmC;AACnC,wCAAsB;AACtB,8CAA4B;AAC5B,6CAA2B;AAC3B,6DAA2C;AAC3C,oDAAkC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/startup",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/startup",
|
|
6
6
|
"repository": {
|
|
@@ -22,30 +22,30 @@
|
|
|
22
22
|
"bin": "./bin/index.js",
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/cpx": "~1.5.2",
|
|
25
|
-
"@types/eslint": "~8.
|
|
25
|
+
"@types/eslint": "~8.21.2",
|
|
26
26
|
"@types/less": "~3.0.3",
|
|
27
27
|
"@types/mini-css-extract-plugin": "~2.4.0",
|
|
28
28
|
"@types/moment-locales-webpack-plugin": "~1.2.2",
|
|
29
29
|
"@types/sass": "~1.43.1",
|
|
30
30
|
"@types/webpack-assets-manifest": "~5.1.0",
|
|
31
31
|
"@types/webpack-dev-server": "~3.11.5",
|
|
32
|
-
"@types/yargs": "~17.0.
|
|
32
|
+
"@types/yargs": "~17.0.22"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@babel/preset-env": "~7.20.2",
|
|
36
36
|
"@jest/core": "~27.5.1",
|
|
37
37
|
"@jest/types": "~27.5.1",
|
|
38
38
|
"@lerna/exec": "~5.6.2",
|
|
39
|
-
"@servicetitan/eslint-config": "22.
|
|
40
|
-
"@servicetitan/stylelint-config": "22.
|
|
39
|
+
"@servicetitan/eslint-config": "22.5.0",
|
|
40
|
+
"@servicetitan/stylelint-config": "22.5.0",
|
|
41
41
|
"@types/jest": "~27.4.0",
|
|
42
42
|
"chalk": "~4.1.2",
|
|
43
43
|
"chokidar": "~3.5.3",
|
|
44
44
|
"cpx": "~1.5.0",
|
|
45
45
|
"css-loader": "~6.7.3",
|
|
46
|
-
"deepmerge": "~4.
|
|
46
|
+
"deepmerge": "~4.3.1",
|
|
47
47
|
"esbuild-loader": "~2.21.0",
|
|
48
|
-
"eslint": "~8.
|
|
48
|
+
"eslint": "~8.36.0",
|
|
49
49
|
"execa": "~5.1.1",
|
|
50
50
|
"fork-ts-checker-webpack-plugin": "~7.3.0",
|
|
51
51
|
"glob": "~7.2.0",
|
|
@@ -63,27 +63,27 @@
|
|
|
63
63
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
64
64
|
"portfinder": "~1.0.28",
|
|
65
65
|
"prettier": "~2.7.1",
|
|
66
|
-
"sass": "~1.
|
|
66
|
+
"sass": "~1.59.3",
|
|
67
67
|
"sass-loader": "~12.6.0",
|
|
68
68
|
"source-map-loader": "~3.0.1",
|
|
69
|
-
"style-loader": "~3.3.
|
|
69
|
+
"style-loader": "~3.3.2",
|
|
70
70
|
"stylelint": "~14.16.1",
|
|
71
71
|
"ts-jest": "~27.1.4",
|
|
72
72
|
"ts-loader": "~9.3.1",
|
|
73
73
|
"ts-node": "~10.8.2",
|
|
74
74
|
"typed-css-modules": "~0.7.2",
|
|
75
|
-
"typescript": "~
|
|
75
|
+
"typescript": "~5.0.2",
|
|
76
76
|
"username": "~5.1.0",
|
|
77
|
-
"webpack": "~5.
|
|
77
|
+
"webpack": "~5.76.1",
|
|
78
78
|
"webpack-assets-manifest": "~5.1.0",
|
|
79
|
-
"webpack-bundle-analyzer": "^4.
|
|
79
|
+
"webpack-bundle-analyzer": "^4.8.0",
|
|
80
80
|
"webpack-dev-server": "~3.11.2",
|
|
81
81
|
"webpack-filter-warnings-plugin": "~1.2.1",
|
|
82
82
|
"webpack-merge": "~5.8.0",
|
|
83
83
|
"webpack-virtual-modules": "~0.5.0",
|
|
84
84
|
"worker-loader": "~3.0.8",
|
|
85
85
|
"xhr-mock": "~2.5.1",
|
|
86
|
-
"yargs": "~17.
|
|
86
|
+
"yargs": "~17.7.1"
|
|
87
87
|
},
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"cli": {
|
|
92
92
|
"webpack": false
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "976f67b687205e256444722b5b277794717d4987"
|
|
95
95
|
}
|
package/src/cli/commands/init.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
|
|
3
1
|
import { Config } from '@jest/types';
|
|
4
2
|
import { runCLI } from '@jest/core';
|
|
5
|
-
|
|
6
|
-
import { getDestinationFolders, getJestConfiguration, logErrors, toArray } from '../../utils';
|
|
3
|
+
import { getJestConfigCLI, logErrors } from '../../utils';
|
|
7
4
|
import { Command } from '.';
|
|
8
5
|
|
|
9
6
|
/**
|
|
@@ -14,51 +11,10 @@ export class Tests implements Command {
|
|
|
14
11
|
|
|
15
12
|
@logErrors
|
|
16
13
|
async execute() {
|
|
17
|
-
const
|
|
18
|
-
testPathIgnorePatterns = [],
|
|
19
|
-
setupFiles = [],
|
|
20
|
-
...config
|
|
21
|
-
} = {
|
|
22
|
-
...getJestConfiguration(),
|
|
23
|
-
...this.args,
|
|
24
|
-
};
|
|
25
|
-
|
|
14
|
+
const jestConfig = getJestConfigCLI(this.args);
|
|
26
15
|
const {
|
|
27
16
|
results: { success },
|
|
28
|
-
} = await runCLI(
|
|
29
|
-
{
|
|
30
|
-
verbose: true,
|
|
31
|
-
testEnvironment: 'jsdom',
|
|
32
|
-
testRunner: 'jest-circus/runner',
|
|
33
|
-
transform: JSON.stringify({
|
|
34
|
-
'^.+\\.jsx?$': [
|
|
35
|
-
'babel-jest',
|
|
36
|
-
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
37
|
-
],
|
|
38
|
-
'^.+\\.tsx?$': 'ts-jest',
|
|
39
|
-
}),
|
|
40
|
-
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
41
|
-
moduleNameMapper: JSON.stringify({
|
|
42
|
-
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
43
|
-
}),
|
|
44
|
-
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
45
|
-
globals: JSON.stringify({
|
|
46
|
-
'ts-jest': {
|
|
47
|
-
tsconfig: './tsconfig.test.json',
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
testPathIgnorePatterns: [
|
|
51
|
-
...getDestinationFolders(),
|
|
52
|
-
...toArray(testPathIgnorePatterns),
|
|
53
|
-
],
|
|
54
|
-
setupFiles: [
|
|
55
|
-
path.join(__dirname, '../../../jest/setup.js'),
|
|
56
|
-
...toArray(setupFiles),
|
|
57
|
-
],
|
|
58
|
-
...config,
|
|
59
|
-
},
|
|
60
|
-
[process.cwd()]
|
|
61
|
-
);
|
|
17
|
+
} = await runCLI(jestConfig, [process.cwd()]);
|
|
62
18
|
|
|
63
19
|
if (!success) {
|
|
64
20
|
// eslint-disable-next-line require-atomic-updates
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { Config } from '@jest/types';
|
|
|
8
8
|
|
|
9
9
|
import { readJson } from '.';
|
|
10
10
|
|
|
11
|
-
const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy'] as const;
|
|
11
|
+
const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'contentBase'] as const;
|
|
12
12
|
|
|
13
13
|
type ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;
|
|
14
14
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { Config } from '@jest/types';
|
|
3
|
+
import { getDestinationFolders, getJestConfiguration, JestConfiguration, toArray } from '.';
|
|
4
|
+
|
|
5
|
+
const getJestConfigBase = (
|
|
6
|
+
stringify: boolean,
|
|
7
|
+
testPathIgnorePatterns: string[] = [],
|
|
8
|
+
setupFiles: string[] = []
|
|
9
|
+
): Partial<JestConfiguration> => {
|
|
10
|
+
const transform = {
|
|
11
|
+
'^.+\\.jsx?$': [
|
|
12
|
+
'babel-jest',
|
|
13
|
+
{ presets: [['@babel/preset-env', { targets: { node: 'current' } }]] },
|
|
14
|
+
],
|
|
15
|
+
'^.+\\.tsx?$': 'ts-jest',
|
|
16
|
+
};
|
|
17
|
+
const moduleNameMapper = {
|
|
18
|
+
'\\.(css|scss|less|svg)$': 'identity-obj-proxy',
|
|
19
|
+
};
|
|
20
|
+
const globals = {
|
|
21
|
+
'ts-jest': {
|
|
22
|
+
tsconfig: './tsconfig.test.json',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
verbose: true,
|
|
28
|
+
testEnvironment: 'jsdom',
|
|
29
|
+
testRunner: 'jest-circus/runner',
|
|
30
|
+
transformIgnorePatterns: ['node_modules/(?!@servicetitan/)'],
|
|
31
|
+
modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],
|
|
32
|
+
transform: stringify ? JSON.stringify(transform) : transform,
|
|
33
|
+
moduleNameMapper: stringify ? JSON.stringify(moduleNameMapper) : moduleNameMapper,
|
|
34
|
+
globals: stringify ? JSON.stringify(globals) : globals,
|
|
35
|
+
testPathIgnorePatterns: [
|
|
36
|
+
'\\.yalc',
|
|
37
|
+
...getDestinationFolders(),
|
|
38
|
+
...toArray(testPathIgnorePatterns),
|
|
39
|
+
],
|
|
40
|
+
setupFiles: [path.join(__dirname, '../../jest/setup.js'), ...toArray(setupFiles)],
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get Jest clean config for running tests. This config could be used to export Jest configuration into the
|
|
46
|
+
* Jest config files.
|
|
47
|
+
*/
|
|
48
|
+
export const getJestConfig = (): JestConfiguration => {
|
|
49
|
+
const {
|
|
50
|
+
testPathIgnorePatterns = [],
|
|
51
|
+
setupFiles = [],
|
|
52
|
+
...config
|
|
53
|
+
} = { ...getJestConfiguration() };
|
|
54
|
+
return {
|
|
55
|
+
...getJestConfigBase(false, testPathIgnorePatterns, setupFiles),
|
|
56
|
+
...config,
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Get Jest config for running it using jest CLI (see jest runCLI function)
|
|
62
|
+
*/
|
|
63
|
+
export const getJestConfigCLI = (args: Config.Argv): Config.Argv => {
|
|
64
|
+
const {
|
|
65
|
+
testPathIgnorePatterns = [],
|
|
66
|
+
setupFiles = [],
|
|
67
|
+
...config
|
|
68
|
+
} = {
|
|
69
|
+
...getJestConfiguration(),
|
|
70
|
+
...args,
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
...getJestConfigBase(true, testPathIgnorePatterns, setupFiles),
|
|
74
|
+
...config,
|
|
75
|
+
};
|
|
76
|
+
};
|
package/src/utils/index.ts
CHANGED
package/template/package.json
CHANGED
|
@@ -7,18 +7,18 @@
|
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"scripts": {},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@servicetitan/design-system": "
|
|
11
|
-
"@servicetitan/link-item": "
|
|
10
|
+
"@servicetitan/design-system": "^12.10.0",
|
|
11
|
+
"@servicetitan/link-item": "^23.1.0",
|
|
12
12
|
"feature-a": "^0.0.0",
|
|
13
13
|
"feature-b": "^0.0.0",
|
|
14
14
|
"feature-c": "^0.0.0",
|
|
15
|
-
"react": "
|
|
16
|
-
"react-dom": "
|
|
17
|
-
"react-router-dom": "
|
|
15
|
+
"react": "^17.0.2",
|
|
16
|
+
"react-dom": "^17.0.2",
|
|
17
|
+
"react-router-dom": "^5.3.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@types/react": "
|
|
21
|
-
"@types/react-dom": "
|
|
22
|
-
"@types/react-router-dom": "
|
|
20
|
+
"@types/react": "^17.0.37",
|
|
21
|
+
"@types/react-dom": "^17.0.11",
|
|
22
|
+
"@types/react-router-dom": "^5.3.2"
|
|
23
23
|
}
|
|
24
24
|
}
|
|
@@ -3,6 +3,7 @@ import { BrowserRouter, Switch, Route } from 'react-router-dom';
|
|
|
3
3
|
import { SideNav, Frame, Page, Sidebar } from '@servicetitan/design-system';
|
|
4
4
|
import { SideNavLinkItem } from '@servicetitan/link-item';
|
|
5
5
|
|
|
6
|
+
import './design-system.css';
|
|
6
7
|
import './app.css';
|
|
7
8
|
|
|
8
9
|
export const App: FC = () => (
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "
|
|
10
|
-
"react-dom": "
|
|
9
|
+
"react": "^17.0.2",
|
|
10
|
+
"react-dom": "^17.0.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "
|
|
14
|
-
"@types/react-dom": "
|
|
13
|
+
"@types/react": "^17.0.37",
|
|
14
|
+
"@types/react-dom": "^17.0.11"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "
|
|
10
|
-
"react-dom": "
|
|
9
|
+
"react": "^17.0.2",
|
|
10
|
+
"react-dom": "^17.0.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "
|
|
14
|
-
"@types/react-dom": "
|
|
13
|
+
"@types/react": "^17.0.37",
|
|
14
|
+
"@types/react-dom": "^17.0.11"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"react": "
|
|
10
|
-
"react-dom": "
|
|
9
|
+
"react": "^17.0.2",
|
|
10
|
+
"react-dom": "^17.0.2"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@types/react": "
|
|
14
|
-
"@types/react-dom": "
|
|
13
|
+
"@types/react": "^17.0.37",
|
|
14
|
+
"@types/react-dom": "^17.0.11"
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|