lism-cli 0.9.0 → 0.10.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/README.md +1 -1
- package/dist/{chunk-BEY36YDC.js → chunk-CRXMV7GV.js} +51 -21
- package/dist/index.js +3 -9
- package/dist/lib.d.ts +8 -6
- package/dist/lib.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ pnpm dlx lism-cli create --template blog-astro-minimal --lang en ./my-blog
|
|
|
36
36
|
|
|
37
37
|
同じ動作は `pnpm create lism` / `npm create lism@latest` でも呼び出せます(`create-lism` パッケージ経由)。挙動は両者で共通です。
|
|
38
38
|
|
|
39
|
-
`--lang <ja|en>` は CLIの表示言語に加えて、**生成されるテンプレート本体の言語**にも反映されます。`--lang` を指定しない場合は、対話端末(TTY)ではほかのどの選択よりも先に言語選択プロンプトが表示され、選んだ言語で以降の表示とテンプレート生成が確定します(非対話環境・CI等では `en` にフォールバック)。対応言語版を持つテンプレート(`blog-astro-minimal` / `blog-astro-personal` / `blog-astro-techlog` / `lp-astro-corporate` / `lp-astro-interior`)では、指定言語のサイト文言・サンプルコンテンツで生成されます。言語版が無いテンプレートは、指定言語に関わらず既存(ベース)の内容で生成されます。
|
|
39
|
+
`--lang <ja|en>` は CLIの表示言語に加えて、**生成されるテンプレート本体の言語**にも反映されます。`--lang` を指定しない場合は、対話端末(TTY)ではほかのどの選択よりも先に言語選択プロンプトが表示され、選んだ言語で以降の表示とテンプレート生成が確定します(非対話環境・CI等では `en` にフォールバック)。対応言語版を持つテンプレート(`blog-astro-minimal` / `blog-astro-personal` / `blog-astro-techlog` / `lp-astro-corporate` / `lp-astro-interior` / `lp-astro-ryokan`)では、指定言語のサイト文言・サンプルコンテンツで生成されます。言語版が無いテンプレートは、指定言語に関わらず既存(ベース)の内容で生成されます。
|
|
40
40
|
|
|
41
41
|
### lism.config の生成
|
|
42
42
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// <define:__LISM_PACKAGE_VERSIONS__>
|
|
2
|
-
var define_LISM_PACKAGE_VERSIONS_default = { "lism-css": "0.
|
|
2
|
+
var define_LISM_PACKAGE_VERSIONS_default = { "lism-css": "0.27.0", "@lism-css/ui": "0.27.0", "@lism-css/plugin": "0.4.3" };
|
|
3
3
|
|
|
4
4
|
// src/logger.ts
|
|
5
5
|
import pc from "picocolors";
|
|
@@ -58,6 +58,10 @@ var messages = {
|
|
|
58
58
|
ja: "\u65E2\u5B58\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5F37\u5236\u4E0A\u66F8\u304D",
|
|
59
59
|
en: "Overwrite existing directory"
|
|
60
60
|
},
|
|
61
|
+
"cli.create.opt.ref": {
|
|
62
|
+
ja: "\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u53D6\u5F97\u5143\u306E Git ref\uFF08\u30D6\u30E9\u30F3\u30C1 / \u30BF\u30B0 / \u30B3\u30DF\u30C3\u30C8\uFF09",
|
|
63
|
+
en: "Git ref to fetch templates from (branch / tag / commit)"
|
|
64
|
+
},
|
|
61
65
|
// init
|
|
62
66
|
"cli.init.description": {
|
|
63
67
|
ja: "lism.config \u30D5\u30A1\u30A4\u30EB\u3092\u65B0\u898F\u751F\u6210\u3059\u308B",
|
|
@@ -559,11 +563,11 @@ import { downloadTemplate } from "giget";
|
|
|
559
563
|
import { select, input, confirm } from "@inquirer/prompts";
|
|
560
564
|
|
|
561
565
|
// src/version.ts
|
|
562
|
-
var LISM_CSS_VERSION = "0.
|
|
566
|
+
var LISM_CSS_VERSION = "0.27.0" ? "0.27.0" : "unknown";
|
|
563
567
|
var LISM_PACKAGE_VERSIONS = typeof define_LISM_PACKAGE_VERSIONS_default !== "undefined" && define_LISM_PACKAGE_VERSIONS_default ? define_LISM_PACKAGE_VERSIONS_default : {
|
|
564
568
|
"lism-css": LISM_CSS_VERSION
|
|
565
569
|
};
|
|
566
|
-
var CLI_VERSION = "0.
|
|
570
|
+
var CLI_VERSION = "0.10.0" ? "0.10.0" : "unknown";
|
|
567
571
|
|
|
568
572
|
// src/constants.ts
|
|
569
573
|
var SOURCE_REPO = "lism-css/lism-css";
|
|
@@ -625,6 +629,10 @@ var TEMPLATES = [
|
|
|
625
629
|
},
|
|
626
630
|
title: { ja: "Blog Minimal", en: "Blog Minimal" },
|
|
627
631
|
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" },
|
|
632
|
+
intro: {
|
|
633
|
+
ja: "\u8A18\u4E8B\u4E00\u89A7\u30FB\u8A18\u4E8B\u8A73\u7D30\u30FB\u30BF\u30B0\u30DA\u30FC\u30B8\u3060\u3051\u3067\u69CB\u6210\u3057\u305F\u3001\u3044\u3061\u3070\u3093\u5C0F\u3055\u306A Astro \u30D6\u30ED\u30B0\u3067\u3059\u3002\u4F59\u8A08\u306A\u6A5F\u80FD\u3092\u6301\u305F\u306A\u3044\u306E\u3067\u3001Lism CSS \u3067\u30D6\u30ED\u30B0\u3092\u7D44\u3080\u624B\u9806\u3092\u6700\u77ED\u3067\u8FFD\u3048\u307E\u3059\u3002\u72EC\u81EA\u306E\u6A5F\u80FD\u3092\u8DB3\u3057\u3066\u3044\u304F\u571F\u53F0\u306B\u3082\u304A\u3059\u3059\u3081\u3067\u3059\u3002",
|
|
634
|
+
en: "The smallest Astro blog, made up of only a post list, post pages, and tag pages. With no extra features, it is the quickest way to see how a blog is built with Lism CSS, and a good base to add your own features to."
|
|
635
|
+
},
|
|
628
636
|
previewUrl: `${PREVIEW_ORIGIN}/blog-astro-minimal/`,
|
|
629
637
|
previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-minimal/en/`,
|
|
630
638
|
features: {
|
|
@@ -648,6 +656,10 @@ var TEMPLATES = [
|
|
|
648
656
|
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",
|
|
649
657
|
en: "Personal / essay-style Astro blog with monthly archives"
|
|
650
658
|
},
|
|
659
|
+
intro: {
|
|
660
|
+
ja: "\u500B\u4EBA\u30D6\u30ED\u30B0\u3084\u30A8\u30C3\u30BB\u30A4\u5411\u3051\u306E\u3001\u843D\u3061\u7740\u3044\u305F\u8AAD\u307F\u7269\u7CFB\u30C7\u30B6\u30A4\u30F3\u306E Astro \u30D6\u30ED\u30B0\u3067\u3059\u3002\u30BF\u30B0\u3068\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u3067\u904E\u53BB\u8A18\u4E8B\u3092\u305F\u3069\u308C\u3001\u30B7\u30A7\u30A2\u30DC\u30BF\u30F3\u3068 OGP \u753B\u50CF\u306E\u81EA\u52D5\u751F\u6210\u3082\u5099\u3048\u3066\u3044\u307E\u3059\u3002\u6587\u7AE0\u3092\u4E3B\u5F79\u306B\u3057\u305F\u30B5\u30A4\u30C8\u3092\u3059\u3050\u59CB\u3081\u3089\u308C\u307E\u3059\u3002",
|
|
661
|
+
en: "A calm, reading-focused Astro blog for personal sites and essays. Tags and monthly archives make older posts easy to find, and share buttons and auto-generated OG images are included. Ideal for a site where the writing comes first."
|
|
662
|
+
},
|
|
651
663
|
previewUrl: `${PREVIEW_ORIGIN}/blog-astro-personal/`,
|
|
652
664
|
previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-personal/en/`,
|
|
653
665
|
features: {
|
|
@@ -671,6 +683,10 @@ var TEMPLATES = [
|
|
|
671
683
|
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",
|
|
672
684
|
en: "Tech blog with code highlighting, categories, tags, TOC, monthly archives and search"
|
|
673
685
|
},
|
|
686
|
+
intro: {
|
|
687
|
+
ja: "\u6280\u8853\u30D6\u30ED\u30B0\u5411\u3051\u306B\u6A5F\u80FD\u3092\u63C3\u3048\u305F Astro \u30D6\u30ED\u30B0\u3067\u3059\u3002\u30B3\u30FC\u30C9\u30CF\u30A4\u30E9\u30A4\u30C8\u3068\u76EE\u6B21\u3001\u30AB\u30C6\u30B4\u30EA\u3068\u30BF\u30B0\u3001\u5E74\u6708\u30A2\u30FC\u30AB\u30A4\u30D6\u306B\u52A0\u3048\u3001Pagefind \u306B\u3088\u308B\u5168\u6587\u691C\u7D22\u3068\u30C0\u30FC\u30AF\u30E2\u30FC\u30C9\u3082\u5099\u3048\u3066\u3044\u307E\u3059\u3002\u8A18\u4E8B\u6570\u304C\u5897\u3048\u3066\u3082\u63A2\u3057\u3084\u3059\u3044\u3001\u672C\u683C\u904B\u7528\u5411\u3051\u306E\u69CB\u6210\u3067\u3059\u3002",
|
|
688
|
+
en: "A fully equipped Astro blog for technical writing. It includes code highlighting, a table of contents, categories and tags, monthly archives, full-text search with Pagefind, and dark mode. Built for blogs that keep growing and need to stay easy to navigate."
|
|
689
|
+
},
|
|
674
690
|
previewUrl: `${PREVIEW_ORIGIN}/blog-astro-techlog/`,
|
|
675
691
|
previewUrlEn: `${PREVIEW_ORIGIN}/blog-astro-techlog/en/`,
|
|
676
692
|
features: {
|
|
@@ -708,6 +724,10 @@ var TEMPLATES = [
|
|
|
708
724
|
sourcePath: "lp/astro",
|
|
709
725
|
title: { ja: "LP Corporate", en: "LP Corporate" },
|
|
710
726
|
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" },
|
|
727
|
+
intro: {
|
|
728
|
+
ja: "\u4F01\u696D\u30B5\u30A4\u30C8\u5411\u3051\u306E1\u30DA\u30FC\u30B8\u69CB\u6210\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8\u3067\u3059\u3002\u4F1A\u793E\u7D39\u4ECB\u30FB\u7279\u5FB4\u30FB\u5236\u4F5C\u5B9F\u7E3E\u30FB\u304A\u77E5\u3089\u305B\u30FBFAQ\u30FB\u304A\u5BA2\u69D8\u306E\u58F0\u30FB\u4F01\u696D\u60C5\u5831\u30FB\u304A\u554F\u3044\u5408\u308F\u305B\u3068\u3001\u30B3\u30FC\u30DD\u30EC\u30FC\u30C8\u30B5\u30A4\u30C8\u306B\u5FC5\u8981\u306A\u30BB\u30AF\u30B7\u30E7\u30F3\u3092\u4E00\u901A\u308A\u542B\u307F\u307E\u3059\u3002",
|
|
729
|
+
en: "A one-page Astro landing page for corporate sites. It covers the sections a company site needs: about, features, works, news, FAQ, testimonials, company information, and contact."
|
|
730
|
+
},
|
|
711
731
|
previewUrl: `${PREVIEW_ORIGIN}/lp-astro/corporate/`,
|
|
712
732
|
previewUrlEn: `${PREVIEW_ORIGIN}/lp-astro/en/corporate/`
|
|
713
733
|
},
|
|
@@ -721,6 +741,10 @@ var TEMPLATES = [
|
|
|
721
741
|
sourcePath: "lp/astro",
|
|
722
742
|
title: { ja: "LP Interior", en: "LP Interior" },
|
|
723
743
|
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" },
|
|
744
|
+
intro: {
|
|
745
|
+
ja: "\u30A4\u30F3\u30C6\u30EA\u30A2\u3084\u66AE\u3089\u3057\u306B\u95A2\u308F\u308B\u30B5\u30FC\u30D3\u30B9\u5411\u3051\u306E\u3001\u5199\u771F\u3092\u5927\u304D\u304F\u898B\u305B\u308B Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8\u3067\u3059\u3002\u30DF\u30C3\u30B7\u30E7\u30F3\u30FB\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u7279\u9577\u30FB\u30B5\u30FC\u30D3\u30B9\u30FB\u3054\u4F9D\u983C\u306E\u6D41\u308C\u30FB\u304A\u5BA2\u69D8\u306E\u58F0\u30FBFAQ\u30FB\u304A\u554F\u3044\u5408\u308F\u305B\u306E\u30BB\u30AF\u30B7\u30E7\u30F3\u3067\u69CB\u6210\u3057\u3066\u3044\u307E\u3059\u3002",
|
|
746
|
+
en: "A photo-forward Astro landing page for interior and lifestyle services. It is made up of mission, message, features, services, process, customer voices, FAQ, and contact sections."
|
|
747
|
+
},
|
|
724
748
|
previewUrl: `${PREVIEW_ORIGIN}/lp-astro/interior/`,
|
|
725
749
|
previewUrlEn: `${PREVIEW_ORIGIN}/lp-astro/en/interior/`
|
|
726
750
|
},
|
|
@@ -734,7 +758,8 @@ var TEMPLATES = [
|
|
|
734
758
|
sourcePath: "lp/astro",
|
|
735
759
|
title: { ja: "LP Ryokan", en: "LP Ryokan" },
|
|
736
760
|
description: { ja: "\u65C5\u9928\u30FB\u5BBF\u6CCA\u696D\u5411\u3051\u306E Astro \u30E9\u30F3\u30C7\u30A3\u30F3\u30B0\u30DA\u30FC\u30B8", en: "Astro landing page for ryokan / lodging" },
|
|
737
|
-
|
|
761
|
+
previewUrl: `${PREVIEW_ORIGIN}/lp-astro/ryokan/`,
|
|
762
|
+
previewUrlEn: `${PREVIEW_ORIGIN}/lp-astro/en/ryokan/`
|
|
738
763
|
}
|
|
739
764
|
];
|
|
740
765
|
|
|
@@ -766,10 +791,10 @@ var CATEGORIES = [
|
|
|
766
791
|
variantPromptKey: "create.promptSelectVariant.web"
|
|
767
792
|
}
|
|
768
793
|
];
|
|
769
|
-
async function runCreate({ template, targetDir, force = false, lang }) {
|
|
770
|
-
await runCreateWithTemplates({ template, targetDir, force, lang }, TEMPLATES);
|
|
794
|
+
async function runCreate({ template, targetDir, force = false, lang, ref }) {
|
|
795
|
+
await runCreateWithTemplates({ template, targetDir, force, lang, ref }, TEMPLATES);
|
|
771
796
|
}
|
|
772
|
-
async function runCreateWithTemplates({ template, targetDir, force = false, lang }, templates) {
|
|
797
|
+
async function runCreateWithTemplates({ template, targetDir, force = false, lang, ref = DEFAULT_TEMPLATES_REF }, templates) {
|
|
773
798
|
const resolvedLang = await resolveLang(lang);
|
|
774
799
|
setLang(resolvedLang);
|
|
775
800
|
const availableTemplates = templates.filter((tpl2) => !tpl2.draft);
|
|
@@ -785,7 +810,6 @@ async function runCreateWithTemplates({ template, targetDir, force = false, lang
|
|
|
785
810
|
return;
|
|
786
811
|
}
|
|
787
812
|
}
|
|
788
|
-
const ref = DEFAULT_TEMPLATES_REF;
|
|
789
813
|
logger.info(t("create.fetching", { name: tpl.slug, ref }));
|
|
790
814
|
await downloadTemplateSource(tpl, outDir, ref, force);
|
|
791
815
|
await applyLangOverlay(tpl, outDir, ref, resolvedLang);
|
|
@@ -797,7 +821,7 @@ async function runCreateWithTemplates({ template, targetDir, force = false, lang
|
|
|
797
821
|
async function createCommand(targetDir, options, command) {
|
|
798
822
|
const langOpt = command?.optsWithGlobals().lang;
|
|
799
823
|
const lang = typeof langOpt === "string" ? langOpt : void 0;
|
|
800
|
-
await runCreate({ template: options.template, targetDir, force: options.force, lang });
|
|
824
|
+
await runCreate({ template: options.template, targetDir, force: options.force, lang, ref: options.ref });
|
|
801
825
|
}
|
|
802
826
|
async function resolveLang(explicit) {
|
|
803
827
|
if (explicit === "ja" || explicit === "en") return explicit;
|
|
@@ -947,14 +971,14 @@ function cleanupDevArtifacts(projectDir) {
|
|
|
947
971
|
fs.rmSync(langDir, { recursive: true, force: true });
|
|
948
972
|
}
|
|
949
973
|
}
|
|
950
|
-
function
|
|
974
|
+
function resolveLangVariantDir(srcDir, variant, lang) {
|
|
951
975
|
const langVariant = `${lang}/${variant}`;
|
|
952
976
|
const hasLangVariant = fs.existsSync(path.join(srcDir, "pages", langVariant, "index.astro"));
|
|
953
|
-
return hasLangVariant ? langVariant :
|
|
977
|
+
return hasLangVariant ? langVariant : void 0;
|
|
954
978
|
}
|
|
955
979
|
function extractVariantFiles(projectDir, tpl, lang) {
|
|
956
980
|
const srcDir = path.join(projectDir, "src");
|
|
957
|
-
const variant =
|
|
981
|
+
const { variant } = tpl;
|
|
958
982
|
const pagesVariantIndex = path.join(srcDir, "pages", variant, "index.astro");
|
|
959
983
|
if (!fs.existsSync(pagesVariantIndex)) {
|
|
960
984
|
throw new Error(
|
|
@@ -965,19 +989,22 @@ function extractVariantFiles(projectDir, tpl, lang) {
|
|
|
965
989
|
);
|
|
966
990
|
}
|
|
967
991
|
if (!fs.existsSync(srcDir) || !fs.statSync(srcDir).isDirectory()) return;
|
|
992
|
+
const langVariant = resolveLangVariantDir(srcDir, variant, lang);
|
|
993
|
+
const variantDirs = langVariant ? [variant, langVariant] : [variant];
|
|
968
994
|
for (const entry of fs.readdirSync(srcDir, { withFileTypes: true })) {
|
|
969
995
|
if (!entry.isDirectory()) continue;
|
|
970
996
|
const parentDir = path.join(srcDir, entry.name);
|
|
971
|
-
const
|
|
972
|
-
if (
|
|
973
|
-
|
|
974
|
-
|
|
997
|
+
const variantDirsInside = variantDirs.map((dir) => path.join(parentDir, dir)).filter((dir) => fs.existsSync(dir) && fs.statSync(dir).isDirectory());
|
|
998
|
+
if (variantDirsInside.length === 0) continue;
|
|
999
|
+
for (const variantDirInside of variantDirsInside) {
|
|
1000
|
+
mergeDirectory(variantDirInside, parentDir);
|
|
1001
|
+
}
|
|
975
1002
|
for (const child of fs.readdirSync(parentDir, { withFileTypes: true })) {
|
|
976
1003
|
if (!child.isDirectory()) continue;
|
|
977
1004
|
fs.rmSync(path.join(parentDir, child.name), { recursive: true, force: true });
|
|
978
1005
|
}
|
|
979
1006
|
}
|
|
980
|
-
rewriteVariantAliasImports(srcDir,
|
|
1007
|
+
rewriteVariantAliasImports(srcDir, variantDirs);
|
|
981
1008
|
}
|
|
982
1009
|
var ALIAS_REWRITE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
983
1010
|
".astro",
|
|
@@ -997,9 +1024,9 @@ var ALIAS_REWRITE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
997
1024
|
".svelte",
|
|
998
1025
|
".html"
|
|
999
1026
|
]);
|
|
1000
|
-
function rewriteVariantAliasImports(srcDir,
|
|
1027
|
+
function rewriteVariantAliasImports(srcDir, variantDirs) {
|
|
1001
1028
|
if (!fs.existsSync(srcDir)) return;
|
|
1002
|
-
const
|
|
1029
|
+
const patterns = variantDirs.map((dir) => new RegExp(`(@/[^/'"\\s\`]+)/${escapeRegExp(dir)}/`, "g"));
|
|
1003
1030
|
walkFiles(srcDir, (filePath) => {
|
|
1004
1031
|
const ext = path.extname(filePath);
|
|
1005
1032
|
if (!ALIAS_REWRITE_EXTENSIONS.has(ext)) return;
|
|
@@ -1009,8 +1036,11 @@ function rewriteVariantAliasImports(srcDir, variant) {
|
|
|
1009
1036
|
} catch {
|
|
1010
1037
|
return;
|
|
1011
1038
|
}
|
|
1012
|
-
if (!original.includes(`/${
|
|
1013
|
-
|
|
1039
|
+
if (!variantDirs.some((dir) => original.includes(`/${dir}/`))) return;
|
|
1040
|
+
let replaced = original;
|
|
1041
|
+
for (const pattern of patterns) {
|
|
1042
|
+
replaced = replaced.replace(pattern, "$1/");
|
|
1043
|
+
}
|
|
1014
1044
|
if (replaced !== original) {
|
|
1015
1045
|
fs.writeFileSync(filePath, replaced);
|
|
1016
1046
|
}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
preScanLang,
|
|
15
15
|
setLang,
|
|
16
16
|
t
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-CRXMV7GV.js";
|
|
18
18
|
|
|
19
19
|
// src/createProgram.ts
|
|
20
20
|
import { Command as Command4 } from "commander";
|
|
@@ -111,13 +111,7 @@ function renderUiSnippet(cli) {
|
|
|
111
111
|
return `ui: ${renderCliObject(cli, "")},`;
|
|
112
112
|
}
|
|
113
113
|
function renderCliObject(cli, indent) {
|
|
114
|
-
return [
|
|
115
|
-
"{",
|
|
116
|
-
//
|
|
117
|
-
`${indent} framework: ${JSON.stringify(cli.framework)},`,
|
|
118
|
-
`${indent} dir: ${JSON.stringify(cli.dir)},`,
|
|
119
|
-
`${indent}}`
|
|
120
|
-
].join("\n");
|
|
114
|
+
return ["{", `${indent} framework: ${JSON.stringify(cli.framework)},`, `${indent} dir: ${JSON.stringify(cli.dir)},`, `${indent}}`].join("\n");
|
|
121
115
|
}
|
|
122
116
|
|
|
123
117
|
// src/commands/ui/fetcher.ts
|
|
@@ -867,7 +861,7 @@ function createLismProgram() {
|
|
|
867
861
|
const lang = opts.lang;
|
|
868
862
|
if (typeof lang === "string") setLang(lang);
|
|
869
863
|
});
|
|
870
|
-
program2.command("create").description(t("cli.create.description")).argument("[targetDir]", t("cli.create.arg.targetDir")).option("-t, --template <name>", t("cli.create.opt.template")).option("-f, --force", t("cli.create.opt.force"), false).action(createCommand);
|
|
864
|
+
program2.command("create").description(t("cli.create.description")).argument("[targetDir]", t("cli.create.arg.targetDir")).option("-t, --template <name>", t("cli.create.opt.template")).option("-f, --force", t("cli.create.opt.force"), false).option("--ref <ref>", t("cli.create.opt.ref")).action(createCommand);
|
|
871
865
|
const init = program2.command("init").description(t("cli.init.description"));
|
|
872
866
|
applyUiSectionOptions(init).action(initCommand);
|
|
873
867
|
program2.addCommand(createUiCommand());
|
package/dist/lib.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ interface RunCreateArgs {
|
|
|
2
2
|
template?: string;
|
|
3
3
|
targetDir?: string;
|
|
4
4
|
force?: boolean;
|
|
5
|
+
/** テンプレ取得元の Git ref。未指定なら `DEFAULT_TEMPLATES_REF`。 */
|
|
6
|
+
ref?: string;
|
|
5
7
|
/**
|
|
6
8
|
* 明示指定された言語(`--lang`)。`ja` / `en` のときその言語で CLI 表示・テンプレ生成を確定する。
|
|
7
9
|
* 未指定(undefined / 不正値)の場合は、対話端末では最初に言語選択プロンプトを出し、
|
|
@@ -9,8 +11,7 @@ interface RunCreateArgs {
|
|
|
9
11
|
*/
|
|
10
12
|
lang?: string;
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
declare function runCreate({ template, targetDir, force, lang }: RunCreateArgs): Promise<void>;
|
|
14
|
+
declare function runCreate({ template, targetDir, force, lang, ref }: RunCreateArgs): Promise<void>;
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* CLI 表示用のメッセージ辞書(ja / en)。
|
|
@@ -52,6 +53,10 @@ declare const messages: {
|
|
|
52
53
|
readonly ja: "既存ディレクトリを強制上書き";
|
|
53
54
|
readonly en: "Overwrite existing directory";
|
|
54
55
|
};
|
|
56
|
+
readonly 'cli.create.opt.ref': {
|
|
57
|
+
readonly ja: "テンプレート取得元の Git ref(ブランチ / タグ / コミット)";
|
|
58
|
+
readonly en: "Git ref to fetch templates from (branch / tag / commit)";
|
|
59
|
+
};
|
|
55
60
|
readonly 'cli.init.description': {
|
|
56
61
|
readonly ja: "lism.config ファイルを新規生成する";
|
|
57
62
|
readonly en: "Generate a new lism.config file";
|
|
@@ -452,11 +457,8 @@ declare const messages: {
|
|
|
452
457
|
type MessageKey = keyof typeof messages;
|
|
453
458
|
|
|
454
459
|
type Lang = 'ja' | 'en';
|
|
455
|
-
/** 現在の言語を設定する(未知の値は無視) */
|
|
456
460
|
declare function setLang(lang: string | undefined): void;
|
|
457
|
-
/**
|
|
458
|
-
* メッセージキーから現在の言語の文字列を取得し、必要に応じて `{name}` プレースホルダーを置換する。
|
|
459
|
-
*/
|
|
461
|
+
/** 現在の言語のメッセージを取得し、プレースホルダーを展開する。 */
|
|
460
462
|
declare function t(key: MessageKey, vars?: Record<string, string | number>): string;
|
|
461
463
|
/**
|
|
462
464
|
* ロケール非依存の 2 言語オブジェクトから現在の言語の値を返す。
|
package/dist/lib.js
CHANGED