Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

chore(backend): format #568

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/backend/cli/tasks/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ runTask({

// Determine args
const args = [
"--config", projectDataPath(project, DENO_JSON_PATH), "--lock", projectDataPath(project, DENO_LOCK_PATH),
"--config",
projectDataPath(project, DENO_JSON_PATH),
"--lock",
projectDataPath(project, DENO_LOCK_PATH),
"--allow-env",
"--allow-net",
"--allow-read",
Expand Down
6 changes: 4 additions & 2 deletions packages/backend/cli/tasks/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ runTask({
const cmd = await new Deno.Command(denoExecutablePath(), {
args: [
"fmt",
"--config", projectDataPath(project, DENO_JSON_PATH),
"--lock", projectDataPath(project, DENO_LOCK_PATH),
"--config",
projectDataPath(project, DENO_JSON_PATH),
"--lock",
projectDataPath(project, DENO_LOCK_PATH),
...input.check ? ["--check"] : [],
...sourceFiles,
],
Expand Down
6 changes: 4 additions & 2 deletions packages/backend/cli/tasks/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ runTask({
const cmd = await new Deno.Command(denoExecutablePath(), {
args: [
"lint",
"--config", projectDataPath(project, DENO_JSON_PATH), "--lock", projectDataPath(project, DENO_LOCK_PATH),
"--config",
projectDataPath(project, DENO_JSON_PATH),
"--lock",
projectDataPath(project, DENO_LOCK_PATH),
...sourceFiles,
],
stdout: "inherit",
Expand All @@ -35,4 +38,3 @@ runTask({
function projectDataPath(project: Project, DENO_JSON_PATH: any): string {
throw new Error("Function not implemented.");
}

5 changes: 4 additions & 1 deletion packages/backend/cli/tasks/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ runTask({

// Determine args
const args = [
"--config", projectDataPath(project, DENO_JSON_PATH), "--lock", projectDataPath(project, DENO_LOCK_PATH),
"--config",
projectDataPath(project, DENO_JSON_PATH),
"--lock",
projectDataPath(project, DENO_LOCK_PATH),
"--allow-env",
"--allow-net",
"--allow-read",
Expand Down
55 changes: 4 additions & 51 deletions packages/backend/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion packages/backend/toolchain/build/plan/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,15 @@ export async function planProjectBuild(
description: "entrypoint.ts",
async build() {
const checkOutput = await new Deno.Command(denoExecutablePath(), {
args: ["check", "--config", projectDataPath(project, DENO_JSON_PATH), "--lock", projectDataPath(project, DENO_LOCK_PATH), "--quiet", projectDataPath(project, ENTRYPOINT_PATH)],
args: [
"check",
"--config",
projectDataPath(project, DENO_JSON_PATH),
"--lock",
projectDataPath(project, DENO_LOCK_PATH),
"--quiet",
projectDataPath(project, ENTRYPOINT_PATH),
],
signal,
}).output();
if (!checkOutput.success) {
Expand Down
60 changes: 30 additions & 30 deletions packages/backend/toolchain/sdk/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function generateSdk(
) {
const targetString = targetToString(sdk.target);
const sdkGenPath = resolve(projectDataPath(project, SDK_PATH), targetString);
const sdkOutput = resolve(Deno.cwd(), sdk.output);
const sdkOutput = resolve(Deno.cwd(), sdk.output);

// Clear artifacts
try {
Expand All @@ -35,52 +35,52 @@ export async function generateSdk(

progress("Building SDK", targetString);

// Generate files
//
// preservePaths is used for preserving generated artifacts from things like
// `npm install`.
let preservePaths: string[];
// Generate files
//
// preservePaths is used for preserving generated artifacts from things like
// `npm install`.
let preservePaths: string[];
if (sdk.target == SdkTarget.TypeScript) {
preservePaths = ["dist"];
preservePaths = ["dist"];
await generateTypescript(project, sdkGenPath);
} else if (sdk.target == SdkTarget.Unity) {
preservePaths = [];
preservePaths = [];
await generateUnity(project, sdkGenPath);
} else if (sdk.target == SdkTarget.Godot) {
preservePaths = [];
preservePaths = [];
await generateGodot(project, sdkGenPath);
} else {
throw new UnreachableError(sdk.target);
}

// Delete target dir
const preserveTempDir = await Deno.makeTempDir();
// Delete target dir
const preserveTempDir = await Deno.makeTempDir();
if (await exists(sdkOutput, { isDirectory: true })) {
// Preserve files before deleting the output path
for (const path of preservePaths) {
const srcPreservePath = resolve(sdkOutput, path);
const dstPreservePath = resolve(preserveTempDir, path);
if (await exists(srcPreservePath)) {
await move(srcPreservePath, dstPreservePath);
} else {
}
}
// Preserve files before deleting the output path
for (const path of preservePaths) {
const srcPreservePath = resolve(sdkOutput, path);
const dstPreservePath = resolve(preserveTempDir, path);
if (await exists(srcPreservePath)) {
await move(srcPreservePath, dstPreservePath);
} else {
}
}

// Remove output
// Remove output
await Deno.remove(sdkOutput, { recursive: true });
}

// Move generated SDK
// Move generated SDK
await move(sdkGenPath, sdkOutput, { overwrite: true });

// Move back preserved files
for (const path of preservePaths) {
const srcPreservePath = resolve(preserveTempDir, path);
const dstPreservePath = resolve(sdkOutput, path);
if (await exists(srcPreservePath, { isDirectory: true })) {
await move(srcPreservePath, dstPreservePath, { overwrite: false });
}
}
// Move back preserved files
for (const path of preservePaths) {
const srcPreservePath = resolve(preserveTempDir, path);
const dstPreservePath = resolve(sdkOutput, path);
if (await exists(srcPreservePath, { isDirectory: true })) {
await move(srcPreservePath, dstPreservePath, { overwrite: false });
}
}

success("Success");
}
Expand Down
Loading