@ucdjs/cli 0.1.0 → 0.1.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.
@@ -4,7 +4,7 @@ import yargs from "yargs-parser";
4
4
 
5
5
  //#region package.json
6
6
  var name = "@ucdjs/cli";
7
- var version = "0.1.0";
7
+ var version = "0.1.1";
8
8
  var type = "module";
9
9
  var author = {
10
10
  "name": "Lucas Nørgård",
@@ -142,7 +142,7 @@ async function runCommand(cmd, flags) {
142
142
  console.log(` ${bgGreen(black(` ucd `))} ${green(`v${package_default.version ?? "x.y.z"}`)}`);
143
143
  break;
144
144
  case "generate": {
145
- const { runGenerate } = await import("./generate-Hwn8O33w.js");
145
+ const { runGenerate } = await import("./generate-CGxUT7N8.js");
146
146
  const versions = flags._.slice(3);
147
147
  await runGenerate({
148
148
  versions,
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { runCLI } from "./cli-utils-Cy8lSvR2.js";
1
+ import { runCLI } from "./cli-utils-gCMcRvvP.js";
2
2
  import process from "node:process";
3
3
 
4
4
  //#region src/cli.ts
@@ -1,12 +1,13 @@
1
- import { printHelp } from "./cli-utils-Cy8lSvR2.js";
1
+ import { printHelp } from "./cli-utils-gCMcRvvP.js";
2
2
  import { green, yellow } from "farver/fast";
3
3
  import { mkdir, writeFile } from "node:fs/promises";
4
4
  import path, { dirname, join } from "node:path";
5
+ import { UNICODE_VERSIONS, UNICODE_VERSIONS_WITH_UCD } from "@luxass/unicode-utils";
5
6
 
6
7
  //#region src/cmd/generate.ts
7
8
  const BASE_URL = "https://unicode-proxy.ucdjs.dev/proxy";
8
9
  async function runGenerate({ versions: providedVersions, flags }) {
9
- if (flags?.help || flags?.h || providedVersions.length === 0) {
10
+ if (flags?.help || flags?.h) {
10
11
  printHelp({
11
12
  headline: "Generate Unicode Data Files",
12
13
  commandName: "ucd generate",
@@ -15,6 +16,16 @@ async function runGenerate({ versions: providedVersions, flags }) {
15
16
  });
16
17
  return;
17
18
  }
19
+ if (providedVersions.length === 0) {
20
+ console.error("No versions provided. Please provide at least one version.");
21
+ return;
22
+ }
23
+ if (providedVersions[0] === "all") providedVersions = UNICODE_VERSIONS_WITH_UCD;
24
+ const invalidVersions = providedVersions.filter((version) => !UNICODE_VERSIONS.includes(version));
25
+ if (invalidVersions.length > 0) {
26
+ console.error(`Invalid version(s) provided: ${invalidVersions.join(", ")}. Please provide valid Unicode versions.`);
27
+ return;
28
+ }
18
29
  const outputDir = flags.outputDir ?? path.join(process.cwd(), "data");
19
30
  await mkdir(outputDir, { recursive: true });
20
31
  async function processDirectory(entry, basePath, version, baseOutputDir, downloadedFiles) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ucdjs/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Lucas Nørgård",