flarecms 0.2.4 → 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 +36 -3
- package/dist/cli/index.js +36 -3
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -6507,7 +6507,7 @@ async function createProjectCommand() {
|
|
|
6507
6507
|
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6508
6508
|
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6509
6509
|
const localPluginPath = resolve(localTemplatesRoot, "plugin-development", "starter-plugin");
|
|
6510
|
-
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "
|
|
6510
|
+
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "playground");
|
|
6511
6511
|
if (existsSync2(localPluginPath) && existsSync2(localPlaygroundPath)) {
|
|
6512
6512
|
cpSync(localPluginPath, resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6513
6513
|
cpSync(localPlaygroundPath, resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
@@ -6517,7 +6517,7 @@ async function createProjectCommand() {
|
|
|
6517
6517
|
dir: resolve(projectDir, "plugins/starter-plugin"),
|
|
6518
6518
|
force: true
|
|
6519
6519
|
});
|
|
6520
|
-
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/
|
|
6520
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/playground", {
|
|
6521
6521
|
dir: resolve(projectDir, "apps/playground"),
|
|
6522
6522
|
force: true
|
|
6523
6523
|
});
|
|
@@ -6525,7 +6525,40 @@ async function createProjectCommand() {
|
|
|
6525
6525
|
throw new Error(`Failed to download plugin templates: ${err instanceof Error ? err.message : String(err)}`);
|
|
6526
6526
|
}
|
|
6527
6527
|
}
|
|
6528
|
-
|
|
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"));
|
|
6529
6562
|
} else {
|
|
6530
6563
|
const template = TEMPLATES[templateKey];
|
|
6531
6564
|
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|
package/dist/cli/index.js
CHANGED
|
@@ -6508,7 +6508,7 @@ async function createProjectCommand() {
|
|
|
6508
6508
|
mkdirSync(resolve(projectDir, "plugins"), { recursive: true });
|
|
6509
6509
|
mkdirSync(resolve(projectDir, "apps"), { recursive: true });
|
|
6510
6510
|
const localPluginPath = resolve(localTemplatesRoot, "plugin-development", "starter-plugin");
|
|
6511
|
-
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "
|
|
6511
|
+
const localPlaygroundPath = resolve(localTemplatesRoot, "plugin-development", "playground");
|
|
6512
6512
|
if (existsSync2(localPluginPath) && existsSync2(localPlaygroundPath)) {
|
|
6513
6513
|
cpSync(localPluginPath, resolve(projectDir, "plugins", "starter-plugin"), { recursive: true });
|
|
6514
6514
|
cpSync(localPlaygroundPath, resolve(projectDir, "apps", "playground"), { recursive: true });
|
|
@@ -6518,7 +6518,7 @@ async function createProjectCommand() {
|
|
|
6518
6518
|
dir: resolve(projectDir, "plugins/starter-plugin"),
|
|
6519
6519
|
force: true
|
|
6520
6520
|
});
|
|
6521
|
-
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/
|
|
6521
|
+
await downloadTemplate("github:fhorray/flarecms/templates/plugin-development/playground", {
|
|
6522
6522
|
dir: resolve(projectDir, "apps/playground"),
|
|
6523
6523
|
force: true
|
|
6524
6524
|
});
|
|
@@ -6526,7 +6526,40 @@ async function createProjectCommand() {
|
|
|
6526
6526
|
throw new Error(`Failed to download plugin templates: ${err instanceof Error ? err.message : String(err)}`);
|
|
6527
6527
|
}
|
|
6528
6528
|
}
|
|
6529
|
-
|
|
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"));
|
|
6530
6563
|
} else {
|
|
6531
6564
|
const template = TEMPLATES[templateKey];
|
|
6532
6565
|
const localTemplatePath = resolve(localTemplatesRoot, template.dir.split("/").pop() || "");
|