vueless 1.4.10 → 1.4.11-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "1.4.10",
3
+ "version": "1.4.11-beta.1",
4
4
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
5
5
  "author": "Johnny Grid <hello@vueless.com> (https://vueless.com)",
6
6
  "homepage": "https://vueless.com",
@@ -59,7 +59,7 @@
59
59
  "@vue/eslint-config-typescript": "^14.7.0",
60
60
  "@vue/test-utils": "^2.4.8",
61
61
  "@vue/tsconfig": "^0.9.1",
62
- "@vueless/storybook": "^1.6.1",
62
+ "@vueless/storybook": "^1.6.6",
63
63
  "eslint": "^10.2.1",
64
64
  "eslint-plugin-storybook": "^10.3.5",
65
65
  "eslint-plugin-vue": "^10.9.0",
@@ -8,7 +8,7 @@
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
10
10
  import { cwd } from "node:process";
11
- import { rm, cp } from "node:fs/promises";
11
+ import { rm, cp, mkdir } from "node:fs/promises";
12
12
  import { createRequire } from "module";
13
13
 
14
14
  import { getVuelessConfig } from "./vuelessConfig.js";
@@ -166,7 +166,7 @@ async function cachePackageIcons(isStorybookEnv) {
166
166
  const internalCachePath = path.join(cwd(), ICONS_CACHED_DIR, INTERNAL_ICONS_LIBRARY);
167
167
 
168
168
  if (fs.existsSync(internalVuelessPath)) {
169
- await cp(internalVuelessPath, internalCachePath, { recursive: true });
169
+ await safeCopyDir(internalVuelessPath, internalCachePath);
170
170
  }
171
171
 
172
172
  /* copy storybook icons for storybook only */
@@ -175,11 +175,30 @@ async function cachePackageIcons(isStorybookEnv) {
175
175
  const storybookCachePath = path.join(cwd(), ICONS_CACHED_DIR, STORYBOOK_ICONS_LIBRARY);
176
176
 
177
177
  if (fs.existsSync(storybookVuelessPath)) {
178
- await cp(storybookVuelessPath, storybookCachePath, { recursive: true });
178
+ await safeCopyDir(storybookVuelessPath, storybookCachePath);
179
179
  }
180
180
  }
181
181
  }
182
182
 
183
+ /**
184
+ * Copy a directory tolerating a destination created by a concurrent build.
185
+ * Node's `cp` does a non-atomic `mkdir` per directory, so two builds racing
186
+ * to create the same cache folder throw `EEXIST`. Pre-creating the destination
187
+ * with `recursive: true` (idempotent) and swallowing `EEXIST` makes it safe.
188
+ * @param {string} from
189
+ * @param {string} to
190
+ * @returns {Promise<void>}
191
+ */
192
+ async function safeCopyDir(from, to) {
193
+ await mkdir(to, { recursive: true });
194
+
195
+ try {
196
+ await cp(from, to, { recursive: true, force: true });
197
+ } catch (error) {
198
+ if (error?.code !== "EEXIST") throw error;
199
+ }
200
+ }
201
+
183
202
  /**
184
203
  * Scan the project for icon names and copy found icons to the cache.
185
204
  * @param {Array} files
@@ -400,16 +400,6 @@ export function getArgs(args: UnknownObject, option: string, outerOption?: strin
400
400
  };
401
401
  }
402
402
 
403
- export function getEnumVariantDescription(message = "Hover over a variant to see its value.") {
404
- return {
405
- docs: {
406
- description: {
407
- story: message,
408
- },
409
- },
410
- };
411
- }
412
-
413
403
  export function trimText(text: string) {
414
404
  return text.replace(/\s+/g, " ").trim();
415
405
  }