Skip to content

Commit c36ca9d

Browse files
codenemericallam
authored andcommitted
Remove useless comments
1 parent d67b65c commit c36ca9d

File tree

1 file changed

+2
-45
lines changed

1 file changed

+2
-45
lines changed

packages/cli-v3/e2e/compile.ts

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,9 @@ export async function compile(options: CompileOptions) {
3333
} = options;
3434
const configPath =
3535
options.resolvedConfig.status === "file" ? options.resolvedConfig.path : undefined;
36-
37-
// COPIED FROM compileProject()
38-
// const compileSpinner = spinner();
39-
// compileSpinner.start(`Building project in ${config.projectDir}`);
40-
4136
const taskFiles = await gatherTaskFiles(config);
42-
const workerFacade = readFileSync(
43-
resolve("./dist/workers/prod/worker-facade.js"),
44-
// join(cliRootPath(), "workers", "prod", "worker-facade.js"),
45-
"utf-8"
46-
);
37+
const workerFacade = readFileSync(resolve("./dist/workers/prod/worker-facade.js"), "utf-8");
4738

48-
// const workerSetupPath = join(cliRootPath(), "workers", "prod", "worker-setup.js");
4939
const workerSetupPath = resolve("./dist/workers/prod/worker-setup.js");
5040

5141
let workerContents = workerFacade
@@ -74,7 +64,6 @@ export async function compile(options: CompileOptions) {
7464
const result = await build({
7565
stdin: {
7666
contents: workerContents,
77-
// resolveDir: process.cwd(),
7867
resolveDir: config.projectDir,
7968
sourcefile: "__entryPoint.ts",
8069
},
@@ -87,11 +76,7 @@ export async function compile(options: CompileOptions) {
8776
platform: "node",
8877
format: "cjs", // This is needed to support opentelemetry instrumentation that uses module patching
8978
target: ["node18", "es2020"],
90-
// outdir: "out",
9179
outdir: resolve(config.projectDir, "out"),
92-
// banner: {
93-
// js: `process.on("uncaughtException", function(error, origin) { if (error instanceof Error) { process.send && process.send({ type: "EVENT", message: { type: "UNCAUGHT_EXCEPTION", payload: { error: { name: error.name, message: error.message, stack: error.stack }, origin }, version: "v1" } }); } else { process.send && process.send({ type: "EVENT", message: { type: "UNCAUGHT_EXCEPTION", payload: { error: { name: "Error", message: typeof error === "string" ? error : JSON.stringify(error) }, origin }, version: "v1" } }); } });`,
94-
// },
9580
footer: {
9681
js: "process.exit();",
9782
},
@@ -112,31 +97,18 @@ export async function compile(options: CompileOptions) {
11297
});
11398

11499
if (result.errors.length > 0) {
115-
// compileSpinner.stop("Build failed, aborting deployment");
116-
117-
// span.setAttributes({
118-
// "build.workerErrors": result.errors.map(
119-
// (error) => `Error: ${error.text} at ${error.location?.file}`
120-
// ),
121-
// });
122-
123100
throw new Error("Build failed, aborting deployment");
124101
}
125102

126103
if (options.outputMetafile) {
127104
await writeJSONFile(join(options.outputMetafile, "worker.json"), result.metafile);
128105
}
129106

130-
const entryPointContents = readFileSync(
131-
resolve("./dist/workers/prod/entry-point.js"),
132-
// join(cliRootPath(), "workers", "prod", "entry-point.js"),
133-
"utf-8"
134-
);
107+
const entryPointContents = readFileSync(resolve("./dist/workers/prod/entry-point.js"), "utf-8");
135108

136109
const entryPointResult = await build({
137110
stdin: {
138111
contents: entryPointContents,
139-
// resolveDir: process.cwd(),
140112
resolveDir: config.projectDir,
141113
sourcefile: "index.ts",
142114
},
@@ -150,7 +122,6 @@ export async function compile(options: CompileOptions) {
150122
packages: "external",
151123
format: "cjs", // This is needed to support opentelemetry instrumentation that uses module patching
152124
target: ["node18", "es2020"],
153-
// outdir: "out",
154125
outdir: resolve(config.projectDir, "out"),
155126
define: {
156127
__PROJECT_CONFIG__: JSON.stringify(config),
@@ -161,14 +132,6 @@ export async function compile(options: CompileOptions) {
161132
});
162133

163134
if (entryPointResult.errors.length > 0) {
164-
// compileSpinner.stop("Build failed, aborting deployment");
165-
166-
// span.setAttributes({
167-
// "build.entryPointErrors": entryPointResult.errors.map(
168-
// (error) => `Error: ${error.text} at ${error.location?.file}`
169-
// ),
170-
// });
171-
172135
throw new Error("Build failed, aborting deployment");
173136
}
174137

@@ -179,13 +142,9 @@ export async function compile(options: CompileOptions) {
179142
);
180143
}
181144

182-
// Create a tmp directory to store the build
183-
// const tempDir = await createTempDir();
184-
185145
logger.debug(`Writing compiled files to ${tempDir}`);
186146

187147
// Get the metaOutput for the result build
188-
// const metaOutput = result.metafile!.outputs[posix.join("out", "stdin.js")];
189148
const metaOutput =
190149
result.metafile!.outputs[
191150
posix.join("e2e", "fixtures", basename(config.projectDir), "out", "stdin.js")
@@ -194,8 +153,6 @@ export async function compile(options: CompileOptions) {
194153
invariant(metaOutput, "Meta output for the result build is missing");
195154

196155
// Get the metaOutput for the entryPoint build
197-
// const entryPointMetaOutput =
198-
// entryPointResult.metafile!.outputs[posix.join("out", "stdin.js")];
199156
const entryPointMetaOutput =
200157
entryPointResult.metafile!.outputs[
201158
posix.join("e2e", "fixtures", basename(config.projectDir), "out", "stdin.js")

0 commit comments

Comments
 (0)