playcademy 0.12.6 → 0.12.7
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 +34 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5051,8 +5051,8 @@ init_constants2();
|
|
|
5051
5051
|
function textLoaderPlugin() {
|
|
5052
5052
|
return {
|
|
5053
5053
|
name: "text-loader",
|
|
5054
|
-
setup(
|
|
5055
|
-
|
|
5054
|
+
setup(build2) {
|
|
5055
|
+
build2.onLoad({ filter: /edge-play\/src\/entry\.ts$/ }, async (args) => {
|
|
5056
5056
|
const fs2 = await import("fs/promises");
|
|
5057
5057
|
const text5 = await fs2.readFile(args.path, "utf8");
|
|
5058
5058
|
return {
|
|
@@ -5060,7 +5060,7 @@ function textLoaderPlugin() {
|
|
|
5060
5060
|
loader: "js"
|
|
5061
5061
|
};
|
|
5062
5062
|
});
|
|
5063
|
-
|
|
5063
|
+
build2.onLoad({ filter: /edge-play\/src\/routes\/root\.html$/ }, async (args) => {
|
|
5064
5064
|
const fs2 = await import("fs/promises");
|
|
5065
5065
|
const text5 = await fs2.readFile(args.path, "utf8");
|
|
5066
5066
|
return {
|
|
@@ -5068,7 +5068,7 @@ function textLoaderPlugin() {
|
|
|
5068
5068
|
loader: "js"
|
|
5069
5069
|
};
|
|
5070
5070
|
});
|
|
5071
|
-
|
|
5071
|
+
build2.onLoad({ filter: /templates\/sample-route\.ts$/ }, async (args) => {
|
|
5072
5072
|
const fs2 = await import("fs/promises");
|
|
5073
5073
|
const text5 = await fs2.readFile(args.path, "utf8");
|
|
5074
5074
|
return {
|
|
@@ -5181,8 +5181,8 @@ async function transpileRoute(filePath) {
|
|
|
5181
5181
|
if (isBun() || !filePath.endsWith(".ts")) {
|
|
5182
5182
|
return filePath;
|
|
5183
5183
|
}
|
|
5184
|
-
const
|
|
5185
|
-
const result = await
|
|
5184
|
+
const esbuild2 = await import("esbuild");
|
|
5185
|
+
const result = await esbuild2.build({
|
|
5186
5186
|
entryPoints: [filePath],
|
|
5187
5187
|
write: false,
|
|
5188
5188
|
format: "esm",
|
|
@@ -5327,7 +5327,7 @@ function createEsbuildConfig(entryCode, paths, bundleConfig, customRoutesDir, op
|
|
|
5327
5327
|
};
|
|
5328
5328
|
}
|
|
5329
5329
|
async function bundleBackend(config, options = {}) {
|
|
5330
|
-
const
|
|
5330
|
+
const esbuild2 = await import("esbuild");
|
|
5331
5331
|
const { customRouteData, customRoutesDir } = await discoverCustomRoutes(config);
|
|
5332
5332
|
const bundleConfig = {
|
|
5333
5333
|
...config,
|
|
@@ -5342,7 +5342,7 @@ async function bundleBackend(config, options = {}) {
|
|
|
5342
5342
|
customRoutesDir,
|
|
5343
5343
|
options
|
|
5344
5344
|
);
|
|
5345
|
-
const result = await
|
|
5345
|
+
const result = await esbuild2.build(buildConfig);
|
|
5346
5346
|
if (!result.outputFiles?.[0]) {
|
|
5347
5347
|
throw new Error("Backend bundling failed: no output");
|
|
5348
5348
|
}
|
|
@@ -5380,9 +5380,12 @@ function generateEntryCode(customRoutes, customRoutesDir) {
|
|
|
5380
5380
|
|
|
5381
5381
|
// src/lib/deploy/schema.ts
|
|
5382
5382
|
init_core();
|
|
5383
|
-
import { existsSync as existsSync9 } from "fs";
|
|
5383
|
+
import { existsSync as existsSync9, mkdtempSync, rmSync } from "fs";
|
|
5384
5384
|
import { createRequire } from "module";
|
|
5385
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
5385
5386
|
import { join as join8 } from "path";
|
|
5387
|
+
import { pathToFileURL } from "url";
|
|
5388
|
+
import * as esbuild from "esbuild";
|
|
5386
5389
|
|
|
5387
5390
|
// src/lib/init/prompts.ts
|
|
5388
5391
|
init_constants3();
|
|
@@ -5645,8 +5648,21 @@ async function getSchemaInfo(previousSchemaSnapshot) {
|
|
|
5645
5648
|
const require2 = createRequire(import.meta.url);
|
|
5646
5649
|
const drizzleKitApi = require2("drizzle-kit/api");
|
|
5647
5650
|
const { generateSQLiteDrizzleJson, generateSQLiteMigration } = drizzleKitApi;
|
|
5648
|
-
const
|
|
5649
|
-
const
|
|
5651
|
+
const tempDir = mkdtempSync(join8(tmpdir2(), "playcademy-schema-"));
|
|
5652
|
+
const outFile = join8(tempDir, "schema.mjs");
|
|
5653
|
+
await esbuild.build({
|
|
5654
|
+
entryPoints: [schemaPath],
|
|
5655
|
+
outfile: outFile,
|
|
5656
|
+
bundle: true,
|
|
5657
|
+
platform: "node",
|
|
5658
|
+
format: "esm",
|
|
5659
|
+
target: "node20",
|
|
5660
|
+
sourcemap: false,
|
|
5661
|
+
minify: false
|
|
5662
|
+
});
|
|
5663
|
+
const schemaModule = await import(pathToFileURL(outFile).href);
|
|
5664
|
+
rmSync(tempDir, { recursive: true, force: true });
|
|
5665
|
+
const currentSchema = schemaModule && typeof schemaModule === "object" && "default" in schemaModule ? schemaModule.default : schemaModule;
|
|
5650
5666
|
const nextJson = await generateSQLiteDrizzleJson(currentSchema);
|
|
5651
5667
|
const prevJson = previousSchemaSnapshot ? previousSchemaSnapshot : await generateSQLiteDrizzleJson({});
|
|
5652
5668
|
const migrationStatements = await generateSQLiteMigration(prevJson, nextJson);
|
|
@@ -5932,14 +5948,14 @@ function formatDelta(bytes) {
|
|
|
5932
5948
|
return `${arrow} ${value.toFixed(2)} ${unit}`;
|
|
5933
5949
|
}
|
|
5934
5950
|
function displayDeploymentDiff(options) {
|
|
5935
|
-
const { diff, noChanges, build, backend, integrations } = options;
|
|
5951
|
+
const { diff, noChanges, build: build2, backend, integrations } = options;
|
|
5936
5952
|
if (noChanges) {
|
|
5937
5953
|
logger.remark("No changes detected");
|
|
5938
5954
|
logger.newLine();
|
|
5939
5955
|
return;
|
|
5940
5956
|
}
|
|
5941
5957
|
const hasConfigChanges = Object.keys(diff).length > 0;
|
|
5942
|
-
const buildChanged =
|
|
5958
|
+
const buildChanged = build2?.changed === true;
|
|
5943
5959
|
const backendChanged = backend?.changed === true;
|
|
5944
5960
|
const customRoutesChanged = backend?.customRoutesChanged === true;
|
|
5945
5961
|
const forceBackend = backend?.forced;
|
|
@@ -5985,8 +6001,8 @@ function displayDeploymentDiff(options) {
|
|
|
5985
6001
|
if (buildChanged) {
|
|
5986
6002
|
logger.bold("Frontend", 1);
|
|
5987
6003
|
let buildInfo;
|
|
5988
|
-
const previousSize =
|
|
5989
|
-
const currentSize =
|
|
6004
|
+
const previousSize = build2?.previousSize;
|
|
6005
|
+
const currentSize = build2?.currentSize;
|
|
5990
6006
|
if (previousSize !== void 0 && currentSize !== void 0) {
|
|
5991
6007
|
const oldSize = formatSize(previousSize);
|
|
5992
6008
|
const newSize = formatSize(currentSize);
|
|
@@ -8637,6 +8653,7 @@ async function runDbDiff() {
|
|
|
8637
8653
|
const previousSnapshot = deployedGameInfo?.schemaSnapshot;
|
|
8638
8654
|
const schemaInfo = await getSchemaInfo(previousSnapshot);
|
|
8639
8655
|
if (!schemaInfo) {
|
|
8656
|
+
logger.newLine();
|
|
8640
8657
|
logger.success("No schema changes detected");
|
|
8641
8658
|
logger.newLine();
|
|
8642
8659
|
logger.remark("Nothing to do");
|
|
@@ -8739,7 +8756,7 @@ init_src2();
|
|
|
8739
8756
|
init_src();
|
|
8740
8757
|
init_constants2();
|
|
8741
8758
|
import { spawn } from "child_process";
|
|
8742
|
-
import { existsSync as existsSync16, rmSync } from "fs";
|
|
8759
|
+
import { existsSync as existsSync16, rmSync as rmSync2 } from "fs";
|
|
8743
8760
|
import { join as join16 } from "path";
|
|
8744
8761
|
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
8745
8762
|
import { Miniflare as Miniflare2 } from "miniflare";
|
|
@@ -8776,7 +8793,7 @@ async function runDbReset() {
|
|
|
8776
8793
|
runStep(
|
|
8777
8794
|
"Deleting database...",
|
|
8778
8795
|
async () => {
|
|
8779
|
-
|
|
8796
|
+
rmSync2(dbDir, { recursive: true, force: true });
|
|
8780
8797
|
},
|
|
8781
8798
|
"Database deleted"
|
|
8782
8799
|
);
|