Skip to content

Commit 0ec7c7c

Browse files
committed
format
1 parent 2bc309d commit 0ec7c7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+969
-1065
lines changed

Diff for: .prettierrc

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"printWidth": 80,
3-
"singleQuote": false,
4-
"semi": true,
5-
"useTabs": true,
6-
"trailingComma": "es5"
2+
"printWidth": 110,
3+
"singleQuote": false,
4+
"semi": true,
5+
"useTabs": false,
6+
"tabWidth": 2,
7+
"trailingComma": "es5"
78
}

Diff for: .vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"editor.formatOnSave": true
2+
"editor.formatOnSave": true
33
}

Diff for: TODO.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ DONE:
1919
```typescript
2020
/** @type {import('next').NextConfig} */
2121
const nextConfig = {
22-
output: "standalone",
23-
experimental: {
24-
serverMinification: false,
25-
},
22+
output: "standalone",
23+
experimental: {
24+
serverMinification: false,
25+
},
2626
};
2727

2828
export default nextConfig;

Diff for: builder/package.json

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"name": "builder",
3-
"scripts": {
4-
"build": "tsup",
5-
"build:watch": "tsup --watch src"
6-
},
7-
"bin": "dist/index.mjs",
8-
"files": [
9-
"dist"
10-
],
11-
"devDependencies": {
12-
"@types/node": "^22.2.0",
13-
"esbuild": "^0.23.0",
14-
"glob": "^11.0.0",
15-
"next": "14.2.5",
16-
"tsup": "^8.2.4",
17-
"typescript": "^5.5.4"
18-
}
2+
"name": "builder",
3+
"scripts": {
4+
"build": "tsup",
5+
"build:watch": "tsup --watch src"
6+
},
7+
"bin": "dist/index.mjs",
8+
"files": [
9+
"dist"
10+
],
11+
"devDependencies": {
12+
"@types/node": "^22.2.0",
13+
"esbuild": "^0.23.0",
14+
"glob": "^11.0.0",
15+
"next": "14.2.5",
16+
"tsup": "^8.2.4",
17+
"typescript": "^5.5.4"
18+
}
1919
}

Diff for: builder/src/args.ts

+39-49
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,51 @@ import { parseArgs } from "node:util";
33
import { resolve } from "node:path";
44

55
export function getArgs(): {
6-
skipBuild: boolean;
7-
outputDir?: string;
6+
skipBuild: boolean;
7+
outputDir?: string;
88
} {
9-
const {
10-
values: { skipBuild, output },
11-
} = parseArgs({
12-
options: {
13-
skipBuild: {
14-
type: "boolean",
15-
short: "s",
16-
default: false,
17-
},
18-
output: {
19-
type: "string",
20-
short: "o",
21-
},
22-
},
23-
allowPositionals: false,
24-
});
9+
const {
10+
values: { skipBuild, output },
11+
} = parseArgs({
12+
options: {
13+
skipBuild: {
14+
type: "boolean",
15+
short: "s",
16+
default: false,
17+
},
18+
output: {
19+
type: "string",
20+
short: "o",
21+
},
22+
},
23+
allowPositionals: false,
24+
});
2525

26-
const outputDir = output ? resolve(output) : undefined;
26+
const outputDir = output ? resolve(output) : undefined;
2727

28-
if (outputDir) {
29-
assertDirArg(outputDir, "output", true);
30-
}
28+
if (outputDir) {
29+
assertDirArg(outputDir, "output", true);
30+
}
3131

32-
return {
33-
outputDir,
34-
skipBuild:
35-
skipBuild ||
36-
["1", "true", "yes"].includes(String(process.env.SKIP_NEXT_APP_BUILD)),
37-
};
32+
return {
33+
outputDir,
34+
skipBuild: skipBuild || ["1", "true", "yes"].includes(String(process.env.SKIP_NEXT_APP_BUILD)),
35+
};
3836
}
3937

4038
function assertDirArg(path: string, argName?: string, make?: boolean) {
41-
let dirStats: Stats;
42-
try {
43-
dirStats = statSync(path);
44-
} catch {
45-
if (!make) {
46-
throw new Error(
47-
`Error: the provided${
48-
argName ? ` "${argName}"` : ""
49-
} input is not a valid path`
50-
);
51-
}
52-
mkdirSync(path);
53-
return;
54-
}
39+
let dirStats: Stats;
40+
try {
41+
dirStats = statSync(path);
42+
} catch {
43+
if (!make) {
44+
throw new Error(`Error: the provided${argName ? ` "${argName}"` : ""} input is not a valid path`);
45+
}
46+
mkdirSync(path);
47+
return;
48+
}
5549

56-
if (!dirStats.isDirectory()) {
57-
throw new Error(
58-
`Error: the provided${
59-
argName ? ` "${argName}"` : ""
60-
} input is not a directory`
61-
);
62-
}
50+
if (!dirStats.isDirectory()) {
51+
throw new Error(`Error: the provided${argName ? ` "${argName}"` : ""} input is not a directory`);
52+
}
6353
}

Diff for: builder/src/build/build-next-app.ts

+15-17
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,24 @@ import { execSync } from "node:child_process";
88
* @param nextAppDir the directory of the app to build
99
*/
1010
export function buildNextjsApp(nextAppDir: string): void {
11-
runNextBuildCommand("pnpm", nextAppDir);
11+
runNextBuildCommand("pnpm", nextAppDir);
1212
}
1313

1414
// equivalent to: https://github.com/sst/open-next/blob/f61b0e94/packages/open-next/src/build.ts#L175-L186
1515
function runNextBuildCommand(
16-
// let's keep things simple and just support only pnpm for now
17-
packager: "pnpm" /*"npm" | "yarn" | "pnpm" | "bun"*/,
18-
nextAppDir: string
16+
// let's keep things simple and just support only pnpm for now
17+
packager: "pnpm" /*"npm" | "yarn" | "pnpm" | "bun"*/,
18+
nextAppDir: string
1919
) {
20-
const command = ["bun", "npm"].includes(packager)
21-
? `${packager} next build`
22-
: `${packager} next build`;
23-
execSync(command, {
24-
stdio: "inherit",
25-
cwd: nextAppDir,
26-
env: {
27-
...process.env,
28-
// equivalent to: https://github.com/sst/open-next/blob/f61b0e9/packages/open-next/src/build.ts#L168-L173
29-
// Equivalent to setting `output: "standalone"` in next.config.js
30-
NEXT_PRIVATE_STANDALONE: "true",
31-
},
32-
});
20+
const command = ["bun", "npm"].includes(packager) ? `${packager} next build` : `${packager} next build`;
21+
execSync(command, {
22+
stdio: "inherit",
23+
cwd: nextAppDir,
24+
env: {
25+
...process.env,
26+
// equivalent to: https://github.com/sst/open-next/blob/f61b0e9/packages/open-next/src/build.ts#L168-L173
27+
// Equivalent to setting `output: "standalone"` in next.config.js
28+
NEXT_PRIVATE_STANDALONE: "true",
29+
},
30+
});
3331
}

0 commit comments

Comments
 (0)