Skip to content

Commit 16c0184

Browse files
committed
fix: windows UI fix
1 parent f90b9c7 commit 16c0184

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

packages/cta-engine/src/environment.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,14 @@ export function createMemoryEnvironment(returnPathsRelativeTo: string = '') {
111111

112112
const { fs, vol } = memfs({})
113113

114-
const cwd = process.cwd()
115-
const isInCwd = (path: string) => path.startsWith(cwd)
116-
const isTemplatePath = (path: string) => !isInCwd(path)
117-
118114
environment.appendFile = async (path: string, contents: string) => {
119115
fs.mkdirSync(dirname(path), { recursive: true })
120116
await fs.appendFileSync(path, contents)
121117
}
122118
environment.copyFile = async (from: string, to: string) => {
123-
if (isTemplatePath(from)) {
124-
const contents = (await readFile(from)).toString()
125-
fs.mkdirSync(dirname(to), { recursive: true })
126-
fs.writeFileSync(to, contents)
127-
} else {
128-
fs.mkdirSync(dirname(to), { recursive: true })
129-
fs.copyFileSync(from, to)
130-
}
119+
fs.mkdirSync(dirname(to), { recursive: true })
120+
fs.copyFileSync(from, to)
121+
return Promise.resolve()
131122
}
132123
environment.execute = async (command: string, args: Array<string>) => {
133124
output.commands.push({

packages/cta-ui/lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const TMP_TARGET_DIR = '/__cta-tmp__'

packages/cta-ui/lib/engine-handling/add-to-app-wrapper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
writeConfigFileToEnvironment,
1313
} from '@tanstack/cta-engine'
1414

15+
import { TMP_TARGET_DIR } from '../constants.js'
16+
1517
import { cleanUpFileArray, cleanUpFiles } from './file-helpers.js'
1618
import { getProjectPath } from './server-environment.js'
1719
import { createAppWrapper } from './create-app-wrapper.js'
@@ -37,7 +39,7 @@ export async function addToAppWrapper(
3739
}
3840

3941
const options = await createAppOptionsFromPersisted(persistedOptions)
40-
options.targetDir = projectPath
42+
options.targetDir = opts.dryRun ? TMP_TARGET_DIR : projectPath
4143

4244
const newAddons: Array<string> = []
4345
for (const addOn of addOns) {

packages/cta-ui/lib/engine-handling/create-app-wrapper.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
loadStarter,
1010
} from '@tanstack/cta-engine'
1111

12+
import { TMP_TARGET_DIR } from '../constants.js'
13+
1214
import { registerFrameworks } from './framework-registration.js'
1315

1416
import { cleanUpFileArray, cleanUpFiles } from './file-helpers.js'
@@ -51,8 +53,9 @@ export async function createAppWrapper(
5153
)
5254

5355
const projectPath = getProjectPath()
54-
const targetDir =
55-
getApplicationMode() === 'add'
56+
const targetDir = opts.dryRun
57+
? TMP_TARGET_DIR
58+
: getApplicationMode() === 'add'
5659
? projectOptions.targetDir
5760
: resolve(projectPath, projectOptions.projectName)
5861

packages/cta-ui/src/styles.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ body {
2222
-moz-osx-font-smoothing: grayscale;
2323
}
2424

25-
code {
26-
font-size: 12px;
25+
code,
26+
.cm-theme,
27+
.cm-merge-theme {
28+
font-size: 16px;
2729
font-family:
2830
'JetBrains Mono',
2931
Menlo,

0 commit comments

Comments
 (0)