@absolutejs/absolute 0.1.7 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/absolute",
3
- "version": "0.1.7",
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,25 +27,35 @@ 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
+
34
+ console.log("Creating build directory");
33
35
  const projectRoot = cwd();
34
36
  const buildDirAbsolute = join(projectRoot, buildDir);
35
37
  const assetsDirAbsolute = join(projectRoot, assetsDir);
36
- const reactIndexDirAbsolute = reactIndexDir && join(projectRoot, reactIndexDir)
37
- const javascriptDirAbsolute = javascriptDir && join(projectRoot, javascriptDir);
38
- const typeScriptDirAbsolute = typeScriptDir && join(projectRoot, typeScriptDir);
39
- const reactPagesDirAbsolute = reactPagesDir && join(projectRoot, reactPagesDir);
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);
40
46
  const htmlDirAbsolute = htmlDir && join(projectRoot, htmlDir);
41
47
 
48
+ console.log("Cleaning build directory");
42
49
  await rm(buildDirAbsolute, { force: true, recursive: true });
43
50
  await mkdir(buildDirAbsolute);
44
51
 
45
- (reactPagesDirAbsolute && reactIndexDirAbsolute) && await generateReactIndexFiles(
46
- reactPagesDirAbsolute,
47
- reactIndexDirAbsolute
48
- );
52
+ console.log("Generating React index files");
53
+ reactPagesDirAbsolute &&
54
+ reactIndexDirAbsolute &&
55
+ (await generateReactIndexFiles(
56
+ reactPagesDirAbsolute,
57
+ reactIndexDirAbsolute
58
+ ));
49
59
 
50
60
  const reactEntryGlob = new Glob("*.{tsx,jsx}");
51
61
  const reactEntryPaths: string[] = [];
@@ -77,6 +87,9 @@ export const build = async ({
77
87
  .concat(javascriptEntryPaths)
78
88
  .concat(typeScriptEntryPaths);
79
89
 
90
+ console.log("Entry points", entryPaths);
91
+
92
+ console.log("Building entry points");
80
93
  const { logs, outputs } = await bunBuild({
81
94
  entrypoints: entryPaths,
82
95
  format: "esm",
@@ -94,12 +107,14 @@ export const build = async ({
94
107
  console.info(log);
95
108
  });
96
109
 
110
+ console.log("Copying assets to build directory");
97
111
  await copyAssetsTobuildDirAbsolute(
98
112
  assetsDirAbsolute,
99
113
  buildDirAbsolute,
100
114
  projectRoot
101
115
  );
102
116
 
117
+ console.log("Generating manifest");
103
118
  const manifest = outputs.reduce<Record<string, string>>((acc, artifact) => {
104
119
  let relativePath = artifact.path;
105
120
 
@@ -124,7 +139,7 @@ export const build = async ({
124
139
  return acc;
125
140
  }, {});
126
141
 
127
- htmlDirAbsolute && await updateScriptTags(manifest, htmlDirAbsolute);
142
+ htmlDirAbsolute && (await updateScriptTags(manifest, htmlDirAbsolute));
128
143
 
129
144
  const end = performance.now();
130
145
  const durationMs = end - start;