@absolutejs/absolute 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -25
- package/package.json +2 -2
- package/src/core/build.ts +21 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/absolute",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "A fullstack meta-framework for building web applications with TypeScript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
16
|
"format": "prettier --write \"./**/*.{js,jsx,ts,tsx,css,json}\"",
|
|
17
17
|
"dev": "bun run --watch example/server.ts",
|
|
18
|
-
"release": "bun run build && bun publish"
|
|
18
|
+
"release": "bun run format && bun run build && bun publish"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@elysiajs/static": "1.0.2",
|
package/src/core/build.ts
CHANGED
|
@@ -17,7 +17,7 @@ type BuildConfig = {
|
|
|
17
17
|
typeScriptDir?: string;
|
|
18
18
|
reactPagesDir?: string;
|
|
19
19
|
htmlDir?: string;
|
|
20
|
-
}
|
|
20
|
+
};
|
|
21
21
|
|
|
22
22
|
export const build = async ({
|
|
23
23
|
buildDir = "build",
|
|
@@ -27,18 +27,22 @@ export const build = async ({
|
|
|
27
27
|
typeScriptDir,
|
|
28
28
|
reactPagesDir,
|
|
29
29
|
htmlDir
|
|
30
|
-
}:BuildConfig = {}) => {
|
|
30
|
+
}: BuildConfig = {}) => {
|
|
31
31
|
const start = performance.now();
|
|
32
32
|
console.log("Building start");
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
console.log("Creating build directory");
|
|
35
35
|
const projectRoot = cwd();
|
|
36
36
|
const buildDirAbsolute = join(projectRoot, buildDir);
|
|
37
37
|
const assetsDirAbsolute = join(projectRoot, assetsDir);
|
|
38
|
-
const reactIndexDirAbsolute =
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
38
|
+
const reactIndexDirAbsolute =
|
|
39
|
+
reactIndexDir && join(projectRoot, reactIndexDir);
|
|
40
|
+
const javascriptDirAbsolute =
|
|
41
|
+
javascriptDir && join(projectRoot, javascriptDir);
|
|
42
|
+
const typeScriptDirAbsolute =
|
|
43
|
+
typeScriptDir && join(projectRoot, typeScriptDir);
|
|
44
|
+
const reactPagesDirAbsolute =
|
|
45
|
+
reactPagesDir && join(projectRoot, reactPagesDir);
|
|
42
46
|
const htmlDirAbsolute = htmlDir && join(projectRoot, htmlDir);
|
|
43
47
|
|
|
44
48
|
console.log("Cleaning build directory");
|
|
@@ -46,10 +50,12 @@ export const build = async ({
|
|
|
46
50
|
await mkdir(buildDirAbsolute);
|
|
47
51
|
|
|
48
52
|
console.log("Generating React index files");
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
reactPagesDirAbsolute &&
|
|
54
|
+
reactIndexDirAbsolute &&
|
|
55
|
+
(await generateReactIndexFiles(
|
|
56
|
+
reactPagesDirAbsolute,
|
|
57
|
+
reactIndexDirAbsolute
|
|
58
|
+
));
|
|
53
59
|
|
|
54
60
|
const reactEntryGlob = new Glob("*.{tsx,jsx}");
|
|
55
61
|
const reactEntryPaths: string[] = [];
|
|
@@ -81,7 +87,9 @@ export const build = async ({
|
|
|
81
87
|
.concat(javascriptEntryPaths)
|
|
82
88
|
.concat(typeScriptEntryPaths);
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
console.log("Entry points", entryPaths);
|
|
91
|
+
|
|
92
|
+
console.log("Building entry points");
|
|
85
93
|
const { logs, outputs } = await bunBuild({
|
|
86
94
|
entrypoints: entryPaths,
|
|
87
95
|
format: "esm",
|
|
@@ -131,7 +139,7 @@ export const build = async ({
|
|
|
131
139
|
return acc;
|
|
132
140
|
}, {});
|
|
133
141
|
|
|
134
|
-
htmlDirAbsolute && await updateScriptTags(manifest, htmlDirAbsolute);
|
|
142
|
+
htmlDirAbsolute && (await updateScriptTags(manifest, htmlDirAbsolute));
|
|
135
143
|
|
|
136
144
|
const end = performance.now();
|
|
137
145
|
const durationMs = end - start;
|