playcademy 0.17.2 → 0.17.4-alpha.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/dist/bin.js +61 -0
- package/dist/cli.js +81 -135
- package/dist/constants.d.ts +6 -23
- package/dist/constants.js +16 -12
- package/dist/db.js +8 -14
- package/dist/index.d.ts +3 -3
- package/dist/index.js +500 -5670
- package/dist/utils.d.ts +8 -3
- package/dist/utils.js +216 -211
- package/dist/version.d.ts +10 -2
- package/dist/version.js +2 -90
- package/package.json +15 -5
package/dist/bin.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/bin.ts
|
|
4
|
+
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { homedir as homedir2 } from "node:os";
|
|
7
|
+
import { join as join2 } from "node:path";
|
|
8
|
+
import { green, red } from "colorette";
|
|
9
|
+
|
|
10
|
+
// src/constants/paths.ts
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
var WORKSPACE_NAME = ".playcademy";
|
|
14
|
+
var CLI_DIRECTORIES = {
|
|
15
|
+
WORKSPACE: WORKSPACE_NAME,
|
|
16
|
+
DATABASE: join(WORKSPACE_NAME, "db"),
|
|
17
|
+
KV: join(WORKSPACE_NAME, "kv"),
|
|
18
|
+
BUCKET: join(WORKSPACE_NAME, "bucket")
|
|
19
|
+
};
|
|
20
|
+
var PLAYCADEMY_HOME = join(homedir(), ".playcademy");
|
|
21
|
+
var CLI_USER_DIRECTORIES = {
|
|
22
|
+
CONFIG: PLAYCADEMY_HOME,
|
|
23
|
+
BIN: join(PLAYCADEMY_HOME, "bin"),
|
|
24
|
+
CACHE: join(PLAYCADEMY_HOME, "cache")
|
|
25
|
+
};
|
|
26
|
+
var CLI_DEFAULT_OUTPUTS = {
|
|
27
|
+
WORKER_BUNDLE: join(WORKSPACE_NAME, "worker-bundle.js")
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/bin.ts
|
|
31
|
+
var exe = process.platform === "win32" ? "playcademy.exe" : "playcademy";
|
|
32
|
+
var locations = [join2(CLI_USER_DIRECTORIES.BIN, exe), join2(homedir2(), ".local", "bin", exe)];
|
|
33
|
+
var binary = locations.find((p) => existsSync(p));
|
|
34
|
+
if (binary) {
|
|
35
|
+
const result = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
36
|
+
if (result.signal) {
|
|
37
|
+
process.kill(process.pid, result.signal);
|
|
38
|
+
}
|
|
39
|
+
process.exit(result.status ?? 1);
|
|
40
|
+
}
|
|
41
|
+
var args = process.argv.slice(2);
|
|
42
|
+
var command = args.length ? `playcademy ${args.join(" ")}` : "playcademy";
|
|
43
|
+
var g = red("\u2502");
|
|
44
|
+
console.error(
|
|
45
|
+
[
|
|
46
|
+
"",
|
|
47
|
+
g,
|
|
48
|
+
`${g} The playcademy npm package doesn't include the CLI.`,
|
|
49
|
+
g,
|
|
50
|
+
`${g} Install it separately:`,
|
|
51
|
+
g,
|
|
52
|
+
`${g} ${green("curl -fsSL https://playcademy.net/cli | bash")}`,
|
|
53
|
+
g,
|
|
54
|
+
`${g} Then re-run your command:`,
|
|
55
|
+
g,
|
|
56
|
+
`${g} ${green(command)}`,
|
|
57
|
+
g,
|
|
58
|
+
""
|
|
59
|
+
].join("\n")
|
|
60
|
+
);
|
|
61
|
+
process.exit(127);
|
package/dist/cli.js
CHANGED
|
@@ -17,8 +17,8 @@ function getPackageVersionFromData(pkg, fallback = "0.0.0") {
|
|
|
17
17
|
}
|
|
18
18
|
function getPackageNameVersionFromData(pkg) {
|
|
19
19
|
const name = getPackageNameFromData(pkg);
|
|
20
|
-
const
|
|
21
|
-
return `${name}@${
|
|
20
|
+
const version = getPackageVersionFromData(pkg);
|
|
21
|
+
return `${name}@${version}`;
|
|
22
22
|
}
|
|
23
23
|
function hasDependencyInData(pkg, packageName) {
|
|
24
24
|
if (!pkg) {
|
|
@@ -56,15 +56,15 @@ import { readFile } from "fs/promises";
|
|
|
56
56
|
import { dirname, parse, resolve } from "path";
|
|
57
57
|
function findFilePath(filename, startDir, maxLevels = 3) {
|
|
58
58
|
const filenames = Array.isArray(filename) ? filename : [filename];
|
|
59
|
-
let
|
|
59
|
+
let currentDir = resolve(startDir);
|
|
60
60
|
let levelsSearched = 0;
|
|
61
61
|
while (levelsSearched <= maxLevels) {
|
|
62
62
|
for (const fname of filenames) {
|
|
63
|
-
const filePath = resolve(
|
|
63
|
+
const filePath = resolve(currentDir, fname);
|
|
64
64
|
if (existsSync(filePath)) {
|
|
65
65
|
return {
|
|
66
66
|
path: filePath,
|
|
67
|
-
dir:
|
|
67
|
+
dir: currentDir,
|
|
68
68
|
filename: fname
|
|
69
69
|
};
|
|
70
70
|
}
|
|
@@ -72,15 +72,15 @@ function findFilePath(filename, startDir, maxLevels = 3) {
|
|
|
72
72
|
if (levelsSearched >= maxLevels) {
|
|
73
73
|
break;
|
|
74
74
|
}
|
|
75
|
-
const parentDir = dirname(
|
|
76
|
-
if (parentDir ===
|
|
75
|
+
const parentDir = dirname(currentDir);
|
|
76
|
+
if (parentDir === currentDir) {
|
|
77
77
|
break;
|
|
78
78
|
}
|
|
79
|
-
const parsed = parse(
|
|
80
|
-
if (parsed.root ===
|
|
79
|
+
const parsed = parse(currentDir);
|
|
80
|
+
if (parsed.root === currentDir) {
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
currentDir = parentDir;
|
|
84
84
|
levelsSearched++;
|
|
85
85
|
}
|
|
86
86
|
return null;
|
|
@@ -248,11 +248,11 @@ function scanDirectory(dir, options = {}) {
|
|
|
248
248
|
}
|
|
249
249
|
throw new Error(`Directory not found: ${dir}`);
|
|
250
250
|
}
|
|
251
|
-
function scan(
|
|
251
|
+
function scan(currentDir, basePath = "") {
|
|
252
252
|
try {
|
|
253
|
-
const entries = readdirSync(
|
|
253
|
+
const entries = readdirSync(currentDir);
|
|
254
254
|
for (const entry of entries) {
|
|
255
|
-
const fullPath = resolve(
|
|
255
|
+
const fullPath = resolve(currentDir, entry);
|
|
256
256
|
const relativePath = basePath ? `${basePath}/${entry}` : entry;
|
|
257
257
|
const stat = statSync(fullPath);
|
|
258
258
|
if (stat.isDirectory()) {
|
|
@@ -674,7 +674,7 @@ function setupGlobalErrorHandlers() {
|
|
|
674
674
|
// src/lib/init/run.ts
|
|
675
675
|
import { execSync as execSync5 } from "child_process";
|
|
676
676
|
import { writeFileSync as writeFileSync10 } from "fs";
|
|
677
|
-
import { resolve as
|
|
677
|
+
import { resolve as resolve8 } from "path";
|
|
678
678
|
import { confirm as confirm5 } from "@inquirer/prompts";
|
|
679
679
|
|
|
680
680
|
// ../utils/src/ansi.ts
|
|
@@ -1189,20 +1189,22 @@ var GODOT_BUILD_OUTPUTS = {
|
|
|
1189
1189
|
};
|
|
1190
1190
|
|
|
1191
1191
|
// src/constants/paths.ts
|
|
1192
|
-
import {
|
|
1192
|
+
import { homedir } from "node:os";
|
|
1193
|
+
import { join as join6 } from "node:path";
|
|
1193
1194
|
var WORKSPACE_NAME = ".playcademy";
|
|
1194
1195
|
var CLI_DIRECTORIES = {
|
|
1195
|
-
/** Root directory for CLI artifacts in workspace */
|
|
1196
1196
|
WORKSPACE: WORKSPACE_NAME,
|
|
1197
|
-
/** Database directory within workspace */
|
|
1198
1197
|
DATABASE: join6(WORKSPACE_NAME, "db"),
|
|
1199
|
-
/** KV storage directory within workspace */
|
|
1200
1198
|
KV: join6(WORKSPACE_NAME, "kv"),
|
|
1201
|
-
/** Bucket storage directory within workspace */
|
|
1202
1199
|
BUCKET: join6(WORKSPACE_NAME, "bucket")
|
|
1203
1200
|
};
|
|
1201
|
+
var PLAYCADEMY_HOME = join6(homedir(), ".playcademy");
|
|
1202
|
+
var CLI_USER_DIRECTORIES = {
|
|
1203
|
+
CONFIG: PLAYCADEMY_HOME,
|
|
1204
|
+
BIN: join6(PLAYCADEMY_HOME, "bin"),
|
|
1205
|
+
CACHE: join6(PLAYCADEMY_HOME, "cache")
|
|
1206
|
+
};
|
|
1204
1207
|
var CLI_DEFAULT_OUTPUTS = {
|
|
1205
|
-
/** Default worker bundle output for debug command */
|
|
1206
1208
|
WORKER_BUNDLE: join6(WORKSPACE_NAME, "worker-bundle.js")
|
|
1207
1209
|
};
|
|
1208
1210
|
|
|
@@ -1693,7 +1695,7 @@ var ConfigError = class extends Error {
|
|
|
1693
1695
|
return msg;
|
|
1694
1696
|
}
|
|
1695
1697
|
};
|
|
1696
|
-
async function findConfigPath(configPath) {
|
|
1698
|
+
async function findConfigPath(configPath, options) {
|
|
1697
1699
|
const { findFile: findFile2 } = await Promise.resolve().then(() => (init_file_loader(), file_loader_exports));
|
|
1698
1700
|
if (configPath) {
|
|
1699
1701
|
const fullPath = resolve3(configPath);
|
|
@@ -1720,7 +1722,11 @@ async function findConfigPath(configPath) {
|
|
|
1720
1722
|
}
|
|
1721
1723
|
return result2.path;
|
|
1722
1724
|
}
|
|
1723
|
-
const result = await findFile2(CONFIG_FILE_NAMES, {
|
|
1725
|
+
const result = await findFile2(CONFIG_FILE_NAMES, {
|
|
1726
|
+
searchUp: true,
|
|
1727
|
+
maxLevels: 3,
|
|
1728
|
+
cwd: options?.searchFrom ?? process.cwd()
|
|
1729
|
+
});
|
|
1724
1730
|
if (!result) {
|
|
1725
1731
|
throw new ConfigError(
|
|
1726
1732
|
"No Playcademy config file found in this directory or any parent directory",
|
|
@@ -1737,13 +1743,13 @@ async function loadConfigFile(path2) {
|
|
|
1737
1743
|
const module = await import(`${path2}?t=${Date.now()}`);
|
|
1738
1744
|
return module.default || module;
|
|
1739
1745
|
}
|
|
1740
|
-
async function loadConfig(configPath) {
|
|
1741
|
-
const result = await loadConfigWithPath(configPath);
|
|
1746
|
+
async function loadConfig(configPath, options) {
|
|
1747
|
+
const result = await loadConfigWithPath(configPath, options);
|
|
1742
1748
|
return result.config;
|
|
1743
1749
|
}
|
|
1744
|
-
async function loadConfigWithPath(configPath) {
|
|
1750
|
+
async function loadConfigWithPath(configPath, options) {
|
|
1745
1751
|
try {
|
|
1746
|
-
const actualPath = configPath ? resolve3(configPath) : await findConfigPath();
|
|
1752
|
+
const actualPath = configPath ? resolve3(configPath) : await findConfigPath(void 0, options);
|
|
1747
1753
|
const config = await loadConfigFile(actualPath);
|
|
1748
1754
|
if (!config || typeof config !== "object") {
|
|
1749
1755
|
throw new ConfigError(
|
|
@@ -2149,16 +2155,26 @@ var init_constants = __esm2(() => {
|
|
|
2149
2155
|
init_constants();
|
|
2150
2156
|
|
|
2151
2157
|
// src/lib/templates/loader.ts
|
|
2152
|
-
import { existsSync as existsSync5, readFileSync } from "fs";
|
|
2153
|
-
import { dirname as dirname3, resolve as resolve4 } from "path";
|
|
2154
|
-
import { fileURLToPath } from "url";
|
|
2155
|
-
|
|
2158
|
+
import { existsSync as existsSync5, readFileSync } from "node:fs";
|
|
2159
|
+
import { dirname as dirname3, resolve as resolve4 } from "node:path";
|
|
2160
|
+
import { fileURLToPath } from "node:url";
|
|
2161
|
+
|
|
2162
|
+
// src/lib/templates/bundle.ts
|
|
2163
|
+
var TEMPLATE_BUNDLE = null;
|
|
2164
|
+
|
|
2165
|
+
// src/lib/templates/loader.ts
|
|
2156
2166
|
function loadTemplateString(filename) {
|
|
2167
|
+
if (TEMPLATE_BUNDLE) {
|
|
2168
|
+
const content = TEMPLATE_BUNDLE[filename] ?? TEMPLATE_BUNDLE[`${filename}.template`];
|
|
2169
|
+
if (content != null) return content;
|
|
2170
|
+
throw new Error(
|
|
2171
|
+
`Template not found in bundle: ${filename}. Available: ${Object.keys(TEMPLATE_BUNDLE).join(", ")}`
|
|
2172
|
+
);
|
|
2173
|
+
}
|
|
2174
|
+
const currentDir = dirname3(fileURLToPath(import.meta.url));
|
|
2157
2175
|
const filenamesToTry = filename.endsWith(".template") ? [filename] : [filename, `${filename}.template`];
|
|
2158
2176
|
const candidatePaths = filenamesToTry.flatMap((name) => [
|
|
2159
|
-
// Dev (TS sources): ../../templates from src/lib/templates
|
|
2160
2177
|
resolve4(currentDir, "../../templates", name),
|
|
2161
|
-
// Bundled build (single-file output): templates relative to dist root
|
|
2162
2178
|
resolve4(currentDir, "templates", name)
|
|
2163
2179
|
]);
|
|
2164
2180
|
for (const candidate of candidatePaths) {
|
|
@@ -2993,99 +3009,11 @@ async function setupPackageJson(workspace) {
|
|
|
2993
3009
|
}
|
|
2994
3010
|
|
|
2995
3011
|
// src/lib/init/database.ts
|
|
2996
|
-
import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "fs";
|
|
2997
|
-
import { join as join13 } from "path";
|
|
2998
|
-
|
|
2999
|
-
// package.json with { type: 'json' }
|
|
3000
|
-
var package_default2 = {
|
|
3001
|
-
name: "playcademy",
|
|
3002
|
-
version: "0.17.1",
|
|
3003
|
-
type: "module",
|
|
3004
|
-
exports: {
|
|
3005
|
-
".": {
|
|
3006
|
-
types: "./dist/index.d.ts",
|
|
3007
|
-
import: "./dist/index.js",
|
|
3008
|
-
require: "./dist/index.js"
|
|
3009
|
-
},
|
|
3010
|
-
"./cli": {
|
|
3011
|
-
types: "./dist/cli.d.ts",
|
|
3012
|
-
import: "./dist/cli.js",
|
|
3013
|
-
require: "./dist/cli.js"
|
|
3014
|
-
},
|
|
3015
|
-
"./db": {
|
|
3016
|
-
types: "./dist/db.d.ts",
|
|
3017
|
-
import: "./dist/db.js",
|
|
3018
|
-
require: "./dist/db.js"
|
|
3019
|
-
},
|
|
3020
|
-
"./utils": {
|
|
3021
|
-
types: "./dist/utils.d.ts",
|
|
3022
|
-
import: "./dist/utils.js"
|
|
3023
|
-
},
|
|
3024
|
-
"./constants": {
|
|
3025
|
-
types: "./dist/constants.d.ts",
|
|
3026
|
-
import: "./dist/constants.js"
|
|
3027
|
-
},
|
|
3028
|
-
"./types": {
|
|
3029
|
-
types: "./dist/index.d.ts"
|
|
3030
|
-
},
|
|
3031
|
-
"./version": {
|
|
3032
|
-
types: "./dist/version.d.ts",
|
|
3033
|
-
import: "./dist/version.js"
|
|
3034
|
-
}
|
|
3035
|
-
},
|
|
3036
|
-
main: "./dist/index.js",
|
|
3037
|
-
module: "./dist/index.js",
|
|
3038
|
-
bin: {
|
|
3039
|
-
playcademy: "./dist/index.js"
|
|
3040
|
-
},
|
|
3041
|
-
files: [
|
|
3042
|
-
"dist"
|
|
3043
|
-
],
|
|
3044
|
-
scripts: {
|
|
3045
|
-
build: "bun build.ts",
|
|
3046
|
-
dev: "PLAYCADEMY_BASE_URL=http://localhost:5174 bun src/index.ts",
|
|
3047
|
-
pub: "bun publish.ts"
|
|
3048
|
-
},
|
|
3049
|
-
dependencies: {
|
|
3050
|
-
"@inquirer/prompts": "^7.8.6",
|
|
3051
|
-
"@playcademy/sdk": "workspace:*",
|
|
3052
|
-
chokidar: "^4.0.3",
|
|
3053
|
-
colorette: "^2.0.20",
|
|
3054
|
-
commander: "^14.0.1",
|
|
3055
|
-
dedent: "^1.6.0",
|
|
3056
|
-
"drizzle-kit": "^0.31.5",
|
|
3057
|
-
"drizzle-orm": "^0.44.6",
|
|
3058
|
-
esbuild: "^0.25.10",
|
|
3059
|
-
giget: "^2.0.0",
|
|
3060
|
-
hono: "^4.9.9",
|
|
3061
|
-
"json-colorizer": "^3.0.1",
|
|
3062
|
-
jszip: "^3.10.1",
|
|
3063
|
-
miniflare: "^4.20251008.0",
|
|
3064
|
-
open: "^10.2.0",
|
|
3065
|
-
ws: "^8.18.3"
|
|
3066
|
-
},
|
|
3067
|
-
devDependencies: {
|
|
3068
|
-
"@cloudflare/workers-types": "^4.20251011.0",
|
|
3069
|
-
"@inquirer/core": "^10.3.0",
|
|
3070
|
-
"@playcademy/constants": "workspace:*",
|
|
3071
|
-
"@playcademy/data": "workspace:*",
|
|
3072
|
-
"@playcademy/edge-play": "workspace:*",
|
|
3073
|
-
"@playcademy/timeback": "workspace:*",
|
|
3074
|
-
"@playcademy/types": "workspace:*",
|
|
3075
|
-
"@playcademy/utils": "workspace:*",
|
|
3076
|
-
"@types/bun": "latest",
|
|
3077
|
-
"@types/ws": "^8.18.1",
|
|
3078
|
-
bumpp: "^10.2.3",
|
|
3079
|
-
rollup: "^4.50.2",
|
|
3080
|
-
"rollup-plugin-dts": "^6.2.3"
|
|
3081
|
-
},
|
|
3082
|
-
peerDependencies: {
|
|
3083
|
-
typescript: "^5"
|
|
3084
|
-
}
|
|
3085
|
-
};
|
|
3012
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3013
|
+
import { join as join13 } from "node:path";
|
|
3086
3014
|
|
|
3087
3015
|
// src/version.ts
|
|
3088
|
-
var
|
|
3016
|
+
var cliVersion = false ? "0.0.0-dev" : "0.17.4-alpha.1";
|
|
3089
3017
|
|
|
3090
3018
|
// src/lib/init/database.ts
|
|
3091
3019
|
var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
|
|
@@ -3133,8 +3061,9 @@ async function setupPackageJson2(workspace, appName) {
|
|
|
3133
3061
|
"drizzle-orm": "^0.42.0",
|
|
3134
3062
|
"better-sqlite3": "^12.0.0"
|
|
3135
3063
|
};
|
|
3064
|
+
const playcademyDevDepRange = cliVersion === "0.0.0-dev" ? "latest" : `^${cliVersion}`;
|
|
3136
3065
|
const dbDevDeps = {
|
|
3137
|
-
playcademy:
|
|
3066
|
+
playcademy: playcademyDevDepRange,
|
|
3138
3067
|
"drizzle-kit": "^0.30.0",
|
|
3139
3068
|
"@types/better-sqlite3": "^7.6.0",
|
|
3140
3069
|
tsx: "^4.20.6"
|
|
@@ -3163,7 +3092,7 @@ async function setupPackageJson2(workspace, appName) {
|
|
|
3163
3092
|
return true;
|
|
3164
3093
|
} else {
|
|
3165
3094
|
const slugifiedName = generateSlug(appName);
|
|
3166
|
-
const packageContent = packageTemplate.replace("{{APP_NAME}}", slugifiedName).replace("{{PLAYCADEMY_VERSION}}",
|
|
3095
|
+
const packageContent = packageTemplate.replace("{{APP_NAME}}", slugifiedName).replace("^{{PLAYCADEMY_VERSION}}", playcademyDevDepRange);
|
|
3167
3096
|
writeFileSync6(pkgPath, packageContent);
|
|
3168
3097
|
logger.success("Created package.json");
|
|
3169
3098
|
return true;
|
|
@@ -3476,11 +3405,10 @@ async function selectConfigFormat(hasPackageJson2) {
|
|
|
3476
3405
|
}
|
|
3477
3406
|
|
|
3478
3407
|
// src/lib/init/types.ts
|
|
3479
|
-
|
|
3480
|
-
import {
|
|
3481
|
-
import {
|
|
3482
|
-
import {
|
|
3483
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3408
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
3409
|
+
import { existsSync as existsSync15, readFileSync as readFileSync9, writeFileSync as writeFileSync9 } from "node:fs";
|
|
3410
|
+
import { dirname as dirname5, join as join17, resolve as resolve7 } from "node:path";
|
|
3411
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
3484
3412
|
|
|
3485
3413
|
// src/lib/deploy/backend.ts
|
|
3486
3414
|
import { existsSync as existsSync13 } from "node:fs";
|
|
@@ -3638,13 +3566,31 @@ function detectBackendFeatures(workspace, config) {
|
|
|
3638
3566
|
function hasAnyBackend(features) {
|
|
3639
3567
|
return Object.values(features).some(Boolean);
|
|
3640
3568
|
}
|
|
3569
|
+
function getDepVersions() {
|
|
3570
|
+
if (true) {
|
|
3571
|
+
return { honoVersion: "^4.9.9", workersTypesVersion: "^4.20251011.0" };
|
|
3572
|
+
}
|
|
3573
|
+
try {
|
|
3574
|
+
const pkgPath = resolve7(
|
|
3575
|
+
dirname5(fileURLToPath2(import.meta.url)),
|
|
3576
|
+
"..",
|
|
3577
|
+
"..",
|
|
3578
|
+
"..",
|
|
3579
|
+
"package.json"
|
|
3580
|
+
);
|
|
3581
|
+
const pkg = JSON.parse(readFileSync9(pkgPath, "utf8"));
|
|
3582
|
+
return {
|
|
3583
|
+
honoVersion: pkg.dependencies?.hono ?? "latest",
|
|
3584
|
+
workersTypesVersion: pkg.devDependencies?.["@cloudflare/workers-types"] ?? "latest"
|
|
3585
|
+
};
|
|
3586
|
+
} catch {
|
|
3587
|
+
return { honoVersion: "latest", workersTypesVersion: "latest" };
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3641
3590
|
async function setupPlaycademyDependencies(workspace) {
|
|
3642
3591
|
const playcademyDir = join17(workspace, CLI_DIRECTORIES.WORKSPACE);
|
|
3643
3592
|
const playcademyPkgPath = join17(playcademyDir, "package.json");
|
|
3644
|
-
const
|
|
3645
|
-
const cliPkg = await loadPackageJson({ cwd: __dirname, searchUp: true, required: true });
|
|
3646
|
-
const workersTypesVersion = cliPkg?.devDependencies?.["@cloudflare/workers-types"] || "latest";
|
|
3647
|
-
const honoVersion = cliPkg?.dependencies?.hono || "latest";
|
|
3593
|
+
const { honoVersion, workersTypesVersion } = getDepVersions();
|
|
3648
3594
|
const playcademyPkg = {
|
|
3649
3595
|
private: true,
|
|
3650
3596
|
dependencies: { hono: honoVersion },
|
|
@@ -3918,7 +3864,7 @@ async function runInit(options = {}) {
|
|
|
3918
3864
|
timebackCourses: timebackConfig ?? void 0
|
|
3919
3865
|
};
|
|
3920
3866
|
const configContent = configFormat === "js" ? generateJsConfig(configOptions) : generateJsonConfig(configOptions);
|
|
3921
|
-
const configPath =
|
|
3867
|
+
const configPath = resolve8(getWorkspace(), configFileName);
|
|
3922
3868
|
writeFileSync10(configPath, configContent, "utf8");
|
|
3923
3869
|
await formatConfigWithPrettier(configPath);
|
|
3924
3870
|
if (database || auth || kv || bucket) {
|
package/dist/constants.d.ts
CHANGED
|
@@ -274,42 +274,25 @@ declare const SSO_AUTH_TIMEOUT_MS = 30000;
|
|
|
274
274
|
* Path constants for CLI directories and files
|
|
275
275
|
*/
|
|
276
276
|
declare const WORKSPACE_NAME = ".playcademy";
|
|
277
|
-
/**
|
|
278
|
-
* CLI workspace directories (local to project)
|
|
279
|
-
*/
|
|
280
277
|
declare const CLI_DIRECTORIES: {
|
|
281
|
-
/** Root directory for CLI artifacts in workspace */
|
|
282
278
|
readonly WORKSPACE: ".playcademy";
|
|
283
|
-
/** Database directory within workspace */
|
|
284
279
|
readonly DATABASE: string;
|
|
285
|
-
/** KV storage directory within workspace */
|
|
286
280
|
readonly KV: string;
|
|
287
|
-
/** Bucket storage directory within workspace */
|
|
288
281
|
readonly BUCKET: string;
|
|
289
282
|
};
|
|
290
|
-
/**
|
|
291
|
-
* CLI user directories (in home directory)
|
|
292
|
-
*/
|
|
293
283
|
declare const CLI_USER_DIRECTORIES: {
|
|
294
|
-
|
|
295
|
-
readonly
|
|
284
|
+
readonly CONFIG: string;
|
|
285
|
+
readonly BIN: string;
|
|
286
|
+
readonly CACHE: string;
|
|
296
287
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
*/
|
|
288
|
+
declare function nativeBinaryPath(name: string): string;
|
|
289
|
+
declare function cacheVersionDir(version: string): string;
|
|
300
290
|
declare const CLI_DEFAULT_OUTPUTS: {
|
|
301
|
-
/** Default worker bundle output for debug command */
|
|
302
291
|
readonly WORKER_BUNDLE: string;
|
|
303
292
|
};
|
|
304
|
-
/**
|
|
305
|
-
* CLI file names
|
|
306
|
-
*/
|
|
307
293
|
declare const CLI_FILES: {
|
|
308
|
-
/** Auth store file in user config directory */
|
|
309
294
|
readonly AUTH_STORE: "auth.json";
|
|
310
|
-
/** Games deployment info store */
|
|
311
295
|
readonly GAMES_STORE: "games.json";
|
|
312
|
-
/** Initial database file (before miniflare) */
|
|
313
296
|
readonly INITIAL_DATABASE: "initial.sqlite";
|
|
314
297
|
};
|
|
315
298
|
|
|
@@ -357,4 +340,4 @@ declare const CONFIG_FILE_NAMES: string[];
|
|
|
357
340
|
*/
|
|
358
341
|
declare const DOCS_URL = "https://docs.dev.playcademy.net/platform";
|
|
359
342
|
|
|
360
|
-
export { AUTH_API_SUBDIRECTORY, AUTH_CONFIG_FILE, AUTH_PROVIDER_NAMES, BETTER_AUTH_VERSION, BUCKET_ALWAYS_SKIP, CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_BINDINGS, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DB_FILES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_TEMPLATE_REF, DOCS_URL, DRIZZLE_CONFIG_FILES, ENV_EXAMPLE_FILE, ENV_FILES, GODOT_ADDON_URL, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_APP_URL, PLAYCADEMY_AUTH_VERSION, PUBLIC_DIRECTORY, QUEUE_NAME_PREFIX, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_SUBDIRECTORY, SELF_WORKER_NAME_BINDING, SERVER_LIB_DIRECTORY, SERVER_ROOT_DIRECTORY, SSO_AUTH_TIMEOUT_MS, TEMPLATE_RENAME_FILES, TEMPLATE_REPOS, TSCONFIG_APP_JSON, TSCONFIG_FILES, TSCONFIG_JSON, TSCONFIG_REQUIRED_INCLUDES, WORKSPACE_NAME };
|
|
343
|
+
export { AUTH_API_SUBDIRECTORY, AUTH_CONFIG_FILE, AUTH_PROVIDER_NAMES, BETTER_AUTH_VERSION, BUCKET_ALWAYS_SKIP, CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_BINDINGS, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DB_FILES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_TEMPLATE_REF, DOCS_URL, DRIZZLE_CONFIG_FILES, ENV_EXAMPLE_FILE, ENV_FILES, GODOT_ADDON_URL, GODOT_BUILD_DIRECTORIES, GODOT_BUILD_OUTPUTS, GODOT_EXECUTABLE_PATTERNS, GODOT_EXPORT_PRESETS_FILE, GODOT_PROJECT_FILE, GODOT_WEB_PLATFORM, MINIFLARE_D1_DIRECTORY, OAUTH_CALLBACK_URL_PATTERN, PLACEHOLDER_APP_URL, PLAYCADEMY_AUTH_VERSION, PUBLIC_DIRECTORY, QUEUE_NAME_PREFIX, SAMPLE_API_SUBDIRECTORY, SAMPLE_BUCKET_FILENAME, SAMPLE_CUSTOM_FILENAME, SAMPLE_DATABASE_FILENAME, SAMPLE_KV_FILENAME, SCHEMA_SUBDIRECTORY, SELF_WORKER_NAME_BINDING, SERVER_LIB_DIRECTORY, SERVER_ROOT_DIRECTORY, SSO_AUTH_TIMEOUT_MS, TEMPLATE_RENAME_FILES, TEMPLATE_REPOS, TSCONFIG_APP_JSON, TSCONFIG_FILES, TSCONFIG_JSON, TSCONFIG_REQUIRED_INCLUDES, WORKSPACE_NAME, cacheVersionDir, nativeBinaryPath };
|
package/dist/constants.js
CHANGED
|
@@ -183,32 +183,34 @@ var CALLBACK_PATH = "/callback";
|
|
|
183
183
|
var SSO_AUTH_TIMEOUT_MS = 3e4;
|
|
184
184
|
|
|
185
185
|
// src/constants/paths.ts
|
|
186
|
-
import {
|
|
186
|
+
import { homedir } from "node:os";
|
|
187
|
+
import { join as join5 } from "node:path";
|
|
187
188
|
var WORKSPACE_NAME = ".playcademy";
|
|
188
189
|
var CLI_DIRECTORIES = {
|
|
189
|
-
/** Root directory for CLI artifacts in workspace */
|
|
190
190
|
WORKSPACE: WORKSPACE_NAME,
|
|
191
|
-
/** Database directory within workspace */
|
|
192
191
|
DATABASE: join5(WORKSPACE_NAME, "db"),
|
|
193
|
-
/** KV storage directory within workspace */
|
|
194
192
|
KV: join5(WORKSPACE_NAME, "kv"),
|
|
195
|
-
/** Bucket storage directory within workspace */
|
|
196
193
|
BUCKET: join5(WORKSPACE_NAME, "bucket")
|
|
197
194
|
};
|
|
195
|
+
var PLAYCADEMY_HOME = join5(homedir(), ".playcademy");
|
|
198
196
|
var CLI_USER_DIRECTORIES = {
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
CONFIG: PLAYCADEMY_HOME,
|
|
198
|
+
BIN: join5(PLAYCADEMY_HOME, "bin"),
|
|
199
|
+
CACHE: join5(PLAYCADEMY_HOME, "cache")
|
|
201
200
|
};
|
|
201
|
+
function nativeBinaryPath(name) {
|
|
202
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
203
|
+
return join5(CLI_USER_DIRECTORIES.BIN, `${name}${ext}`);
|
|
204
|
+
}
|
|
205
|
+
function cacheVersionDir(version) {
|
|
206
|
+
return join5(CLI_USER_DIRECTORIES.CACHE, `v${version}`);
|
|
207
|
+
}
|
|
202
208
|
var CLI_DEFAULT_OUTPUTS = {
|
|
203
|
-
/** Default worker bundle output for debug command */
|
|
204
209
|
WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
|
|
205
210
|
};
|
|
206
211
|
var CLI_FILES = {
|
|
207
|
-
/** Auth store file in user config directory */
|
|
208
212
|
AUTH_STORE: "auth.json",
|
|
209
|
-
/** Games deployment info store */
|
|
210
213
|
GAMES_STORE: "games.json",
|
|
211
|
-
/** Initial database file (before miniflare) */
|
|
212
214
|
INITIAL_DATABASE: "initial.sqlite"
|
|
213
215
|
};
|
|
214
216
|
|
|
@@ -439,5 +441,7 @@ export {
|
|
|
439
441
|
TSCONFIG_FILES,
|
|
440
442
|
TSCONFIG_JSON,
|
|
441
443
|
TSCONFIG_REQUIRED_INCLUDES,
|
|
442
|
-
WORKSPACE_NAME
|
|
444
|
+
WORKSPACE_NAME,
|
|
445
|
+
cacheVersionDir,
|
|
446
|
+
nativeBinaryPath
|
|
443
447
|
};
|
package/dist/db.js
CHANGED
|
@@ -124,28 +124,27 @@ var GODOT_BUILD_OUTPUTS = {
|
|
|
124
124
|
};
|
|
125
125
|
|
|
126
126
|
// src/constants/paths.ts
|
|
127
|
-
import {
|
|
127
|
+
import { homedir } from "node:os";
|
|
128
|
+
import { join as join5 } from "node:path";
|
|
128
129
|
var WORKSPACE_NAME = ".playcademy";
|
|
129
130
|
var CLI_DIRECTORIES = {
|
|
130
|
-
/** Root directory for CLI artifacts in workspace */
|
|
131
131
|
WORKSPACE: WORKSPACE_NAME,
|
|
132
|
-
/** Database directory within workspace */
|
|
133
132
|
DATABASE: join5(WORKSPACE_NAME, "db"),
|
|
134
|
-
/** KV storage directory within workspace */
|
|
135
133
|
KV: join5(WORKSPACE_NAME, "kv"),
|
|
136
|
-
/** Bucket storage directory within workspace */
|
|
137
134
|
BUCKET: join5(WORKSPACE_NAME, "bucket")
|
|
138
135
|
};
|
|
136
|
+
var PLAYCADEMY_HOME = join5(homedir(), ".playcademy");
|
|
137
|
+
var CLI_USER_DIRECTORIES = {
|
|
138
|
+
CONFIG: PLAYCADEMY_HOME,
|
|
139
|
+
BIN: join5(PLAYCADEMY_HOME, "bin"),
|
|
140
|
+
CACHE: join5(PLAYCADEMY_HOME, "cache")
|
|
141
|
+
};
|
|
139
142
|
var CLI_DEFAULT_OUTPUTS = {
|
|
140
|
-
/** Default worker bundle output for debug command */
|
|
141
143
|
WORKER_BUNDLE: join5(WORKSPACE_NAME, "worker-bundle.js")
|
|
142
144
|
};
|
|
143
145
|
var CLI_FILES = {
|
|
144
|
-
/** Auth store file in user config directory */
|
|
145
146
|
AUTH_STORE: "auth.json",
|
|
146
|
-
/** Games deployment info store */
|
|
147
147
|
GAMES_STORE: "games.json",
|
|
148
|
-
/** Initial database file (before miniflare) */
|
|
149
148
|
INITIAL_DATABASE: "initial.sqlite"
|
|
150
149
|
};
|
|
151
150
|
|
|
@@ -1262,11 +1261,6 @@ init_file_loader();
|
|
|
1262
1261
|
// src/lib/config/loader.ts
|
|
1263
1262
|
init_file_loader();
|
|
1264
1263
|
|
|
1265
|
-
// src/lib/templates/loader.ts
|
|
1266
|
-
import { dirname, resolve } from "path";
|
|
1267
|
-
import { fileURLToPath } from "url";
|
|
1268
|
-
var currentDir = dirname(fileURLToPath(import.meta.url));
|
|
1269
|
-
|
|
1270
1264
|
// src/lib/core/import.ts
|
|
1271
1265
|
import { mkdtempSync, rmSync } from "fs";
|
|
1272
1266
|
import { tmpdir } from "os";
|
package/dist/index.d.ts
CHANGED
|
@@ -1191,10 +1191,10 @@ interface BundleOptions {
|
|
|
1191
1191
|
}
|
|
1192
1192
|
/**
|
|
1193
1193
|
* Resolved paths for bundling embedded sources
|
|
1194
|
-
* Used to support
|
|
1194
|
+
* Used to support monorepo development and the published `playcademy` npm package (dist/).
|
|
1195
1195
|
*/
|
|
1196
1196
|
interface EmbeddedSourcePaths {
|
|
1197
|
-
/**
|
|
1197
|
+
/** True when running from installed npm package (dist/ has embedded sources), not monorepo dev */
|
|
1198
1198
|
isBuiltPackage: boolean;
|
|
1199
1199
|
/** Path to edge-play sources (embedded or monorepo) */
|
|
1200
1200
|
edgePlaySrc: string;
|
|
@@ -1202,7 +1202,7 @@ interface EmbeddedSourcePaths {
|
|
|
1202
1202
|
constantsEntry: string;
|
|
1203
1203
|
/** User's workspace node_modules */
|
|
1204
1204
|
workspaceNodeModules: string;
|
|
1205
|
-
/**
|
|
1205
|
+
/** Resolution roots: monorepo root in dev; playcademy package or .playcademy deps when published/binary */
|
|
1206
1206
|
cliNodeModules: string;
|
|
1207
1207
|
}
|
|
1208
1208
|
|