playcademy 0.13.0 → 0.13.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.
- package/dist/index.js +40 -49
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -5441,7 +5441,6 @@ import { checkbox, confirm, input, select } from "@inquirer/prompts";
|
|
|
5441
5441
|
import { bold as bold3, cyan as cyan2 } from "colorette";
|
|
5442
5442
|
|
|
5443
5443
|
// src/lib/init/scaffold.ts
|
|
5444
|
-
init_src();
|
|
5445
5444
|
init_constants2();
|
|
5446
5445
|
init_core();
|
|
5447
5446
|
init_loader2();
|
|
@@ -5454,21 +5453,15 @@ var playcademyGitignoreTemplate = loadTemplateString("playcademy-gitignore");
|
|
|
5454
5453
|
async function scaffoldApiDirectory(apiDirectory, sampleRoutes) {
|
|
5455
5454
|
const apiPath = resolve6(getWorkspace(), apiDirectory);
|
|
5456
5455
|
const samplePath = join9(apiPath, "sample");
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
for (const route of sampleRoutes) {
|
|
5467
|
-
writeFileSync3(join9(samplePath, route.filename), route.template, "utf-8");
|
|
5468
|
-
}
|
|
5469
|
-
},
|
|
5470
|
-
"API directory scaffolded"
|
|
5471
|
-
);
|
|
5456
|
+
if (!existsSync8(apiPath)) {
|
|
5457
|
+
mkdirSync3(apiPath, { recursive: true });
|
|
5458
|
+
}
|
|
5459
|
+
if (!existsSync8(samplePath)) {
|
|
5460
|
+
mkdirSync3(samplePath, { recursive: true });
|
|
5461
|
+
}
|
|
5462
|
+
for (const route of sampleRoutes) {
|
|
5463
|
+
writeFileSync3(join9(samplePath, route.filename), route.template, "utf-8");
|
|
5464
|
+
}
|
|
5472
5465
|
}
|
|
5473
5466
|
function validateApiDirectoryDoesNotExist(value) {
|
|
5474
5467
|
const dirPath = resolve6(getWorkspace(), value.trim());
|
|
@@ -5486,7 +5479,8 @@ function ensurePlaycademyGitignore() {
|
|
|
5486
5479
|
const gitignorePath = join9(playcademyDir, ".gitignore");
|
|
5487
5480
|
writeFileSync3(gitignorePath, playcademyGitignoreTemplate);
|
|
5488
5481
|
}
|
|
5489
|
-
async function scaffoldIntegrations(
|
|
5482
|
+
async function scaffoldIntegrations(gameName, options) {
|
|
5483
|
+
const { customRoutes, database, kv } = options;
|
|
5490
5484
|
ensurePlaycademyGitignore();
|
|
5491
5485
|
if (customRoutes) {
|
|
5492
5486
|
const sampleRoutes = [
|
|
@@ -7934,27 +7928,35 @@ var initCommand = new Command2("init").description("Initialize a playcademy.conf
|
|
|
7934
7928
|
kv,
|
|
7935
7929
|
customRoutes
|
|
7936
7930
|
} = await promptForIntegrations();
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
customRoutes
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7931
|
+
logger.newLine();
|
|
7932
|
+
await runStep(
|
|
7933
|
+
"Setting up project",
|
|
7934
|
+
async () => {
|
|
7935
|
+
let depsAdded = false;
|
|
7936
|
+
const hasPackageJsonFile = hasPackageJson();
|
|
7937
|
+
if (hasPackageJsonFile) {
|
|
7938
|
+
const sdkAdded = await addPlaycademySdk();
|
|
7939
|
+
if (sdkAdded) depsAdded = true;
|
|
7940
|
+
}
|
|
7941
|
+
if (customRoutes || database) {
|
|
7942
|
+
const scaffoldOptions = { customRoutes, database, kv };
|
|
7943
|
+
const scaffoldDepsAdded = await scaffoldIntegrations(
|
|
7944
|
+
gameInfo.name,
|
|
7945
|
+
scaffoldOptions
|
|
7946
|
+
);
|
|
7947
|
+
if (scaffoldDepsAdded) depsAdded = true;
|
|
7948
|
+
}
|
|
7949
|
+
if (depsAdded) {
|
|
7950
|
+
const pm = detectPackageManager(getWorkspace());
|
|
7951
|
+
const installCmd = getInstallCommand(pm);
|
|
7952
|
+
execSync3(installCmd, {
|
|
7953
|
+
cwd: getWorkspace(),
|
|
7954
|
+
stdio: ["ignore", "ignore", "ignore"]
|
|
7955
|
+
});
|
|
7956
|
+
}
|
|
7957
|
+
},
|
|
7958
|
+
"Project configured"
|
|
7959
|
+
);
|
|
7958
7960
|
logger.newLine();
|
|
7959
7961
|
const configContent = configFormat === "js" ? generateJsConfig({
|
|
7960
7962
|
name: gameInfo.name,
|
|
@@ -7998,17 +8000,6 @@ async function addPlaycademySdk() {
|
|
|
7998
8000
|
writeFileSync5(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
7999
8001
|
return true;
|
|
8000
8002
|
}
|
|
8001
|
-
async function installDependencies() {
|
|
8002
|
-
const pm = detectPackageManager(getWorkspace());
|
|
8003
|
-
const installCmd = getInstallCommand(pm);
|
|
8004
|
-
await runStep(
|
|
8005
|
-
"Installing dependencies...",
|
|
8006
|
-
async () => {
|
|
8007
|
-
execSync3(installCmd, { cwd: getWorkspace(), stdio: ["ignore", "ignore", "ignore"] });
|
|
8008
|
-
},
|
|
8009
|
-
"Dependencies installed"
|
|
8010
|
-
);
|
|
8011
|
-
}
|
|
8012
8003
|
initCommand.addCommand(configCommand);
|
|
8013
8004
|
|
|
8014
8005
|
// src/commands/login.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playcademy",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
"pub": "bun publish.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@hono/node-server": "^1.19.5",
|
|
43
42
|
"@inquirer/prompts": "^7.8.6",
|
|
44
43
|
"@playcademy/sdk": "0.1.5",
|
|
45
44
|
"better-sqlite3": "^12.4.1",
|