@@ -116,6 +116,15 @@ class Log {
116
116
console . error ( Log . msg ( message ) ) ;
117
117
}
118
118
} ;
119
+
120
+ ngLog = ( entry : logging . LogEntry ) => {
121
+ // TODO: use level
122
+ if ( this . options . log ) {
123
+ this . options . log . error ( Log . msg ( entry . message ) ) ;
124
+ } else {
125
+ console . error ( Log . msg ( entry . message ) ) ;
126
+ }
127
+ } ;
119
128
}
120
129
121
130
class ServerlessReact {
@@ -273,16 +282,6 @@ class ServerlessReact {
273
282
throw new Error ( "build target does not exist" ) ;
274
283
}
275
284
276
- // console.log("!!! buildTarget", buildTarget);
277
-
278
- // const builderInfo = await architectHost.resolveBuilder(buildTarget.builder);
279
-
280
- // console.log("!!! builderInfo", builderInfo);
281
-
282
- // const builder = await architectHost.loadBuilder(builderInfo);
283
-
284
- // console.log("!!! builder", builder);
285
-
286
285
const architect = new Architect ( architectHost ) ;
287
286
288
287
const projectMetadata = await architectHost . getProjectMetadata ( projectName ) ;
@@ -291,23 +290,9 @@ class ServerlessReact {
291
290
throw new Error ( `projectMetadata does not exist` ) ;
292
291
}
293
292
294
- console . log ( "!!! projectMetadata" , projectMetadata ) ;
295
-
296
- // const targetOptions = await architectHost.getOptionsForTarget({
297
- // configuration: "",
298
- // project: projectName,
299
- // target: "build",
300
- // });
301
-
302
- // if (!targetOptions) {
303
- // throw new Error(`targetOptions does not exist`);
304
- // }
305
-
306
- // console.log("!!! targetOptions", targetOptions);
307
-
308
293
const logger = new logging . Logger ( PLUGIN_NAME ) ;
309
294
logger . subscribe ( ( entry ) => {
310
- console . log ( entry . message ) ;
295
+ this . log . ngLog ( entry ) ;
311
296
} ) ;
312
297
313
298
const scheduleTargetRun = await architect . scheduleTarget (
@@ -324,46 +309,9 @@ class ServerlessReact {
324
309
const scheduleTargetLastOutput = await scheduleTargetRun . lastOutput ;
325
310
console . log ( "!!! scheduleTargetLastOutput" , scheduleTargetLastOutput ) ;
326
311
327
- // const scheduleBuilderRun = await architect.scheduleBuilder(
328
- // buildTarget.builder,
329
- // targetOptions
330
- // );
331
-
332
- // console.log("!!! scheduleBuilderRun", scheduleBuilderRun);
333
- // const scheduleBuilderLastOutput = await scheduleBuilderRun.lastOutput;
334
- // console.log("!!! scheduleBuilderLastOutput", scheduleBuilderLastOutput);
335
-
336
- // const host = workspaces.createWorkspaceHost(new NodeJsSyncHost());
337
-
338
- // const { workspace } = await workspaces.readWorkspace(angularJsonPath, host);
339
-
340
- // console.log("!!!! workspace", workspace);
341
-
342
- // const project = workspace.projects.get(projectName);
343
- // if (!project) {
344
- // throw new Error(`${projectName} does not exist`);
345
- // }
346
-
347
- // console.log("!!!! project", project);
348
-
349
- // console.log("!!!! buildTarget", buildTarget);
350
-
351
- // buildTarget.options.optimization = true;
352
- // buildApplication({});
353
- // const vite = await import("vite");
354
- // const { entryPoint } = this.pluginConfig;
355
- // await vite.build({
356
- // mode,
357
- // configFile: this.pluginConfig.vite?.configFile,
358
- // build: {
359
- // outDir: this.outputPath,
360
- // rollupOptions: {
361
- // input: { app: entryPoint ? entryPoint : "./index.html" },
362
- // },
363
- // watch: watch ? {} : undefined,
364
- // reportCompressedSize: this.options.verbose,
365
- // },
366
- // });
312
+ if ( scheduleTargetLastOutput . error ) {
313
+ throw new Error ( scheduleTargetLastOutput . error ) ;
314
+ }
367
315
} ;
368
316
}
369
317
0 commit comments