playcademy 0.12.5 → 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 +37 -18
- 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,8 +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
|
+
import { createRequire } from "module";
|
|
5385
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
5384
5386
|
import { join as join8 } from "path";
|
|
5387
|
+
import { pathToFileURL } from "url";
|
|
5388
|
+
import * as esbuild from "esbuild";
|
|
5385
5389
|
|
|
5386
5390
|
// src/lib/init/prompts.ts
|
|
5387
5391
|
init_constants3();
|
|
@@ -5641,10 +5645,24 @@ async function getSchemaInfo(previousSchemaSnapshot) {
|
|
|
5641
5645
|
return null;
|
|
5642
5646
|
}
|
|
5643
5647
|
try {
|
|
5644
|
-
const
|
|
5648
|
+
const require2 = createRequire(import.meta.url);
|
|
5649
|
+
const drizzleKitApi = require2("drizzle-kit/api");
|
|
5645
5650
|
const { generateSQLiteDrizzleJson, generateSQLiteMigration } = drizzleKitApi;
|
|
5646
|
-
const
|
|
5647
|
-
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;
|
|
5648
5666
|
const nextJson = await generateSQLiteDrizzleJson(currentSchema);
|
|
5649
5667
|
const prevJson = previousSchemaSnapshot ? previousSchemaSnapshot : await generateSQLiteDrizzleJson({});
|
|
5650
5668
|
const migrationStatements = await generateSQLiteMigration(prevJson, nextJson);
|
|
@@ -5930,14 +5948,14 @@ function formatDelta(bytes) {
|
|
|
5930
5948
|
return `${arrow} ${value.toFixed(2)} ${unit}`;
|
|
5931
5949
|
}
|
|
5932
5950
|
function displayDeploymentDiff(options) {
|
|
5933
|
-
const { diff, noChanges, build, backend, integrations } = options;
|
|
5951
|
+
const { diff, noChanges, build: build2, backend, integrations } = options;
|
|
5934
5952
|
if (noChanges) {
|
|
5935
5953
|
logger.remark("No changes detected");
|
|
5936
5954
|
logger.newLine();
|
|
5937
5955
|
return;
|
|
5938
5956
|
}
|
|
5939
5957
|
const hasConfigChanges = Object.keys(diff).length > 0;
|
|
5940
|
-
const buildChanged =
|
|
5958
|
+
const buildChanged = build2?.changed === true;
|
|
5941
5959
|
const backendChanged = backend?.changed === true;
|
|
5942
5960
|
const customRoutesChanged = backend?.customRoutesChanged === true;
|
|
5943
5961
|
const forceBackend = backend?.forced;
|
|
@@ -5983,8 +6001,8 @@ function displayDeploymentDiff(options) {
|
|
|
5983
6001
|
if (buildChanged) {
|
|
5984
6002
|
logger.bold("Frontend", 1);
|
|
5985
6003
|
let buildInfo;
|
|
5986
|
-
const previousSize =
|
|
5987
|
-
const currentSize =
|
|
6004
|
+
const previousSize = build2?.previousSize;
|
|
6005
|
+
const currentSize = build2?.currentSize;
|
|
5988
6006
|
if (previousSize !== void 0 && currentSize !== void 0) {
|
|
5989
6007
|
const oldSize = formatSize(previousSize);
|
|
5990
6008
|
const newSize = formatSize(currentSize);
|
|
@@ -8635,6 +8653,7 @@ async function runDbDiff() {
|
|
|
8635
8653
|
const previousSnapshot = deployedGameInfo?.schemaSnapshot;
|
|
8636
8654
|
const schemaInfo = await getSchemaInfo(previousSnapshot);
|
|
8637
8655
|
if (!schemaInfo) {
|
|
8656
|
+
logger.newLine();
|
|
8638
8657
|
logger.success("No schema changes detected");
|
|
8639
8658
|
logger.newLine();
|
|
8640
8659
|
logger.remark("Nothing to do");
|
|
@@ -8737,7 +8756,7 @@ init_src2();
|
|
|
8737
8756
|
init_src();
|
|
8738
8757
|
init_constants2();
|
|
8739
8758
|
import { spawn } from "child_process";
|
|
8740
|
-
import { existsSync as existsSync16, rmSync } from "fs";
|
|
8759
|
+
import { existsSync as existsSync16, rmSync as rmSync2 } from "fs";
|
|
8741
8760
|
import { join as join16 } from "path";
|
|
8742
8761
|
import { confirm as confirm6 } from "@inquirer/prompts";
|
|
8743
8762
|
import { Miniflare as Miniflare2 } from "miniflare";
|
|
@@ -8774,7 +8793,7 @@ async function runDbReset() {
|
|
|
8774
8793
|
runStep(
|
|
8775
8794
|
"Deleting database...",
|
|
8776
8795
|
async () => {
|
|
8777
|
-
|
|
8796
|
+
rmSync2(dbDir, { recursive: true, force: true });
|
|
8778
8797
|
},
|
|
8779
8798
|
"Database deleted"
|
|
8780
8799
|
);
|