Skip to content

Commit 98eb4d2

Browse files
authored
Filter out node_modules without breaking nx monorepos (#352)
* round 2 filtering out node_modules, this time without breaking monorepos * fix test and add bug * fix adapter
1 parent 4675e3e commit 98eb4d2

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@apphosting/adapter-nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apphosting/adapter-nextjs",
3-
"version": "14.0.16",
3+
"version": "14.0.17",
44
"main": "dist/index.js",
55
"description": "Experimental addon to the Firebase CLI to add web framework support",
66
"repository": {

packages/@apphosting/adapter-nextjs/src/bin/build.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ metadata:
6262
adapterVersion: ${adapterMetadata.adapterVersion}
6363
framework: nextjs
6464
frameworkVersion: ${defaultNextVersion}
65+
outputFiles:
66+
serverApp:
67+
include:
68+
- .next/standalone
6569
`,
6670
};
6771
validateTestFiles(tmpDir, expectedFiles);

packages/@apphosting/adapter-nextjs/src/utils.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ async function moveResources(
151151
for (const path of pathsToMove) {
152152
const isbundleYamlDir = join(appDir, path) === dirname(bundleYamlPath);
153153
const existsInOutputBundle = await exists(join(outputBundleAppDir, path));
154-
if (!isbundleYamlDir && !existsInOutputBundle) {
154+
// Keep apphosting.yaml files in the root directory still, as later steps expect them to be there
155+
const isApphostingYaml = path === "apphosting_preprocessed" || path === "apphosting.yaml";
156+
if (!isbundleYamlDir && !existsInOutputBundle && !isApphostingYaml) {
155157
await move(join(appDir, path), join(outputBundleAppDir, path));
156158
}
157159
}
@@ -191,6 +193,15 @@ async function generateBundleYaml(
191193
frameworkVersion: nextVersion,
192194
},
193195
};
196+
// TODO (b/432285470) See if there is a way to also delete files for apps using Nx monorepos
197+
if (!process.env.MONOREPO_COMMAND) {
198+
outputBundle.outputFiles = {
199+
serverApp: {
200+
include: [normalize(relative(cwd, opts.outputDirectoryAppPath))],
201+
},
202+
};
203+
}
204+
194205
await writeFile(opts.bundleYamlPath, yamlStringify(outputBundle));
195206
return;
196207
}

0 commit comments

Comments
 (0)