lism-cli 0.4.1 → 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-VMIN57OF.js → chunk-USFIDRTL.js} +151 -45
- package/dist/index.js +1 -1
- package/dist/lib.d.ts +2 -2
- package/dist/lib.js +1 -1
- package/package.json +1 -1
|
@@ -130,8 +130,8 @@ var messages = {
|
|
|
130
130
|
en: "Select a variant ({count} options):"
|
|
131
131
|
},
|
|
132
132
|
"create.promptSelectVariant.blog": {
|
|
133
|
-
ja: "\
|
|
134
|
-
en: "Select a
|
|
133
|
+
ja: "\u30BF\u30A4\u30D7\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08{count}\u4EF6\uFF09:",
|
|
134
|
+
en: "Select a type ({count} options):"
|
|
135
135
|
},
|
|
136
136
|
"create.promptSelectVariant.lp": {
|
|
137
137
|
ja: "\u696D\u7A2E\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08{count}\u4EF6\uFF09:",
|
|
@@ -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";
|
|
@@ -584,52 +584,102 @@ var TEMPLATES = [
|
|
|
584
584
|
previewUrl: "https://lism-minimal-vite.pages.dev/"
|
|
585
585
|
},
|
|
586
586
|
{
|
|
587
|
-
slug: "blog-astro-
|
|
587
|
+
slug: "blog-astro-minimal",
|
|
588
588
|
kind: "project",
|
|
589
589
|
category: "blog",
|
|
590
|
-
variant: "
|
|
591
|
-
variantLabel: { ja: "
|
|
590
|
+
variant: "minimal",
|
|
591
|
+
variantLabel: { ja: "Minimal", en: "Minimal" },
|
|
592
592
|
stack: "astro",
|
|
593
|
-
sourcePath: "blog/astro/
|
|
594
|
-
title: { ja: "Blog
|
|
595
|
-
description: { ja: "\
|
|
596
|
-
|
|
593
|
+
sourcePath: "blog/astro/minimal",
|
|
594
|
+
title: { ja: "Blog Minimal", en: "Blog Minimal" },
|
|
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/",
|
|
597
|
+
features: {
|
|
598
|
+
ja: ["\u30BF\u30B0", "sitemap"],
|
|
599
|
+
en: ["Tags", "sitemap"]
|
|
600
|
+
}
|
|
597
601
|
},
|
|
598
602
|
{
|
|
599
|
-
slug: "blog-astro-
|
|
603
|
+
slug: "blog-astro-personal",
|
|
600
604
|
kind: "project",
|
|
601
605
|
category: "blog",
|
|
602
|
-
variant: "
|
|
603
|
-
variantLabel: { ja: "
|
|
606
|
+
variant: "personal",
|
|
607
|
+
variantLabel: { ja: "Personal", en: "Personal" },
|
|
604
608
|
stack: "astro",
|
|
605
|
-
sourcePath: "blog/astro/
|
|
606
|
-
title: { ja: "Blog
|
|
607
|
-
description: {
|
|
608
|
-
|
|
609
|
+
sourcePath: "blog/astro/personal",
|
|
610
|
+
title: { ja: "Blog Personal", en: "Blog Personal" },
|
|
611
|
+
description: {
|
|
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",
|
|
613
|
+
en: "Personal / essay-style Astro blog with monthly archives"
|
|
614
|
+
},
|
|
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
|
+
}
|
|
609
620
|
},
|
|
610
621
|
{
|
|
611
|
-
slug: "
|
|
622
|
+
slug: "blog-astro-techlog",
|
|
623
|
+
kind: "project",
|
|
624
|
+
category: "blog",
|
|
625
|
+
variant: "techlog",
|
|
626
|
+
variantLabel: { ja: "Tech Log", en: "Tech Log" },
|
|
627
|
+
stack: "astro",
|
|
628
|
+
sourcePath: "blog/astro/techlog",
|
|
629
|
+
title: { ja: "Blog Tech Log", en: "Blog Tech Log" },
|
|
630
|
+
description: {
|
|
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",
|
|
632
|
+
en: "Tech blog with code highlighting, categories, tags, TOC, monthly archives and search"
|
|
633
|
+
},
|
|
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
|
+
}
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
slug: "lp-astro-corporate",
|
|
612
662
|
kind: "single-project-variant",
|
|
613
663
|
category: "lp",
|
|
614
664
|
stack: "astro",
|
|
615
|
-
variant: "
|
|
616
|
-
variantLabel: { ja: "
|
|
665
|
+
variant: "corporate",
|
|
666
|
+
variantLabel: { ja: "Corporate", en: "Corporate" },
|
|
617
667
|
sourcePath: "lp/astro",
|
|
618
|
-
title: { ja: "LP
|
|
619
|
-
description: { ja: "\
|
|
620
|
-
|
|
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/"
|
|
621
671
|
},
|
|
622
672
|
{
|
|
623
|
-
slug: "lp-astro-
|
|
673
|
+
slug: "lp-astro-interior",
|
|
624
674
|
kind: "single-project-variant",
|
|
625
675
|
category: "lp",
|
|
626
676
|
stack: "astro",
|
|
627
|
-
variant: "
|
|
628
|
-
variantLabel: { ja: "
|
|
677
|
+
variant: "interior",
|
|
678
|
+
variantLabel: { ja: "Interior", en: "Interior" },
|
|
629
679
|
sourcePath: "lp/astro",
|
|
630
|
-
title: { ja: "LP
|
|
631
|
-
description: { ja: "\
|
|
632
|
-
|
|
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/"
|
|
633
683
|
},
|
|
634
684
|
{
|
|
635
685
|
slug: "lp-astro-ryokan",
|
|
@@ -806,7 +856,7 @@ function postProcessTemplate(projectDir, tpl) {
|
|
|
806
856
|
rewritePackageName(projectDir, tpl.slug);
|
|
807
857
|
}
|
|
808
858
|
if (tpl.kind === "single-project-variant") {
|
|
809
|
-
|
|
859
|
+
extractVariantFiles(projectDir, tpl);
|
|
810
860
|
rewritePackageName(projectDir, tpl.packageName ?? tpl.slug);
|
|
811
861
|
}
|
|
812
862
|
cleanupDevArtifacts(projectDir);
|
|
@@ -822,28 +872,84 @@ function cleanupDevArtifacts(projectDir) {
|
|
|
822
872
|
fs.rmSync(screenshotsConfig, { force: true });
|
|
823
873
|
}
|
|
824
874
|
}
|
|
825
|
-
function
|
|
826
|
-
const
|
|
827
|
-
const
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
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)) {
|
|
831
880
|
throw new Error(
|
|
832
881
|
t("create.variantMissing", {
|
|
833
|
-
variant
|
|
834
|
-
path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${
|
|
882
|
+
variant,
|
|
883
|
+
path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${variant}/index.astro`
|
|
835
884
|
})
|
|
836
885
|
);
|
|
837
886
|
}
|
|
838
|
-
if (fs.existsSync(
|
|
839
|
-
|
|
840
|
-
}
|
|
841
|
-
fs.renameSync(variantIndex, targetIndex);
|
|
842
|
-
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 })) {
|
|
843
889
|
if (!entry.isDirectory()) continue;
|
|
844
|
-
|
|
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
|
+
}
|
|
845
948
|
}
|
|
846
949
|
}
|
|
950
|
+
function escapeRegExp(s) {
|
|
951
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
952
|
+
}
|
|
847
953
|
function printNextSteps(projectDir, tpl) {
|
|
848
954
|
logger.heading(t("create.nextSteps"));
|
|
849
955
|
const rel = path.relative(process.cwd(), projectDir) || ".";
|
package/dist/index.js
CHANGED
package/dist/lib.d.ts
CHANGED
|
@@ -141,8 +141,8 @@ declare const messages: {
|
|
|
141
141
|
readonly en: "Select a variant ({count} options):";
|
|
142
142
|
};
|
|
143
143
|
readonly 'create.promptSelectVariant.blog': {
|
|
144
|
-
readonly ja: "
|
|
145
|
-
readonly en: "Select a
|
|
144
|
+
readonly ja: "タイプを選択してください({count}件):";
|
|
145
|
+
readonly en: "Select a type ({count} options):";
|
|
146
146
|
};
|
|
147
147
|
readonly 'create.promptSelectVariant.lp': {
|
|
148
148
|
readonly ja: "業種を選択してください({count}件):";
|
package/dist/lib.js
CHANGED