Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Makisuo committed Jan 15, 2025
1 parent 24c518f commit 9237712
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/commands/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export async function add(options: any) {
const responseClasses = await fetch(getUtilsFolder("classes.ts"))
const fileContentClasses = await responseClasses.text()

writeCodeFile(config, {
await writeCodeFile(config, {
ogFilename: "classes.ts",
writePath: classesFile,
content: fileContentClasses,
Expand All @@ -191,7 +191,7 @@ export async function add(options: any) {
const responseMediaQuery = await fetch(getUtilsFolder("use-media-query.ts"))
const fileContentMediaQuery = await responseMediaQuery.text()

writeCodeFile(config, {
await writeCodeFile(config, {
ogFilename: "use-media-query.ts",
writePath: mediaQueryFile,
content: fileContentMediaQuery,
Expand Down Expand Up @@ -371,7 +371,7 @@ async function createComponent(config: Config, componentName: string) {

const content = await response.text()

writeCodeFile(config, { writePath, ogFilename: `${componentName}.tsx`, content })
await writeCodeFile(config, { writePath, ogFilename: `${componentName}.tsx`, content })
} catch (err) {
console.log(err)
error(`Error writing component: ${componentName}`)
Expand Down
8 changes: 4 additions & 4 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export async function init(flags: { force?: boolean; yes?: boolean }) {

const fileContent = await response.text()

writeCodeFile(createdConfig, {
await writeCodeFile(createdConfig, {
writePath: path.join(uiFolder, "primitive.tsx"),
ogFilename: "primitive.tsx",
content: fileContent,
Expand All @@ -312,7 +312,7 @@ export async function init(flags: { force?: boolean; yes?: boolean }) {
const responseClasses = await fetch(getUtilsFolder("classes.ts"))
const fileContentClasses = await responseClasses.text()

writeCodeFile(createdConfig, {
await writeCodeFile(createdConfig, {
writePath: path.join(utilsFolder, "classes.ts"),
ogFilename: "classes.ts",
content: fileContentClasses,
Expand All @@ -321,7 +321,7 @@ export async function init(flags: { force?: boolean; yes?: boolean }) {
if (themeProvider) {
const themeProviderContent = fs.readFileSync(themeProvider, "utf8")

writeCodeFile(createdConfig, {
await writeCodeFile(createdConfig, {
ogFilename: "theme-provider.tsx",
writePath: path.join(componentFolder, "theme-provider.tsx"),
content: themeProviderContent,
Expand All @@ -330,7 +330,7 @@ export async function init(flags: { force?: boolean; yes?: boolean }) {
if (providers) {
const providersContent = fs.readFileSync(providers, "utf8")

writeCodeFile(createdConfig, {
await writeCodeFile(createdConfig, {
ogFilename: "providers.tsx",
writePath: path.join(componentFolder, "providers.tsx"),
content: providersContent,
Expand Down
6 changes: 3 additions & 3 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import { confirm, input } from "@inquirer/prompts"
import stripJsonComments from "strip-json-comments"
import { type Config, configManager } from "./config"

import oxc from "oxc-transform"

// Get the path to the CSS file from the justd.json file
export async function getCSSPath() {
const doesConfigExist = configManager.doesConfigExist()
Expand Down Expand Up @@ -82,7 +80,7 @@ export async function addUiPathToTsConfig() {
}
}

export const writeCodeFile = (
export const writeCodeFile = async (
config: Config,
options: { writePath: string; ogFilename: string; content: string },
) => {
Expand All @@ -107,6 +105,8 @@ export const writeCodeFile = (
parsedContent = parsedContent.replace(/@\/utils\/classes/g, `@/${utils}/classes`)

if (config.language === "javascript") {
const oxc = await import("oxc-transform")

const { code: transformedCode } = oxc.transform(options.ogFilename, parsedContent, {
sourcemap: false,
jsx: "preserve",
Expand Down

0 comments on commit 9237712

Please sign in to comment.