lism-cli 0.4.2 → 0.5.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.
- package/dist/{chunk-J2T5ZPMR.js → chunk-USFIDRTL.js} +120 -32
- package/dist/index.js +1 -1
- package/dist/lib.js +1 -1
- package/package.json +1 -1
|
@@ -547,8 +547,8 @@ var logger = {
|
|
|
547
547
|
};
|
|
548
548
|
|
|
549
549
|
// src/version.ts
|
|
550
|
-
var LISM_CSS_VERSION = "0.
|
|
551
|
-
var CLI_VERSION = "0.
|
|
550
|
+
var LISM_CSS_VERSION = "0.21.0" ? "0.21.0" : "unknown";
|
|
551
|
+
var CLI_VERSION = "0.5.0" ? "0.5.0" : "unknown";
|
|
552
552
|
|
|
553
553
|
// src/constants.ts
|
|
554
554
|
var SOURCE_REPO = "lism-css/lism-css";
|
|
@@ -593,7 +593,11 @@ var TEMPLATES = [
|
|
|
593
593
|
sourcePath: "blog/astro/minimal",
|
|
594
594
|
title: { ja: "Blog Minimal", en: "Blog Minimal" },
|
|
595
595
|
description: { ja: "\u8A18\u4E8B\u4E00\u89A7 / \u8A73\u7D30 / Tags \u306E\u307F\u306E\u6700\u5C0F\u69CB\u6210\u306E Astro \u30D6\u30ED\u30B0", en: "Minimal Astro blog with posts and tags only" },
|
|
596
|
-
previewUrl: "https://lism-blog-astro-minimal.pages.dev/"
|
|
596
|
+
previewUrl: "https://lism-blog-astro-minimal.pages.dev/",
|
|
597
|
+
features: {
|
|
598
|
+
ja: ["\u30BF\u30B0", "sitemap"],
|
|
599
|
+
en: ["Tags", "sitemap"]
|
|
600
|
+
}
|
|
597
601
|
},
|
|
598
602
|
{
|
|
599
603
|
slug: "blog-astro-personal",
|
|
@@ -608,7 +612,11 @@ var TEMPLATES = [
|
|
|
608
612
|
ja: "\u500B\u4EBA\u30D6\u30ED\u30B0\u30FB\u30A8\u30C3\u30BB\u30A4\u5411\u3051\u3002\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u3064\u304D\u306E\u843D\u3061\u7740\u3044\u305F Astro \u30D6\u30ED\u30B0",
|
|
609
613
|
en: "Personal / essay-style Astro blog with monthly archives"
|
|
610
614
|
},
|
|
611
|
-
previewUrl: "https://lism-blog-astro-personal.pages.dev/"
|
|
615
|
+
previewUrl: "https://lism-blog-astro-personal.pages.dev/",
|
|
616
|
+
features: {
|
|
617
|
+
ja: ["\u30BF\u30B0", "\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6", "\u30B7\u30A7\u30A2\u30DC\u30BF\u30F3", "OGP\u753B\u50CF\u81EA\u52D5\u751F\u6210", "sitemap\uFF08lastmod \u5BFE\u5FDC\uFF09"],
|
|
618
|
+
en: ["Tags", "Monthly archives", "Share buttons", "Auto-generated OG images", "sitemap (with lastmod)"]
|
|
619
|
+
}
|
|
612
620
|
},
|
|
613
621
|
{
|
|
614
622
|
slug: "blog-astro-techlog",
|
|
@@ -623,31 +631,55 @@ var TEMPLATES = [
|
|
|
623
631
|
ja: "\u6280\u8853\u30D6\u30ED\u30B0\u5411\u3051\u3002\u30B3\u30FC\u30C9\u30CF\u30A4\u30E9\u30A4\u30C8\u30FB\u30AB\u30C6\u30B4\u30EA\u30FB\u30BF\u30B0\u30FBTOC\u30FB\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u30FB\u691C\u7D22\u3092\u88C5\u5099\u3057\u305F Astro \u30D6\u30ED\u30B0",
|
|
624
632
|
en: "Tech blog with code highlighting, categories, tags, TOC, monthly archives and search"
|
|
625
633
|
},
|
|
626
|
-
previewUrl: "https://lism-blog-astro-techlog.pages.dev/"
|
|
634
|
+
previewUrl: "https://lism-blog-astro-techlog.pages.dev/",
|
|
635
|
+
features: {
|
|
636
|
+
ja: [
|
|
637
|
+
"\u30AB\u30C6\u30B4\u30EA / \u30BF\u30B0",
|
|
638
|
+
"\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6",
|
|
639
|
+
"\u691C\u7D22\uFF08Pagefind\uFF09",
|
|
640
|
+
"\u76EE\u6B21",
|
|
641
|
+
"\u30B3\u30FC\u30C9\u30CF\u30A4\u30E9\u30A4\u30C8",
|
|
642
|
+
"\u30C0\u30FC\u30AF\u30E2\u30FC\u30C9",
|
|
643
|
+
"\u30B7\u30A7\u30A2\u30DC\u30BF\u30F3",
|
|
644
|
+
"OGP\u753B\u50CF\u81EA\u52D5\u751F\u6210",
|
|
645
|
+
"sitemap\uFF08lastmod \u5BFE\u5FDC\uFF09"
|
|
646
|
+
],
|
|
647
|
+
en: [
|
|
648
|
+
"Categories / Tags",
|
|
649
|
+
"Monthly archives",
|
|
650
|
+
"Search (Pagefind)",
|
|
651
|
+
"Table of contents",
|
|
652
|
+
"Code highlighting",
|
|
653
|
+
"Dark mode",
|
|
654
|
+
"Share buttons",
|
|
655
|
+
"Auto-generated OG images",
|
|
656
|
+
"sitemap (with lastmod)"
|
|
657
|
+
]
|
|
658
|
+
}
|
|
627
659
|
},
|
|
628
660
|
{
|
|
629
|
-
slug: "lp-astro-
|
|
661
|
+
slug: "lp-astro-corporate",
|
|
630
662
|
kind: "single-project-variant",
|
|
631
663
|
category: "lp",
|
|
632
664
|
stack: "astro",
|
|
633
|
-
variant: "
|
|
634
|
-
variantLabel: { ja: "
|
|
665
|
+
variant: "corporate",
|
|
666
|
+
variantLabel: { ja: "Corporate", en: "Corporate" },
|
|
635
667
|
sourcePath: "lp/astro",
|
|
636
|
-
title: { ja: "LP
|
|
637
|
-
description: { ja: "\
|
|
638
|
-
|
|
668
|
+
title: { ja: "LP Corporate", en: "LP Corporate" },
|
|
669
|
+
description: { ja: "\u30B3\u30FC\u30DD\u30EC\u30FC\u30C8\u30B5\u30A4\u30C8\u5411\u3051\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Astro landing page for corporate sites" },
|
|
670
|
+
previewUrl: "https://lism-lp-astro.pages.dev/corporate/"
|
|
639
671
|
},
|
|
640
672
|
{
|
|
641
|
-
slug: "lp-astro-
|
|
673
|
+
slug: "lp-astro-interior",
|
|
642
674
|
kind: "single-project-variant",
|
|
643
675
|
category: "lp",
|
|
644
676
|
stack: "astro",
|
|
645
|
-
variant: "
|
|
646
|
-
variantLabel: { ja: "
|
|
677
|
+
variant: "interior",
|
|
678
|
+
variantLabel: { ja: "Interior", en: "Interior" },
|
|
647
679
|
sourcePath: "lp/astro",
|
|
648
|
-
title: { ja: "LP
|
|
649
|
-
description: { ja: "\
|
|
650
|
-
|
|
680
|
+
title: { ja: "LP Interior", en: "LP Interior" },
|
|
681
|
+
description: { ja: "\u30A4\u30F3\u30C6\u30EA\u30A2\u30FB\u66AE\u3089\u3057\u7CFB\u30B5\u30FC\u30D3\u30B9\u5411\u3051\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Astro landing page for interior / lifestyle services" },
|
|
682
|
+
previewUrl: "https://lism-lp-astro.pages.dev/interior/"
|
|
651
683
|
},
|
|
652
684
|
{
|
|
653
685
|
slug: "lp-astro-ryokan",
|
|
@@ -824,7 +856,7 @@ function postProcessTemplate(projectDir, tpl) {
|
|
|
824
856
|
rewritePackageName(projectDir, tpl.slug);
|
|
825
857
|
}
|
|
826
858
|
if (tpl.kind === "single-project-variant") {
|
|
827
|
-
|
|
859
|
+
extractVariantFiles(projectDir, tpl);
|
|
828
860
|
rewritePackageName(projectDir, tpl.packageName ?? tpl.slug);
|
|
829
861
|
}
|
|
830
862
|
cleanupDevArtifacts(projectDir);
|
|
@@ -840,28 +872,84 @@ function cleanupDevArtifacts(projectDir) {
|
|
|
840
872
|
fs.rmSync(screenshotsConfig, { force: true });
|
|
841
873
|
}
|
|
842
874
|
}
|
|
843
|
-
function
|
|
844
|
-
const
|
|
845
|
-
const
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
if (!fs.existsSync(variantIndex)) {
|
|
875
|
+
function extractVariantFiles(projectDir, tpl) {
|
|
876
|
+
const srcDir = path.join(projectDir, "src");
|
|
877
|
+
const variant = tpl.variant;
|
|
878
|
+
const pagesVariantIndex = path.join(srcDir, "pages", variant, "index.astro");
|
|
879
|
+
if (!fs.existsSync(pagesVariantIndex)) {
|
|
849
880
|
throw new Error(
|
|
850
881
|
t("create.variantMissing", {
|
|
851
|
-
variant
|
|
852
|
-
path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${
|
|
882
|
+
variant,
|
|
883
|
+
path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${variant}/index.astro`
|
|
853
884
|
})
|
|
854
885
|
);
|
|
855
886
|
}
|
|
856
|
-
if (fs.existsSync(
|
|
857
|
-
|
|
858
|
-
}
|
|
859
|
-
fs.renameSync(variantIndex, targetIndex);
|
|
860
|
-
for (const entry of fs.readdirSync(pagesDir, { withFileTypes: true })) {
|
|
887
|
+
if (!fs.existsSync(srcDir) || !fs.statSync(srcDir).isDirectory()) return;
|
|
888
|
+
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
861
889
|
if (!entry.isDirectory()) continue;
|
|
862
|
-
|
|
890
|
+
const parentDir = path.join(srcDir, entry.name);
|
|
891
|
+
const variantDirInside = path.join(parentDir, variant);
|
|
892
|
+
if (!fs.existsSync(variantDirInside)) continue;
|
|
893
|
+
if (!fs.statSync(variantDirInside).isDirectory()) continue;
|
|
894
|
+
mergeDirectory(variantDirInside, parentDir);
|
|
895
|
+
for (const child of fs.readdirSync(parentDir, { withFileTypes: true })) {
|
|
896
|
+
if (!child.isDirectory()) continue;
|
|
897
|
+
fs.rmSync(path.join(parentDir, child.name), { recursive: true, force: true });
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
rewriteVariantAliasImports(srcDir, variant);
|
|
901
|
+
}
|
|
902
|
+
var ALIAS_REWRITE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
903
|
+
".astro",
|
|
904
|
+
".ts",
|
|
905
|
+
".tsx",
|
|
906
|
+
".js",
|
|
907
|
+
".jsx",
|
|
908
|
+
".mjs",
|
|
909
|
+
".cjs",
|
|
910
|
+
".css",
|
|
911
|
+
".scss",
|
|
912
|
+
".sass",
|
|
913
|
+
".less",
|
|
914
|
+
".md",
|
|
915
|
+
".mdx",
|
|
916
|
+
".vue",
|
|
917
|
+
".svelte",
|
|
918
|
+
".html"
|
|
919
|
+
]);
|
|
920
|
+
function rewriteVariantAliasImports(srcDir, variant) {
|
|
921
|
+
if (!fs.existsSync(srcDir)) return;
|
|
922
|
+
const pattern = new RegExp(`(@/[^/'"\\s\`]+)/${escapeRegExp(variant)}/`, "g");
|
|
923
|
+
walkFiles(srcDir, (filePath) => {
|
|
924
|
+
const ext = path.extname(filePath);
|
|
925
|
+
if (!ALIAS_REWRITE_EXTENSIONS.has(ext)) return;
|
|
926
|
+
let original;
|
|
927
|
+
try {
|
|
928
|
+
original = fs.readFileSync(filePath, "utf-8");
|
|
929
|
+
} catch {
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
if (!original.includes(`/${variant}/`)) return;
|
|
933
|
+
const replaced = original.replace(pattern, "$1/");
|
|
934
|
+
if (replaced !== original) {
|
|
935
|
+
fs.writeFileSync(filePath, replaced);
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
function walkFiles(dir, callback) {
|
|
940
|
+
if (!fs.existsSync(dir)) return;
|
|
941
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
942
|
+
const fp = path.join(dir, entry.name);
|
|
943
|
+
if (entry.isDirectory()) {
|
|
944
|
+
walkFiles(fp, callback);
|
|
945
|
+
} else if (entry.isFile()) {
|
|
946
|
+
callback(fp);
|
|
947
|
+
}
|
|
863
948
|
}
|
|
864
949
|
}
|
|
950
|
+
function escapeRegExp(s) {
|
|
951
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
952
|
+
}
|
|
865
953
|
function printNextSteps(projectDir, tpl) {
|
|
866
954
|
logger.heading(t("create.nextSteps"));
|
|
867
955
|
const rel = path.relative(process.cwd(), projectDir) || ".";
|
package/dist/index.js
CHANGED
package/dist/lib.js
CHANGED