@tanstack/cta-engine 0.48.0 → 0.49.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,7 +23,7 @@ beforeEach(() => {
23
23
  vol.reset()
24
24
 
25
25
  const fakeFiles = {
26
- './package.json': JSON.stringify({
26
+ 'package.json': JSON.stringify({
27
27
  name: 'test',
28
28
  version: '1.0.0',
29
29
  dependencies: {},
@@ -69,7 +69,7 @@ beforeEach(() => {
69
69
  },
70
70
  },
71
71
  dependsOn: [],
72
- getFiles: () => Promise.resolve(['./jack.txt']),
72
+ getFiles: () => Promise.resolve(['jack.txt']),
73
73
  getFileContents: () => Promise.resolve('foo'),
74
74
  getDeletedFiles: () => Promise.resolve([]),
75
75
  },
@@ -45,7 +45,7 @@ describe('relativePath', () => {
45
45
  it('relative path with a different directory', () => {
46
46
  expect(
47
47
  relativePath(
48
- './src/routes/__root.tsx.ejs',
48
+ 'src/routes/__root.tsx.ejs',
49
49
  'src/integrations/tanstack-query/layout.tsx',
50
50
  ),
51
51
  ).toBe('../integrations/tanstack-query/layout.tsx')
@@ -31,7 +31,7 @@ describe('Filename Processing - Prefix Stripping', () => {
31
31
  })
32
32
  environment.startRun()
33
33
  await templateFile(
34
- './__postgres__testAddon.config.ts.ejs',
34
+ '__postgres__testAddon.config.ts.ejs',
35
35
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\n// PostgreSQL config\nexport default { driver: "postgres" }'
36
36
  )
37
37
  environment.finishRun()
@@ -54,7 +54,7 @@ describe('Filename Processing - Prefix Stripping', () => {
54
54
  })
55
55
  environment.startRun()
56
56
  await templateFile(
57
- './src/db/__mysql__connection.ts.ejs',
57
+ 'src/db/__mysql__connection.ts.ejs',
58
58
  '<% if (addOnOption.testAddon.database !== "mysql") { ignoreFile() } %>\n// MySQL connection\nexport const connection = "mysql"'
59
59
  )
60
60
  environment.finishRun()
@@ -77,15 +77,15 @@ describe('Filename Processing - Prefix Stripping', () => {
77
77
  })
78
78
  environment.startRun()
79
79
  await templateFile(
80
- './__postgres__testAddon.config.ts.ejs',
80
+ '__postgres__testAddon.config.ts.ejs',
81
81
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\n// PostgreSQL config'
82
82
  )
83
83
  await templateFile(
84
- './__mysql__testAddon.config.ts.ejs',
84
+ '__mysql__testAddon.config.ts.ejs',
85
85
  '<% if (addOnOption.testAddon.database !== "mysql") { ignoreFile() } %>\n// MySQL config'
86
86
  )
87
87
  await templateFile(
88
- './__sqlite__testAddon.config.ts.ejs',
88
+ '__sqlite__testAddon.config.ts.ejs',
89
89
  '<% if (addOnOption.testAddon.database !== "sqlite") { ignoreFile() } %>\n// SQLite config'
90
90
  )
91
91
  environment.finishRun()
@@ -110,7 +110,7 @@ describe('Filename Processing - Prefix Stripping', () => {
110
110
  })
111
111
  environment.startRun()
112
112
  await templateFile(
113
- './__auth0__auth.config.js.ejs',
113
+ '__auth0__auth.config.js.ejs',
114
114
  '<% if (addOnOption.auth.provider !== "auth0") { ignoreFile() } %>\n// Auth0 configuration\nmodule.exports = { provider: "auth0" }'
115
115
  )
116
116
  environment.finishRun()
@@ -131,12 +131,12 @@ describe('Filename Processing - Prefix Stripping', () => {
131
131
  environment.startRun()
132
132
  // Create base file first
133
133
  await templateFile(
134
- './.env.ejs',
134
+ '.env.ejs',
135
135
  'BASE_VAR=value\n'
136
136
  )
137
137
  // Then append with prefixed filename
138
138
  await templateFile(
139
- './__postgres__.env.append.ejs',
139
+ '__postgres__.env.append.ejs',
140
140
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\nDATABASE_URL=postgresql://localhost:5432/mydb\n'
141
141
  )
142
142
  environment.finishRun()
@@ -151,7 +151,7 @@ describe('Filename Processing - Prefix Stripping', () => {
151
151
  const templateFile = createTemplateFile(environment, simpleOptions)
152
152
  environment.startRun()
153
153
  await templateFile(
154
- './regular-file.ts.ejs',
154
+ 'regular-file.ts.ejs',
155
155
  'export const config = "normal"'
156
156
  )
157
157
  environment.finishRun()
@@ -166,15 +166,15 @@ describe('Filename Processing - Prefix Stripping', () => {
166
166
  const templateFile = createTemplateFile(environment, simpleOptions)
167
167
  environment.startRun()
168
168
  await templateFile(
169
- './__malformed_prefix.ts.ejs',
169
+ '__malformed_prefix.ts.ejs',
170
170
  'export const config = "malformed"'
171
171
  )
172
172
  await templateFile(
173
- './__only_one_underscore.ts.ejs',
173
+ '__only_one_underscore.ts.ejs',
174
174
  'export const config = "malformed2"'
175
175
  )
176
176
  await templateFile(
177
- './____.ts.ejs',
177
+ '____.ts.ejs',
178
178
  'export const config = "empty"'
179
179
  )
180
180
  environment.finishRun()
@@ -195,7 +195,7 @@ describe('Filename Processing - Prefix Stripping', () => {
195
195
  })
196
196
  environment.startRun()
197
197
  await templateFile(
198
- './src/styles/components/__tailwind__button.css.ejs',
198
+ 'src/styles/components/__tailwind__button.css.ejs',
199
199
  '<% if (addOnOption.styling.framework !== "tailwind") { ignoreFile() } %>\n@tailwind base;\n@tailwind components;\n@tailwind utilities;'
200
200
  )
201
201
  environment.finishRun()
@@ -215,11 +215,11 @@ describe('Filename Processing - Prefix Stripping', () => {
215
215
  })
216
216
  environment.startRun()
217
217
  await templateFile(
218
- './__chakra__theme.ts.ejs',
218
+ '__chakra__theme.ts.ejs',
219
219
  '<% if (addOnOption.ui.library !== "chakra") { ignoreFile() } %>\n// Chakra UI theme\nexport const theme = { colors: {} }'
220
220
  )
221
221
  await templateFile(
222
- './__mui__theme.ts.ejs',
222
+ '__mui__theme.ts.ejs',
223
223
  '<% if (addOnOption.ui.library !== "mui") { ignoreFile() } %>\n// Material-UI theme\nexport const theme = { palette: {} }'
224
224
  )
225
225
  environment.finishRun()
@@ -243,7 +243,7 @@ describe('Filename Processing - Prefix Stripping', () => {
243
243
  })
244
244
  environment.startRun()
245
245
  await templateFile(
246
- './__vercel-edge__api.ts.ejs',
246
+ '__vercel-edge__api.ts.ejs',
247
247
  '<% if (addOnOption.deployment.platform !== "vercel-edge") { ignoreFile() } %>\n// Vercel Edge API\nexport const runtime = "edge"'
248
248
  )
249
249
  environment.finishRun()
@@ -263,7 +263,7 @@ describe('Filename Processing - Prefix Stripping', () => {
263
263
  })
264
264
  environment.startRun()
265
265
  await templateFile(
266
- './__postgres__file__with__underscores.ts.ejs',
266
+ '__postgres__file__with__underscores.ts.ejs',
267
267
  '<% if (addOnOption.test.value !== "postgres") { ignoreFile() } %>\n// File with underscores\nexport const value = "test"'
268
268
  )
269
269
  environment.finishRun()
@@ -35,7 +35,7 @@ describe('registerFramework', () => {
35
35
  description: 'Test',
36
36
  version: '1.0.0',
37
37
  base: {
38
- './package.json': JSON.stringify(basePackageJSON),
38
+ 'package.json': JSON.stringify(basePackageJSON),
39
39
  },
40
40
  basePackageJSON,
41
41
  optionalPackages: {},
@@ -51,9 +51,9 @@ describe('registerFramework', () => {
51
51
  const f = getFrameworkById('test')!
52
52
 
53
53
  const baseFiles = await f.getFiles()
54
- expect(baseFiles).toEqual(['./package.json'])
54
+ expect(baseFiles).toEqual(['package.json'])
55
55
 
56
- const fileContents = await f.getFileContents('./package.json')
56
+ const fileContents = await f.getFileContents('package.json')
57
57
  expect(fileContents).toEqual(JSON.stringify(basePackageJSON))
58
58
 
59
59
  expect(getFrameworkByName('Test')).not.toBeUndefined()
@@ -32,7 +32,7 @@ describe('Template Context - Add-on Options', () => {
32
32
  }
33
33
  })
34
34
  environment.startRun()
35
- await templateFile('./test.txt.ejs', 'Database: <%= addOnOption.testAddon.database %>')
35
+ await templateFile('test.txt.ejs', 'Database: <%= addOnOption.testAddon.database %>')
36
36
  environment.finishRun()
37
37
 
38
38
  expect(output.files['/test/test.txt']).toEqual('Database: postgres')
@@ -53,7 +53,7 @@ describe('Template Context - Add-on Options', () => {
53
53
  })
54
54
  environment.startRun()
55
55
  await templateFile(
56
- './test.txt.ejs',
56
+ 'test.txt.ejs',
57
57
  'Drizzle: <%= addOnOption.testAddon.database %>, shadcn: <%= addOnOption.shadcn.theme %>'
58
58
  )
59
59
  environment.finishRun()
@@ -75,7 +75,7 @@ describe('Template Context - Add-on Options', () => {
75
75
  })
76
76
  environment.startRun()
77
77
  await templateFile(
78
- './test.txt.ejs',
78
+ 'test.txt.ejs',
79
79
  'DB: <%= addOnOption["complex-addon"].database %>, Theme: <%= addOnOption["complex-addon"].theme %>, Port: <%= addOnOption["complex-addon"].port %>'
80
80
  )
81
81
  environment.finishRun()
@@ -95,7 +95,7 @@ describe('Template Context - Add-on Options', () => {
95
95
  })
96
96
  environment.startRun()
97
97
  await templateFile(
98
- './test.txt.ejs',
98
+ 'test.txt.ejs',
99
99
  `<% if (addOnOption.testAddon.database === 'postgres') { %>
100
100
  PostgreSQL configuration
101
101
  <% } else if (addOnOption.testAddon.database === 'mysql') { %>
@@ -121,11 +121,11 @@ SQLite configuration
121
121
  })
122
122
  environment.startRun()
123
123
  await templateFile(
124
- './postgres-config.ts.ejs',
124
+ 'postgres-config.ts.ejs',
125
125
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\n// PostgreSQL configuration\nexport const config = "postgres"'
126
126
  )
127
127
  await templateFile(
128
- './mysql-config.ts.ejs',
128
+ 'mysql-config.ts.ejs',
129
129
  '<% if (addOnOption.testAddon.database !== "mysql") { ignoreFile() } %>\n// MySQL configuration\nexport const config = "mysql"'
130
130
  )
131
131
  environment.finishRun()
@@ -143,7 +143,7 @@ SQLite configuration
143
143
  })
144
144
  environment.startRun()
145
145
  await templateFile(
146
- './test.txt.ejs',
146
+ 'test.txt.ejs',
147
147
  'Options: <%= JSON.stringify(addOnOption) %>'
148
148
  )
149
149
  environment.finishRun()
@@ -163,7 +163,7 @@ SQLite configuration
163
163
  })
164
164
  environment.startRun()
165
165
  await templateFile(
166
- './test.txt.ejs',
166
+ 'test.txt.ejs',
167
167
  'Database: <%= addOnOption.testAddon.database || "not set" %>'
168
168
  )
169
169
  environment.finishRun()
@@ -190,7 +190,7 @@ SQLite configuration
190
190
  })
191
191
  environment.startRun()
192
192
  await templateFile(
193
- './test.txt.ejs',
193
+ 'test.txt.ejs',
194
194
  'Project: <%= projectName %>, Add-ons: <%= Object.keys(addOnEnabled).join(", ") %>, Database: <%= addOnOption.testAddon.database %>'
195
195
  )
196
196
  environment.finishRun()
@@ -210,7 +210,7 @@ SQLite configuration
210
210
  })
211
211
  environment.startRun()
212
212
  await templateFile(
213
- './test.txt.ejs',
213
+ 'test.txt.ejs',
214
214
  'Exists: <%= addOnOption.testAddon ? "yes" : "no" %>, Non-existent: <%= addOnOption.nonexistent ? "yes" : "no" %>'
215
215
  )
216
216
  environment.finishRun()
@@ -230,7 +230,7 @@ SQLite configuration
230
230
  })
231
231
  environment.startRun()
232
232
  await templateFile(
233
- './db-config.ts.ejs',
233
+ 'db-config.ts.ejs',
234
234
  `<% if (addOnOption.testAddon.database === 'postgres') { %>
235
235
  import { testAddon } from 'testAddon-orm/postgres-js'
236
236
  import postgres from 'postgres'
@@ -264,11 +264,11 @@ export const db = testAddon(/* connection */)`
264
264
  })
265
265
  environment.startRun()
266
266
  await templateFile(
267
- './__postgres__testAddon.config.ts.ejs',
267
+ '__postgres__testAddon.config.ts.ejs',
268
268
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\n// PostgreSQL Drizzle config\nexport default { driver: "postgres" }'
269
269
  )
270
270
  await templateFile(
271
- './__mysql__testAddon.config.ts.ejs',
271
+ '__mysql__testAddon.config.ts.ejs',
272
272
  '<% if (addOnOption.testAddon.database !== "mysql") { ignoreFile() } %>\n// MySQL Drizzle config\nexport default { driver: "mysql" }'
273
273
  )
274
274
  environment.finishRun()
@@ -294,11 +294,11 @@ export const db = testAddon(/* connection */)`
294
294
  })
295
295
  environment.startRun()
296
296
  await templateFile(
297
- './src/db/__sqlite__index.ts.ejs',
297
+ 'src/db/__sqlite__index.ts.ejs',
298
298
  '<% if (addOnOption.testAddon.database !== "sqlite") { ignoreFile() } %>\n// SQLite database connection\nexport const db = "sqlite"'
299
299
  )
300
300
  await templateFile(
301
- './src/db/__postgres__index.ts.ejs',
301
+ 'src/db/__postgres__index.ts.ejs',
302
302
  '<% if (addOnOption.testAddon.database !== "postgres") { ignoreFile() } %>\n// PostgreSQL database connection\nexport const db = "postgres"'
303
303
  )
304
304
  environment.finishRun()
@@ -25,7 +25,7 @@ describe('createTemplateFile', () => {
25
25
  const { environment, output } = createMemoryEnvironment()
26
26
  const templateFile = createTemplateFile(environment, simpleOptions)
27
27
  environment.startRun()
28
- await templateFile('./test.ts', 'let a = 1')
28
+ await templateFile('test.ts', 'let a = 1')
29
29
  environment.finishRun()
30
30
 
31
31
  expect(output.files['/test/test.ts'].trim()).toEqual('let a = 1')
@@ -37,7 +37,7 @@ describe('createTemplateFile', () => {
37
37
  ...simpleOptions,
38
38
  } as unknown as Options)
39
39
  environment.startRun()
40
- await templateFile('./test.ts.ejs', '<% ignoreFile() %>let a = 1')
40
+ await templateFile('test.ts.ejs', '<% ignoreFile() %>let a = 1')
41
41
  environment.finishRun()
42
42
 
43
43
  expect(output.files['/test/test.ts']).toBeUndefined()
@@ -47,8 +47,8 @@ describe('createTemplateFile', () => {
47
47
  const { environment, output } = createMemoryEnvironment()
48
48
  const templateFile = createTemplateFile(environment, simpleOptions)
49
49
  environment.startRun()
50
- await templateFile('./test.txt.ejs', 'Line 1\n')
51
- await templateFile('./test.txt.append', 'Line 2\n')
50
+ await templateFile('test.txt.ejs', 'Line 1\n')
51
+ await templateFile('test.txt.append', 'Line 2\n')
52
52
  environment.finishRun()
53
53
 
54
54
  expect(output.files['/test/test.txt']).toEqual('Line 1\nLine 2\n')
@@ -71,7 +71,7 @@ describe('createTemplateFile', () => {
71
71
  })
72
72
  environment.startRun()
73
73
  await templateFile(
74
- './test.txt.ejs',
74
+ 'test.txt.ejs',
75
75
  "Addons: <%= Object.keys(addOnEnabled).join(', ') %>",
76
76
  )
77
77
  environment.finishRun()
@@ -84,8 +84,8 @@ describe('createTemplateFile', () => {
84
84
  const templateFile = createTemplateFile(environment, simpleOptions)
85
85
  environment.startRun()
86
86
  await templateFile(
87
- './src/test/test.txt.ejs',
88
- "import { foo } from '<%= relativePath('./foo.ts') %>'",
87
+ 'src/test/test.txt.ejs',
88
+ "import { foo } from '<%= relativePath('foo.ts') %>'",
89
89
  )
90
90
  environment.finishRun()
91
91
 
@@ -116,7 +116,7 @@ describe('createTemplateFile', () => {
116
116
 
117
117
  environment.startRun()
118
118
  await templateFile(
119
- './test.txt.ejs',
119
+ 'test.txt.ejs',
120
120
  "<%= routes.map((route) => route.url).join(', ') %>",
121
121
  )
122
122
  environment.finishRun()
@@ -145,7 +145,7 @@ describe('createTemplateFile', () => {
145
145
 
146
146
  environment.startRun()
147
147
  await templateFile(
148
- './test.txt.ejs',
148
+ 'test.txt.ejs',
149
149
  "<%= integrations.map((integration) => integration.path).join(', ') %>",
150
150
  )
151
151
  environment.finishRun()
@@ -158,15 +158,15 @@ describe('createTemplateFile', () => {
158
158
  const templateFile = createTemplateFile(environment, simpleOptions)
159
159
  environment.startRun()
160
160
  await templateFile(
161
- './foo.txt.ejs',
161
+ 'foo.txt.ejs',
162
162
  "<%= getPackageManagerAddScript('foo') %>",
163
163
  )
164
164
  await templateFile(
165
- './foo-dev.txt.ejs',
165
+ 'foo-dev.txt.ejs',
166
166
  "<%= getPackageManagerAddScript('foo', true) %>",
167
167
  )
168
168
  await templateFile(
169
- './run-dev.txt.ejs',
169
+ 'run-dev.txt.ejs',
170
170
  "<%= getPackageManagerRunScript('dev') %>",
171
171
  )
172
172
  environment.finishRun()