Skip to content

Commit d03a212

Browse files
authored
refactor: remove unused framework parameter from local build pipeline (#10526)
1 parent f0cc355 commit d03a212

4 files changed

Lines changed: 13 additions & 31 deletions

File tree

src/apphosting/localbuilds.spec.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ describe("localBuild", () => {
5555
const expectedAnnotations = {
5656
language: "nodejs",
5757
runtime: "nodejs22",
58-
framework: "nextjs",
5958
};
6059
const expectedOutputFiles = [".next/standalone"];
6160
const expectedBuildConfig = {
@@ -70,11 +69,7 @@ describe("localBuild", () => {
7069
stderr: "mock stderr",
7170
signal: null,
7271
});
73-
const { outputFiles, annotations, buildConfig } = await localBuild(
74-
"test-project",
75-
"./",
76-
"nextjs",
77-
);
72+
const { outputFiles, annotations, buildConfig } = await localBuild("test-project", "./");
7873
expect(annotations).to.deep.equal(expectedAnnotations);
7974
expect(buildConfig).to.deep.equal(expectedBuildConfig);
8075
expect(outputFiles).to.deep.equal(expectedOutputFiles);
@@ -103,7 +98,7 @@ describe("localBuild", () => {
10398
MY_PLAIN_VAR: { value: "plain-value" },
10499
};
105100

106-
await localBuild("test-project", "./", "nextjs", envMap, {
101+
await localBuild("test-project", "./", envMap, {
107102
nonInteractive: true,
108103
allowLocalBuildSecrets: true,
109104
});
@@ -136,7 +131,7 @@ describe("localBuild", () => {
136131
ANOTHER_VAR: { value: "another-value" },
137132
};
138133

139-
await localBuild("test-project", "./", "nextjs", envMap);
134+
await localBuild("test-project", "./", envMap);
140135

141136
expect(loadSecretStub).to.not.have.been.called;
142137
// We expect the original process.env to not have these injected globally after run completes,
@@ -158,7 +153,7 @@ describe("localBuild", () => {
158153
};
159154

160155
await expect(
161-
localBuild("test-project", "./", "nextjs", envMap, { nonInteractive: true }),
156+
localBuild("test-project", "./", envMap, { nonInteractive: true }),
162157
).to.be.rejectedWith(
163158
"Using build-available secrets during a local build in non-interactive mode requires the --allow-local-build-secrets flag.",
164159
);
@@ -179,7 +174,7 @@ describe("localBuild", () => {
179174
MY_BUILD_SECRET: { secret: "my-secret-id", availability: ["BUILD"] },
180175
};
181176

182-
await localBuild("test-project", "./", "nextjs", envMap, {
177+
await localBuild("test-project", "./", envMap, {
183178
nonInteractive: true,
184179
allowLocalBuildSecrets: true,
185180
});
@@ -195,7 +190,7 @@ describe("localBuild", () => {
195190
};
196191

197192
await expect(
198-
localBuild("test-project", "./", "nextjs", envMap, { nonInteractive: false }),
193+
localBuild("test-project", "./", envMap, { nonInteractive: false }),
199194
).to.be.rejectedWith("Cancelled local build due to BUILD-available secrets.");
200195
expect(confirmStub).to.have.been.calledOnce;
201196
});
@@ -216,7 +211,7 @@ describe("localBuild", () => {
216211
MY_BUILD_SECRET: { secret: "my-secret-id", availability: ["BUILD"] },
217212
};
218213

219-
await localBuild("test-project", "./", "nextjs", envMap, { nonInteractive: false });
214+
await localBuild("test-project", "./", envMap, { nonInteractive: false });
220215
expect(confirmStub).to.have.been.calledOnce;
221216
});
222217
});
@@ -232,13 +227,12 @@ describe("localBuild", () => {
232227
signal: null,
233228
});
234229

235-
const output = await runUniversalMaker("./", "nextjs");
230+
const output = await runUniversalMaker("./");
236231

237232
expect(output).to.deep.equal({
238233
metadata: {
239234
language: "nodejs",
240235
runtime: "nodejs22",
241-
framework: "nextjs",
242236
},
243237
runConfig: {
244238
runCommand: "npm run start",

src/apphosting/localbuilds.ts

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,10 @@ interface UniversalMakerOutput {
2222
/**
2323
* Runs the Universal Maker binary to build the project.
2424
*/
25-
export async function runUniversalMaker(
26-
projectRoot: string,
27-
framework?: string,
28-
): Promise<AppHostingBuildOutput> {
25+
export async function runUniversalMaker(projectRoot: string): Promise<AppHostingBuildOutput> {
2926
const universalMakerBinary = await getOrDownloadUniversalMaker();
3027
executeUniversalMakerBinary(universalMakerBinary, projectRoot);
31-
return processUniversalMakerOutput(projectRoot, framework);
28+
return processUniversalMakerOutput(projectRoot);
3229
}
3330

3431
/**
@@ -118,10 +115,7 @@ function parseBundleYaml(
118115
* This includes resolving the final run command and artifact paths from the
119116
* generated bundle.yaml, as well as cleaning up temporary metadata files.
120117
*/
121-
function processUniversalMakerOutput(
122-
projectRoot: string,
123-
framework?: string,
124-
): AppHostingBuildOutput {
118+
function processUniversalMakerOutput(projectRoot: string): AppHostingBuildOutput {
125119
const outputFilePath = path.join(projectRoot, "build_output.json");
126120
if (!fs.existsSync(outputFilePath)) {
127121
throw new FirebaseError(
@@ -166,7 +160,6 @@ function processUniversalMakerOutput(
166160
metadata: {
167161
language: umOutput.language,
168162
runtime: umOutput.runtime,
169-
framework: framework || "nextjs",
170163
},
171164
runConfig: {
172165
runCommand: finalRunCommand,
@@ -213,7 +206,6 @@ export interface AppHostingBuildOutput {
213206
* generates the necessary build artifacts, and returns metadata about the build.
214207
* @param projectId - The project ID to use for resolving secrets.
215208
* @param projectRoot - The root directory of the project to build.
216-
* @param framework - The framework to use for the build (e.g., 'nextjs').
217209
* @param env - The environment configuration map to resolve and inject into the build.
218210
* @return A promise that resolves to the build output, including:
219211
* - `outputFiles`: Paths to the generated build artifacts.
@@ -223,7 +215,6 @@ export interface AppHostingBuildOutput {
223215
export async function localBuild(
224216
projectId: string,
225217
projectRoot: string,
226-
framework: string,
227218
env: EnvMap = {},
228219
options?: { nonInteractive?: boolean; allowLocalBuildSecrets?: boolean },
229220
): Promise<{
@@ -264,7 +255,7 @@ export async function localBuild(
264255

265256
let apphostingBuildOutput: AppHostingBuildOutput;
266257
try {
267-
apphostingBuildOutput = await runUniversalMaker(projectRoot, framework);
258+
apphostingBuildOutput = await runUniversalMaker(projectRoot);
268259
} finally {
269260
for (const key in process.env) {
270261
if (!(key in originalEnv)) {

src/deploy/apphosting/prepare.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ describe("apphosting", () => {
298298
expect(localBuildStub).to.be.calledWithMatch(
299299
"my-project",
300300
sinon.match.any,
301-
"nextjs",
302301
sinon.match({
303302
FIREBASE_WEBAPP_CONFIG: { value: JSON.stringify(webAppConfig) },
304303
FIREBASE_CONFIG: {
@@ -359,14 +358,13 @@ describe("apphosting", () => {
359358
expect(localBuildStub).to.have.been.calledWithMatch(
360359
"my-project",
361360
sinon.match.any,
362-
"nextjs",
363361
sinon.match({
364362
BUILD_VAR: { secret: "build-secret", availability: ["BUILD"] },
365363
SHARED_VAR: { secret: "shared-secret", availability: ["BUILD", "RUNTIME"] },
366364
}),
367365
);
368366
// RUNTIME_VAR should definitely NOT be present in match
369-
expect(localBuildStub.firstCall.args[3]).to.not.have.property("RUNTIME_VAR");
367+
expect(localBuildStub.firstCall.args[2]).to.not.have.property("RUNTIME_VAR");
370368
});
371369

372370
it("should fail if localBuild is specified but experiment is disabled", async () => {

src/deploy/apphosting/prepare.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ export default async function (context: Context, options: Options): Promise<void
205205
const { outputFiles, annotations, buildConfig } = await localBuild(
206206
projectId,
207207
localBuildScratchDir,
208-
"nextjs",
209208
buildEnv[cfg.backendId] || {},
210209
{
211210
nonInteractive: options.nonInteractive,

0 commit comments

Comments
 (0)