svelte-sitemap 3.0.0-next.21 → 3.0.0-next.22
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/cli.js +4 -4
- package/cli.js.map +1 -1
- package/package.js +1 -1
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -86,12 +86,12 @@ const main = async () => {
|
|
|
86
86
|
if (invalidKeys.length > 0) console.log(cliColors.yellow, ` ⚠ Invalid properties in config file, so I ignore them: ${invalidKeys.join(", ")}`);
|
|
87
87
|
if (hasCliOptions) console.log(cliColors.yellow, ` ⚠ You have also set CLI options (arguments with '--'), but they are ignored because your config file 'svelte-sitemap.config.ts' is used.`);
|
|
88
88
|
if (!config.domain) {
|
|
89
|
-
console.log(cliColors.yellow,
|
|
89
|
+
console.log(cliColors.yellow, ` ⚠ svelte-sitemap: 'domain' property is required in your config file. See instructions: ${REPO_URL}\n`);
|
|
90
90
|
console.error(cliColors.red, errorMsgGeneration);
|
|
91
91
|
process.exit(0);
|
|
92
92
|
}
|
|
93
93
|
if (!config.domain.includes("http")) {
|
|
94
|
-
console.log(cliColors.yellow,
|
|
94
|
+
console.log(cliColors.yellow, ` ⚠ svelte-sitemap: 'domain' property in your config file must start with https:// See instructions: ${REPO_URL}\n`);
|
|
95
95
|
console.error(cliColors.red, errorMsgGeneration);
|
|
96
96
|
process.exit(0);
|
|
97
97
|
}
|
|
@@ -107,12 +107,12 @@ const main = async () => {
|
|
|
107
107
|
process.exit(0);
|
|
108
108
|
}
|
|
109
109
|
if (!args.domain) {
|
|
110
|
-
console.log(cliColors.
|
|
110
|
+
console.log(cliColors.red, ` ⚠ svelte-sitemap: --domain argument is required. See instructions: ${REPO_URL}\n Example:\n svelte-sitemap --domain https://mydomain.com\n`);
|
|
111
111
|
console.error(cliColors.red, errorMsgGeneration);
|
|
112
112
|
process.exit(0);
|
|
113
113
|
}
|
|
114
114
|
if (!args.domain.includes("http")) {
|
|
115
|
-
console.log(cliColors.
|
|
115
|
+
console.log(cliColors.red, ` ⚠ svelte-sitemap: --domain argument must start with https:// See instructions: ${REPO_URL}\n Example:\n\n svelte-sitemap --domain https://mydomain.com\n`);
|
|
116
116
|
console.error(cliColors.red, errorMsgGeneration);
|
|
117
117
|
process.exit(0);
|
|
118
118
|
}
|
package/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":["pkg.version"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport minimist from 'minimist';\nimport pkg from './../package.json' with { type: 'json' };\nimport { APP_NAME, CONFIG_FILES, REPO_URL } from './const.js';\nimport type { ChangeFreq, OptionsSvelteSitemap } from './dto/index.js';\nimport { defaultConfig, loadConfig, withDefaultConfig } from './helpers/config.js';\nimport { cliColors, errorMsgGeneration } from './helpers/vars.helper.js';\nimport { createSitemap } from './index.js';\nconst version = pkg.version;\n\nconst main = async () => {\n console.log(cliColors.cyanAndBold, `> Using ${APP_NAME}`);\n\n let stop = false;\n\n const config = await loadConfig(CONFIG_FILES);\n\n const args = minimist(process.argv.slice(2), {\n string: ['domain', 'out-dir', 'ignore', 'change-freq', 'additional'],\n boolean: ['attribution', 'reset-time', 'trailing-slashes', 'debug', 'version'],\n default: { attribution: true, 'trailing-slashes': false, default: false },\n alias: {\n d: 'domain',\n D: 'domain',\n h: 'help',\n H: 'help',\n v: 'version',\n V: 'version',\n O: 'out-dir',\n o: 'out-dir',\n r: 'reset-time',\n R: 'reset-time',\n c: 'change-freq',\n C: 'change-freq',\n i: 'ignore',\n I: 'ignore',\n t: 'trailing-slashes',\n T: 'trailing-slashes',\n a: 'additional',\n A: 'additional'\n },\n unknown: (err: string) => {\n if (config && Object.keys(config).length > 0) return false;\n console.log(cliColors.yellow, ' ⚠ This argument is not supported:', err);\n // console.log(cliColors.yellow, ' Use: `svelte-sitemap --help` for more options.');\n stop = true;\n return false;\n }\n });\n\n if (args.help || args.version === '' || args.version === true) {\n const log = args.help ? console.log : console.error;\n log('Svelte `sitemap.xml` generator');\n log('');\n log(`svelte-sitemap ${version} (check updates: ${REPO_URL})`);\n log('');\n log('Options:');\n log('');\n log(' -d, --domain Use your domain (eg. https://example.com)');\n log(' -o, --out-dir Custom output dir');\n log(' -i, --ignore Exclude some pages or folders');\n log(' -a, --additional Additional pages outside of SvelteKit (e.g. /, /contact)');\n log(' -t, --trailing-slashes Do you like trailing slashes?');\n log(' -r, --reset-time Set modified time to now');\n log(' -c, --change-freq Set change frequency `weekly` | `daily` | …');\n log(' -v, --version Show version');\n log(' --debug Debug mode');\n log(' ');\n process.exit(args.help ? 0 : 1);\n } else if (config && Object.keys(config).length > 0) {\n // --- CONFIG FILE PATH ---\n const hasCliOptions = process.argv.slice(2).length > 0;\n console.log(cliColors.green, ` ✔ Reading config file...`);\n\n const allowedKeys = Object.keys(defaultConfig);\n const invalidKeys = Object.keys(config).filter((key) => !allowedKeys.includes(key));\n if (invalidKeys.length > 0) {\n console.log(\n cliColors.yellow,\n ` ⚠ Invalid properties in config file, so I ignore them: ${invalidKeys.join(', ')}`\n );\n }\n\n if (hasCliOptions) {\n console.log(\n cliColors.yellow,\n ` ⚠ You have also set CLI options (arguments with '--'), but they are ignored because your config file 'svelte-sitemap.config.ts' is used.`\n );\n }\n\n if (!config.domain) {\n console.log(\n cliColors.yellow,\n
|
|
1
|
+
{"version":3,"file":"cli.js","names":["pkg.version"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport minimist from 'minimist';\nimport pkg from './../package.json' with { type: 'json' };\nimport { APP_NAME, CONFIG_FILES, REPO_URL } from './const.js';\nimport type { ChangeFreq, OptionsSvelteSitemap } from './dto/index.js';\nimport { defaultConfig, loadConfig, withDefaultConfig } from './helpers/config.js';\nimport { cliColors, errorMsgGeneration } from './helpers/vars.helper.js';\nimport { createSitemap } from './index.js';\nconst version = pkg.version;\n\nconst main = async () => {\n console.log(cliColors.cyanAndBold, `> Using ${APP_NAME}`);\n\n let stop = false;\n\n const config = await loadConfig(CONFIG_FILES);\n\n const args = minimist(process.argv.slice(2), {\n string: ['domain', 'out-dir', 'ignore', 'change-freq', 'additional'],\n boolean: ['attribution', 'reset-time', 'trailing-slashes', 'debug', 'version'],\n default: { attribution: true, 'trailing-slashes': false, default: false },\n alias: {\n d: 'domain',\n D: 'domain',\n h: 'help',\n H: 'help',\n v: 'version',\n V: 'version',\n O: 'out-dir',\n o: 'out-dir',\n r: 'reset-time',\n R: 'reset-time',\n c: 'change-freq',\n C: 'change-freq',\n i: 'ignore',\n I: 'ignore',\n t: 'trailing-slashes',\n T: 'trailing-slashes',\n a: 'additional',\n A: 'additional'\n },\n unknown: (err: string) => {\n if (config && Object.keys(config).length > 0) return false;\n console.log(cliColors.yellow, ' ⚠ This argument is not supported:', err);\n // console.log(cliColors.yellow, ' Use: `svelte-sitemap --help` for more options.');\n stop = true;\n return false;\n }\n });\n\n if (args.help || args.version === '' || args.version === true) {\n const log = args.help ? console.log : console.error;\n log('Svelte `sitemap.xml` generator');\n log('');\n log(`svelte-sitemap ${version} (check updates: ${REPO_URL})`);\n log('');\n log('Options:');\n log('');\n log(' -d, --domain Use your domain (eg. https://example.com)');\n log(' -o, --out-dir Custom output dir');\n log(' -i, --ignore Exclude some pages or folders');\n log(' -a, --additional Additional pages outside of SvelteKit (e.g. /, /contact)');\n log(' -t, --trailing-slashes Do you like trailing slashes?');\n log(' -r, --reset-time Set modified time to now');\n log(' -c, --change-freq Set change frequency `weekly` | `daily` | …');\n log(' -v, --version Show version');\n log(' --debug Debug mode');\n log(' ');\n process.exit(args.help ? 0 : 1);\n } else if (config && Object.keys(config).length > 0) {\n // --- CONFIG FILE PATH ---\n const hasCliOptions = process.argv.slice(2).length > 0;\n console.log(cliColors.green, ` ✔ Reading config file...`);\n\n const allowedKeys = Object.keys(defaultConfig);\n const invalidKeys = Object.keys(config).filter((key) => !allowedKeys.includes(key));\n if (invalidKeys.length > 0) {\n console.log(\n cliColors.yellow,\n ` ⚠ Invalid properties in config file, so I ignore them: ${invalidKeys.join(', ')}`\n );\n }\n\n if (hasCliOptions) {\n console.log(\n cliColors.yellow,\n ` ⚠ You have also set CLI options (arguments with '--'), but they are ignored because your config file 'svelte-sitemap.config.ts' is used.`\n );\n }\n\n if (!config.domain) {\n console.log(\n cliColors.yellow,\n ` ⚠ svelte-sitemap: 'domain' property is required in your config file. See instructions: ${REPO_URL}\\n`\n );\n console.error(cliColors.red, errorMsgGeneration);\n process.exit(0);\n }\n\n if (!config.domain.includes('http')) {\n console.log(\n cliColors.yellow,\n ` ⚠ svelte-sitemap: 'domain' property in your config file must start with https:// See instructions: ${REPO_URL}\\n`\n );\n console.error(cliColors.red, errorMsgGeneration);\n process.exit(0);\n }\n\n try {\n await createSitemap(withDefaultConfig(config));\n } catch (err) {\n console.error(cliColors.red, errorMsgGeneration, err);\n process.exit(0);\n }\n } else {\n // --- CLI ARGUMENTS PATH ---\n if (stop) {\n console.error(cliColors.red, errorMsgGeneration);\n process.exit(0);\n }\n\n if (!args.domain) {\n console.log(\n cliColors.red,\n ` ⚠ svelte-sitemap: --domain argument is required. See instructions: ${REPO_URL}\\n Example:\\n svelte-sitemap --domain https://mydomain.com\\n`\n );\n console.error(cliColors.red, errorMsgGeneration);\n process.exit(0);\n }\n\n if (!args.domain.includes('http')) {\n console.log(\n cliColors.red,\n ` ⚠ svelte-sitemap: --domain argument must start with https:// See instructions: ${REPO_URL}\\n Example:\\n\\n svelte-sitemap --domain https://mydomain.com\\n`\n );\n console.error(cliColors.red, errorMsgGeneration);\n process.exit(0);\n }\n\n const domain: string = args.domain;\n const debug: boolean = args.debug === '' || args.debug === true ? true : false;\n const additional = Array.isArray(args['additional'])\n ? args['additional']\n : args.additional\n ? [args.additional]\n : [];\n const resetTime: boolean =\n args['reset-time'] === '' || args['reset-time'] === true ? true : false;\n const trailingSlashes: boolean =\n args['trailing-slashes'] === '' || args['trailing-slashes'] === true ? true : false;\n const changeFreq: ChangeFreq = args['change-freq'];\n const outDir: string = args['out-dir'];\n const ignore: string = args['ignore'];\n const attribution: boolean =\n args['attribution'] === '' || args['attribution'] === false ? false : true;\n\n const optionsCli: OptionsSvelteSitemap = {\n debug,\n resetTime,\n changeFreq,\n outDir,\n domain,\n attribution,\n ignore,\n trailingSlashes,\n additional\n };\n\n console.log(\n cliColors.yellow,\n ` ℹ Hint: Configuration file is now the preferred method to set up svelte-sitemap. See ${REPO_URL}?tab=readme-ov-file#-usage`\n );\n console.log(cliColors.cyanAndBold, ` ✔ Using CLI options. Config file not found.`);\n try {\n await createSitemap(optionsCli);\n } catch (err) {\n console.error(cliColors.red, errorMsgGeneration, err);\n process.exit(0);\n }\n }\n};\n\nmain();\n"],"mappings":";;;;;;;;;AAQA,MAAM,UAAUA;AAEhB,MAAM,OAAO,YAAY;AACvB,SAAQ,IAAI,UAAU,aAAa,WAAW,WAAW;CAEzD,IAAI,OAAO;CAEX,MAAM,SAAS,MAAM,WAAW,aAAa;CAE7C,MAAM,OAAO,SAAS,QAAQ,KAAK,MAAM,EAAE,EAAE;EAC3C,QAAQ;GAAC;GAAU;GAAW;GAAU;GAAe;GAAa;EACpE,SAAS;GAAC;GAAe;GAAc;GAAoB;GAAS;GAAU;EAC9E,SAAS;GAAE,aAAa;GAAM,oBAAoB;GAAO,SAAS;GAAO;EACzE,OAAO;GACL,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACH,GAAG;GACJ;EACD,UAAU,QAAgB;AACxB,OAAI,UAAU,OAAO,KAAK,OAAO,CAAC,SAAS,EAAG,QAAO;AACrD,WAAQ,IAAI,UAAU,QAAQ,uCAAuC,IAAI;AAEzE,UAAO;AACP,UAAO;;EAEV,CAAC;AAEF,KAAI,KAAK,QAAQ,KAAK,YAAY,MAAM,KAAK,YAAY,MAAM;EAC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