Skip to content

Commit f907a56

Browse files
committed
fix: rename justd.json to intentui.json before hand
1 parent 49f9f87 commit f907a56

File tree

7 files changed

+25
-3
lines changed

7 files changed

+25
-3
lines changed

src/commands/add.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ora from "ora"
1313
import { writeCodeFile } from "@/utils"
1414
import { readUser } from "rc9"
1515
import { FILENAME } from "./blocks"
16+
import { rename } from "@/commands/rename"
1617

1718
const exceptions = ["field", "dropdown", "dialog"]
1819

@@ -26,6 +27,7 @@ export async function add(options: {
2627
successMessage: string
2728
prioritize: "block" | "intentui"
2829
}) {
30+
rename()
2931
const spinner = ora("Checking.").start()
3032
const { overwrite, successMessage, components: comps, prioritize = "intentui" } = options
3133

src/commands/blocks.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { listen } from "async-listen"
2020
import chalk from "chalk"
2121
import { readUser, updateUser } from "rc9"
2222
import { add } from "./add"
23+
import { rename } from "@/commands/rename"
2324

2425
export const FILENAME = ".intentui"
2526
const DOMAIN = "https://blocks.intentui.com"
@@ -59,6 +60,7 @@ const blockType = type({
5960
})
6061

6162
export const addBlock = async ({ slugs }: { slugs: string[] }) => {
63+
rename()
6264
if (slugs.length !== 3) {
6365
console.info(errorText("Please provide three slugs."))
6466

src/commands/change-gray.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import { error, errorText, grayText, highlight } from "@/utils/logging"
66
import { getThemesRepoUrl } from "@/utils/repo"
77
import { confirm, select } from "@inquirer/prompts"
88
import ora from "ora"
9+
import { rename } from "@/commands/rename"
910

1011
export const availableGrays = ["zinc", "gray", "slate", "neutral", "stone"]
1112

1213
export async function changeGray(
1314
cssLocation: string,
1415
flags: { yes?: boolean },
1516
): Promise<string | undefined> {
17+
rename()
1618
const spinner = ora("Looking up possibilities...").start()
1719
const grays = availableGrays
1820
spinner.stop()

src/commands/diff.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { checkbox } from "@inquirer/prompts"
88
import chalk from "chalk"
99
import { diffLines } from "diff"
1010
import ora from "ora"
11+
import { rename } from "@/commands/rename"
1112

1213
/**
1314
* This function is used to sanitize the content of a component.
@@ -96,6 +97,7 @@ const compareComponents = (localContent: string, remoteContent: string) => {
9697
*/
9798

9899
export const diff = async (...args: string[]) => {
100+
rename()
99101
try {
100102
const spinner = ora("Checking.").start()
101103

src/commands/help.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Command } from "commander"
22
import packageJson from "../../package.json"
3+
import { rename } from "@/commands/rename"
34

45
/**
56
* This variable is used to store the version of the CLI
@@ -15,6 +16,7 @@ export function help(program: Command) {
1516
.command("help [command]")
1617
.description("Show help information")
1718
.action((commandName) => {
19+
rename()
1820
console.log(`CLI Tool v${version}\n`)
1921

2022
if (commandName) {

src/commands/rename.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { existsSync, renameSync } from "node:fs"
2+
import { join } from "node:path"
3+
4+
export const rename = () => {
5+
const cwd = process.cwd()
6+
const justdPath = join(cwd, "justd.json")
7+
const intentuiPath = join(cwd, "intentui.json")
8+
9+
if (existsSync(justdPath)) {
10+
if (!existsSync(intentuiPath)) {
11+
renameSync(justdPath, intentuiPath)
12+
}
13+
}
14+
}

src/utils/config.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ export class ConfigManager {
4949

5050
async loadConfig(): Promise<Config> {
5151
const data = await fs.readFile(this.filePath, "utf-8")
52-
const out = this.parseConfig(JSON.parse(data))
53-
54-
return out
52+
return this.parseConfig(JSON.parse(data))
5553
}
5654

5755
async updateConfig(updates: Partial<Config>): Promise<Config> {

0 commit comments

Comments
 (0)