@lang-tag/cli 0.18.0 → 0.18.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/index.cjs +31 -6
- package/index.js +31 -6
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1722,6 +1722,28 @@ function detectProjectDirectories() {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
return detectedFolders.length > 0 ? detectedFolders.sort() : ["src", "app"];
|
|
1724
1724
|
}
|
|
1725
|
+
function getDefaultAnswers() {
|
|
1726
|
+
return {
|
|
1727
|
+
projectType: "project",
|
|
1728
|
+
tagName: "lang",
|
|
1729
|
+
collectorType: "namespace",
|
|
1730
|
+
namespaceOptions: {
|
|
1731
|
+
modifyNamespaceOptions: false,
|
|
1732
|
+
defaultNamespace: "common"
|
|
1733
|
+
},
|
|
1734
|
+
localesDirectory: "public/locales",
|
|
1735
|
+
configGeneration: {
|
|
1736
|
+
enabled: true,
|
|
1737
|
+
useAlgorithm: "path-based",
|
|
1738
|
+
keepVariables: true
|
|
1739
|
+
},
|
|
1740
|
+
importLibraries: true,
|
|
1741
|
+
interfereWithCollection: false,
|
|
1742
|
+
includeDirectories: ["src"],
|
|
1743
|
+
baseLanguageCode: "en",
|
|
1744
|
+
addCommentGuides: false
|
|
1745
|
+
};
|
|
1746
|
+
}
|
|
1725
1747
|
async function askProjectSetupQuestions() {
|
|
1726
1748
|
const projectType = await select({
|
|
1727
1749
|
message: "Is this a project or a library?",
|
|
@@ -1975,7 +1997,7 @@ async function detectModuleSystem() {
|
|
|
1975
1997
|
return "cjs";
|
|
1976
1998
|
}
|
|
1977
1999
|
}
|
|
1978
|
-
async function $LT_CMD_InitConfig() {
|
|
2000
|
+
async function $LT_CMD_InitConfig(options = {}) {
|
|
1979
2001
|
const logger = $LT_CreateDefaultLogger();
|
|
1980
2002
|
if (fs.existsSync(CONFIG_FILE_NAME)) {
|
|
1981
2003
|
logger.error(
|
|
@@ -1987,7 +2009,10 @@ async function $LT_CMD_InitConfig() {
|
|
|
1987
2009
|
logger.info("Welcome to Lang Tag CLI Setup!");
|
|
1988
2010
|
console.log("");
|
|
1989
2011
|
try {
|
|
1990
|
-
const answers = await askProjectSetupQuestions();
|
|
2012
|
+
const answers = options.yes ? getDefaultAnswers() : await askProjectSetupQuestions();
|
|
2013
|
+
if (options.yes) {
|
|
2014
|
+
logger.info("Using default configuration (--yes flag detected)...");
|
|
2015
|
+
}
|
|
1991
2016
|
const moduleSystem = await detectModuleSystem();
|
|
1992
2017
|
const configContent = renderConfigTemplate({
|
|
1993
2018
|
answers,
|
|
@@ -2003,13 +2028,13 @@ async function $LT_CMD_InitConfig() {
|
|
|
2003
2028
|
configFile: CONFIG_FILE_NAME
|
|
2004
2029
|
});
|
|
2005
2030
|
logger.info(
|
|
2006
|
-
" 2.
|
|
2031
|
+
" 2. Ensure all dependencies are installed (TypeScript, React, etc.),"
|
|
2007
2032
|
);
|
|
2008
2033
|
logger.info(
|
|
2009
|
-
|
|
2034
|
+
' then run "npx lang-tag init-tag" to generate an initial tag'
|
|
2010
2035
|
);
|
|
2011
2036
|
logger.info(
|
|
2012
|
-
|
|
2037
|
+
" (the tag will be based on what libraries you have in your project)"
|
|
2013
2038
|
);
|
|
2014
2039
|
logger.info(
|
|
2015
2040
|
" 3. Use your tag in the project under the include directories"
|
|
@@ -2358,7 +2383,7 @@ function createCli() {
|
|
|
2358
2383
|
commander.program.command("watch").alias("w").description(
|
|
2359
2384
|
"Watch for changes in source files and automatically collect translations"
|
|
2360
2385
|
).action($LT_WatchTranslations);
|
|
2361
|
-
commander.program.command("init").description("Initialize project with default configuration").action($LT_CMD_InitConfig);
|
|
2386
|
+
commander.program.command("init").description("Initialize project with default configuration").option("-y, --yes", "Skip prompts and use default configuration").action($LT_CMD_InitConfig);
|
|
2362
2387
|
commander.program.command("init-tag").description("Initialize a new lang-tag function file").option(
|
|
2363
2388
|
"-n, --name <name>",
|
|
2364
2389
|
"Name of the tag function (default: from config)"
|
package/index.js
CHANGED
|
@@ -1702,6 +1702,28 @@ function detectProjectDirectories() {
|
|
|
1702
1702
|
}
|
|
1703
1703
|
return detectedFolders.length > 0 ? detectedFolders.sort() : ["src", "app"];
|
|
1704
1704
|
}
|
|
1705
|
+
function getDefaultAnswers() {
|
|
1706
|
+
return {
|
|
1707
|
+
projectType: "project",
|
|
1708
|
+
tagName: "lang",
|
|
1709
|
+
collectorType: "namespace",
|
|
1710
|
+
namespaceOptions: {
|
|
1711
|
+
modifyNamespaceOptions: false,
|
|
1712
|
+
defaultNamespace: "common"
|
|
1713
|
+
},
|
|
1714
|
+
localesDirectory: "public/locales",
|
|
1715
|
+
configGeneration: {
|
|
1716
|
+
enabled: true,
|
|
1717
|
+
useAlgorithm: "path-based",
|
|
1718
|
+
keepVariables: true
|
|
1719
|
+
},
|
|
1720
|
+
importLibraries: true,
|
|
1721
|
+
interfereWithCollection: false,
|
|
1722
|
+
includeDirectories: ["src"],
|
|
1723
|
+
baseLanguageCode: "en",
|
|
1724
|
+
addCommentGuides: false
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1705
1727
|
async function askProjectSetupQuestions() {
|
|
1706
1728
|
const projectType = await select({
|
|
1707
1729
|
message: "Is this a project or a library?",
|
|
@@ -1955,7 +1977,7 @@ async function detectModuleSystem() {
|
|
|
1955
1977
|
return "cjs";
|
|
1956
1978
|
}
|
|
1957
1979
|
}
|
|
1958
|
-
async function $LT_CMD_InitConfig() {
|
|
1980
|
+
async function $LT_CMD_InitConfig(options = {}) {
|
|
1959
1981
|
const logger = $LT_CreateDefaultLogger();
|
|
1960
1982
|
if (existsSync(CONFIG_FILE_NAME)) {
|
|
1961
1983
|
logger.error(
|
|
@@ -1967,7 +1989,10 @@ async function $LT_CMD_InitConfig() {
|
|
|
1967
1989
|
logger.info("Welcome to Lang Tag CLI Setup!");
|
|
1968
1990
|
console.log("");
|
|
1969
1991
|
try {
|
|
1970
|
-
const answers = await askProjectSetupQuestions();
|
|
1992
|
+
const answers = options.yes ? getDefaultAnswers() : await askProjectSetupQuestions();
|
|
1993
|
+
if (options.yes) {
|
|
1994
|
+
logger.info("Using default configuration (--yes flag detected)...");
|
|
1995
|
+
}
|
|
1971
1996
|
const moduleSystem = await detectModuleSystem();
|
|
1972
1997
|
const configContent = renderConfigTemplate({
|
|
1973
1998
|
answers,
|
|
@@ -1983,13 +2008,13 @@ async function $LT_CMD_InitConfig() {
|
|
|
1983
2008
|
configFile: CONFIG_FILE_NAME
|
|
1984
2009
|
});
|
|
1985
2010
|
logger.info(
|
|
1986
|
-
" 2.
|
|
2011
|
+
" 2. Ensure all dependencies are installed (TypeScript, React, etc.),"
|
|
1987
2012
|
);
|
|
1988
2013
|
logger.info(
|
|
1989
|
-
|
|
2014
|
+
' then run "npx lang-tag init-tag" to generate an initial tag'
|
|
1990
2015
|
);
|
|
1991
2016
|
logger.info(
|
|
1992
|
-
|
|
2017
|
+
" (the tag will be based on what libraries you have in your project)"
|
|
1993
2018
|
);
|
|
1994
2019
|
logger.info(
|
|
1995
2020
|
" 3. Use your tag in the project under the include directories"
|
|
@@ -2338,7 +2363,7 @@ function createCli() {
|
|
|
2338
2363
|
program.command("watch").alias("w").description(
|
|
2339
2364
|
"Watch for changes in source files and automatically collect translations"
|
|
2340
2365
|
).action($LT_WatchTranslations);
|
|
2341
|
-
program.command("init").description("Initialize project with default configuration").action($LT_CMD_InitConfig);
|
|
2366
|
+
program.command("init").description("Initialize project with default configuration").option("-y, --yes", "Skip prompts and use default configuration").action($LT_CMD_InitConfig);
|
|
2342
2367
|
program.command("init-tag").description("Initialize a new lang-tag function file").option(
|
|
2343
2368
|
"-n, --name <name>",
|
|
2344
2369
|
"Name of the tag function (default: from config)"
|