flarecms 0.2.3 → 0.2.5
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/cli/commands.js +53 -3
- package/dist/cli/index.js +53 -3
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -6506,9 +6506,59 @@ async function createProjectCommand() {
|
|
|
6506
6506
|
};
|
|
6507
6507
|
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6508
6508
|
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6509
|
-
|
|
6510
|
-
|
|
6511
|
-
|
|
6509
|
+
const localPluginPath = resolve(localTemplatesRoot, "plugin-development", "starter-plugin");
|
|
6510
|
+
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "playground");
|
|
6511
|
+
if (existsSync2(localPluginPath) && existsSync2(localPlaygroundPath)) {
|
|
6512
|
+
cpSync(localPluginPath, resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6513
|
+
cpSync(localPlaygroundPath, resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
6514
|
+
} else {
|
|
6515
|
+
try {
|
|
6516
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/starter-plugin", {
|
|
6517
|
+
dir: resolve(projectDir, "plugins/starter-plugin"),
|
|
6518
|
+
force: true
|
|
6519
|
+
});
|
|
6520
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/playground", {
|
|
6521
|
+
dir: resolve(projectDir, "apps/playground"),
|
|
6522
|
+
force: true
|
|
6523
|
+
});
|
|
6524
|
+
} catch (err) {
|
|
6525
|
+
throw new Error(`Failed to download plugin templates: ${err instanceof Error ? err.message : String(err)}`);
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
const pluginId = projectName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
6529
|
+
const pluginPackageName = `@flarecms/plugin-${pluginId}`;
|
|
6530
|
+
const pluginNameHuman = projectName.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
6531
|
+
const placeholders = {
|
|
6532
|
+
"{{PLUGIN_ID}}": pluginId,
|
|
6533
|
+
"{{PLUGIN_NAME}}": pluginPackageName,
|
|
6534
|
+
"{{PLUGIN_PACKAGE_NAME}}": pluginPackageName,
|
|
6535
|
+
"{{PLUGIN_NAME_HUMAN}}": pluginNameHuman,
|
|
6536
|
+
"{{PLAYGROUND_NAME}}": `${pluginId}-playground`
|
|
6537
|
+
};
|
|
6538
|
+
const patchManifest = (path) => {
|
|
6539
|
+
if (!existsSync2(path))
|
|
6540
|
+
return;
|
|
6541
|
+
let content = readFileSync(path, "utf-8");
|
|
6542
|
+
for (const [key, value] of Object.entries(placeholders)) {
|
|
6543
|
+
content = content.replaceAll(key, value);
|
|
6544
|
+
}
|
|
6545
|
+
const pkg = JSON.parse(content);
|
|
6546
|
+
if (pkg.dependencies?.["flarecms"] === "workspace:*") {
|
|
6547
|
+
pkg.dependencies["flarecms"] = "latest";
|
|
6548
|
+
}
|
|
6549
|
+
if (pkg.devDependencies?.["flarecms"] === "workspace:*") {
|
|
6550
|
+
pkg.devDependencies["flarecms"] = "latest";
|
|
6551
|
+
}
|
|
6552
|
+
if (path === pkgPath)
|
|
6553
|
+
pkg.name = projectName;
|
|
6554
|
+
writeFileSync(path, JSON.stringify(pkg, null, 2) + `
|
|
6555
|
+
`);
|
|
6556
|
+
};
|
|
6557
|
+
writeFileSync(pkgPath, JSON.stringify(rootPkg, null, 2) + `
|
|
6558
|
+
`);
|
|
6559
|
+
patchManifest(pkgPath);
|
|
6560
|
+
patchManifest(resolve(projectDir, "plugins/starter-plugin/package.json"));
|
|
6561
|
+
patchManifest(resolve(projectDir, "apps/playground/package.json"));
|
|
6512
6562
|
} else {
|
|
6513
6563
|
const template = TEMPLATES[templateKey];
|
|
6514
6564
|
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|
package/dist/cli/index.js
CHANGED
|
@@ -6507,9 +6507,59 @@ async function createProjectCommand() {
|
|
|
6507
6507
|
};
|
|
6508
6508
|
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6509
6509
|
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6510
|
-
|
|
6511
|
-
|
|
6512
|
-
|
|
6510
|
+
const localPluginPath = resolve(localTemplatesRoot, "plugin-development", "starter-plugin");
|
|
6511
|
+
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "playground");
|
|
6512
|
+
if (existsSync2(localPluginPath) && existsSync2(localPlaygroundPath)) {
|
|
6513
|
+
cpSync(localPluginPath, resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6514
|
+
cpSync(localPlaygroundPath, resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
6515
|
+
} else {
|
|
6516
|
+
try {
|
|
6517
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/starter-plugin", {
|
|
6518
|
+
dir: resolve(projectDir, "plugins/starter-plugin"),
|
|
6519
|
+
force: true
|
|
6520
|
+
});
|
|
6521
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/playground", {
|
|
6522
|
+
dir: resolve(projectDir, "apps/playground"),
|
|
6523
|
+
force: true
|
|
6524
|
+
});
|
|
6525
|
+
} catch (err) {
|
|
6526
|
+
throw new Error(`Failed to download plugin templates: ${err instanceof Error ? err.message : String(err)}`);
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
const pluginId = projectName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
6530
|
+
const pluginPackageName = `@flarecms/plugin-${pluginId}`;
|
|
6531
|
+
const pluginNameHuman = projectName.split(/[-_]/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
6532
|
+
const placeholders = {
|
|
6533
|
+
"{{PLUGIN_ID}}": pluginId,
|
|
6534
|
+
"{{PLUGIN_NAME}}": pluginPackageName,
|
|
6535
|
+
"{{PLUGIN_PACKAGE_NAME}}": pluginPackageName,
|
|
6536
|
+
"{{PLUGIN_NAME_HUMAN}}": pluginNameHuman,
|
|
6537
|
+
"{{PLAYGROUND_NAME}}": `${pluginId}-playground`
|
|
6538
|
+
};
|
|
6539
|
+
const patchManifest = (path) => {
|
|
6540
|
+
if (!existsSync2(path))
|
|
6541
|
+
return;
|
|
6542
|
+
let content = readFileSync(path, "utf-8");
|
|
6543
|
+
for (const [key, value] of Object.entries(placeholders)) {
|
|
6544
|
+
content = content.replaceAll(key, value);
|
|
6545
|
+
}
|
|
6546
|
+
const pkg = JSON.parse(content);
|
|
6547
|
+
if (pkg.dependencies?.["flarecms"] === "workspace:*") {
|
|
6548
|
+
pkg.dependencies["flarecms"] = "latest";
|
|
6549
|
+
}
|
|
6550
|
+
if (pkg.devDependencies?.["flarecms"] === "workspace:*") {
|
|
6551
|
+
pkg.devDependencies["flarecms"] = "latest";
|
|
6552
|
+
}
|
|
6553
|
+
if (path === pkgPath)
|
|
6554
|
+
pkg.name = projectName;
|
|
6555
|
+
writeFileSync(path, JSON.stringify(pkg, null, 2) + `
|
|
6556
|
+
`);
|
|
6557
|
+
};
|
|
6558
|
+
writeFileSync(pkgPath, JSON.stringify(rootPkg, null, 2) + `
|
|
6559
|
+
`);
|
|
6560
|
+
patchManifest(pkgPath);
|
|
6561
|
+
patchManifest(resolve(projectDir, "plugins/starter-plugin/package.json"));
|
|
6562
|
+
patchManifest(resolve(projectDir, "apps/playground/package.json"));
|
|
6513
6563
|
} else {
|
|
6514
6564
|
const template = TEMPLATES[templateKey];
|
|
6515
6565
|
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|