Skip to content

Commit

Permalink
CLI error on push for components with node actions (#29550)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 4cb0c691375b81201f870c42b1140b7829131a9f
  • Loading branch information
emmaling27 authored and Convex, Inc. committed Sep 5, 2024
1 parent 83374e7 commit 76fa726
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/cli/lib/components/definition/bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,30 @@ export async function bundleImplementations(
externalNodeDependencies,
};
} else {
// Reject push if components have node bundles in non-root directories.
if (directory.path !== rootComponentDirectory.path) {
const nodeResult: {
modules: Bundle[];
externalDependencies: Map<string, string>;
bundledModuleNames: Set<string>;
} = await bundle(
ctx,
resolvedPath,
entryPoints.node,
true,
"node",
path.join("_deps", "node"),
nodeExternalPackages,
);
if (nodeResult.modules.length > 0) {
// TODO(ENG-7116) Remove error and bundle the component node actions when we are ready to support them.
await ctx.crash({
exitCode: 1,
errorType: "invalid filesystem data",
printedMessage: `"use node" directive is not supported in components. Remove it from the component at: ${resolvedPath}.`,
});
}
}
// definitionPath is the canonical form
const definitionPath = encodeDefinitionPath(
toComponentDefinitionPath(rootComponentDirectory, directory),
Expand Down

0 comments on commit 76fa726

Please sign in to comment.