@servicetitan/startup 32.0.1 → 32.2.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/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +10 -2
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/no-deprecated-content-base.d.ts +13 -0
- package/dist/cli/commands/review/rules/no-deprecated-content-base.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js +71 -0
- package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -0
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.d.ts +15 -0
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js +75 -0
- package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js.map +1 -0
- package/dist/cli/commands/review/rules/no-typescript-entry-point.d.ts +2 -2
- package/dist/cli/commands/review/rules/no-typescript-entry-point.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js +58 -45
- package/dist/cli/commands/review/rules/no-typescript-entry-point.js.map +1 -1
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.d.ts +20 -0
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js +145 -0
- package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -0
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.d.ts +22 -0
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +189 -0
- package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -0
- package/dist/cli/commands/review/rules/require-explicit-side-effects.d.ts +2 -1
- package/dist/cli/commands/review/rules/require-explicit-side-effects.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js +24 -11
- package/dist/cli/commands/review/rules/require-explicit-side-effects.js.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -1
- package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js +5 -7
- package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js.map +1 -1
- package/dist/cli/commands/review/rules/require-servicetitan-scope.d.ts +2 -1
- package/dist/cli/commands/review/rules/require-servicetitan-scope.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js +24 -11
- package/dist/cli/commands/review/rules/require-servicetitan-scope.js.map +1 -1
- package/dist/cli/commands/review/types.d.ts +4 -1
- package/dist/cli/commands/review/types.d.ts.map +1 -1
- package/dist/cli/commands/review/types.js.map +1 -1
- package/dist/cli/commands/review/utils/check-packages.d.ts +7 -0
- package/dist/cli/commands/review/utils/check-packages.d.ts.map +1 -0
- package/dist/cli/commands/review/utils/check-packages.js +30 -0
- package/dist/cli/commands/review/utils/check-packages.js.map +1 -0
- package/dist/cli/commands/review/utils/index.d.ts +1 -0
- package/dist/cli/commands/review/utils/index.d.ts.map +1 -1
- package/dist/cli/commands/review/utils/index.js +1 -0
- package/dist/cli/commands/review/utils/index.js.map +1 -1
- package/dist/cli/commands/test/runners/vitest.js +2 -1
- package/dist/cli/commands/test/runners/vitest.js.map +1 -1
- package/dist/cli/utils/bundle.js +1 -1
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-git.d.ts.map +1 -1
- package/dist/cli/utils/cli-git.js +11 -8
- package/dist/cli/utils/cli-git.js.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.d.ts.map +1 -1
- package/dist/cli/utils/maybe-create-git-folder.js +7 -1
- package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +9 -3
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-jest-config.d.ts.map +1 -1
- package/dist/utils/get-jest-config.js +20 -9
- package/dist/utils/get-jest-config.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/utils/omit.d.ts +2 -0
- package/dist/utils/omit.d.ts.map +1 -0
- package/dist/utils/omit.js +28 -0
- package/dist/utils/omit.js.map +1 -0
- package/package.json +22 -17
- package/src/cli/commands/review/rules/__mocks__/mock-config.ts +8 -2
- package/src/cli/commands/review/rules/__tests__/no-deprecated-content-base.test.ts +123 -0
- package/src/cli/commands/review/rules/__tests__/no-direct-peer-dependencies.test.ts +130 -0
- package/src/cli/commands/review/rules/__tests__/prefer-open-ended-peer-dependencies.test.ts +121 -0
- package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts +256 -0
- package/src/cli/commands/review/rules/index.ts +10 -2
- package/src/cli/commands/review/rules/no-deprecated-content-base.ts +50 -0
- package/src/cli/commands/review/rules/no-direct-peer-dependencies.ts +58 -0
- package/src/cli/commands/review/rules/no-typescript-entry-point.ts +5 -8
- package/src/cli/commands/review/rules/prefer-open-ended-peer-dependencies.ts +89 -0
- package/src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts +141 -0
- package/src/cli/commands/review/rules/require-explicit-side-effects.ts +14 -14
- package/src/cli/commands/review/rules/require-one-collection-version.ts +1 -3
- package/src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts +5 -9
- package/src/cli/commands/review/rules/require-servicetitan-scope.ts +14 -14
- package/src/cli/commands/review/types.ts +16 -2
- package/src/cli/commands/review/utils/check-packages.ts +19 -0
- package/src/cli/commands/review/utils/index.ts +1 -0
- package/src/cli/commands/test/runners/__tests__/vitest.test.ts +82 -13
- package/src/cli/commands/test/runners/vitest.ts +4 -2
- package/src/cli/utils/__tests__/cli-git.test.ts +20 -18
- package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +1 -1
- package/src/cli/utils/bundle.ts +1 -1
- package/src/cli/utils/cli-git.ts +8 -7
- package/src/cli/utils/maybe-create-git-folder.ts +6 -1
- package/src/utils/__tests__/get-jest-config.test.ts +44 -0
- package/src/utils/get-configuration.ts +6 -2
- package/src/utils/get-jest-config.ts +36 -18
- package/src/utils/index.ts +1 -0
- package/src/utils/omit.ts +12 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "checkPackages", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return checkPackages;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _applyfilter = require("./apply-filter");
|
|
12
|
+
function checkPackages({ id }, { config, packages }, fn) {
|
|
13
|
+
var _config_rules;
|
|
14
|
+
const ruleConfig = id ? (_config_rules = config.rules) === null || _config_rules === void 0 ? void 0 : _config_rules[id] : undefined;
|
|
15
|
+
return (0, _applyfilter.applyFilter)(ruleConfig, packages, ({ name })=>name).reduce((result, pkg)=>{
|
|
16
|
+
const error = fn(pkg);
|
|
17
|
+
if (Array.isArray(error)) {
|
|
18
|
+
return [
|
|
19
|
+
...result,
|
|
20
|
+
...error
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
return error ? [
|
|
24
|
+
...result,
|
|
25
|
+
error
|
|
26
|
+
] : result;
|
|
27
|
+
}, []);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=check-packages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/check-packages.ts"],"sourcesContent":["import { Package, PackageError, Project } from '../types';\nimport { applyFilter } from './apply-filter';\n\ntype CheckFn<T> = (pkg: Package) => PackageError<T>[] | PackageError<T> | undefined;\n\nexport function checkPackages<T>(\n { id }: { id?: string },\n { config, packages }: Project,\n fn: CheckFn<T>\n) {\n const ruleConfig = id ? config.rules?.[id] : undefined;\n return applyFilter(ruleConfig, packages, ({ name }) => name).reduce((result, pkg) => {\n const error = fn(pkg);\n if (Array.isArray(error)) {\n return [...result, ...error];\n }\n return error ? [...result, error] : result;\n }, []);\n}\n"],"names":["checkPackages","id","config","packages","fn","ruleConfig","rules","undefined","applyFilter","name","reduce","result","pkg","error","Array","isArray"],"mappings":";;;;+BAKgBA;;;eAAAA;;;6BAJY;AAIrB,SAASA,cACZ,EAAEC,EAAE,EAAmB,EACvB,EAAEC,MAAM,EAAEC,QAAQ,EAAW,EAC7BC,EAAc;QAEUF;IAAxB,MAAMG,aAAaJ,MAAKC,gBAAAA,OAAOI,KAAK,cAAZJ,oCAAAA,aAAc,CAACD,GAAG,GAAGM;IAC7C,OAAOC,IAAAA,wBAAW,EAACH,YAAYF,UAAU,CAAC,EAAEM,IAAI,EAAE,GAAKA,MAAMC,MAAM,CAAC,CAACC,QAAQC;QACzE,MAAMC,QAAQT,GAAGQ;QACjB,IAAIE,MAAMC,OAAO,CAACF,QAAQ;YACtB,OAAO;mBAAIF;mBAAWE;aAAM;QAChC;QACA,OAAOA,QAAQ;eAAIF;YAAQE;SAAM,GAAGF;IACxC,GAAG,EAAE;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/review/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
_export_star(require("./apply-filter"), exports);
|
|
6
|
+
_export_star(require("./check-packages"), exports);
|
|
6
7
|
_export_star(require("./collate-dependencies"), exports);
|
|
7
8
|
_export_star(require("./compare-version"), exports);
|
|
8
9
|
_export_star(require("./format-depends-on"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/index.ts"],"sourcesContent":["export * from './apply-filter';\nexport * from './collate-dependencies';\nexport * from './compare-version';\nexport * from './format-depends-on';\nexport * from './format-location';\nexport * from './get-key';\nexport * from './get-max-version';\nexport * from './indent';\nexport * from './is-library';\nexport * from './name-to-location';\nexport * from './pluralize';\nexport * from './set-version';\nexport * from './summarize';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/review/utils/index.ts"],"sourcesContent":["export * from './apply-filter';\nexport * from './check-packages';\nexport * from './collate-dependencies';\nexport * from './compare-version';\nexport * from './format-depends-on';\nexport * from './format-location';\nexport * from './get-key';\nexport * from './get-max-version';\nexport * from './indent';\nexport * from './is-library';\nexport * from './name-to-location';\nexport * from './pluralize';\nexport * from './set-version';\nexport * from './summarize';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -75,8 +75,9 @@ function getDefaultConfig() {
|
|
|
75
75
|
}
|
|
76
76
|
async function getUserConfig() {
|
|
77
77
|
const { viteConfig } = await (0, _node.resolveConfig)();
|
|
78
|
+
const { omitDefault = [], ...config } = (0, _utils.getVitestConfiguration)();
|
|
78
79
|
var _viteConfig_test;
|
|
79
|
-
const result = (0, _config.mergeConfig)((0, _config.mergeConfig)(
|
|
80
|
+
const result = (0, _config.mergeConfig)((0, _config.mergeConfig)((0, _utils.omit)(getDefaultConfig(), omitDefault), config), (_viteConfig_test = viteConfig.test) !== null && _viteConfig_test !== void 0 ? _viteConfig_test : {});
|
|
80
81
|
/* istanbul ignore next: debug only */ _utils.log.debug('vitest:userConfig', ()=>JSON.stringify(result, null, 2));
|
|
81
82
|
return {
|
|
82
83
|
test: result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { startVitest, parseCLI, resolveConfig } from 'vitest/node';\nimport { getVitestConfiguration, log } from '../../../../utils';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [\n ...coverageConfigDefaults.exclude,\n '**/__mocks__/**',\n '**/*.stories.*',\n '\\\\.yalc',\n ],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, '\\\\.yalc'],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const result = mergeConfig(\n mergeConfig(getDefaultConfig(),
|
|
1
|
+
{"version":3,"sources":["../../../../../src/cli/commands/test/runners/vitest.ts"],"sourcesContent":["import { configDefaults, coverageConfigDefaults, mergeConfig, ViteUserConfig } from 'vitest/config';\nimport { startVitest, parseCLI, resolveConfig } from 'vitest/node';\nimport { getVitestConfiguration, log, omit } from '../../../../utils';\n\ntype VitestConfig = NonNullable<ViteUserConfig['test']>;\n\nexport class Vitest {\n async run() {\n const cliOptions = getCliOptions();\n const userConfig = await getUserConfig();\n\n // startVitest sets process.exitCode to 1 when tests fail\n const vitest = await startVitest('test', cliOptions.filter, cliOptions.options, userConfig);\n await vitest.close();\n }\n}\n\nconst RUNNER_OPTION = '--runner';\n\nfunction excludeRunnerOption(args: string[]) {\n return args.reduce<string[]>((result, item, index) => {\n if (!item.startsWith(RUNNER_OPTION) && (index === 0 || args[index - 1] !== RUNNER_OPTION)) {\n result.push(item);\n }\n return result;\n }, []);\n}\n\nfunction getCliOptions() {\n // parseCLI requires the first element to be \"vitest\"\n const result = parseCLI(['vitest', ...excludeRunnerOption(process.argv.slice(3))]);\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:cliOptions', () => JSON.stringify(result, null, 2));\n\n return result;\n}\n\nfunction getDefaultConfig(): VitestConfig {\n return {\n coverage: {\n exclude: [\n ...coverageConfigDefaults.exclude,\n '**/__mocks__/**',\n '**/*.stories.*',\n '\\\\.yalc',\n ],\n include: ['**/*.{ts,tsx}'],\n reporter: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n },\n environment: 'jsdom',\n exclude: [...configDefaults.exclude, '\\\\.yalc'],\n restoreMocks: true,\n server: { deps: { inline: ['@servicetitan/anvil2'] } }, // fixes css parser errors\n };\n}\n\nasync function getUserConfig(): Promise<ViteUserConfig> {\n const { viteConfig } = await resolveConfig();\n\n const { omitDefault = [], ...config } = getVitestConfiguration();\n\n const result = mergeConfig(\n mergeConfig(omit(getDefaultConfig(), omitDefault), config),\n viteConfig.test ?? {}\n );\n\n /* istanbul ignore next: debug only */\n log.debug('vitest:userConfig', () => JSON.stringify(result, null, 2));\n\n return { test: result };\n}\n"],"names":["Vitest","run","cliOptions","getCliOptions","userConfig","getUserConfig","vitest","startVitest","filter","options","close","RUNNER_OPTION","excludeRunnerOption","args","reduce","result","item","index","startsWith","push","parseCLI","process","argv","slice","log","debug","JSON","stringify","getDefaultConfig","coverage","exclude","coverageConfigDefaults","include","reporter","environment","configDefaults","restoreMocks","server","deps","inline","viteConfig","resolveConfig","omitDefault","config","getVitestConfiguration","mergeConfig","omit","test"],"mappings":";;;;+BAMaA;;;eAAAA;;;wBANuE;sBAC/B;uBACH;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,IAAAA,6BAAsB;QAI1DJ;IAFJ,MAAMzB,SAAS8B,IAAAA,mBAAW,EACtBA,IAAAA,mBAAW,EAACC,IAAAA,WAAI,EAAClB,oBAAoBc,cAAcC,SACnDH,CAAAA,mBAAAA,WAAWO,IAAI,cAAfP,8BAAAA,mBAAmB,CAAC;IAGxB,oCAAoC,GACpChB,UAAG,CAACC,KAAK,CAAC,qBAAqB,IAAMC,KAAKC,SAAS,CAACZ,QAAQ,MAAM;IAElE,OAAO;QAAEgC,MAAMhC;IAAO;AAC1B"}
|
package/dist/cli/utils/bundle.js
CHANGED
|
@@ -173,7 +173,7 @@ async function runWatch(config) {
|
|
|
173
173
|
return new Promise((_0, reject)=>{
|
|
174
174
|
const watching = compiler.watch({}, (e)=>{
|
|
175
175
|
if (e) {
|
|
176
|
-
watching.close(()=>{
|
|
176
|
+
watching === null || watching === void 0 ? void 0 : watching.close(()=>{
|
|
177
177
|
reject(e);
|
|
178
178
|
});
|
|
179
179
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/bundle.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport crypto from 'crypto';\nimport { getPortPromise } from 'portfinder';\n\nimport webpack, { Configuration } from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\n\nimport {\n getPackageName,\n hasHeadlessBundle,\n isDevServerDisabled,\n isExposeSharedDependencies,\n isWebComponent,\n log,\n pick,\n} from '../../utils';\nimport { Overrides, createWebpackConfig } from '../../webpack';\nimport { stringifyConfig } from '../../webpack/utils';\n\ninterface Options {\n buildStat?: boolean;\n codeCoverage?: boolean;\n config?: string;\n emitExposedDependencies?: boolean | Pick<Configuration, 'output'>;\n useWatchConfig?: boolean;\n watch?: boolean;\n}\n\nfunction getName() {\n const packageName = getPackageName()\n .replace(/\\//g, '-')\n .replace(/[^\\w-]/g, '');\n const hash = crypto.randomBytes(4).toString('hex');\n\n return `${packageName}-${hash}`;\n}\n\nexport const webpackDevConfigFileName = 'webpack.dev.config.js';\nexport const webpackProdConfigFileName = 'webpack.prod.config.js';\n\nexport async function bundle(options: Options = {}) {\n const { emitExposedDependencies, useWatchConfig, watch } = options;\n if (emitExposedDependencies) {\n if (watch) {\n throw new Error('cannot bundle exposed dependencies in watch mode');\n }\n if (!isExposeSharedDependencies()) {\n return;\n }\n }\n\n log.info(`Bundling ${emitExposedDependencies ? 'exposed dependencies' : 'package'}...`);\n\n const mode = watch ? 'development' : 'production';\n const fallback = watch || useWatchConfig ? webpackDevConfigFileName : webpackProdConfigFileName;\n const customConfig = readWebpackConfig({ ...options, fallback });\n const webpackOptions = getWebpackOptions(options, customConfig);\n\n /* istanbul ignore next: debug only */\n log.debug('custom-webpack-config', () => stringifyConfig(customConfig));\n\n if (isWebComponent()) {\n return bundleWebComponent({ customConfig, mode, watch, webpackOptions });\n }\n\n const config =\n customConfig && !emitExposedDependencies\n ? customConfig\n : createWebpackConfig({ configuration: { mode } }, webpackOptions);\n\n if (watch) {\n return isDevServerDisabled() ? runWatch(config) : runServe(config);\n }\n\n return run(config);\n}\n\nfunction bundleWebComponent({\n customConfig,\n mode,\n watch,\n webpackOptions,\n}: {\n customConfig: ReturnType<typeof readWebpackConfig>;\n mode: 'development' | 'production';\n watch?: boolean;\n webpackOptions: ReturnType<typeof getWebpackOptions>;\n}) {\n const overrides: Overrides = {\n configuration: { ...customConfig?.configuration, mode },\n plugins: customConfig?.plugins,\n };\n\n const fullConfig = createWebpackConfig(overrides, webpackOptions);\n const lightConfig = createWebpackConfig(overrides, { ...webpackOptions, embed: true });\n const headlessConfig = hasHeadlessBundle()\n ? createWebpackConfig(overrides, {\n ...webpackOptions,\n headless: true,\n })\n : undefined;\n\n const promises = watch\n ? [\n runWatch(lightConfig),\n isDevServerDisabled() ? runWatch(fullConfig) : runServe(fullConfig),\n headlessConfig && runWatch(headlessConfig),\n ]\n : [run(lightConfig), run(fullConfig), headlessConfig && run(headlessConfig)];\n\n return Promise.all(promises.filter(promise => !!promise));\n}\n\nfunction getWebpackOptions(options: Options, customConfig?: Record<string, any>) {\n const result = {\n name: getName(),\n ...pick(options, ['buildStat', 'codeCoverage', 'emitExposedDependencies']),\n };\n\n if (result.emitExposedDependencies && customConfig) {\n result.emitExposedDependencies = { output: customConfig.output };\n }\n\n return result;\n}\n\nfunction readWebpackConfig({ config, fallback }: Options & { fallback: string }) {\n return readConfig(config) ?? readConfig(fallback);\n}\n\nfunction readConfig(relativePath?: string): Record<string, any> | undefined {\n if (relativePath && fs.existsSync(relativePath)) {\n return require(path.resolve(relativePath));\n }\n}\n\nasync function run(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n\n const stats = await new Promise<webpack.Stats>((resolve, reject) => {\n compiler.run((error, stats) => {\n if (!stats || error) {\n return reject(error ?? new Error('Something went wrong.'));\n }\n\n if (stats.hasErrors()) {\n return reject(new Error(stats.toString('errors-only')));\n }\n\n compiler.close(() => resolve(stats));\n });\n });\n\n process.stdout.write(stats.toString(config.stats) + '\\n');\n}\n\nasync function runServe({ devServer = {}, ...config }: Configuration) {\n const compiler = createWebpackCompiler(config);\n const host = devServer.host ?? 'localhost';\n const port = await getPortPromise({\n port: Number(devServer.port) || 8080,\n host,\n });\n\n return new Promise<void>((_0, reject) => {\n const server = new WebpackDevServer({ ...devServer, host, port }, compiler);\n server.startCallback(e => {\n if (e) {\n server.stopCallback(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nasync function runWatch(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n return new Promise<void>((_0, reject) => {\n const watching = compiler.watch({}, e => {\n if (e) {\n watching.close(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nfunction createWebpackCompiler(config: Configuration) {\n return webpack(config)!; // webpack only potentially returns null when given a callback argument\n}\n"],"names":["bundle","webpackDevConfigFileName","webpackProdConfigFileName","getName","packageName","getPackageName","replace","hash","crypto","randomBytes","toString","options","emitExposedDependencies","useWatchConfig","watch","Error","isExposeSharedDependencies","log","info","mode","fallback","customConfig","readWebpackConfig","webpackOptions","getWebpackOptions","debug","stringifyConfig","isWebComponent","bundleWebComponent","config","createWebpackConfig","configuration","isDevServerDisabled","runWatch","runServe","run","overrides","plugins","fullConfig","lightConfig","embed","headlessConfig","hasHeadlessBundle","headless","undefined","promises","Promise","all","filter","promise","result","name","pick","output","readConfig","relativePath","fs","existsSync","require","path","resolve","compiler","createWebpackCompiler","stats","reject","error","hasErrors","close","process","stdout","write","devServer","host","port","getPortPromise","Number","_0","server","WebpackDevServer","startCallback","e","stopCallback","watching","webpack"],"mappings":";;;;;;;;;;;QAyCsBA;eAAAA;;QAHTC;eAAAA;;QACAC;eAAAA;;;2DAvCE;6DACE;+DACE;4BACY;gEAEQ;yEACV;uBAUtB;0BACwC;wBACf;;;;;;AAWhC,SAASC;IACL,MAAMC,cAAcC,IAAAA,qBAAc,IAC7BC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,WAAW;IACxB,MAAMC,OAAOC,eAAM,CAACC,WAAW,CAAC,GAAGC,QAAQ,CAAC;IAE5C,OAAO,GAAGN,YAAY,CAAC,EAAEG,MAAM;AACnC;AAEO,MAAMN,2BAA2B;AACjC,MAAMC,4BAA4B;AAElC,eAAeF,OAAOW,UAAmB,CAAC,CAAC;IAC9C,MAAM,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGH;IAC3D,IAAIC,yBAAyB;QACzB,IAAIE,OAAO;YACP,MAAM,IAAIC,MAAM;QACpB;QACA,IAAI,CAACC,IAAAA,iCAA0B,KAAI;YAC/B;QACJ;IACJ;IAEAC,UAAG,CAACC,IAAI,CAAC,CAAC,SAAS,EAAEN,0BAA0B,yBAAyB,UAAU,GAAG,CAAC;IAEtF,MAAMO,OAAOL,QAAQ,gBAAgB;IACrC,MAAMM,WAAWN,SAASD,iBAAiBZ,2BAA2BC;IACtE,MAAMmB,eAAeC,kBAAkB;QAAE,GAAGX,OAAO;QAAES;IAAS;IAC9D,MAAMG,iBAAiBC,kBAAkBb,SA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AC9BD,MAAME,OAAOJ,UAAUE,IAAI,KAAK;QAChCD;IACJ;IAEA,OAAO,IAAI1B,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMa,SAAS,IAAIC,yBAAgB,CAAC;YAAE,GAAGP,SAAS;YAAEC;YAAMC;QAAK,GAAGZ;QAClEgB,OAAOE,aAAa,CAACC,CAAAA;YACjB,IAAIA,GAAG;gBACHH,OAAOI,YAAY,CAAC;oBAChBjB,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,eAAe/C,SAASJ,MAAqB;IACzC,MAAMgC,WAAWC,sBAAsBjC;IACvC,OAAO,IAAIiB,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMkB,WAAWrB,SAAS/C,KAAK,CAAC,CAAC,GAAGkE,CAAAA;YAChC,IAAIA,GAAG;gBACHE,SAASf,KAAK,CAAC;oBACXH,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,SAASlB,sBAAsBjC,MAAqB;IAChD,OAAOsD,IAAAA,gBAAO,EAACtD,SAAU,uEAAuE;AACpG"}
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/bundle.ts"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport crypto from 'crypto';\nimport { getPortPromise } from 'portfinder';\n\nimport webpack, { Configuration } from 'webpack';\nimport WebpackDevServer from 'webpack-dev-server';\n\nimport {\n getPackageName,\n hasHeadlessBundle,\n isDevServerDisabled,\n isExposeSharedDependencies,\n isWebComponent,\n log,\n pick,\n} from '../../utils';\nimport { Overrides, createWebpackConfig } from '../../webpack';\nimport { stringifyConfig } from '../../webpack/utils';\n\ninterface Options {\n buildStat?: boolean;\n codeCoverage?: boolean;\n config?: string;\n emitExposedDependencies?: boolean | Pick<Configuration, 'output'>;\n useWatchConfig?: boolean;\n watch?: boolean;\n}\n\nfunction getName() {\n const packageName = getPackageName()\n .replace(/\\//g, '-')\n .replace(/[^\\w-]/g, '');\n const hash = crypto.randomBytes(4).toString('hex');\n\n return `${packageName}-${hash}`;\n}\n\nexport const webpackDevConfigFileName = 'webpack.dev.config.js';\nexport const webpackProdConfigFileName = 'webpack.prod.config.js';\n\nexport async function bundle(options: Options = {}) {\n const { emitExposedDependencies, useWatchConfig, watch } = options;\n if (emitExposedDependencies) {\n if (watch) {\n throw new Error('cannot bundle exposed dependencies in watch mode');\n }\n if (!isExposeSharedDependencies()) {\n return;\n }\n }\n\n log.info(`Bundling ${emitExposedDependencies ? 'exposed dependencies' : 'package'}...`);\n\n const mode = watch ? 'development' : 'production';\n const fallback = watch || useWatchConfig ? webpackDevConfigFileName : webpackProdConfigFileName;\n const customConfig = readWebpackConfig({ ...options, fallback });\n const webpackOptions = getWebpackOptions(options, customConfig);\n\n /* istanbul ignore next: debug only */\n log.debug('custom-webpack-config', () => stringifyConfig(customConfig));\n\n if (isWebComponent()) {\n return bundleWebComponent({ customConfig, mode, watch, webpackOptions });\n }\n\n const config =\n customConfig && !emitExposedDependencies\n ? customConfig\n : createWebpackConfig({ configuration: { mode } }, webpackOptions);\n\n if (watch) {\n return isDevServerDisabled() ? runWatch(config) : runServe(config);\n }\n\n return run(config);\n}\n\nfunction bundleWebComponent({\n customConfig,\n mode,\n watch,\n webpackOptions,\n}: {\n customConfig: ReturnType<typeof readWebpackConfig>;\n mode: 'development' | 'production';\n watch?: boolean;\n webpackOptions: ReturnType<typeof getWebpackOptions>;\n}) {\n const overrides: Overrides = {\n configuration: { ...customConfig?.configuration, mode },\n plugins: customConfig?.plugins,\n };\n\n const fullConfig = createWebpackConfig(overrides, webpackOptions);\n const lightConfig = createWebpackConfig(overrides, { ...webpackOptions, embed: true });\n const headlessConfig = hasHeadlessBundle()\n ? createWebpackConfig(overrides, {\n ...webpackOptions,\n headless: true,\n })\n : undefined;\n\n const promises = watch\n ? [\n runWatch(lightConfig),\n isDevServerDisabled() ? runWatch(fullConfig) : runServe(fullConfig),\n headlessConfig && runWatch(headlessConfig),\n ]\n : [run(lightConfig), run(fullConfig), headlessConfig && run(headlessConfig)];\n\n return Promise.all(promises.filter(promise => !!promise));\n}\n\nfunction getWebpackOptions(options: Options, customConfig?: Record<string, any>) {\n const result = {\n name: getName(),\n ...pick(options, ['buildStat', 'codeCoverage', 'emitExposedDependencies']),\n };\n\n if (result.emitExposedDependencies && customConfig) {\n result.emitExposedDependencies = { output: customConfig.output };\n }\n\n return result;\n}\n\nfunction readWebpackConfig({ config, fallback }: Options & { fallback: string }) {\n return readConfig(config) ?? readConfig(fallback);\n}\n\nfunction readConfig(relativePath?: string): Record<string, any> | undefined {\n if (relativePath && fs.existsSync(relativePath)) {\n return require(path.resolve(relativePath));\n }\n}\n\nasync function run(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n\n const stats = await new Promise<webpack.Stats>((resolve, reject) => {\n compiler.run((error, stats) => {\n if (!stats || error) {\n return reject(error ?? new Error('Something went wrong.'));\n }\n\n if (stats.hasErrors()) {\n return reject(new Error(stats.toString('errors-only')));\n }\n\n compiler.close(() => resolve(stats));\n });\n });\n\n process.stdout.write(stats.toString(config.stats) + '\\n');\n}\n\nasync function runServe({ devServer = {}, ...config }: Configuration) {\n const compiler = createWebpackCompiler(config);\n const host = devServer.host ?? 'localhost';\n const port = await getPortPromise({\n port: Number(devServer.port) || 8080,\n host,\n });\n\n return new Promise<void>((_0, reject) => {\n const server = new WebpackDevServer({ ...devServer, host, port }, compiler);\n server.startCallback(e => {\n if (e) {\n server.stopCallback(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nasync function runWatch(config: Configuration) {\n const compiler = createWebpackCompiler(config);\n return new Promise<void>((_0, reject) => {\n const watching = compiler.watch({}, e => {\n if (e) {\n watching?.close(() => {\n reject(e);\n });\n }\n });\n });\n}\n\nfunction createWebpackCompiler(config: Configuration) {\n return webpack(config)!; // webpack only potentially returns null when given a callback argument\n}\n"],"names":["bundle","webpackDevConfigFileName","webpackProdConfigFileName","getName","packageName","getPackageName","replace","hash","crypto","randomBytes","toString","options","emitExposedDependencies","useWatchConfig","watch","Error","isExposeSharedDependencies","log","info","mode","fallback","customConfig","readWebpackConfig","webpackOptions","getWebpackOptions","debug","stringifyConfig","isWebComponent","bundleWebComponent","config","createWebpackConfig","configuration","isDevServerDisabled","runWatch","runServe","run","overrides","plugins","fullConfig","lightConfig","embed","headlessConfig","hasHeadlessBundle","headless","undefined","promises","Promise","all","filter","promise","result","name","pick","output","readConfig","relativePath","fs","existsSync","require","path","resolve","compiler","createWebpackCompiler","stats","reject","error","hasErrors","close","process","stdout","write","devServer","host","port","getPortPromise","Number","_0","server","WebpackDevServer","startCallback","e","stopCallback","watching","webpack"],"mappings":";;;;;;;;;;;QAyCsBA;eAAAA;;QAHTC;eAAAA;;QACAC;eAAAA;;;2DAvCE;6DACE;+DACE;4BACY;gEAEQ;yEACV;uBAUtB;0BACwC;wBACf;;;;;;AAWhC,SAASC;IACL,MAAMC,cAAcC,IAAAA,qBAAc,IAC7BC,OAAO,CAAC,OAAO,KACfA,OAAO,CAAC,WAAW;IACxB,MAAMC,OAAOC,eAAM,CAACC,WAAW,CAAC,GAAGC,QAAQ,CAAC;IAE5C,OAAO,GAAGN,YAAY,CAAC,EAAEG,MAAM;AACnC;AAEO,MAAMN,2BAA2B;AACjC,MAAMC,4BAA4B;AAElC,eAAeF,OAAOW,UAAmB,CAAC,CAAC;IAC9C,MAAM,EAAEC,uBAAuB,EAAEC,cAAc,EAAEC,KAAK,EAAE,GAAGH;IAC3D,IAAIC,yBAAyB;QACzB,IAAIE,OAAO;YACP,MAAM,IAAIC,MAAM;QACpB;QACA,IAAI,CAACC,IAAAA,iCAA0B,KAAI;YAC/B;QACJ;IACJ;IAEAC,UAAG,CAACC,IAAI,CAAC,CAAC,SAAS,EAAEN,0BAA0B,yBAAyB,UAAU,GAAG,CAAC;IAEtF,MAAMO,OAAOL,QAAQ,gBAAgB;IACrC,MAAMM,WAAWN,SAASD,iBAAiBZ,2BAA2BC;IACtE,MAAMmB,eAAeC,kBAAkB;QAAE,GAAGX,OAAO;QAAES;IAAS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ME,OAAO,MAAMC,IAAAA,0BAAc,EAAC;QAC9BD,MAAME,OAAOJ,UAAUE,IAAI,KAAK;QAChCD;IACJ;IAEA,OAAO,IAAI1B,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMa,SAAS,IAAIC,yBAAgB,CAAC;YAAE,GAAGP,SAAS;YAAEC;YAAMC;QAAK,GAAGZ;QAClEgB,OAAOE,aAAa,CAACC,CAAAA;YACjB,IAAIA,GAAG;gBACHH,OAAOI,YAAY,CAAC;oBAChBjB,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,eAAe/C,SAASJ,MAAqB;IACzC,MAAMgC,WAAWC,sBAAsBjC;IACvC,OAAO,IAAIiB,QAAc,CAAC8B,IAAIZ;QAC1B,MAAMkB,WAAWrB,SAAS/C,KAAK,CAAC,CAAC,GAAGkE,CAAAA;YAChC,IAAIA,GAAG;gBACHE,qBAAAA,+BAAAA,SAAUf,KAAK,CAAC;oBACZH,OAAOgB;gBACX;YACJ;QACJ;IACJ;AACJ;AAEA,SAASlB,sBAAsBjC,MAAqB;IAChD,OAAOsD,IAAAA,gBAAO,EAACtD,SAAU,uEAAuE;AACpG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,UAAU,IAAI;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"cli-git.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/cli-git.ts"],"names":[],"mappings":"AAIA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,UAAU,IAAI;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,YAAY,CAAC,MAAM,EAAE,IAAI,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,oBAsBxE;AAED,wBAAgB,cAAc,CAAC,EAAE,KAAsB,EAAE,IAAI,EAAE,EAAE,IAAI,WASpE"}
|
|
@@ -43,7 +43,12 @@ async function gitCloneRepo(params) {
|
|
|
43
43
|
_utils.log.debug('git:clone-repo', `running ${command}`);
|
|
44
44
|
// eslint-disable-next-line no-await-in-loop
|
|
45
45
|
await (0, _clios.runCommand)(command, {
|
|
46
|
-
quiet: true
|
|
46
|
+
quiet: true,
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
48
|
+
env: {
|
|
49
|
+
...process.env,
|
|
50
|
+
GIT_TERMINAL_PROMPT: '0'
|
|
51
|
+
}
|
|
47
52
|
});
|
|
48
53
|
return true;
|
|
49
54
|
} catch (e) {
|
|
@@ -70,14 +75,12 @@ function gitIsReachable({ owner = 'servicetitan', name }) {
|
|
|
70
75
|
function getGitUrls({ owner, name }) {
|
|
71
76
|
const webUrl = `https://github.com/${owner}/${name}.git`;
|
|
72
77
|
const sshUrl = `git@github.com:${owner}/${name}.git`;
|
|
73
|
-
|
|
74
|
-
webUrl,
|
|
75
|
-
|
|
78
|
+
return (0, _isci.isCI)() && !!process.env.GITHUB_TOKEN ? [
|
|
79
|
+
webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`)
|
|
80
|
+
] : [
|
|
81
|
+
sshUrl,
|
|
82
|
+
webUrl
|
|
76
83
|
];
|
|
77
|
-
if ((0, _isci.isCI)() && !!process.env.GITHUB_TOKEN) {
|
|
78
|
-
urls.unshift(webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`));
|
|
79
|
-
}
|
|
80
|
-
return urls;
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
//# sourceMappingURL=cli-git.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { runCommand, runCommandOutput } from './cli-os';\nimport { isCI } from './is-ci';\n\nexport function gitGetBranch(): string {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n}\n\nexport function gitGetCommitHash(): string {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n}\n\ninterface Repo {\n owner?: string;\n name: string;\n}\n\nexport async function gitCloneRepo(params: Repo & { destination: string }) {\n const { destination, name, owner = 'servicetitan' } = params;\n const gitUrls = getGitUrls({ owner, name });\n\n for (const url of gitUrls) {\n try {\n const command = `git clone -q ${url} ${destination}`;\n log.debug('git:clone-repo', `running ${command}`);\n\n // eslint-disable-next-line no-await-in-loop\n await runCommand(command, {
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/cli-git.ts"],"sourcesContent":["import { log } from '../../utils';\nimport { runCommand, runCommandOutput } from './cli-os';\nimport { isCI } from './is-ci';\n\nexport function gitGetBranch(): string {\n return runCommandOutput('git rev-parse --abbrev-ref HEAD').trim();\n}\n\nexport function gitGetCommitHash(): string {\n return runCommandOutput('git rev-parse --short HEAD').trim();\n}\n\ninterface Repo {\n owner?: string;\n name: string;\n}\n\nexport async function gitCloneRepo(params: Repo & { destination: string }) {\n const { destination, name, owner = 'servicetitan' } = params;\n const gitUrls = getGitUrls({ owner, name });\n\n for (const url of gitUrls) {\n try {\n const command = `git clone -q ${url} ${destination}`;\n log.debug('git:clone-repo', `running ${command}`);\n\n // eslint-disable-next-line no-await-in-loop\n await runCommand(command, {\n quiet: true,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },\n });\n return true;\n } catch {\n // ignore error\n }\n }\n\n return false;\n}\n\nexport function gitIsReachable({ owner = 'servicetitan', name }: Repo) {\n return getGitUrls({ owner, name }).some(url => {\n try {\n runCommandOutput(`git ls-remote -qt ${url}`, { quiet: true });\n return true;\n } catch {\n return false;\n }\n });\n}\n\nfunction getGitUrls({ owner, name }: Repo) {\n const webUrl = `https://github.com/${owner}/${name}.git`;\n const sshUrl = `git@github.com:${owner}/${name}.git`;\n\n return isCI() && !!process.env.GITHUB_TOKEN\n ? [webUrl.replace('github.com', `oauth2:${process.env.GITHUB_TOKEN}@github.com`)]\n : [sshUrl, webUrl];\n}\n"],"names":["gitCloneRepo","gitGetBranch","gitGetCommitHash","gitIsReachable","runCommandOutput","trim","params","destination","name","owner","gitUrls","getGitUrls","url","command","log","debug","runCommand","quiet","env","process","GIT_TERMINAL_PROMPT","some","webUrl","sshUrl","isCI","GITHUB_TOKEN","replace"],"mappings":";;;;;;;;;;;QAiBsBA;eAAAA;;QAbNC;eAAAA;;QAIAC;eAAAA;;QAiCAC;eAAAA;;;uBAzCI;uBACyB;sBACxB;AAEd,SAASF;IACZ,OAAOG,IAAAA,uBAAgB,EAAC,mCAAmCC,IAAI;AACnE;AAEO,SAASH;IACZ,OAAOE,IAAAA,uBAAgB,EAAC,8BAA8BC,IAAI;AAC9D;AAOO,eAAeL,aAAaM,MAAsC;IACrE,MAAM,EAAEC,WAAW,EAAEC,IAAI,EAAEC,QAAQ,cAAc,EAAE,GAAGH;IACtD,MAAMI,UAAUC,WAAW;QAAEF;QAAOD;IAAK;IAEzC,KAAK,MAAMI,OAAOF,QAAS;QACvB,IAAI;YACA,MAAMG,UAAU,CAAC,aAAa,EAAED,IAAI,CAAC,EAAEL,aAAa;YACpDO,UAAG,CAACC,KAAK,CAAC,kBAAkB,CAAC,QAAQ,EAAEF,SAAS;YAEhD,4CAA4C;YAC5C,MAAMG,IAAAA,iBAAU,EAACH,SAAS;gBACtBI,OAAO;gBACP,gEAAgE;gBAChEC,KAAK;oBAAE,GAAGC,QAAQD,GAAG;oBAAEE,qBAAqB;gBAAI;YACpD;YACA,OAAO;QACX,EAAE,UAAM;QACJ,eAAe;QACnB;IACJ;IAEA,OAAO;AACX;AAEO,SAASjB,eAAe,EAAEM,QAAQ,cAAc,EAAED,IAAI,EAAQ;IACjE,OAAOG,WAAW;QAAEF;QAAOD;IAAK,GAAGa,IAAI,CAACT,CAAAA;QACpC,IAAI;YACAR,IAAAA,uBAAgB,EAAC,CAAC,kBAAkB,EAAEQ,KAAK,EAAE;gBAAEK,OAAO;YAAK;YAC3D,OAAO;QACX,EAAE,UAAM;YACJ,OAAO;QACX;IACJ;AACJ;AAEA,SAASN,WAAW,EAAEF,KAAK,EAAED,IAAI,EAAQ;IACrC,MAAMc,SAAS,CAAC,mBAAmB,EAAEb,MAAM,CAAC,EAAED,KAAK,IAAI,CAAC;IACxD,MAAMe,SAAS,CAAC,eAAe,EAAEd,MAAM,CAAC,EAAED,KAAK,IAAI,CAAC;IAEpD,OAAOgB,IAAAA,UAAI,OAAM,CAAC,CAACL,QAAQD,GAAG,CAACO,YAAY,GACrC;QAACH,OAAOI,OAAO,CAAC,cAAc,CAAC,OAAO,EAAEP,QAAQD,GAAG,CAACO,YAAY,CAAC,WAAW,CAAC;KAAE,GAC/E;QAACF;QAAQD;KAAO;AAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"maybe-create-git-folder.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"maybe-create-git-folder.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,QAe7D"}
|
|
@@ -23,7 +23,13 @@ function maybeCreateGitFolder(command) {
|
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
if (!_fs.default.existsSync('.git')) {
|
|
26
|
-
|
|
26
|
+
/*
|
|
27
|
+
* Using {recursive: true} to ignore if directory exists. This happens
|
|
28
|
+
* when parallel process creates the directory after we've checked
|
|
29
|
+
* whether it exists.
|
|
30
|
+
*/ _fs.default.mkdirSync('.git', {
|
|
31
|
+
recursive: true
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"sourcesContent":["import fs from 'fs';\n\nimport { Init } from '../commands/init';\nimport { Command, Newable } from '../commands/types';\n\n/**\n * Create empty .git folder to workaround issue where Lerna does not\n * detect workspace packages on Windows systems. The empty .git folder\n * causes nx to use the git-hasher when building the project graph.\n * Note this gets fixed (e.g., https://github.com/nrwl/nx/issues/8601) but\n * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and\n * https://github.com/nrwl/nx/issues/18094)\n */\nexport function maybeCreateGitFolder(command: Newable<Command>) {\n if (process.platform !== 'win32') {\n return;\n }\n if (command === Init) {\n return;\n }\n if (!fs.existsSync('.git')) {\n fs.mkdirSync('.git');\n }\n}\n"],"names":["maybeCreateGitFolder","command","process","platform","Init","fs","existsSync","mkdirSync"],"mappings":";;;;+BAagBA;;;eAAAA;;;2DAbD;sBAEM;;;;;;AAWd,SAASA,qBAAqBC,OAAyB;IAC1D,IAAIC,QAAQC,QAAQ,KAAK,SAAS;QAC9B;IACJ;IACA,IAAIF,YAAYG,UAAI,EAAE;QAClB;IACJ;IACA,IAAI,CAACC,WAAE,CAACC,UAAU,CAAC,SAAS;
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/utils/maybe-create-git-folder.ts"],"sourcesContent":["import fs from 'fs';\n\nimport { Init } from '../commands/init';\nimport { Command, Newable } from '../commands/types';\n\n/**\n * Create empty .git folder to workaround issue where Lerna does not\n * detect workspace packages on Windows systems. The empty .git folder\n * causes nx to use the git-hasher when building the project graph.\n * Note this gets fixed (e.g., https://github.com/nrwl/nx/issues/8601) but\n * keeps reappearing (e.g., https://github.com/nrwl/nx/issues/9584 and\n * https://github.com/nrwl/nx/issues/18094)\n */\nexport function maybeCreateGitFolder(command: Newable<Command>) {\n if (process.platform !== 'win32') {\n return;\n }\n if (command === Init) {\n return;\n }\n if (!fs.existsSync('.git')) {\n /*\n * Using {recursive: true} to ignore if directory exists. This happens\n * when parallel process creates the directory after we've checked\n * whether it exists.\n */\n fs.mkdirSync('.git', { recursive: true });\n }\n}\n"],"names":["maybeCreateGitFolder","command","process","platform","Init","fs","existsSync","mkdirSync","recursive"],"mappings":";;;;+BAagBA;;;eAAAA;;;2DAbD;sBAEM;;;;;;AAWd,SAASA,qBAAqBC,OAAyB;IAC1D,IAAIC,QAAQC,QAAQ,KAAK,SAAS;QAC9B;IACJ;IACA,IAAIF,YAAYG,UAAI,EAAE;QAClB;IACJ;IACA,IAAI,CAACC,WAAE,CAACC,UAAU,CAAC,SAAS;QACxB;;;;SAIC,GACDD,WAAE,CAACE,SAAS,CAAC,QAAQ;YAAEC,WAAW;QAAK;IAC3C;AACJ"}
|
|
@@ -33,7 +33,9 @@ export interface StylelintConfiguration extends Partial<LinterOptions> {
|
|
|
33
33
|
ignorePattern?: string[];
|
|
34
34
|
disabled?: boolean;
|
|
35
35
|
}
|
|
36
|
-
export
|
|
36
|
+
export interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {
|
|
37
|
+
omitDefault?: string[];
|
|
38
|
+
}
|
|
37
39
|
export interface NodeConfiguration {
|
|
38
40
|
NODE_OPTIONS?: string[];
|
|
39
41
|
}
|
|
@@ -58,7 +60,9 @@ export declare enum CommandName {
|
|
|
58
60
|
'task' = "task",
|
|
59
61
|
'upload-sourcemaps' = "upload-sourcemaps"
|
|
60
62
|
}
|
|
61
|
-
export type VitestConfiguration = ViteUserConfig['test']
|
|
63
|
+
export type VitestConfiguration = ViteUserConfig['test'] & {
|
|
64
|
+
omitDefault?: string[];
|
|
65
|
+
};
|
|
62
66
|
export interface WebComponentBranchConfigs {
|
|
63
67
|
publishTag?: string;
|
|
64
68
|
uploadSourcemaps?: boolean;
|
|
@@ -95,7 +99,9 @@ export declare function getESLintConfiguration(): ESLintConfiguration;
|
|
|
95
99
|
export declare function getJestConfiguration(): JestConfiguration;
|
|
96
100
|
export declare function getReviewConfiguration(): ReviewConfiguration & NodeConfiguration;
|
|
97
101
|
export declare function getStylelintConfiguration(): StylelintConfiguration;
|
|
98
|
-
export declare function getVitestConfiguration(): import("vitest/node").InlineConfig
|
|
102
|
+
export declare function getVitestConfiguration(): import("vitest/node").InlineConfig & {
|
|
103
|
+
omitDefault?: string[];
|
|
104
|
+
};
|
|
99
105
|
export declare function getWebpackConfiguration(locationOrJson?: LocationOrJson): WebpackConfiguration;
|
|
100
106
|
export declare function getWebComponentConfiguration(locationOrJson?: LocationOrJson): WebComponentOptions | undefined;
|
|
101
107
|
export declare function getWebComponentBranchConfigs(locationOrJson?: LocationOrJson): Record<string, WebComponentBranchConfigs> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/get-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,aAAa,IAAI,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,mBA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AAS,CAsBjC;AAED,wBAAgB,4BAA4B,CAAC,cAAc,GAAE,cAAqB,yDAIjF;AAED,wBAAgB,iBAAiB,YAShC;AAED,wBAAgB,iCAAiC,+BAEhD;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,kBAAkB,YAEjC;AAED,wBAAgB,mBAAmB,YAGlC;AAED,wBAAgB,0BAA0B,YAEzC;AAED,wBAAgB,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,WAEvD;AAED,wBAAgB,YAAY,YAE3B;AAED,wBAAgB,oBAAoB,YAEnC;AAED,wBAAgB,cAAc,CAAC,cAAc,GAAE,cAAqB,WAEnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport { swcDir } from '@swc/cli';\nimport { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport { LinterOptions } from 'stylelint';\nimport { ViteUserConfig } from 'vitest/config';\nimport { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\n\nimport { ReviewConfiguration } from '../cli/commands/review';\nimport { log } from './log';\nimport { getFolders } from './get-folders';\nimport { readJson, readJsonSafe } from './read-json';\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration\n extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n > {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport type JestConfiguration = Omit<Config.Argv, '_' | '$0'>;\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-package' = 'bundle-package',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-publish' = 'mfe-publish',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'];\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\ntype LocationOrJson = string | Record<string, any>;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).webpack !== false;\n}\n\nexport function isCustomStyleRules() {\n return getWebpackConfiguration()['custom-style-rules'] === true;\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return getWebpackConfiguration()['expose-shared-dependencies'] === true;\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isCustomStyleRules","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","webpackConfiguration","devServer","legacy","legacyRoot"],"mappings":";;;;;;;;;;;QA6DYA;eAAAA;;QA/CCC;eAAAA;;QAuGGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;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AAO;IACX;IACA,MAAME,eAAezB,aAAI,CAACC,IAAI,CAACsB,QAAQ;IACvC,OAAOP,WAAE,CAACC,UAAU,CAACQ;AACzB;AAEO,SAAS1C;QACLN;IAAP,OAAOA,CAAAA,sCAAAA,kBAAkB,CAAC,sBAAsB,cAAzCA,iDAAAA,sCAA6C,CAAC;AACzD;AAEO,SAASY,SAASQ,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgBe,OAAO,KAAK;AACxD;AAEO,SAAStB;IACZ,OAAOH,yBAAyB,CAAC,qBAAqB,KAAK;AAC/D;AAEO,SAASI;IACZ,MAAMmC,uBAAuBvC;IAC7B,OAAOuC,qBAAqBC,SAAS,KAAK;AAC9C;AAEO,SAASnC;IACZ,OAAOL,yBAAyB,CAAC,6BAA6B,KAAK;AACvE;AAEO,SAASM,SAASI,cAA+B;IACpD,OAAOpB,iBAAiBoB,gBAAgB+B,MAAM,KAAK;AACvD;AAEO,SAASlC;QACLR;IAAP,OAAOA,EAAAA,gCAAAA,4CAAAA,oDAAAA,8BAAgC2C,UAAU,MAAK;AAC1D;AAEO,SAASlC;IACZ,OAAOR,yBAAyB,CAAC,sBAAsB,KAAK;AAChE;AAEO,SAASS,eAAeC,iBAAiC,IAAI;IAChE,OAAO,CAAC,CAACX,6BAA6BW;AAC1C"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/get-configuration.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport { swcDir } from '@swc/cli';\nimport { ESLint } from 'eslint';\nimport fs from 'fs';\nimport path from 'path';\nimport { LinterOptions } from 'stylelint';\nimport { ViteUserConfig } from 'vitest/config';\nimport { Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';\n\nimport { ReviewConfiguration } from '../cli/commands/review';\nimport { log } from './log';\nimport { getFolders } from './get-folders';\nimport { readJson, readJsonSafe } from './read-json';\n\nexport const allowedWebpackDevServerOptions = ['headers', 'port', 'proxy', 'static'] as const;\n\ntype ElementType<T> = T extends readonly (infer ElementType)[] ? ElementType : never;\n\nexport interface MinifyJSOptions {\n compress?: boolean;\n mangle?: boolean;\n}\n\nexport interface MinifyCssOptions {}\n\nexport interface MinifyOptions {\n css?: boolean | MinifyCssOptions;\n js?: boolean | MinifyJSOptions;\n}\n\nexport interface WebpackConfiguration\n extends Omit<\n Pick<WebpackDevServerConfiguration, ElementType<typeof allowedWebpackDevServerOptions>>,\n 'proxy'\n > {\n 'contentBase'?: boolean | string | string[] | number; // deprecated 2024-07\n 'custom-style-rules'?: boolean;\n 'expose-shared-dependencies'?: boolean;\n 'devServer'?: false | WebpackDevServerConfiguration;\n 'disable-style-check'?: boolean;\n 'minify'?: MinifyOptions;\n 'proxy'?: WebpackDevServerConfiguration['proxy'] | string;\n}\n\nexport interface ESLintConfiguration extends ESLint.Options {\n disabled?: boolean;\n}\n\nexport interface StylelintConfiguration extends Partial<LinterOptions> {\n ignorePattern?: string[];\n disabled?: boolean;\n}\n\nexport interface JestConfiguration extends Omit<Config.Argv, '_' | '$0'> {\n omitDefault?: string[];\n}\n\nexport interface NodeConfiguration {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n NODE_OPTIONS?: string[];\n}\n\n/* eslint-disable @typescript-eslint/naming-convention */\nexport enum CommandName {\n 'build' = 'build',\n 'bundle-package' = 'bundle-package',\n 'clean' = 'clean',\n 'convert-eslint-config' = 'convert-eslint-config',\n 'eslint' = 'eslint',\n 'init' = 'init',\n 'install' = 'install',\n 'kendo-ui-license' = 'kendo-ui-license',\n 'lint' = 'lint',\n 'mfe-package-clean' = 'mfe-package-clean',\n 'mfe-package-publish' = 'mfe-package-publish',\n 'mfe-publish' = 'mfe-publish',\n 'prepare-package' = 'prepare-package',\n 'review' = 'review',\n 'start' = 'start',\n 'styles-check' = 'styles-check',\n 'test' = 'test',\n 'task' = 'task',\n 'upload-sourcemaps' = 'upload-sourcemaps',\n}\n/* eslint-enable @typescript-eslint/naming-convention */\n\nexport type VitestConfiguration = ViteUserConfig['test'] & {\n omitDefault?: string[];\n};\n\nexport interface WebComponentBranchConfigs {\n publishTag?: string;\n uploadSourcemaps?: boolean;\n}\n\ninterface WebComponentOptions {\n legacyRoot?: boolean;\n /**\n * mapping of git branches to configs.\n * Used to separate configs (ex publish tag) depending on current branch\n */\n branches?: Record<string, WebComponentBranchConfigs>;\n}\n\ntype Configuration = {\n 'jest'?: JestConfiguration;\n 'legacy'?: boolean;\n 'lint'?: { eslint: ESLintConfiguration; stylelint: StylelintConfiguration };\n 'review'?: ReviewConfiguration;\n 'swc-compile-package'?: Parameters<typeof swcDir>[0];\n 'test'?: JestConfiguration; // for backward-compatibility\n 'testRunner'?: string;\n 'vitest'?: VitestConfiguration;\n 'web-component'?: boolean | string | WebComponentOptions;\n 'webpack'?: false | WebpackConfiguration;\n} & {\n [key in CommandName]?: NodeConfiguration;\n} & NodeConfiguration;\n\ntype LocationOrJson = string | Record<string, any>;\n\nexport function getConfiguration(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJson(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getConfigurationSafe(locationOrJson: LocationOrJson = './'): Configuration {\n const json =\n typeof locationOrJson === 'string'\n ? readJsonSafe(path.join(locationOrJson, 'package.json'))\n : locationOrJson;\n return json?.cli ?? {};\n}\n\nexport function getESLintConfiguration() {\n return getConfiguration().lint?.eslint ?? {};\n}\n\nexport function getJestConfiguration() {\n const configuration = getConfiguration();\n return configuration.jest ?? configuration.test ?? {};\n}\n\nexport function getReviewConfiguration() {\n return getConfiguration().review ?? {};\n}\n\nexport function getStylelintConfiguration() {\n return getConfiguration().lint?.stylelint ?? {};\n}\n\nexport function getVitestConfiguration() {\n return getConfiguration().vitest ?? {};\n}\n\nexport function getWebpackConfiguration(locationOrJson?: LocationOrJson) {\n const { webpack } = getConfiguration(locationOrJson);\n return typeof webpack === 'object' ? webpack : {};\n}\n\nexport function getWebComponentConfiguration(\n locationOrJson: LocationOrJson = './'\n): WebComponentOptions | undefined {\n const config = getConfigurationSafe(locationOrJson)['web-component'];\n\n if (config === true) {\n return {};\n }\n\n if (typeof config === 'object') {\n return config;\n }\n\n if (typeof config === 'string') {\n const configPath = path.resolve(\n typeof locationOrJson === 'string' ? path.join(locationOrJson, config) : config\n );\n if (fs.existsSync(configPath)) {\n return require(path.resolve(configPath));\n }\n log.warning(`could not find web-component configuration: \"${config}\"`);\n\n return undefined;\n }\n}\n\nexport function getWebComponentBranchConfigs(locationOrJson: LocationOrJson = './') {\n const config = getWebComponentConfiguration(locationOrJson);\n\n return config?.branches;\n}\n\nexport function hasHeadlessBundle() {\n let source: string;\n try {\n source = getFolders().source;\n } catch {\n return false;\n }\n const headlessPath = path.join(source, 'headless.ts');\n return fs.existsSync(headlessPath);\n}\n\nexport function getSwcCompilePackageConfiguration() {\n return getConfiguration()['swc-compile-package'] ?? {};\n}\n\nexport function isBundle(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).webpack !== false;\n}\n\nexport function isCustomStyleRules() {\n return getWebpackConfiguration()['custom-style-rules'] === true;\n}\n\nexport function isDevServerDisabled() {\n const webpackConfiguration = getWebpackConfiguration();\n return webpackConfiguration.devServer === false;\n}\n\nexport function isExposeSharedDependencies() {\n return getWebpackConfiguration()['expose-shared-dependencies'] === true;\n}\n\nexport function isLegacy(locationOrJson?: LocationOrJson) {\n return getConfiguration(locationOrJson).legacy === true;\n}\n\nexport function isLegacyRoot() {\n return getWebComponentConfiguration()?.legacyRoot === true;\n}\n\nexport function isStyleCheckDisabled() {\n return getWebpackConfiguration()['disable-style-check'] === true;\n}\n\nexport function isWebComponent(locationOrJson: LocationOrJson = './') {\n return !!getWebComponentConfiguration(locationOrJson);\n}\n"],"names":["CommandName","allowedWebpackDevServerOptions","getConfiguration","getConfigurationSafe","getESLintConfiguration","getJestConfiguration","getReviewConfiguration","getStylelintConfiguration","getSwcCompilePackageConfiguration","getVitestConfiguration","getWebComponentBranchConfigs","getWebComponentConfiguration","getWebpackConfiguration","hasHeadlessBundle","isBundle","isCustomStyleRules","isDevServerDisabled","isExposeSharedDependencies","isLegacy","isLegacyRoot","isStyleCheckDisabled","isWebComponent","locationOrJson","json","readJson","path","join","cli","readJsonSafe","lint","eslint","configuration","jest","test","review","stylelint","vitest","webpack","config","configPath","resolve","fs","existsSync","require","log","warning","undefined","branches","source","getFolders","headlessPath","webpackConfiguration","devServer","legacy","legacyRoot"],"mappings":";;;;;;;;;;;QA+DYA;eAAAA;;QAjDCC;eAAAA;;QA2GGC;eAAAA;;QAQAC;eAAAA;;QAQAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAwDAC;eAAAA;;QApDAC;eAAAA;;QAmCAC;eAAAA;;QA1BAC;eAAAA;;QALAC;eAAAA;;QAqCAC;eAAAA;;QAeAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAKAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;QAIAC;eAAAA;;;2DA5OD;6DACE;qBAMG;4BACO;0BACY;;;;;;AAEhC,MAAMpB,iCAAiC;IAAC;IAAW;IAAQ;IAAS;CAAS;AAiD7E,IAAA,AAAKD,qCAAAA;;;;;;;;;;;;;;;;;;;;WAAAA;;AA0DL,SAASE,iBAAiBoB,iBAAiC,IAAI;IAClE,MAAMC,OACF,OAAOD,mBAAmB,WACpBE,IAAAA,kBAAQ,EAACC,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACnCA;QACHC;IAAP,OAAOA,CAAAA,YAAAA,iBAAAA,2BAAAA,KAAMI,GAAG,cAATJ,uBAAAA,YAAa,CAAC;AACzB;AAEO,SAASpB,qBAAqBmB,iBAAiC,IAAI;IACtE,MAAMC,OACF,OAAOD,mBAAmB,WACpBM,IAAAA,sBAAY,EAACH,aAAI,CAACC,IAAI,CAACJ,gBAAgB,mBACvCA;QACHC;IAAP,OAAOA,CAAAA,YAAAA,iBAAAA,2BAAAA,KAAMI,G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1
|
-
{"version":3,"file":"get-jest-config.d.ts","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"get-jest-config.d.ts","sourceRoot":"","sources":["../../src/utils/get-jest-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAiCrC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAsB/D"}
|
|
@@ -12,12 +12,13 @@ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
|
12
12
|
const _getconfiguration = require("./get-configuration");
|
|
13
13
|
const _getdestinationfolders = require("./get-destination-folders");
|
|
14
14
|
const _toarray = require("./to-array");
|
|
15
|
+
const _omit = require("./omit");
|
|
15
16
|
function _interop_require_default(obj) {
|
|
16
17
|
return obj && obj.__esModule ? obj : {
|
|
17
18
|
default: obj
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
function getDefaultJestConfiguration(
|
|
21
|
+
function getDefaultJestConfiguration() {
|
|
21
22
|
const moduleNameMapper = {
|
|
22
23
|
'\\.(css|scss|less|png|svg|svg\\?\\w+|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$': 'identity-obj-proxy'
|
|
23
24
|
};
|
|
@@ -26,8 +27,7 @@ function getDefaultJestConfiguration({ coveragePathIgnorePatterns = [], setupFil
|
|
|
26
27
|
'**/*.{ts,tsx}'
|
|
27
28
|
],
|
|
28
29
|
coveragePathIgnorePatterns: [
|
|
29
|
-
'^.+\\.d\\.ts$'
|
|
30
|
-
...coveragePathIgnorePatterns
|
|
30
|
+
'^.+\\.d\\.ts$'
|
|
31
31
|
],
|
|
32
32
|
coverageReporters: [
|
|
33
33
|
'html-spa',
|
|
@@ -42,14 +42,12 @@ function getDefaultJestConfiguration({ coveragePathIgnorePatterns = [], setupFil
|
|
|
42
42
|
],
|
|
43
43
|
preset: _path.default.join(__dirname, '../../jest'),
|
|
44
44
|
setupFiles: [
|
|
45
|
-
_path.default.join(__dirname, '../../jest/setup.js')
|
|
46
|
-
...(0, _toarray.toArray)(setupFiles)
|
|
45
|
+
_path.default.join(__dirname, '../../jest/setup.js')
|
|
47
46
|
],
|
|
48
47
|
testEnvironment: 'jsdom',
|
|
49
48
|
testPathIgnorePatterns: [
|
|
50
49
|
'\\.yalc',
|
|
51
|
-
...(0, _getdestinationfolders.getDestinationFolders)()
|
|
52
|
-
...(0, _toarray.toArray)(testPathIgnorePatterns)
|
|
50
|
+
...(0, _getdestinationfolders.getDestinationFolders)()
|
|
53
51
|
],
|
|
54
52
|
testRunner: 'jest-circus/runner',
|
|
55
53
|
transformIgnorePatterns: [
|
|
@@ -59,12 +57,13 @@ function getDefaultJestConfiguration({ coveragePathIgnorePatterns = [], setupFil
|
|
|
59
57
|
};
|
|
60
58
|
}
|
|
61
59
|
function getJestConfigCLI(args) {
|
|
62
|
-
const { coveragePathIgnorePatterns, setupFiles, testPathIgnorePatterns, ...config } = {
|
|
60
|
+
const { coveragePathIgnorePatterns, omitDefault = [], setupFiles, testPathIgnorePatterns, ...config } = {
|
|
63
61
|
...(0, _getconfiguration.getJestConfiguration)(),
|
|
64
62
|
...args
|
|
65
63
|
};
|
|
64
|
+
const defaultConfig = (0, _omit.omit)(getDefaultJestConfiguration(), omitDefault);
|
|
66
65
|
return stringifyForCLI({
|
|
67
|
-
...
|
|
66
|
+
...mergeArrayValues(defaultConfig, {
|
|
68
67
|
coveragePathIgnorePatterns,
|
|
69
68
|
setupFiles,
|
|
70
69
|
testPathIgnorePatterns
|
|
@@ -72,6 +71,18 @@ function getJestConfigCLI(args) {
|
|
|
72
71
|
...config
|
|
73
72
|
});
|
|
74
73
|
}
|
|
74
|
+
function mergeArrayValues(config, arrayValues) {
|
|
75
|
+
return Object.keys(arrayValues).reduce((result, key)=>{
|
|
76
|
+
const newValue = arrayValues[key];
|
|
77
|
+
if (newValue) {
|
|
78
|
+
result[key] = [
|
|
79
|
+
...(0, _toarray.toArray)(result[key]),
|
|
80
|
+
...(0, _toarray.toArray)(newValue)
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}, config);
|
|
85
|
+
}
|
|
75
86
|
function stringifyForCLI(config) {
|
|
76
87
|
return [
|
|
77
88
|
'collectCoverageFrom',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/get-jest-config.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport path from 'path';\nimport { getJestConfiguration } from './get-configuration';\nimport { getDestinationFolders } from './get-destination-folders';\nimport { toArray } from './to-array';\
|
|
1
|
+
{"version":3,"sources":["../../src/utils/get-jest-config.ts"],"sourcesContent":["import { Config } from '@jest/types';\nimport path from 'path';\nimport { getJestConfiguration } from './get-configuration';\nimport { getDestinationFolders } from './get-destination-folders';\nimport { toArray } from './to-array';\nimport { omit } from './omit';\n\nfunction getDefaultJestConfiguration() {\n const moduleNameMapper = {\n '\\\\.(css|scss|less|png|svg|svg\\\\?\\\\w+|jpg|jpeg|gif|woff|woff2|eot|ttf|otf)$':\n 'identity-obj-proxy',\n };\n\n return {\n collectCoverageFrom: ['**/*.{ts,tsx}'],\n coveragePathIgnorePatterns: ['^.+\\\\.d\\\\.ts$'],\n coverageReporters: ['html-spa', 'text', 'json', 'cobertura', 'lcov'],\n moduleNameMapper,\n modulePathIgnorePatterns: ['<rootDir>/.*/__mocks__'],\n preset: path.join(__dirname, '../../jest'),\n setupFiles: [path.join(__dirname, '../../jest/setup.js')],\n testEnvironment: 'jsdom',\n testPathIgnorePatterns: ['\\\\.yalc', ...getDestinationFolders()],\n testRunner: 'jest-circus/runner',\n transformIgnorePatterns: ['node_modules/(?!(@servicetitan|@react-hook|nanoid|axios)/)'],\n verbose: true,\n } as Omit<Config.Argv, 'collectCoverageFrom' | 'moduleNameMapper' | 'setupFiles'> & {\n collectCoverageFrom: string[];\n moduleNameMapper: Record<string, string>;\n setupFiles: string[];\n };\n}\n\n/**\n * Get Jest config for running it using jest CLI (see jest runCLI function)\n */\nexport function getJestConfigCLI(args: Config.Argv): Config.Argv {\n const {\n coveragePathIgnorePatterns,\n omitDefault = [],\n setupFiles,\n testPathIgnorePatterns,\n ...config\n } = {\n ...getJestConfiguration(),\n ...args,\n };\n\n const defaultConfig = omit(getDefaultJestConfiguration(), omitDefault);\n\n return stringifyForCLI({\n ...mergeArrayValues(defaultConfig, {\n coveragePathIgnorePatterns,\n setupFiles,\n testPathIgnorePatterns,\n }),\n ...config,\n });\n}\n\nfunction mergeArrayValues(\n config: any,\n arrayValues: {\n coveragePathIgnorePatterns?: string | string[];\n setupFiles?: string | string[];\n testPathIgnorePatterns?: string | string[];\n }\n) {\n return Object.keys(arrayValues).reduce((result, key: keyof typeof arrayValues) => {\n const newValue = arrayValues[key];\n if (newValue) {\n result[key] = [...toArray(result[key]), ...toArray(newValue)];\n }\n return result;\n }, config);\n}\n\nfunction stringifyForCLI(config: any): Config.Argv {\n return ['collectCoverageFrom', 'globals', 'moduleNameMapper', 'transform'].reduce(\n (result, key) => {\n const value = result[key];\n if (value && typeof value !== 'string') {\n result[key] = JSON.stringify(result[key]);\n }\n return result;\n },\n config\n );\n}\n"],"names":["getJestConfigCLI","getDefaultJestConfiguration","moduleNameMapper","collectCoverageFrom","coveragePathIgnorePatterns","coverageReporters","modulePathIgnorePatterns","preset","path","join","__dirname","setupFiles","testEnvironment","testPathIgnorePatterns","getDestinationFolders","testRunner","transformIgnorePatterns","verbose","args","omitDefault","config","getJestConfiguration","defaultConfig","omit","stringifyForCLI","mergeArrayValues","arrayValues","Object","keys","reduce","result","key","newValue","toArray","value","JSON","stringify"],"mappings":";;;;+BAoCgBA;;;eAAAA;;;6DAnCC;kCACoB;uCACC;yBACd;sBACH;;;;;;AAErB,SAASC;IACL,MAAMC,mBAAmB;QACrB,8EACI;IACR;IAEA,OAAO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pCJ,MAAM,CAACC,IAAI,GAAGI,KAAKC,SAAS,CAACN,MAAM,CAACC,IAAI;QAC5C;QACA,OAAOD;IACX,GACAV;AAER"}
|
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,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -18,6 +18,7 @@ _export_star(require("./get-tsconfig"), exports);
|
|
|
18
18
|
_export_star(require("./load-shared-dependencies"), exports);
|
|
19
19
|
_export_star(require("./log"), exports);
|
|
20
20
|
_export_star(require("./log-errors"), exports);
|
|
21
|
+
_export_star(require("./omit"), exports);
|
|
21
22
|
_export_star(require("./pick"), exports);
|
|
22
23
|
_export_star(require("./read-json"), exports);
|
|
23
24
|
_export_star(require("./to-array"), exports);
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './get-branch-configs';\nexport * from './get-configuration';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-startup-version';\nexport * from './get-tsconfig';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './pick';\nexport * from './read-json';\nexport * from './to-array';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './find-packages';\nexport * from './find-up';\nexport * from './format-duration';\nexport * from './get-branch-configs';\nexport * from './get-configuration';\nexport * from './get-destination-folders';\nexport * from './get-folders';\nexport * from './get-jest-config';\nexport * from './get-package-data';\nexport * from './get-package-name';\nexport * from './get-packages';\nexport * from './get-startup-version';\nexport * from './get-tsconfig';\nexport * from './load-shared-dependencies';\nexport * from './log';\nexport * from './log-errors';\nexport * from './omit';\nexport * from './pick';\nexport * from './read-json';\nexport * from './to-array';\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"omit.d.ts","sourceRoot":"","sources":["../../src/utils/omit.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAE7E"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "omit", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return omit;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function omit(obj, keys) {
|
|
12
|
+
return keys.reduce((result, key)=>omitInternal({
|
|
13
|
+
...result
|
|
14
|
+
}, key.split('.')), obj);
|
|
15
|
+
}
|
|
16
|
+
function omitInternal(obj, [key, ...rest]) {
|
|
17
|
+
if (!rest.length) {
|
|
18
|
+
delete obj[key];
|
|
19
|
+
} else if (typeof obj[key] === 'object') {
|
|
20
|
+
return {
|
|
21
|
+
...obj,
|
|
22
|
+
[key]: omitInternal(obj[key], rest)
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=omit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/omit.ts"],"sourcesContent":["export function omit<T extends Record<string, any>>(obj: T, keys: string[]): T {\n return keys.reduce((result, key) => omitInternal({ ...result }, key.split('.')), obj);\n}\n\nfunction omitInternal<T extends Record<string, any>>(obj: T, [key, ...rest]: string[]): T {\n if (!rest.length) {\n delete obj[key];\n } else if (typeof obj[key] === 'object') {\n return { ...obj, [key]: omitInternal(obj[key], rest) };\n }\n return obj;\n}\n"],"names":["omit","obj","keys","reduce","result","key","omitInternal","split","rest","length"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,KAAoCC,GAAM,EAAEC,IAAc;IACtE,OAAOA,KAAKC,MAAM,CAAC,CAACC,QAAQC,MAAQC,aAAa;YAAE,GAAGF,MAAM;QAAC,GAAGC,IAAIE,KAAK,CAAC,OAAON;AACrF;AAEA,SAASK,aAA4CL,GAAM,EAAE,CAACI,KAAK,GAAGG,KAAe;IACjF,IAAI,CAACA,KAAKC,MAAM,EAAE;QACd,OAAOR,GAAG,CAACI,IAAI;IACnB,OAAO,IAAI,OAAOJ,GAAG,CAACI,IAAI,KAAK,UAAU;QACrC,OAAO;YAAE,GAAGJ,GAAG;YAAE,CAACI,IAAI,EAAEC,aAAaL,GAAG,CAACI,IAAI,EAAEG;QAAM;IACzD;IACA,OAAOP;AACX"}
|