Skip to content

Commit f0e6969

Browse files
authored
Removes experimental warning from ext-install and deploy (#5678)
* Removes experimental warning from ext-install and deploy * Fix tests
1 parent 811dbac commit f0e6969

File tree

3 files changed

+8
-91
lines changed

3 files changed

+8
-91
lines changed

src/commands/ext-install.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,8 @@ async function infoExtensionVersion(args: {
165165
extensionVersion: ExtensionVersion;
166166
}): Promise<void> {
167167
const ref = refs.parse(args.extensionName);
168-
const extension = await extensionsApi.getExtension(refs.toExtensionRef(ref));
169168
await displayExtInfo(args.extensionName, ref.publisherId, args.extensionVersion.spec, true);
170-
await displayWarningPrompts(
171-
ref.publisherId,
172-
extension.registryLaunchStage,
173-
args.extensionVersion
174-
);
169+
await displayWarningPrompts(ref.publisherId, args.extensionVersion);
175170
}
176171

177172
interface InstallExtensionOptions {

src/extensions/warnings.ts

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { marked } from "marked";
22
import * as clc from "colorette";
33

4-
import { ExtensionVersion, RegistryLaunchStage } from "./types";
4+
import { ExtensionVersion } from "./types";
55
import { printSourceDownloadLink } from "./displayExtensionInfo";
66
import { logPrefix } from "./extensionsHelper";
77
import { getTrustedPublishers } from "./resolveSource";
88
import { humanReadable } from "../deploy/extensions/deploymentSummary";
99
import { InstanceSpec, getExtension } from "../deploy/extensions/planner";
10-
import { partition } from "../functional";
1110
import * as utils from "../utils";
1211
import { logger } from "../logger";
1312

@@ -30,23 +29,11 @@ function displayEAPWarning({
3029
printSourceDownloadLink(sourceDownloadUri);
3130
}
3231

33-
function displayExperimentalWarning() {
34-
utils.logLabeledBullet(
35-
logPrefix,
36-
marked(
37-
`${clc.yellow(clc.bold("Important"))}: This extension is ${clc.bold(
38-
"experimental"
39-
)} and may not be production-ready. Its functionality might change in backward-incompatible ways before its official release, or it may be discontinued.`
40-
)
41-
);
42-
}
43-
4432
/**
4533
* Show warning if extension is experimental or developed by 3P.
4634
*/
4735
export async function displayWarningPrompts(
4836
publisherId: string,
49-
launchStage: RegistryLaunchStage,
5037
extensionVersion: ExtensionVersion
5138
): Promise<void> {
5239
const trustedPublishers = await getTrustedPublishers();
@@ -56,8 +43,6 @@ export async function displayWarningPrompts(
5643
sourceDownloadUri: extensionVersion.sourceDownloadUri,
5744
githubLink: extensionVersion.spec.sourceUrl,
5845
});
59-
} else if (launchStage === RegistryLaunchStage.EXPERIMENTAL) {
60-
displayExperimentalWarning();
6146
} else {
6247
// Otherwise, this is an official extension and requires no warning prompts.
6348
return;
@@ -85,27 +70,9 @@ export async function displayWarningsForDeploy(instancesToCreate: InstanceSpec[]
8570
await getExtension(i);
8671
}
8772

88-
const [eapExtensions, nonEapExtensions] = partition(
89-
publishedExtensionInstances,
73+
const eapExtensions = publishedExtensionInstances.filter(
9074
(i) => !trustedPublishers.includes(i.ref?.publisherId ?? "")
9175
);
92-
// Only mark non-eap extensions as experimental.
93-
const experimental = nonEapExtensions.filter(
94-
(i) => i.extension!.registryLaunchStage === RegistryLaunchStage.EXPERIMENTAL
95-
);
96-
97-
if (experimental.length) {
98-
const humanReadableList = experimental.map((i) => `\t${humanReadable(i)}`).join("\n");
99-
utils.logLabeledBullet(
100-
logPrefix,
101-
marked(
102-
`The following are instances of ${clc.bold(
103-
"experimental"
104-
)} extensions.They may not be production-ready. Their functionality may change in backward-incompatible ways before their official release, or they may be discontinued.\n${humanReadableList}\n`,
105-
{ gfm: false }
106-
)
107-
);
108-
}
10976

11077
if (eapExtensions.length) {
11178
const humanReadableList = eapExtensions.map(toListEntry).join("\n");
@@ -119,7 +86,7 @@ export async function displayWarningsForDeploy(instancesToCreate: InstanceSpec[]
11986
)
12087
);
12188
}
122-
return experimental.length > 0 || eapExtensions.length > 0;
89+
return eapExtensions.length > 0;
12390
}
12491

12592
export function outOfBandChangesWarning(instanceIds: string[]) {

src/test/extensions/warnings.spec.ts

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,18 @@ describe("displayWarningPrompts", () => {
7272
logLabeledStub.restore();
7373
});
7474

75-
it("should not warn if from trusted publisher and not experimental", async () => {
75+
it("should not warn if from trusted publisher", async () => {
7676
const publisherId = "firebase";
7777

78-
await warnings.displayWarningPrompts(
79-
publisherId,
80-
RegistryLaunchStage.BETA,
81-
testExtensionVersion
82-
);
78+
await warnings.displayWarningPrompts(publisherId, testExtensionVersion);
8379

8480
expect(logLabeledStub).to.not.have.been.called;
8581
});
8682

87-
it("should warn if experimental", async () => {
88-
const publisherId = "firebase";
89-
90-
await warnings.displayWarningPrompts(
91-
publisherId,
92-
RegistryLaunchStage.EXPERIMENTAL,
93-
testExtensionVersion
94-
);
95-
96-
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "experimental");
97-
});
98-
9983
it("should warn if the publisher is not on the approved publisher list", async () => {
10084
const publisherId = "pubby-mcpublisher";
10185

102-
await warnings.displayWarningPrompts(
103-
publisherId,
104-
RegistryLaunchStage.BETA,
105-
testExtensionVersion
106-
);
86+
await warnings.displayWarningPrompts(publisherId, testExtensionVersion);
10787

10888
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "Early Access Program");
10989
});
@@ -124,7 +104,7 @@ describe("displayWarningsForDeploy", () => {
124104
logLabeledStub.restore();
125105
});
126106

127-
it("should not warn or prompt if from trusted publisher and not experimental", async () => {
107+
it("should not warn or prompt if from trusted publisher", async () => {
128108
const toCreate = [
129109
testInstanceSpec("firebase", "ext-id-1", RegistryLaunchStage.GA),
130110
testInstanceSpec("firebase", "ext-id-2", RegistryLaunchStage.GA),
@@ -136,18 +116,6 @@ describe("displayWarningsForDeploy", () => {
136116
expect(logLabeledStub).to.not.have.been.called;
137117
});
138118

139-
it("should prompt if experimental", async () => {
140-
const toCreate = [
141-
testInstanceSpec("firebase", "ext-id-1", RegistryLaunchStage.EXPERIMENTAL),
142-
testInstanceSpec("firebase", "ext-id-2", RegistryLaunchStage.EXPERIMENTAL),
143-
];
144-
145-
const warned = await warnings.displayWarningsForDeploy(toCreate);
146-
147-
expect(warned).to.be.true;
148-
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "experimental");
149-
});
150-
151119
it("should prompt if the publisher is not on the approved publisher list", async () => {
152120
const toCreate = [
153121
testInstanceSpec("pubby-mcpublisher", "ext-id-1", RegistryLaunchStage.GA),
@@ -159,17 +127,4 @@ describe("displayWarningsForDeploy", () => {
159127
expect(warned).to.be.true;
160128
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "Early Access Program");
161129
});
162-
163-
it("should show multiple warnings at once if triggered", async () => {
164-
const toCreate = [
165-
testInstanceSpec("pubby-mcpublisher", "ext-id-1", RegistryLaunchStage.GA),
166-
testInstanceSpec("firebase", "ext-id-2", RegistryLaunchStage.EXPERIMENTAL),
167-
];
168-
169-
const warned = await warnings.displayWarningsForDeploy(toCreate);
170-
171-
expect(warned).to.be.true;
172-
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "Early Access Program");
173-
expect(logLabeledStub).to.have.been.calledWithMatch("extensions", "experimental");
174-
});
175130
});

0 commit comments

Comments
 (0)