Skip to content

Commit

Permalink
Redactored propsess.cwd() into cwd().
Browse files Browse the repository at this point in the history
  • Loading branch information
itsJohnnyGrid committed Dec 30, 2024
1 parent 97682b7 commit e739889
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable no-console */

import fs, { promises } from "fs";
import { cwd } from "node:process";
import path from "path";

// Get the command-line arguments
Expand All @@ -10,7 +11,7 @@ const parsedArgs = parseArgs(args);

const __dirname = path.dirname(new URL(import.meta.url).pathname);
const source = path.join(__dirname, ".storybook");
const target = path.join(process.cwd(), ".storybook");
const target = path.join(cwd(), ".storybook");

copyStorybookPreset(source, target);

Expand Down Expand Up @@ -53,7 +54,7 @@ async function addStorybookCommands() {
"sb:preview": "vite preview --host --outDir=storybook-static",
};

const packageJsonPath = path.resolve(process.cwd(), "package.json");
const packageJsonPath = path.resolve(cwd(), "package.json");
const data = await promises.readFile(packageJsonPath, "utf8");
const packageJson = JSON.parse(data);

Expand All @@ -72,7 +73,7 @@ async function createNpmrc() {
"public-hoist-pattern[] = prettier2",
];

const npmrcPath = path.join(process.cwd(), ".npmrc");
const npmrcPath = path.join(cwd(), ".npmrc");

try {
await promises.writeFile(npmrcPath, npmrcContent.join("\n"));
Expand Down
12 changes: 6 additions & 6 deletions src/webTypes/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import fs from "fs";
import path from "path";
import { cwd } from "node:process";
import { readFile } from "fs/promises";
import esbuild from "esbuild";

const CACHE_PATH = "./node_modules/.cache/vueless";
const WEB_TYPES_CONFIG_FILE_NAME = "web-types.config";

export async function extractConfig() {
const cwd = process.cwd();
const fileContent = await readFile(path.join(cwd, "package.json"), "utf-8");
const fileContent = await readFile(path.join(cwd(), "package.json"), "utf-8");
const packageJson = JSON.parse(fileContent);

const config = await getConfig();
Expand All @@ -18,7 +18,7 @@ export async function extractConfig() {
: ["node_modules/vueless/**/*.vue", "src/components/**/*.vue"];

return {
cwd,
cwd: cwd(),
components,
outFile: `${CACHE_PATH}/web-types.json`,
packageName: packageJson["name"],
Expand All @@ -30,9 +30,9 @@ export async function extractConfig() {
}

async function getConfig() {
const configPathJs = path.resolve(process.cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.js`);
const configPathTs = path.resolve(process.cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.ts`);
const configOutPath = path.join(process.cwd(), `${CACHE_PATH}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);
const configPathJs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.js`);
const configPathTs = path.resolve(cwd(), `${WEB_TYPES_CONFIG_FILE_NAME}.ts`);
const configOutPath = path.join(cwd(), `${CACHE_PATH}/${WEB_TYPES_CONFIG_FILE_NAME}.mjs`);

let config = {};

Expand Down

0 comments on commit e739889

Please sign in to comment.