@absolutejs/absolute 0.1.8 → 0.1.10
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 +23 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/absolute",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
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,29 +27,34 @@ 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");
|
|
45
49
|
await rm(buildDirAbsolute, { force: true, recursive: true });
|
|
46
50
|
await mkdir(buildDirAbsolute);
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
reactPagesDirAbsolute &&
|
|
53
|
+
reactIndexDirAbsolute &&
|
|
54
|
+
(await generateReactIndexFiles(
|
|
55
|
+
reactPagesDirAbsolute,
|
|
56
|
+
reactIndexDirAbsolute
|
|
57
|
+
));
|
|
53
58
|
|
|
54
59
|
const reactEntryGlob = new Glob("*.{tsx,jsx}");
|
|
55
60
|
const reactEntryPaths: string[] = [];
|
|
@@ -81,7 +86,9 @@ export const build = async ({
|
|
|
81
86
|
.concat(javascriptEntryPaths)
|
|
82
87
|
.concat(typeScriptEntryPaths);
|
|
83
88
|
|
|
84
|
-
|
|
89
|
+
console.log("Entry points", entryPaths);
|
|
90
|
+
|
|
91
|
+
console.log("Building entry points");
|
|
85
92
|
const { logs, outputs } = await bunBuild({
|
|
86
93
|
entrypoints: entryPaths,
|
|
87
94
|
format: "esm",
|
|
@@ -131,7 +138,7 @@ export const build = async ({
|
|
|
131
138
|
return acc;
|
|
132
139
|
}, {});
|
|
133
140
|
|
|
134
|
-
htmlDirAbsolute && await updateScriptTags(manifest, htmlDirAbsolute);
|
|
141
|
+
htmlDirAbsolute && (await updateScriptTags(manifest, htmlDirAbsolute));
|
|
135
142
|
|
|
136
143
|
const end = performance.now();
|
|
137
144
|
const durationMs = end - start;
|
|
@@ -165,6 +172,8 @@ const generateReactIndexFiles = async (
|
|
|
165
172
|
reactPagesDirAbsolute: string,
|
|
166
173
|
reactIndexDirAbsolute: string
|
|
167
174
|
) => {
|
|
175
|
+
console.log("Generating React index files");
|
|
176
|
+
|
|
168
177
|
await rm(reactIndexDirAbsolute, { force: true, recursive: true });
|
|
169
178
|
await mkdir(reactIndexDirAbsolute);
|
|
170
179
|
|