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.
@@ -130,8 +130,8 @@ var messages = {
130
130
  en: "Select a variant ({count} options):"
131
131
  },
132
132
  "create.promptSelectVariant.blog": {
133
- ja: "\u6A5F\u80FD\u30EC\u30D9\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\uFF08{count}\u4EF6\uFF09:",
134
- en: "Select a feature level ({count} options):"
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.18.0" ? "0.18.0" : "unknown";
551
- var CLI_VERSION = "0.4.1" ? "0.4.1" : "unknown";
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-simple",
587
+ slug: "blog-astro-minimal",
588
588
  kind: "project",
589
589
  category: "blog",
590
- variant: "simple",
591
- variantLabel: { ja: "Simple", en: "Simple" },
590
+ variant: "minimal",
591
+ variantLabel: { ja: "Minimal", en: "Minimal" },
592
592
  stack: "astro",
593
- sourcePath: "blog/astro/simple",
594
- title: { ja: "Blog Astro Simple", en: "Blog Astro Simple" },
595
- description: { ja: "\u30BF\u30B0\u306E\u307F\u306E\u30B7\u30F3\u30D7\u30EB\u306A Astro \u30D6\u30ED\u30B0", en: "Simple Astro blog with tags" },
596
- draft: true
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-full",
603
+ slug: "blog-astro-personal",
600
604
  kind: "project",
601
605
  category: "blog",
602
- variant: "full",
603
- variantLabel: { ja: "Full", en: "Full" },
606
+ variant: "personal",
607
+ variantLabel: { ja: "Personal", en: "Personal" },
604
608
  stack: "astro",
605
- sourcePath: "blog/astro/full",
606
- title: { ja: "Blog Astro Full", en: "Blog Astro Full" },
607
- description: { ja: "\u30AB\u30C6\u30B4\u30EA\u30FB\u76EE\u6B21\u3064\u304D\u306E Astro \u30D6\u30ED\u30B0", en: "Astro blog with categories and table of contents" },
608
- draft: true
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: "lp-astro-minimal",
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: "minimal",
616
- variantLabel: { ja: "Minimal", en: "Minimal" },
665
+ variant: "corporate",
666
+ variantLabel: { ja: "Corporate", en: "Corporate" },
617
667
  sourcePath: "lp/astro",
618
- title: { ja: "LP Minimal", en: "LP Minimal" },
619
- description: { ja: "\u30DF\u30CB\u30DE\u30EB\u306A Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Minimal Astro landing page" },
620
- draft: true
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-natural",
673
+ slug: "lp-astro-interior",
624
674
  kind: "single-project-variant",
625
675
  category: "lp",
626
676
  stack: "astro",
627
- variant: "natural",
628
- variantLabel: { ja: "Natural", en: "Natural" },
677
+ variant: "interior",
678
+ variantLabel: { ja: "Interior", en: "Interior" },
629
679
  sourcePath: "lp/astro",
630
- title: { ja: "LP Natural", en: "LP Natural" },
631
- description: { ja: "\u30CA\u30C1\u30E5\u30E9\u30EB\u306A\u96F0\u56F2\u6C17\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Natural-themed Astro landing page" },
632
- draft: true
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
- extractVariantPages(projectDir, tpl);
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 extractVariantPages(projectDir, tpl) {
826
- const pagesDir = path.join(projectDir, "src", "pages");
827
- const variantDir = path.join(pagesDir, tpl.variant);
828
- const variantIndex = path.join(variantDir, "index.astro");
829
- const targetIndex = path.join(pagesDir, "index.astro");
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: tpl.variant,
834
- path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${tpl.variant}/index.astro`
882
+ variant,
883
+ path: `${formatTemplatePath(tpl.sourcePath)}/src/pages/${variant}/index.astro`
835
884
  })
836
885
  );
837
886
  }
838
- if (fs.existsSync(targetIndex)) {
839
- fs.rmSync(targetIndex, { force: true });
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
- fs.rmSync(path.join(pagesDir, entry.name), { recursive: true, force: true });
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
@@ -13,7 +13,7 @@ import {
13
13
  preScanLang,
14
14
  setLang,
15
15
  t
16
- } from "./chunk-VMIN57OF.js";
16
+ } from "./chunk-USFIDRTL.js";
17
17
 
18
18
  // src/createProgram.ts
19
19
  import { Command as Command3 } from "commander";
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: "機能レベルを選択してください({count}件):";
145
- readonly en: "Select a feature level ({count} options):";
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
@@ -3,7 +3,7 @@ import {
3
3
  setLang,
4
4
  t,
5
5
  tOf
6
- } from "./chunk-VMIN57OF.js";
6
+ } from "./chunk-USFIDRTL.js";
7
7
  export {
8
8
  runCreate,
9
9
  setLang,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lism-cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "CLI for scaffolding projects and adding UI components for Lism CSS / Lism UI.",
5
5
  "author": {
6
6
  "name": "ddryo",