flarecms 0.2.7 → 0.2.9
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 +45 -17
- package/dist/cli/index.js +69 -18
- package/package.json +1 -1
package/dist/cli/commands.js
CHANGED
|
@@ -6701,28 +6701,56 @@ async function createPluginCommand() {
|
|
|
6701
6701
|
"{{PLUGIN_PACKAGE_NAME}}": pluginPackageName,
|
|
6702
6702
|
"{{PLAYGROUND_NAME}}": playgroundName
|
|
6703
6703
|
};
|
|
6704
|
-
const
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6704
|
+
const TEXT_EXTENSIONS = new Set([
|
|
6705
|
+
".ts",
|
|
6706
|
+
".tsx",
|
|
6707
|
+
".js",
|
|
6708
|
+
".jsx",
|
|
6709
|
+
".json",
|
|
6710
|
+
".html",
|
|
6711
|
+
".css",
|
|
6712
|
+
".md",
|
|
6713
|
+
".txt",
|
|
6714
|
+
".toml",
|
|
6715
|
+
".jsonc",
|
|
6716
|
+
".env",
|
|
6717
|
+
".env.example"
|
|
6718
|
+
]);
|
|
6719
|
+
const patchFile = (filePath) => {
|
|
6720
|
+
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
6721
|
+
if (!TEXT_EXTENSIONS.has(ext))
|
|
6722
|
+
return;
|
|
6723
|
+
let content = readFileSync(filePath, "utf-8");
|
|
6724
|
+
for (const [key, value] of Object.entries(placeholders)) {
|
|
6725
|
+
content = content.replaceAll(key, value);
|
|
6726
|
+
}
|
|
6727
|
+
if (ext === ".json" && filePath.endsWith("package.json")) {
|
|
6728
|
+
try {
|
|
6729
|
+
const pkg = JSON.parse(content);
|
|
6730
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
6731
|
+
if (pkg[field]?.["flarecms"] === "workspace:*") {
|
|
6732
|
+
pkg[field]["flarecms"] = "latest";
|
|
6717
6733
|
}
|
|
6718
6734
|
}
|
|
6719
|
-
|
|
6720
|
-
|
|
6735
|
+
content = JSON.stringify(pkg, null, 2) + `
|
|
6736
|
+
`;
|
|
6737
|
+
} catch {}
|
|
6738
|
+
}
|
|
6739
|
+
writeFileSync(filePath, content);
|
|
6740
|
+
};
|
|
6741
|
+
const patchDir = (dir) => {
|
|
6742
|
+
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
6743
|
+
const full = resolve(dir, entry.name);
|
|
6744
|
+
if (entry.isDirectory()) {
|
|
6745
|
+
if (entry.name !== "node_modules" && entry.name !== ".git")
|
|
6746
|
+
patchDir(full);
|
|
6747
|
+
} else {
|
|
6748
|
+
patchFile(full);
|
|
6721
6749
|
}
|
|
6722
6750
|
}
|
|
6723
6751
|
};
|
|
6724
|
-
|
|
6725
|
-
|
|
6752
|
+
patchDir(paths.targetPlugin);
|
|
6753
|
+
patchDir(paths.targetPlayground);
|
|
6726
6754
|
s3.stop("Plugin created!");
|
|
6727
6755
|
wt(`cd apps/${playgroundName}
|
|
6728
6756
|
bun install
|
package/dist/cli/index.js
CHANGED
|
@@ -6702,28 +6702,56 @@ async function createPluginCommand() {
|
|
|
6702
6702
|
"{{PLUGIN_PACKAGE_NAME}}": pluginPackageName,
|
|
6703
6703
|
"{{PLAYGROUND_NAME}}": playgroundName
|
|
6704
6704
|
};
|
|
6705
|
-
const
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6705
|
+
const TEXT_EXTENSIONS = new Set([
|
|
6706
|
+
".ts",
|
|
6707
|
+
".tsx",
|
|
6708
|
+
".js",
|
|
6709
|
+
".jsx",
|
|
6710
|
+
".json",
|
|
6711
|
+
".html",
|
|
6712
|
+
".css",
|
|
6713
|
+
".md",
|
|
6714
|
+
".txt",
|
|
6715
|
+
".toml",
|
|
6716
|
+
".jsonc",
|
|
6717
|
+
".env",
|
|
6718
|
+
".env.example"
|
|
6719
|
+
]);
|
|
6720
|
+
const patchFile = (filePath) => {
|
|
6721
|
+
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
6722
|
+
if (!TEXT_EXTENSIONS.has(ext))
|
|
6723
|
+
return;
|
|
6724
|
+
let content = readFileSync(filePath, "utf-8");
|
|
6725
|
+
for (const [key, value] of Object.entries(placeholders)) {
|
|
6726
|
+
content = content.replaceAll(key, value);
|
|
6727
|
+
}
|
|
6728
|
+
if (ext === ".json" && filePath.endsWith("package.json")) {
|
|
6729
|
+
try {
|
|
6730
|
+
const pkg = JSON.parse(content);
|
|
6731
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
6732
|
+
if (pkg[field]?.["flarecms"] === "workspace:*") {
|
|
6733
|
+
pkg[field]["flarecms"] = "latest";
|
|
6718
6734
|
}
|
|
6719
6735
|
}
|
|
6720
|
-
|
|
6721
|
-
|
|
6736
|
+
content = JSON.stringify(pkg, null, 2) + `
|
|
6737
|
+
`;
|
|
6738
|
+
} catch {}
|
|
6739
|
+
}
|
|
6740
|
+
writeFileSync(filePath, content);
|
|
6741
|
+
};
|
|
6742
|
+
const patchDir = (dir) => {
|
|
6743
|
+
for (const entry of readdirSync2(dir, { withFileTypes: true })) {
|
|
6744
|
+
const full = resolve(dir, entry.name);
|
|
6745
|
+
if (entry.isDirectory()) {
|
|
6746
|
+
if (entry.name !== "node_modules" && entry.name !== ".git")
|
|
6747
|
+
patchDir(full);
|
|
6748
|
+
} else {
|
|
6749
|
+
patchFile(full);
|
|
6722
6750
|
}
|
|
6723
6751
|
}
|
|
6724
6752
|
};
|
|
6725
|
-
|
|
6726
|
-
|
|
6753
|
+
patchDir(paths.targetPlugin);
|
|
6754
|
+
patchDir(paths.targetPlayground);
|
|
6727
6755
|
s3.stop("Plugin created!");
|
|
6728
6756
|
wt(`cd apps/${playgroundName}
|
|
6729
6757
|
bun install
|
|
@@ -6755,14 +6783,37 @@ async function mcpCommand(args) {
|
|
|
6755
6783
|
}
|
|
6756
6784
|
|
|
6757
6785
|
// src/cli/index.ts
|
|
6786
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
6758
6787
|
import { readFileSync as readFileSync2 } from "fs";
|
|
6759
6788
|
import { resolve as resolve2, dirname } from "path";
|
|
6760
6789
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6761
6790
|
var __dirname2 = dirname(fileURLToPath2(import.meta.url));
|
|
6762
6791
|
var pkg = JSON.parse(readFileSync2(resolve2(__dirname2, "../../package.json"), "utf8"));
|
|
6763
6792
|
var version = pkg.version;
|
|
6793
|
+
function displayHelp() {
|
|
6794
|
+
console.log(`
|
|
6795
|
+
${import_picocolors2.default.bold(import_picocolors2.default.yellow("\u2014 F L A R E C M S \u2014"))} ${import_picocolors2.default.dim(`v${version}`)}
|
|
6796
|
+
`);
|
|
6797
|
+
console.log(` ${import_picocolors2.default.bold("Usage:")} ${import_picocolors2.default.cyan("flarecms")} ${import_picocolors2.default.dim("<command> [options]")}
|
|
6798
|
+
`);
|
|
6799
|
+
console.log(` ${import_picocolors2.default.bold("Commands:")}`);
|
|
6800
|
+
console.log(` ${import_picocolors2.default.cyan("create")} ${import_picocolors2.default.dim("Initialize a new FlareCMS project (default)")}`);
|
|
6801
|
+
console.log(` ${import_picocolors2.default.cyan("plugin create")} ${import_picocolors2.default.dim("Create a new FlareCMS plugin")}`);
|
|
6802
|
+
console.log(` ${import_picocolors2.default.cyan("mcp")} ${import_picocolors2.default.dim("Start the FlareCMS MCP bridge")}`);
|
|
6803
|
+
console.log(` ${import_picocolors2.default.cyan("version")} ${import_picocolors2.default.dim("Show current version")}`);
|
|
6804
|
+
console.log(` ${import_picocolors2.default.cyan("help")} ${import_picocolors2.default.dim("Show this help message")}
|
|
6805
|
+
`);
|
|
6806
|
+
console.log(` ${import_picocolors2.default.bold("Options:")}`);
|
|
6807
|
+
console.log(` ${import_picocolors2.default.cyan("-v, --version")} ${import_picocolors2.default.dim("Show current version")}`);
|
|
6808
|
+
console.log(` ${import_picocolors2.default.cyan("-h, --help")} ${import_picocolors2.default.dim("Show this help message")}
|
|
6809
|
+
`);
|
|
6810
|
+
}
|
|
6764
6811
|
async function main() {
|
|
6765
6812
|
const args = process.argv.slice(2);
|
|
6813
|
+
if (args.includes("-h") || args.includes("--help") || args[0] === "help") {
|
|
6814
|
+
displayHelp();
|
|
6815
|
+
process.exit(0);
|
|
6816
|
+
}
|
|
6766
6817
|
if (args.includes("-v") || args.includes("--version") || args[0] === "version") {
|
|
6767
6818
|
console.log(version);
|
|
6768
6819
|
process.exit(0);
|
|
@@ -6774,7 +6825,7 @@ async function main() {
|
|
|
6774
6825
|
} else if (args.length === 0 || args[0] === "create") {
|
|
6775
6826
|
await createProjectCommand();
|
|
6776
6827
|
} else {
|
|
6777
|
-
|
|
6828
|
+
displayHelp();
|
|
6778
6829
|
process.exit(1);
|
|
6779
6830
|
}
|
|
6780
6831
|
}
|