superslate 0.1.0 → 0.2.0

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 +26 -29
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ import { dirname, join as join2, resolve } from "node:path";
62
62
 
63
63
  // src/runtime.ts
64
64
  import { spawn } from "node:child_process";
65
- import { accessSync, constants } from "node:fs";
65
+ import { accessSync, constants, realpathSync } from "node:fs";
66
66
  import { delimiter, join, resolve as resolvePath } from "node:path";
67
67
  function runCaptured(command, options) {
68
68
  const [file, ...args] = command;
@@ -770,6 +770,7 @@ Dispatch .github/workflows/deploy-cloud.yml`);
770
770
 
771
771
  // src/runtime.ts
772
772
  import { spawn as spawn2 } from "node:child_process";
773
+ import { accessSync as accessSync2, constants as constants2, realpathSync as realpathSync2 } from "node:fs";
773
774
  import { delimiter as delimiter2, join as join4, resolve as resolvePath2 } from "node:path";
774
775
  import { fileURLToPath } from "node:url";
775
776
  function runCaptured2(command, options) {
@@ -814,12 +815,19 @@ function runInherited(command, options) {
814
815
  });
815
816
  });
816
817
  }
818
+ function canonicalPath(path) {
819
+ try {
820
+ return realpathSync2(path);
821
+ } catch {
822
+ return resolvePath2(path);
823
+ }
824
+ }
817
825
  function isEntrypoint(moduleUrl) {
818
826
  const entry = process.argv[1];
819
827
  if (!entry)
820
828
  return false;
821
829
  try {
822
- return resolvePath2(fileURLToPath(moduleUrl)) === resolvePath2(entry);
830
+ return canonicalPath(fileURLToPath(moduleUrl)) === canonicalPath(entry);
823
831
  } catch {
824
832
  return false;
825
833
  }
@@ -1133,7 +1141,7 @@ var BRAND_MANIFEST = [
1133
1141
  { path: "apps/web/src/configs/config.ts", occurrences: 2 },
1134
1142
  { path: "apps/web/index.html", occurrences: 4 },
1135
1143
  { path: "apps/web/public/favicon/site.webmanifest", occurrences: 2 },
1136
- { path: "apps/web/public/offline.html", occurrences: 2 },
1144
+ { path: "apps/web/public/offline.html", occurrences: 6 },
1137
1145
  { path: "apps/docs/lib/shared.ts", occurrences: 1 },
1138
1146
  { path: "apps/server/.env.example", occurrences: 1 },
1139
1147
  { path: "apps/server/src/config/env.ts", occurrences: 2 },
@@ -1333,10 +1341,10 @@ function removeParagraphContaining(content, fragment) {
1333
1341
  `);
1334
1342
  }
1335
1343
  function rewriteBuyerAgentInstructions(content) {
1336
- if (content.includes("Audit and remediate the complete buyer-owned SaaS application") && !/landing\/|seller-surface|studio-owned/i.test(content)) {
1344
+ if (content.includes("Audit and remediate the complete buyer-owned SaaS application") && !/internal\/|landing\/|seller-surface|studio-owned/i.test(content)) {
1337
1345
  return content;
1338
1346
  }
1339
- let rewritten = removeParagraphContaining(content, "`landing/` is the source repository's commercial sales application");
1347
+ let rewritten = removeParagraphContaining(content, "`internal/` holds every seller-only surface");
1340
1348
  rewritten = removeParagraphContaining(rewritten, "The root pnpm workspace includes only `apps/*` and `packages/*`.");
1341
1349
  rewritten = replaceMarkdownSection(rewritten, "Product security audit scope", `## Product security audit scope
1342
1350
 
@@ -1349,18 +1357,18 @@ into this repository.
1349
1357
  `);
1350
1358
  rewritten = replaceMarkdownSection(rewritten, "Landing boundary", "");
1351
1359
  rewritten = rewritten.split(`
1352
- `).filter((line) => !line.includes("| `landing`")).join(`
1353
- `).replace("real env files, `landing/`, or\n `bun.lock`", "real env files, or `bun.lock`");
1354
- if (/landing\/|seller-surface|studio-owned/i.test(rewritten)) {
1360
+ `).filter((line) => !line.includes("| `internal`")).join(`
1361
+ `).replace("real env files, `internal/`, or\n `bun.lock`", "real env files, or `bun.lock`");
1362
+ if (/internal\/|landing\/|seller-surface|studio-owned/i.test(rewritten)) {
1355
1363
  throw new Error("Buyer agent instructions still contain seller-only guidance.");
1356
1364
  }
1357
1365
  return rewritten;
1358
1366
  }
1359
1367
  function rewriteBuyerClaudeInstructions(content) {
1360
- if (!/landing\/|studio-owned/i.test(content))
1368
+ if (!/internal\/|landing\/|studio-owned/i.test(content))
1361
1369
  return content;
1362
- const rewritten = removeParagraphContaining(content, "`landing/AGENTS.md`");
1363
- if (/landing\/|studio-owned/i.test(rewritten)) {
1370
+ const rewritten = removeParagraphContaining(content, "`internal/landing/AGENTS.md`");
1371
+ if (/internal\/|landing\/|studio-owned/i.test(rewritten)) {
1364
1372
  throw new Error("Buyer Claude instructions still contain seller-only guidance.");
1365
1373
  }
1366
1374
  return rewritten;
@@ -1416,14 +1424,12 @@ function isTemplatePathExcluded(relativePath) {
1416
1424
  return true;
1417
1425
  if (normalized === "skills-lock.json")
1418
1426
  return true;
1419
- if (normalized === "operations" || normalized.startsWith("operations/"))
1427
+ if (normalized === "internal" || normalized.startsWith("internal/"))
1420
1428
  return true;
1421
1429
  if (normalized === "apps/worker" || normalized.startsWith("apps/worker/"))
1422
1430
  return true;
1423
1431
  if (parts.includes("dist") || parts.includes("out"))
1424
1432
  return true;
1425
- if (normalized === "landing" || normalized.startsWith("landing/"))
1426
- return true;
1427
1433
  if (normalized === "bun.lock")
1428
1434
  return true;
1429
1435
  if (normalized === ".vercelignore")
@@ -1440,10 +1446,6 @@ function isTemplatePathExcluded(relativePath) {
1440
1446
  return true;
1441
1447
  if (normalized === "packages/create-app/README.md")
1442
1448
  return true;
1443
- if (normalized === "docs/phase2" || normalized.startsWith("docs/phase2/"))
1444
- return true;
1445
- if (/^docs\/evaluations\/(?:tec|pro2)-[^/]+\.md$/.test(normalized))
1446
- return true;
1447
1449
  if (normalized === "apps/server/server")
1448
1450
  return true;
1449
1451
  if (basename.endsWith(".tsbuildinfo"))
@@ -1593,9 +1595,6 @@ async function applyScopeRewrite(target, scope) {
1593
1595
  if (result.replacements > 0 && (path.endsWith(".ts") || path.endsWith(".tsx"))) {
1594
1596
  result.content = wrapLongNamedImports(result.content);
1595
1597
  }
1596
- if (result.replacements > 0 && path.endsWith("/apps/docs/README.md")) {
1597
- result.content = result.content.replace("root workspace filter: `pnpm", "root workspace filter:\n`pnpm").replace("<command>`.\nThe product deployment", "<command>`. The product deployment").replace("not deploy this Next.js application. See `docs/docs-site.md`\nfor publication", "not deploy this\nNext.js application. See `docs/docs-site.md` for publication");
1598
- }
1599
1598
  return result;
1600
1599
  });
1601
1600
  if (replacements > 0)
@@ -1654,29 +1653,27 @@ async function neutralizeSourceCli(target, scope, brandName) {
1654
1653
  if (cliPackage.name !== CLI_PACKAGE_NAME || !cliPackage.bin?.[CLI_NAME2]) {
1655
1654
  throw new Error(`Source CLI package must expose ${CLI_PACKAGE_NAME} as ${CLI_NAME2}.`);
1656
1655
  }
1657
- const executable = cliPackage.bin[CLI_NAME2];
1658
- cliPackage.name = BUYER_CLI_PACKAGE_NAME;
1659
- cliPackage.private = true;
1660
- cliPackage.bin = { [BUYER_CLI_NAME]: executable };
1656
+ cliPackage.bin = { [BUYER_CLI_NAME]: "./src/cli.ts" };
1661
1657
  delete cliPackage.description;
1662
1658
  delete cliPackage.homepage;
1663
1659
  delete cliPackage.repository;
1664
1660
  delete cliPackage.keywords;
1665
1661
  delete cliPackage.files;
1666
1662
  delete cliPackage.publishConfig;
1667
- await writeFile4(cliPackagePath, `${JSON.stringify(cliPackage, null, 2)}
1663
+ const { name: _sourceName, version: cliVersion, ...cliPackageRemainder } = cliPackage;
1664
+ await writeFile4(cliPackagePath, `${JSON.stringify({ name: BUYER_CLI_PACKAGE_NAME, version: cliVersion, private: true, ...cliPackageRemainder }, null, 2)}
1668
1665
  `);
1669
1666
  const constantsPath = join6(target, "packages/create-app/src/constants.ts");
1670
- const constants2 = await readFile5(constantsPath, "utf8");
1667
+ const constants3 = await readFile5(constantsPath, "utf8");
1671
1668
  const cliDeclaration = `export const CLI_NAME = '${CLI_NAME2}'`;
1672
1669
  const packageDeclaration = `export const CLI_PACKAGE_NAME = '${CLI_PACKAGE_NAME}'`;
1673
1670
  const scopeDeclaration = `export const DEFAULT_SCOPE = '@app'`;
1674
1671
  const repositoryDeclaration = `export const TEMPLATE_REPOSITORY = '${TEMPLATE_REPOSITORY}'`;
1675
1672
  const brandDeclaration = `export const SOURCE_BRAND_NAME = '${SOURCE_BRAND_NAME}'`;
1676
- if (!constants2.includes(cliDeclaration) || !constants2.includes(packageDeclaration) || !constants2.includes(scopeDeclaration) || !constants2.includes(repositoryDeclaration) || !constants2.includes(brandDeclaration)) {
1673
+ if (!constants3.includes(cliDeclaration) || !constants3.includes(packageDeclaration) || !constants3.includes(scopeDeclaration) || !constants3.includes(repositoryDeclaration) || !constants3.includes(brandDeclaration)) {
1677
1674
  throw new Error("Source CLI constants do not match the package identity.");
1678
1675
  }
1679
- await writeFile4(constantsPath, constants2.replace(cliDeclaration, `export const CLI_NAME = '${BUYER_CLI_NAME}'`).replace(packageDeclaration, `export const CLI_PACKAGE_NAME = '${BUYER_CLI_PACKAGE_NAME}'`).replace(scopeDeclaration, `export const DEFAULT_SCOPE = '${normalizeScope2(scope)}'`).replace(repositoryDeclaration, "export const TEMPLATE_REPOSITORY = 'OWNER/REPOSITORY'").replace(brandDeclaration, `export const SOURCE_BRAND_NAME = '${brandName}'`));
1676
+ await writeFile4(constantsPath, constants3.replace(cliDeclaration, `export const CLI_NAME = '${BUYER_CLI_NAME}'`).replace(packageDeclaration, `export const CLI_PACKAGE_NAME = '${BUYER_CLI_PACKAGE_NAME}'`).replace(scopeDeclaration, `export const DEFAULT_SCOPE = '${normalizeScope2(scope)}'`).replace(repositoryDeclaration, "export const TEMPLATE_REPOSITORY = 'OWNER/REPOSITORY'").replace(brandDeclaration, `export const SOURCE_BRAND_NAME = '${brandName}'`));
1680
1677
  const brandingPath = join6(target, "docs/golden-paths/customize-branding-design-tokens.md");
1681
1678
  const branding = await readFile5(brandingPath, "utf8");
1682
1679
  await writeFile4(brandingPath, branding.replaceAll(`pnpm ${CLI_NAME2}`, `pnpm ${BUYER_CLI_NAME}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superslate",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Create a production-oriented SaaS application from superslate.",
5
5
  "keywords": [
6
6
  "bun",