@forge/cli-shared 10.1.0-next.7 → 10.1.0-next.9
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/CHANGELOG.md +12 -0
- package/out/apps/get-app-owner.d.ts.map +1 -1
- package/out/graphql/gql/graphql.d.ts +84 -12
- package/out/graphql/gql/graphql.d.ts.map +1 -1
- package/out/service/supported-products-service.d.ts +8 -16
- package/out/service/supported-products-service.d.ts.map +1 -1
- package/out/service/supported-products-service.js +24 -60
- package/out/shared/error-handling.d.ts +2 -0
- package/out/shared/error-handling.d.ts.map +1 -1
- package/out/shared/error-handling.js +6 -1
- package/out/shared/test.d.ts.map +1 -1
- package/out/shared/test.js +1 -1
- package/out/ui/command-line-ui.d.ts +2 -0
- package/out/ui/command-line-ui.d.ts.map +1 -1
- package/out/ui/command-line-ui.js +13 -2
- package/package.json +1 -1
|
@@ -11,27 +11,19 @@ export type ProductDefinition = {
|
|
|
11
11
|
isEnabledByFeatureGate?: (statsigService: StatsigService) => Promise<boolean>;
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
declare class SupportedProductEntry {
|
|
15
|
-
productName: SupportedProduct;
|
|
16
|
-
productType: ProductType;
|
|
17
|
-
supportedByCrossProductApps: boolean;
|
|
18
|
-
constructor(productName: SupportedProduct, productType: ProductType, supportedByCrossProductApps: boolean);
|
|
19
|
-
}
|
|
20
|
-
declare function resolveEnabledProducts(statsigService: StatsigService): Promise<SupportedProductEntry[]>;
|
|
21
14
|
export declare class SupportedProductsService {
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
15
|
+
private readonly statsigService;
|
|
16
|
+
private readonly definitions;
|
|
17
|
+
private enabledProducts;
|
|
18
|
+
private enabledProductsPromise?;
|
|
19
|
+
constructor(statsigService: StatsigService, definitions?: Readonly<ProductDefinition[]>);
|
|
20
|
+
getSupportedProducts(): Promise<SupportedProduct[]>;
|
|
21
|
+
getSupportedProductsIfResolved(): SupportedProduct[];
|
|
27
22
|
getSupportedSecondaryProductsForXPA(requiredProducts: string[]): SupportedProduct[];
|
|
28
|
-
validateSupportedProduct(productNameInput: string): SupportedProduct
|
|
23
|
+
validateSupportedProduct(productNameInput: string): Promise<SupportedProduct>;
|
|
29
24
|
isWorkspaceProduct(product: string): boolean;
|
|
30
25
|
validateSite(site: string, product: ProductDisplayName | undefined): URL;
|
|
31
26
|
}
|
|
32
27
|
export declare const isBitbucketProduct: (product: string) => boolean;
|
|
33
|
-
export declare const TEST_ONLY_EXPORTS: {
|
|
34
|
-
resolveEnabledProducts: typeof resolveEnabledProducts;
|
|
35
|
-
};
|
|
36
28
|
export {};
|
|
37
29
|
//# sourceMappingURL=supported-products-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service/supported-products-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAuC,MAAM,oBAAoB,CAAC;AAK7F,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,gBAAgB,GAAG,OAAO,GAAG,WAAW,CAAC;AAuC5G,KAAK,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,CAAC,EAAE;QACR,2BAA2B,CAAC,EAAE,OAAO,CAAC;QACtC,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAC/E,CAAC;CACH,CAAC;
|
|
1
|
+
{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service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;CAqBhF;AAID,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,OAEpD,CAAC"}
|
|
@@ -35,72 +35,38 @@ const SUPPORTED_PRODUCTS_DEFINITIONS = [
|
|
|
35
35
|
productType: 'workspace'
|
|
36
36
|
}
|
|
37
37
|
];
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
constructor(productName, productType, supportedByCrossProductApps) {
|
|
43
|
-
this.productName = productName;
|
|
44
|
-
this.productType = productType;
|
|
45
|
-
this.supportedByCrossProductApps = supportedByCrossProductApps;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function resolveEnabledProducts(statsigService) {
|
|
49
|
-
const productDefinitionWithIsEnabledResolved = await Promise.all(SUPPORTED_PRODUCTS_DEFINITIONS.map(async (pd) => {
|
|
50
|
-
const enabledByFeatureGateResolver = pd.special?.isEnabledByFeatureGate;
|
|
51
|
-
const isEnabled = enabledByFeatureGateResolver ? await enabledByFeatureGateResolver(statsigService) : true;
|
|
52
|
-
return { pd, isEnabled };
|
|
38
|
+
async function resolveEnabledProducts(definitions, statsigService) {
|
|
39
|
+
const resolved = await Promise.all(definitions.map(async (pd) => {
|
|
40
|
+
const isEnabledByFeatureGate = pd.special?.isEnabledByFeatureGate;
|
|
41
|
+
return { pd, isEnabled: isEnabledByFeatureGate ? await isEnabledByFeatureGate(statsigService) : true };
|
|
53
42
|
}));
|
|
54
|
-
|
|
55
|
-
.filter(({ isEnabled }) => isEnabled)
|
|
56
|
-
.map(({ pd }) => pd);
|
|
57
|
-
return definitionsForEnabledProducts.map((pd) => {
|
|
58
|
-
return new SupportedProductEntry(pd.name, pd.productType, pd.special?.supportedByCrossProductApps ?? false);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
class SupportedProductEntriesHolder {
|
|
62
|
-
value;
|
|
63
|
-
constructor(value) {
|
|
64
|
-
this.value = value;
|
|
65
|
-
}
|
|
66
|
-
async initialize(valueProvider) {
|
|
67
|
-
if (this.value) {
|
|
68
|
-
throw new Error('SupportedProductsService was already initialized - is initialization called multiple times?');
|
|
69
|
-
}
|
|
70
|
-
this.value = await valueProvider();
|
|
71
|
-
}
|
|
72
|
-
get() {
|
|
73
|
-
if (!this.value) {
|
|
74
|
-
throw new Error('SupportedProductsService is not initialized - are you calling it from some constructor?');
|
|
75
|
-
}
|
|
76
|
-
return this.value;
|
|
77
|
-
}
|
|
43
|
+
return resolved.filter(({ isEnabled }) => isEnabled).map(({ pd }) => pd.name);
|
|
78
44
|
}
|
|
79
45
|
export class SupportedProductsService {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
46
|
+
statsigService;
|
|
47
|
+
definitions;
|
|
48
|
+
enabledProducts;
|
|
49
|
+
enabledProductsPromise;
|
|
50
|
+
constructor(statsigService, definitions = SUPPORTED_PRODUCTS_DEFINITIONS) {
|
|
51
|
+
this.statsigService = statsigService;
|
|
52
|
+
this.definitions = definitions;
|
|
83
53
|
}
|
|
84
|
-
async
|
|
85
|
-
|
|
54
|
+
async getSupportedProducts() {
|
|
55
|
+
this.enabledProductsPromise ??= resolveEnabledProducts(this.definitions, this.statsigService).then((products) => (this.enabledProducts = products));
|
|
56
|
+
return this.enabledProductsPromise;
|
|
86
57
|
}
|
|
87
|
-
|
|
88
|
-
return this.
|
|
89
|
-
.get()
|
|
90
|
-
.filter((p) => filter(p))
|
|
91
|
-
.map((p) => p.productName);
|
|
92
|
-
}
|
|
93
|
-
getSupportedProducts() {
|
|
94
|
-
return this.supportedProductEntriesHolder.get().map((p) => p.productName);
|
|
58
|
+
getSupportedProductsIfResolved() {
|
|
59
|
+
return (this.enabledProducts ?? this.definitions.filter((pd) => !pd.special?.isEnabledByFeatureGate).map((pd) => pd.name));
|
|
95
60
|
}
|
|
96
61
|
getSupportedSecondaryProductsForXPA(requiredProducts) {
|
|
97
62
|
const requiredProductsNames = requiredProducts.map((p) => productDisplayName(p));
|
|
98
|
-
return this.
|
|
63
|
+
return this.definitions
|
|
64
|
+
.filter((pd) => pd.special?.supportedByCrossProductApps && !requiredProductsNames.includes(pd.name))
|
|
65
|
+
.map((pd) => pd.name);
|
|
99
66
|
}
|
|
100
|
-
validateSupportedProduct(productNameInput) {
|
|
67
|
+
async validateSupportedProduct(productNameInput) {
|
|
101
68
|
const productName = productDisplayName(productNameInput);
|
|
102
|
-
|
|
103
|
-
if (supportedProducts.includes(productName)) {
|
|
69
|
+
if ((await this.getSupportedProducts()).includes(productName)) {
|
|
104
70
|
return productName;
|
|
105
71
|
}
|
|
106
72
|
else {
|
|
@@ -108,7 +74,8 @@ export class SupportedProductsService {
|
|
|
108
74
|
}
|
|
109
75
|
}
|
|
110
76
|
isWorkspaceProduct(product) {
|
|
111
|
-
|
|
77
|
+
const name = productDisplayName(product);
|
|
78
|
+
return this.definitions.some((pd) => pd.productType === 'workspace' && pd.name === name);
|
|
112
79
|
}
|
|
113
80
|
validateSite(site, product) {
|
|
114
81
|
const trySites = [site, `https://${site}`];
|
|
@@ -130,6 +97,3 @@ export class SupportedProductsService {
|
|
|
130
97
|
export const isBitbucketProduct = (product) => {
|
|
131
98
|
return productDisplayName(product) === 'Bitbucket';
|
|
132
99
|
};
|
|
133
|
-
export const TEST_ONLY_EXPORTS = {
|
|
134
|
-
resolveEnabledProducts
|
|
135
|
-
};
|
|
@@ -25,6 +25,8 @@ export interface AutoAnalyzeErrorInput {
|
|
|
25
25
|
assistantName?: string;
|
|
26
26
|
prompt?: string;
|
|
27
27
|
}
|
|
28
|
+
export declare const markSentryInitialised: () => void;
|
|
29
|
+
export declare const isSentryInitialised: () => boolean;
|
|
28
30
|
export declare const NO_HINT: null;
|
|
29
31
|
export declare const exitOnError: (logger: Logger, error: Error, hint?: string | null, autoAnalyzeErrorInput?: AutoAnalyzeErrorInput) => Promise<never>;
|
|
30
32
|
export declare const wrapError: (error: unknown) => Error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/shared/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG;IACrF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAKF,MAAM,WAAW,kBAAkB;IACjC,aAAa,IAAI,cAAc,CAAC;CACjC;AA8CD,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,GAAG,OAAO,CAW3C;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,GAAG,GAAG,cAAc,CAOzD;AAED,qBAAa,SAAU,SAAQ,KAAM,YAAW,kBAAkB;IAE9D,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS;gBAA9B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,EACjD,OAAO,CAAC,EAAE,MAAM;IAKX,aAAa,IAAI,cAAc;IAM/B,WAAW,IAAI,OAAO;CAG9B;AAED,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS;IAIrD,WAAW,IAAI,OAAO;CAG9B;AAED,qBAAa,WAAY,SAAQ,SAAS;gBAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS;CAG7D;AAUD,MAAM,WAAW,qBAAqB;IACpC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"error-handling.d.ts","sourceRoot":"","sources":["../../src/shared/error-handling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAIxC,MAAM,MAAM,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,SAAS;CAAG;AAEzD,qBAAa,aAAc,SAAQ,SAAS;IAGxC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAD3B,OAAO,CAAC,EAAE,MAAM,EACC,UAAU,GAAE,OAAe;IAKvC,WAAW;CAGnB;AAUD,qBAAa,wBAAyB,SAAQ,SAAS;gBAMzC,OAAO,CAAC,EAAE,MAAM;CAG7B;AAUD,qBAAa,mBAAoB,SAAQ,SAAS;gBAMpC,OAAO,CAAC,EAAE,MAAM;CAG7B"}
|
|
@@ -83,10 +83,15 @@ function removePrefixFromErrorMessage(message) {
|
|
|
83
83
|
}
|
|
84
84
|
return message;
|
|
85
85
|
}
|
|
86
|
+
let sentryInitialised = false;
|
|
87
|
+
export const markSentryInitialised = () => {
|
|
88
|
+
sentryInitialised = true;
|
|
89
|
+
};
|
|
90
|
+
export const isSentryInitialised = () => sentryInitialised;
|
|
86
91
|
export const NO_HINT = null;
|
|
87
92
|
export const exitOnError = async (logger, error, hint, autoAnalyzeErrorInput) => {
|
|
88
93
|
let exitCode = 0;
|
|
89
|
-
const Sentry = await import('@sentry/node').catch(() => undefined);
|
|
94
|
+
const Sentry = sentryInitialised ? await import('@sentry/node').catch(() => undefined) : undefined;
|
|
90
95
|
Sentry?.withScope((scope) => {
|
|
91
96
|
scope.setTag('userError', isUserError(error));
|
|
92
97
|
scope.setFingerprint(['{{ default }}', '{{ tags.command.name }}']);
|
package/out/shared/test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/shared/test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/shared/test.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,wBAAgB,UAAU,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,GAAG,MAAM,CAU/E;AAED,KAAK,OAAO,GAAG;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC/C,CAAC;AAEF,wBAAsB,aAAa,CAAC,EAClC,QAAQ,EACR,gBAA0B,EAC1B,iBAAwB,EACxB,QAAQ,EACR,cAAsB,EACvB,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,OAAO,CAAC,CAiDnB"}
|
package/out/shared/test.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { writeFile } from 'fs/promises';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { ensureDir, ensureSymlink } from 'fs-extra';
|
|
4
3
|
import { tmpDir } from './directories.js';
|
|
5
4
|
export function mockLogger(traceEnabled, debugEnabled) {
|
|
6
5
|
return {
|
|
@@ -14,6 +13,7 @@ export function mockLogger(traceEnabled, debugEnabled) {
|
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
15
|
export async function createTestApp({ userCode, userCodeFilename = 'index', userCodeExtension = 'ts', packages, withI18nBundle = false }) {
|
|
16
|
+
const { ensureDir, ensureSymlink } = await import('fs-extra');
|
|
17
17
|
const appDirectory = tmpDir();
|
|
18
18
|
const { SOURCE_DIRECTORY } = await import('@forge/manifest');
|
|
19
19
|
const userCodeDir = path.join(appDirectory, SOURCE_DIRECTORY, path.dirname(userCodeFilename));
|
|
@@ -17,6 +17,8 @@ export declare class CommandLineUI implements UI {
|
|
|
17
17
|
private insideProgress;
|
|
18
18
|
private statsigService;
|
|
19
19
|
private cachedSpinnerConfig;
|
|
20
|
+
private customSpinnerRequested;
|
|
21
|
+
private showsConfiguredSpinner;
|
|
20
22
|
private static HINT_ROTATION_INTERVAL_MS;
|
|
21
23
|
private hintLine;
|
|
22
24
|
private hintTimer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-line-ui.d.ts","sourceRoot":"","sources":["../../src/ui/command-line-ui.ts"],"names":[],"mappings":"AAKA,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,EAAW,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAoBxE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,KAAK,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAQjF,qBAAa,aAAc,YAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"command-line-ui.d.ts","sourceRoot":"","sources":["../../src/ui/command-line-ui.ts"],"names":[],"mappings":"AAKA,OAAY,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,EAAW,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAoBxE,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAMD,KAAK,SAAS,CAAC,GAAG,SAAS,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAQjF,qBAAa,aAAc,YAAW,EAAE;IAsEpC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAIxB,OAAO,CAAC,QAAQ,CAAC,oBA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,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAQ1G,oBAAoB,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,UAAO,GAAG,MAAM;CAItF"}
|
|
@@ -46,6 +46,8 @@ export class CommandLineUI {
|
|
|
46
46
|
insideProgress = false;
|
|
47
47
|
statsigService;
|
|
48
48
|
cachedSpinnerConfig = 'dots';
|
|
49
|
+
customSpinnerRequested = false;
|
|
50
|
+
showsConfiguredSpinner = false;
|
|
49
51
|
static HINT_ROTATION_INTERVAL_MS = 7000;
|
|
50
52
|
hintLine;
|
|
51
53
|
hintTimer;
|
|
@@ -67,7 +69,6 @@ export class CommandLineUI {
|
|
|
67
69
|
}
|
|
68
70
|
setStatsigService(statsigService) {
|
|
69
71
|
this.statsigService = statsigService;
|
|
70
|
-
this.initCustomSpinner();
|
|
71
72
|
}
|
|
72
73
|
seasonalSpinnerEffectsEnabled() {
|
|
73
74
|
if (process.env.FORGE_DISABLE_SEASONAL_EFFECTS) {
|
|
@@ -79,19 +80,26 @@ export class CommandLineUI {
|
|
|
79
80
|
return true;
|
|
80
81
|
}
|
|
81
82
|
initCustomSpinner() {
|
|
82
|
-
if (!this.seasonalSpinnerEffectsEnabled() || !this.statsigService) {
|
|
83
|
+
if (this.customSpinnerRequested || !this.seasonalSpinnerEffectsEnabled() || !this.statsigService) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
86
|
+
this.customSpinnerRequested = true;
|
|
85
87
|
this.statsigService
|
|
86
88
|
.getCustomSpinnerConfig()
|
|
87
89
|
.then((frames) => {
|
|
88
90
|
if (frames && frames.length > 0) {
|
|
89
91
|
this.cachedSpinnerConfig = { interval: 300, frames };
|
|
92
|
+
if (this.spinner.isSpinning && this.showsConfiguredSpinner) {
|
|
93
|
+
this.spinner.spinner = this.cachedSpinnerConfig;
|
|
94
|
+
this.spinner.stop();
|
|
95
|
+
this.spinner.start();
|
|
96
|
+
}
|
|
90
97
|
}
|
|
91
98
|
})
|
|
92
99
|
.catch(() => this.debug(Text.settings.customEffects.setupError));
|
|
93
100
|
}
|
|
94
101
|
getSpinner() {
|
|
102
|
+
this.initCustomSpinner();
|
|
95
103
|
return this.cachedSpinnerConfig;
|
|
96
104
|
}
|
|
97
105
|
async prompt(questions, initialAnswers) {
|
|
@@ -122,6 +130,7 @@ export class CommandLineUI {
|
|
|
122
130
|
this.addedProgressPadding = false;
|
|
123
131
|
if (!this.debugEnabled) {
|
|
124
132
|
this.spinner.spinner = this.getSpinner();
|
|
133
|
+
this.showsConfiguredSpinner = true;
|
|
125
134
|
this.spinner.text = '';
|
|
126
135
|
this.spinner.start();
|
|
127
136
|
}
|
|
@@ -205,6 +214,7 @@ export class CommandLineUI {
|
|
|
205
214
|
this.log(animateEllipsis ? waitText + ELLIPSIS_FRAMES[ELLIPSIS_FRAMES.length - 1] : waitText, ProgressLogType.startText);
|
|
206
215
|
}
|
|
207
216
|
else {
|
|
217
|
+
this.showsConfiguredSpinner = false;
|
|
208
218
|
this.spinner.spinner = animateEllipsis
|
|
209
219
|
? { interval: ELLIPSIS_INTERVAL_MS, frames: ELLIPSIS_FRAMES.map((ellipsis) => waitText + ellipsis) }
|
|
210
220
|
: { interval: 9999, frames: [''] };
|
|
@@ -229,6 +239,7 @@ export class CommandLineUI {
|
|
|
229
239
|
this.addedProgressPadding = false;
|
|
230
240
|
if (!this.debugEnabled) {
|
|
231
241
|
this.spinner.spinner = this.getSpinner();
|
|
242
|
+
this.showsConfiguredSpinner = true;
|
|
232
243
|
this.spinner.text = '';
|
|
233
244
|
this.spinner.start();
|
|
234
245
|
}
|