Skip to content

Commit d505974

Browse files
committed
login working again
1 parent f3893a7 commit d505974

File tree

13 files changed

+439
-391
lines changed

13 files changed

+439
-391
lines changed

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,32 @@
11
import { resolve } from 'node:path'
2-
3-
import {
4-
CONFIG_FILE,
5-
addToApp,
6-
createAppOptionsFromPersisted,
7-
createDefaultEnvironment,
8-
createSerializedOptionsFromPersisted,
9-
readConfigFile,
10-
recursivelyGatherFiles,
11-
writeConfigFileToEnvironment,
12-
} from '@tanstack/cta-engine'
13-
142
import { TMP_TARGET_DIR } from '../constants'
15-
16-
import { cleanUpFileArray, cleanUpFiles } from './file-helpers'
17-
import { getProjectPath } from './server-environment'
18-
import { createAppWrapper } from './create-app-wrapper'
19-
20-
import type { Environment } from '@tanstack/cta-engine'
213
import type { Response } from 'express'
224
import type { DryRunOutput } from '../types'
23-
import { createMemoryEnvironment } from './memory-environment'
245

256
export async function addToAppWrapper(
267
addOns: Array<string>,
278
opts: {
289
dryRun?: boolean
2910
response?: Response
30-
environmentFactory?: () => Environment
11+
environmentFactory?: () => any
3112
}
3213
) {
14+
// Dynamically import CTA engine to prevent client bundling
15+
const {
16+
CONFIG_FILE,
17+
addToApp,
18+
createAppOptionsFromPersisted,
19+
createDefaultEnvironment,
20+
createSerializedOptionsFromPersisted,
21+
readConfigFile,
22+
recursivelyGatherFiles,
23+
writeConfigFileToEnvironment,
24+
} = await import('@tanstack/cta-engine')
25+
const { cleanUpFileArray, cleanUpFiles } = await import('./file-helpers')
26+
const { getProjectPath } = await import('./server-environment')
27+
const { createAppWrapper } = await import('./create-app-wrapper')
28+
const { createMemoryEnvironment } = await import('./memory-environment')
29+
3330
const projectPath = getProjectPath()
3431

3532
const persistedOptions = await readConfigFile(projectPath)

src/cta/lib/engine-handling/create-app-wrapper.ts

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,35 @@
11
import { resolve } from 'node:path'
2-
3-
import {
4-
createApp,
5-
createDefaultEnvironment,
6-
finalizeAddOns,
7-
getFrameworkById,
8-
loadStarter,
9-
} from '@tanstack/cta-engine'
10-
112
import { TMP_TARGET_DIR } from '../constants'
12-
13-
import { cleanUpFileArray, cleanUpFiles } from './file-helpers'
14-
import { getApplicationMode, getProjectPath } from './server-environment'
15-
16-
import type {
17-
Environment,
18-
Options,
19-
SerializedOptions,
20-
Starter,
21-
} from '@tanstack/cta-engine'
22-
233
import type { Response } from 'express'
24-
import { createMemoryEnvironment } from './memory-environment'
254

265
export async function createAppWrapper(
27-
projectOptions: SerializedOptions,
6+
projectOptions: any,
287
opts: {
298
dryRun?: boolean
309
response?: Response
31-
environmentFactory?: () => Environment
10+
environmentFactory?: () => any
3211
}
3312
) {
13+
// Dynamically import CTA engine to prevent client bundling
14+
const {
15+
createApp,
16+
createDefaultEnvironment,
17+
finalizeAddOns,
18+
getFrameworkById,
19+
loadStarter,
20+
} = await import('@tanstack/cta-engine')
21+
const { cleanUpFileArray, cleanUpFiles } = await import('./file-helpers')
22+
const { getApplicationMode, getProjectPath } = await import(
23+
'./server-environment'
24+
)
25+
const { createMemoryEnvironment } = await import('./memory-environment')
26+
3427
const framework = getFrameworkById(projectOptions.framework)!
3528
if (!framework) {
3629
throw new Error(`Framework ${projectOptions.framework} not found`)
3730
}
3831

39-
let starter: Starter | undefined
32+
let starter: any | undefined
4033
const addOns: Array<string> = [...projectOptions.chosenAddOns]
4134
if (projectOptions.starter) {
4235
starter = await loadStarter(projectOptions.starter)

src/cta/lib/engine-handling/generate-initial-payload.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
11
import { basename, resolve } from 'node:path'
2-
3-
import {
4-
createSerializedOptionsFromPersisted,
5-
getAllAddOns,
6-
getFrameworkById,
7-
getRawRegistry,
8-
getRegistryAddOns,
9-
readConfigFile,
10-
recursivelyGatherFiles,
11-
} from '@tanstack/cta-engine'
12-
13-
import { cleanUpFiles } from './file-helpers'
14-
import { createAppWrapper } from './create-app-wrapper'
15-
import {
16-
getApplicationMode,
17-
getForcedAddOns,
18-
getForcedRouterMode,
19-
getProjectOptions,
20-
getProjectPath,
21-
getRegistry as getRegistryURL,
22-
} from './server-environment'
23-
24-
import type { AddOn, SerializedOptions } from '@tanstack/cta-engine'
252
import type { AddOnInfo } from '../types'
263

27-
function convertAddOnToAddOnInfo(addOn: AddOn): AddOnInfo {
4+
function convertAddOnToAddOnInfo(addOn: any): AddOnInfo {
285
return {
296
id: addOn.id,
307
name: addOn.name,
@@ -39,6 +16,27 @@ function convertAddOnToAddOnInfo(addOn: AddOn): AddOnInfo {
3916
}
4017

4118
export async function generateInitialPayload() {
19+
// Dynamically import CTA engine modules to prevent client bundling
20+
const {
21+
createSerializedOptionsFromPersisted,
22+
getAllAddOns,
23+
getFrameworkById,
24+
getRawRegistry,
25+
getRegistryAddOns,
26+
readConfigFile,
27+
recursivelyGatherFiles,
28+
} = await import('@tanstack/cta-engine')
29+
const { cleanUpFiles } = await import('./file-helpers')
30+
const { createAppWrapper } = await import('./create-app-wrapper')
31+
const {
32+
getApplicationMode,
33+
getForcedAddOns,
34+
getForcedRouterMode,
35+
getProjectOptions,
36+
getProjectPath,
37+
getRegistry: getRegistryURL,
38+
} = await import('./server-environment')
39+
4240
const projectPath = getProjectPath()
4341
const applicationMode = getApplicationMode()
4442

src/forge/engine-handling/add-to-app-wrapper.ts

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
import { resolve } from 'node:path'
2-
3-
import {
4-
CONFIG_FILE,
5-
addToApp,
6-
createAppOptionsFromPersisted,
7-
createDefaultEnvironment,
8-
createMemoryEnvironment,
9-
createSerializedOptionsFromPersisted,
10-
readConfigFile,
11-
recursivelyGatherFiles,
12-
writeConfigFileToEnvironment,
13-
} from '@tanstack/cta-engine'
14-
152
import { TMP_TARGET_DIR } from '~/forge/constants'
16-
17-
import { cleanUpFileArray, cleanUpFiles } from './file-helpers'
18-
import { getProjectPath } from './server-environment'
19-
import { createAppWrapper } from './create-app-wrapper'
20-
21-
import type { Environment } from '@tanstack/cta-engine'
223
import type { DryRunOutput } from '~/forge/types'
234

245
export async function addToAppWrapper(
256
addOns: Array<string>,
267
opts: {
278
dryRun?: boolean
289
stream?: boolean
29-
environmentFactory?: () => Environment
10+
environmentFactory?: () => any
3011
}
3112
) {
13+
// Dynamically import CTA engine to prevent client bundling
14+
const {
15+
CONFIG_FILE,
16+
addToApp,
17+
createAppOptionsFromPersisted,
18+
createDefaultEnvironment,
19+
createMemoryEnvironment,
20+
createSerializedOptionsFromPersisted,
21+
readConfigFile,
22+
recursivelyGatherFiles,
23+
writeConfigFileToEnvironment,
24+
} = await import('@tanstack/cta-engine')
25+
const { cleanUpFileArray, cleanUpFiles } = await import('./file-helpers')
26+
const { getProjectPath } = await import('./server-environment')
27+
const { createAppWrapper } = await import('./create-app-wrapper')
28+
3229
const projectPath = getProjectPath()
3330

3431
const persistedOptions = await readConfigFile(projectPath)

src/forge/engine-handling/create-app-wrapper.ts

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
11
import { resolve } from 'node:path'
2-
3-
import {
4-
createApp,
5-
createDefaultEnvironment,
6-
createMemoryEnvironment,
7-
finalizeAddOns,
8-
getFrameworkById,
9-
loadStarter,
10-
} from '@tanstack/cta-engine'
11-
122
import { TMP_TARGET_DIR } from '~/forge/constants'
133

14-
import { cleanUpFileArray, cleanUpFiles } from './file-helpers'
15-
import { getApplicationMode, getProjectPath } from './server-environment'
16-
17-
import type {
18-
Environment,
19-
Options,
20-
SerializedOptions,
21-
Starter,
22-
} from '@tanstack/cta-engine'
23-
244
export async function createAppWrapper(
25-
projectOptions: SerializedOptions,
5+
projectOptions: any,
266
opts: {
277
dryRun?: boolean
288
stream?: boolean
29-
environmentFactory?: () => Environment
9+
environmentFactory?: () => any
3010
}
3111
) {
12+
// Dynamically import CTA engine to prevent client bundling
13+
const {
14+
createApp,
15+
createDefaultEnvironment,
16+
createMemoryEnvironment,
17+
finalizeAddOns,
18+
getFrameworkById,
19+
loadStarter,
20+
} = await import('@tanstack/cta-engine')
21+
const { cleanUpFileArray, cleanUpFiles } = await import('./file-helpers')
22+
const { getApplicationMode, getProjectPath } = await import(
23+
'./server-environment'
24+
)
25+
3226
const framework = getFrameworkById(projectOptions.framework)!
3327
if (!framework) {
3428
throw new Error(`Framework ${projectOptions.framework} not found`)

src/forge/engine-handling/generate-initial-payload.ts

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
11
import { basename, resolve } from 'node:path'
2-
3-
import {
4-
createSerializedOptionsFromPersisted,
5-
getAllAddOns,
6-
getFrameworkById,
7-
getRawRegistry,
8-
getRegistryAddOns,
9-
readConfigFile,
10-
recursivelyGatherFiles,
11-
} from '@tanstack/cta-engine'
12-
13-
import { cleanUpFiles } from './file-helpers'
14-
import { createAppWrapper } from './create-app-wrapper'
15-
import {
16-
getApplicationMode,
17-
getForcedAddOns,
18-
getForcedRouterMode,
19-
getProjectOptions,
20-
getProjectPath,
21-
getRegistry as getRegistryURL,
22-
} from './server-environment'
23-
24-
import type { AddOn, SerializedOptions } from '@tanstack/cta-engine'
252
import type { AddOnInfo } from '~/forge/types'
263

27-
function convertAddOnToAddOnInfo(addOn: AddOn): AddOnInfo {
4+
function convertAddOnToAddOnInfo(addOn: any): AddOnInfo {
285
return {
296
id: addOn.id,
307
name: addOn.name,
@@ -39,6 +16,27 @@ function convertAddOnToAddOnInfo(addOn: AddOn): AddOnInfo {
3916
}
4017

4118
export async function generateInitialPayload() {
19+
// Dynamically import CTA engine modules to prevent client bundling
20+
const {
21+
createSerializedOptionsFromPersisted,
22+
getAllAddOns,
23+
getFrameworkById,
24+
getRawRegistry,
25+
getRegistryAddOns,
26+
readConfigFile,
27+
recursivelyGatherFiles,
28+
} = await import('@tanstack/cta-engine')
29+
const { cleanUpFiles } = await import('./file-helpers')
30+
const { createAppWrapper } = await import('./create-app-wrapper')
31+
const {
32+
getApplicationMode,
33+
getForcedAddOns,
34+
getForcedRouterMode,
35+
getProjectOptions,
36+
getProjectPath,
37+
getRegistry: getRegistryURL,
38+
} = await import('./server-environment')
39+
4240
const projectPath = getProjectPath()
4341
const applicationMode = getApplicationMode()
4442

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
1-
import { register } from '@tanstack/cta-framework-react-cra'
2-
31
import { setServerEnvironment } from './server-environment'
42

53
let initialized = false
64

7-
setServerEnvironment({
8-
projectPath: './',
9-
mode: 'setup',
10-
addOns: [],
11-
options: {
12-
framework: 'react-cra',
13-
projectName: 'test',
14-
typescript: true,
15-
tailwind: true,
16-
targetDir: './',
17-
packageManager: 'pnpm',
18-
git: true,
19-
mode: 'file-router',
20-
chosenAddOns: [],
21-
starter: undefined,
22-
},
23-
forcedRouterMode: undefined,
24-
forcedAddOns: ['start'],
25-
registry: undefined,
26-
})
27-
28-
export function initialize() {
5+
export async function initialize() {
296
if (initialized) return
307
initialized = true
318

9+
// Dynamically import CTA framework to prevent client bundling
10+
const { register } = await import('@tanstack/cta-framework-react-cra')
11+
12+
setServerEnvironment({
13+
projectPath: './',
14+
mode: 'setup',
15+
addOns: [],
16+
options: {
17+
framework: 'react-cra',
18+
projectName: 'test',
19+
typescript: true,
20+
tailwind: true,
21+
targetDir: './',
22+
packageManager: 'pnpm',
23+
git: true,
24+
mode: 'file-router',
25+
chosenAddOns: [],
26+
starter: undefined,
27+
},
28+
forcedRouterMode: undefined,
29+
forcedAddOns: ['start'],
30+
registry: undefined,
31+
})
32+
3233
register()
3334
}

0 commit comments

Comments
 (0)