@aklinker1/aframe 1.0.0 → 1.0.1
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 +1 -1
- package/src/index.ts +22 -6
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createReadStream,
|
|
3
|
+
createWriteStream,
|
|
4
|
+
lstatSync,
|
|
5
|
+
type CopyOptions,
|
|
6
|
+
} from "node:fs";
|
|
2
7
|
import { cp, mkdir, readdir, rm, writeFile } from "node:fs/promises";
|
|
3
8
|
import { join, relative } from "node:path/posix";
|
|
4
9
|
import * as vite from "vite";
|
|
@@ -137,20 +142,29 @@ export async function build(config: ResolvedConfig) {
|
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
async function buildServer(config: ResolvedConfig): Promise<void> {
|
|
140
|
-
|
|
145
|
+
const cpOptions: CopyOptions = {
|
|
141
146
|
recursive: true,
|
|
142
147
|
filter: (src) =>
|
|
143
148
|
!src.includes("__tests__") &&
|
|
144
149
|
!src.includes(".test.") &&
|
|
145
150
|
!src.includes(".spec."),
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
await Promise.all([
|
|
154
|
+
// Copy dirs
|
|
155
|
+
...[config.serverDir, join(config.rootDir, "shared")].map((src) =>
|
|
156
|
+
cp(src, config.serverOutDir, cpOptions).catch(() => {
|
|
157
|
+
// Ignore errors
|
|
158
|
+
}),
|
|
159
|
+
),
|
|
160
|
+
// Copy root files
|
|
161
|
+
...["bun.lock", "bun.lockb", "tsconfig.json"].map((file) =>
|
|
149
162
|
cp(join(config.rootDir, file), join(config.outDir, file)).catch(() => {
|
|
150
163
|
// Ignore errors
|
|
151
164
|
}),
|
|
152
165
|
),
|
|
153
|
-
);
|
|
166
|
+
]);
|
|
167
|
+
|
|
154
168
|
const packageJson = await Bun.file(config.packageJsonPath)
|
|
155
169
|
.json()
|
|
156
170
|
.catch(() => ({}));
|
|
@@ -165,6 +179,7 @@ async function buildServer(config: ResolvedConfig): Promise<void> {
|
|
|
165
179
|
2,
|
|
166
180
|
),
|
|
167
181
|
);
|
|
182
|
+
|
|
168
183
|
await Bun.write(
|
|
169
184
|
join(config.outDir, "server-entry.ts"),
|
|
170
185
|
`import { resolve } from 'node:path';
|
|
@@ -182,6 +197,7 @@ console.log(\`Server running @ http://localhost:\${port}\`);
|
|
|
182
197
|
server.listen(port);
|
|
183
198
|
`,
|
|
184
199
|
);
|
|
200
|
+
|
|
185
201
|
const installProc = Bun.spawn(
|
|
186
202
|
["bun", "i", "--production", "--frozen-lockfile"],
|
|
187
203
|
{
|