Skip to content

Commit 7ccf54d

Browse files
committed
change builder requirements
1 parent 567d35e commit 7ccf54d

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

packages/@apphosting/adapter-angular/src/bin/build.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const { stdout: output } = await runBuild();
2222
if (!output) {
2323
throw new Error("No output from Angular build command, expecting a build manifest file.");
2424
}
25-
const outputBundleOptions = parseOutputBundleOptions(output);
26-
if (!outputBundleExists(outputBundleOptions)){
25+
if (!outputBundleExists()){
26+
const outputBundleOptions = parseOutputBundleOptions(output);
2727
const root = process.cwd();
2828
await generateBuildOutput(root, outputBundleOptions, process.env.FRAMEWORK_VERSION);
2929

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ const __filename = fileURLToPath(import.meta.url);
2424
const __dirname = dirname(__filename);
2525
const SIMPLE_SERVER_FILE_PATH = join(__dirname, "simple-server", "bundled_server.mjs");
2626

27-
export const REQUIRED_BUILDER = "@angular-devkit/build-angular:application";
27+
export const ALLOWED_BUILDERS = [
28+
"@angular-devkit/build-angular:application",
29+
"@analogjs/platform:vite"
30+
];
2831

2932
/**
3033
* Check if the following build conditions are satisfied for the workspace:
@@ -38,10 +41,10 @@ export async function checkBuildConditions(opts: BuildOptions): Promise<void> {
3841
const output = execSync(`npx nx show project ${opts.projectName}`);
3942
const projectJson = JSON.parse(output.toString());
4043
const builder = projectJson.targets.build.executor;
41-
if (builder !== REQUIRED_BUILDER) {
44+
if (!ALLOWED_BUILDERS.includes(builder)) {
4245
throw new Error(
43-
"Only the Angular application builder is supported. Please refer to https://angular.dev/tools/cli/build-system-migration#for-existing-applications guide to upgrade your builder to the Angular application builder. ",
44-
);
46+
`Currently, only the following builders are supported: ${ALLOWED_BUILDERS.join(',')}.`,
47+
)
4548
}
4649
return;
4750
}
@@ -75,9 +78,9 @@ export async function checkBuildConditions(opts: BuildOptions): Promise<void> {
7578
if (!workspaceProject.targets.has(target)) throw new Error("Could not find build target.");
7679

7780
const { builder } = workspaceProject.targets.get(target)!;
78-
if (builder !== REQUIRED_BUILDER) {
81+
if (!ALLOWED_BUILDERS.includes(builder)) {
7982
throw new Error(
80-
"Only the Angular application builder is supported. Please refer to https://angular.dev/tools/cli/build-system-migration#for-existing-applications guide to upgrade your builder to the Angular application builder. ",
83+
`Currently, only the following builders are supported: ${ALLOWED_BUILDERS.join(',')}.`,
8184
);
8285
}
8386
}
@@ -227,8 +230,9 @@ export const isMain = (meta: ImportMeta) => {
227230
return process.argv[1] === fileURLToPath(meta.url);
228231
};
229232

230-
export const outputBundleExists = (outputBundleOptions: OutputBundleOptions) => {
231-
if (existsSync(dirname(outputBundleOptions.bundleYamlPath))){
233+
export const outputBundleExists = () => {
234+
const outputBundleDir = resolve(".apphosting");
235+
if (existsSync(outputBundleDir)){
232236
return true;
233237
}
234238
return false;

0 commit comments

Comments
 (0)