superslate 0.1.0 → 0.1.1
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.js +13 -5
- 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
|
|
830
|
+
return canonicalPath(fileURLToPath(moduleUrl)) === canonicalPath(entry);
|
|
823
831
|
} catch {
|
|
824
832
|
return false;
|
|
825
833
|
}
|
|
@@ -1667,16 +1675,16 @@ async function neutralizeSourceCli(target, scope, brandName) {
|
|
|
1667
1675
|
await writeFile4(cliPackagePath, `${JSON.stringify(cliPackage, null, 2)}
|
|
1668
1676
|
`);
|
|
1669
1677
|
const constantsPath = join6(target, "packages/create-app/src/constants.ts");
|
|
1670
|
-
const
|
|
1678
|
+
const constants3 = await readFile5(constantsPath, "utf8");
|
|
1671
1679
|
const cliDeclaration = `export const CLI_NAME = '${CLI_NAME2}'`;
|
|
1672
1680
|
const packageDeclaration = `export const CLI_PACKAGE_NAME = '${CLI_PACKAGE_NAME}'`;
|
|
1673
1681
|
const scopeDeclaration = `export const DEFAULT_SCOPE = '@app'`;
|
|
1674
1682
|
const repositoryDeclaration = `export const TEMPLATE_REPOSITORY = '${TEMPLATE_REPOSITORY}'`;
|
|
1675
1683
|
const brandDeclaration = `export const SOURCE_BRAND_NAME = '${SOURCE_BRAND_NAME}'`;
|
|
1676
|
-
if (!
|
|
1684
|
+
if (!constants3.includes(cliDeclaration) || !constants3.includes(packageDeclaration) || !constants3.includes(scopeDeclaration) || !constants3.includes(repositoryDeclaration) || !constants3.includes(brandDeclaration)) {
|
|
1677
1685
|
throw new Error("Source CLI constants do not match the package identity.");
|
|
1678
1686
|
}
|
|
1679
|
-
await writeFile4(constantsPath,
|
|
1687
|
+
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
1688
|
const brandingPath = join6(target, "docs/golden-paths/customize-branding-design-tokens.md");
|
|
1681
1689
|
const branding = await readFile5(brandingPath, "utf8");
|
|
1682
1690
|
await writeFile4(brandingPath, branding.replaceAll(`pnpm ${CLI_NAME2}`, `pnpm ${BUYER_CLI_NAME}`));
|