Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Explicit12 committed Jan 2, 2025
1 parent 42d5f26 commit 4be067d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ export const DEFAULT_SVGO_CONFIG = {
/* Vueless general */
export const ICONS_DIR = "assets/icons";
export const VUELESS_LIBRARY = "vueless";
export const STORYBOOK_DIR = "storybook";
export const VUELESS_CONFIG_FILE_NAME = "vueless.config";
export const VUELESS_CACHE_DIR = "node_modules/.cache/vueless";
export const VUELESS_DIR = `node_modules/${VUELESS_LIBRARY}`;
Expand Down
7 changes: 4 additions & 3 deletions src/utils/node/dynamicStories.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import path from "node:path";
import { existsSync } from "node:fs";
import { cwd } from "node:process";
import { rename, readdir } from "node:fs/promises";

import { vuelessConfig } from "./vuelessConfig.js";
import { COMPONENTS, VUELESS_DIR, VUELESS_LOCAL_DIR } from "../../constants.js";
import { COMPONENTS, VUELESS_DIR, VUELESS_LOCAL_DIR, STORYBOOK_DIR } from "../../constants.js";

async function hideComponentStories(storybookPath) {
if (existsSync(storybookPath)) {
Expand Down Expand Up @@ -50,7 +51,7 @@ export async function hideHiddenStories(isVuelessEnv) {
const isHiddenStories = componentGlobalConfig && componentGlobalConfig.storybook === false;

if (isHiddenStories) {
await hideComponentStories(path.join(process.cwd(), srcDir, componentDir, "storybook"));
await hideComponentStories(path.join(cwd(), srcDir, componentDir, STORYBOOK_DIR));
}
}
}
Expand All @@ -59,6 +60,6 @@ export async function showHiddenStories(isVuelessEnv) {
const srcDir = isVuelessEnv ? VUELESS_LOCAL_DIR : VUELESS_DIR;

for await (const componentDir of Object.values(COMPONENTS)) {
await showComponentStories(path.join(process.cwd(), srcDir, componentDir, "storybook"));
await showComponentStories(path.join(cwd(), srcDir, componentDir, STORYBOOK_DIR));
}
}

0 comments on commit 4be067d

Please sign in to comment.