@nextsparkjs/cli 0.1.0-beta.45 → 0.1.0-beta.46

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.
Files changed (2) hide show
  1. package/dist/cli.js +39 -0
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1634,6 +1634,44 @@ async function updatePermissionsConfig(config2) {
1634
1634
  });
1635
1635
  await fs2.writeFile(permissionsConfigPath, content, "utf-8");
1636
1636
  }
1637
+ async function updateEntityPermissions(config2) {
1638
+ const permissionsConfigPath = path2.join(
1639
+ getTargetThemesDir2(),
1640
+ config2.projectSlug,
1641
+ "config",
1642
+ "permissions.config.ts"
1643
+ );
1644
+ if (!await fs2.pathExists(permissionsConfigPath)) {
1645
+ return;
1646
+ }
1647
+ let content = await fs2.readFile(permissionsConfigPath, "utf-8");
1648
+ if (config2.contentFeatures.pages) {
1649
+ content = uncommentPermissionBlock(content, "PAGES");
1650
+ }
1651
+ if (config2.contentFeatures.blog) {
1652
+ content = uncommentPermissionBlock(content, "POSTS");
1653
+ }
1654
+ await fs2.writeFile(permissionsConfigPath, content, "utf-8");
1655
+ }
1656
+ function uncommentPermissionBlock(content, markerName) {
1657
+ const startMarker = `// __${markerName}_PERMISSIONS_START__`;
1658
+ const endMarker = `// __${markerName}_PERMISSIONS_END__`;
1659
+ const startIndex = content.indexOf(startMarker);
1660
+ const endIndex = content.indexOf(endMarker);
1661
+ if (startIndex === -1 || endIndex === -1) {
1662
+ return content;
1663
+ }
1664
+ const beforeBlock = content.slice(0, startIndex);
1665
+ const block = content.slice(startIndex + startMarker.length, endIndex);
1666
+ const afterBlock = content.slice(endIndex + endMarker.length);
1667
+ const uncommentedBlock = block.split("\n").map((line) => {
1668
+ if (line.match(/^\s*\/\/\s+/)) {
1669
+ return line.replace(/^(\s*)\/\/\s*/, "$1");
1670
+ }
1671
+ return line;
1672
+ }).join("\n");
1673
+ return beforeBlock + uncommentedBlock + afterBlock;
1674
+ }
1637
1675
  async function updateDashboardConfig(config2) {
1638
1676
  const dashboardConfigPath = path2.join(
1639
1677
  getTargetThemesDir2(),
@@ -2467,6 +2505,7 @@ async function generateProject(config2) {
2467
2505
  await updateMigrations(config2);
2468
2506
  await updateTestFiles(config2);
2469
2507
  await updatePermissionsConfig(config2);
2508
+ await updateEntityPermissions(config2);
2470
2509
  await updateDashboardConfig(config2);
2471
2510
  await updateAuthConfig(config2);
2472
2511
  await updateDashboardUIConfig(config2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextsparkjs/cli",
3
- "version": "0.1.0-beta.45",
3
+ "version": "0.1.0-beta.46",
4
4
  "description": "NextSpark CLI - Complete development toolkit",
5
5
  "type": "module",
6
6
  "bin": {