@aklinker1/aframe 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +26 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aklinker1/aframe",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "packageManager": "bun@1.3.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,4 +1,9 @@
1
- import { createReadStream, createWriteStream, lstatSync } from "node:fs";
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,33 @@ export async function build(config: ResolvedConfig) {
137
142
  }
138
143
 
139
144
  async function buildServer(config: ResolvedConfig): Promise<void> {
140
- await cp(config.serverDir, config.serverOutDir, {
145
+ const cpDirOptions: 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
- await Promise.all(
148
- ["bun.lock", "bun.lockb", "tsconfig.json"].map((file) =>
151
+ };
152
+
153
+ await Promise.all([
154
+ // Copy dirs
155
+ ...["server", "shared"].map((src) =>
156
+ cp(
157
+ join(config.rootDir, src),
158
+ join(config.outDir, src),
159
+ cpDirOptions,
160
+ ).catch(() => {
161
+ // Ignore errors
162
+ }),
163
+ ),
164
+ // Copy root files
165
+ ...["bun.lock", "bun.lockb", "tsconfig.json"].map((file) =>
149
166
  cp(join(config.rootDir, file), join(config.outDir, file)).catch(() => {
150
167
  // Ignore errors
151
168
  }),
152
169
  ),
153
- );
170
+ ]);
171
+
154
172
  const packageJson = await Bun.file(config.packageJsonPath)
155
173
  .json()
156
174
  .catch(() => ({}));
@@ -165,6 +183,7 @@ async function buildServer(config: ResolvedConfig): Promise<void> {
165
183
  2,
166
184
  ),
167
185
  );
186
+
168
187
  await Bun.write(
169
188
  join(config.outDir, "server-entry.ts"),
170
189
  `import { resolve } from 'node:path';
@@ -182,6 +201,7 @@ console.log(\`Server running @ http://localhost:\${port}\`);
182
201
  server.listen(port);
183
202
  `,
184
203
  );
204
+
185
205
  const installProc = Bun.spawn(
186
206
  ["bun", "i", "--production", "--frozen-lockfile"],
187
207
  {