flarecms 0.2.7 → 0.2.8
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 +45 -17
- 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
|