@tanstack/cta-engine 0.49.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tanstack/cta-engine
2
2
 
3
+ ## 0.49.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: remove relative file prefixes ([`78af490`](https://github.com/TanStack/create-tsrouter-app/commit/78af49072b54a08ebfdafe72be146efecf4ce77c))
8
+
3
9
  ## 0.49.0
4
10
 
5
11
  ### Minor Changes
@@ -5,7 +5,7 @@ import { createMemoryEnvironment } from '../environment.js';
5
5
  import { finalizeAddOns, populateAddOnOptionsDefaults } from '../add-ons.js';
6
6
  import { getFrameworkById } from '../frameworks.js';
7
7
  import { readConfigFileFromEnvironment } from '../config-file.js';
8
- import { readFileHelper } from '../file-helpers.js';
8
+ import { readFileHelper, toCleanPath } from '../file-helpers.js';
9
9
  import { loadStarter } from '../custom-add-ons/starter.js';
10
10
  export function createPackageAdditions(originalPackageJson, currentPackageJson) {
11
11
  const packageAdditions = {};
@@ -87,9 +87,10 @@ export async function runCreateApp(options) {
87
87
  ...options,
88
88
  targetDir,
89
89
  });
90
- output.files = Object.fromEntries(Object.entries(output.files).map(([key, value]) => {
91
- return [key.replace(targetDir, '.'), value];
92
- }));
90
+ output.files = Object.fromEntries(Object.entries(output.files).map(([key, value]) => [
91
+ toCleanPath(key, targetDir),
92
+ value,
93
+ ]));
93
94
  return output;
94
95
  }
95
96
  export async function compareFilesRecursively(path, ignore, original, changedFiles) {
@@ -28,6 +28,16 @@ export function getBinaryFile(content) {
28
28
  }
29
29
  return null;
30
30
  }
31
+ /**
32
+ * Convert an absolute path to a clean relative path by removing a base directory.
33
+ * Returns a path without leading ./ or / prefix.
34
+ */
35
+ export function toCleanPath(absolutePath, baseDir) {
36
+ let cleanPath = absolutePath.replace(baseDir, '');
37
+ if (cleanPath.startsWith('/'))
38
+ cleanPath = cleanPath.slice(1);
39
+ return cleanPath;
40
+ }
31
41
  export function relativePath(from, to, stripExtension = false) {
32
42
  const fixedOnWindows = from.startsWith('.\\')
33
43
  ? from.replace(/\\/g, '/')
@@ -88,7 +98,7 @@ async function recursivelyGatherFilesHelper(basePath, path, files, ignore) {
88
98
  }
89
99
  else {
90
100
  const filePath = resolve(path, file.name);
91
- files[filePath.replace(basePath, '.')] = await readFileHelper(filePath);
101
+ files[toCleanPath(filePath, basePath)] = await readFileHelper(filePath);
92
102
  }
93
103
  }
94
104
  }
@@ -109,7 +119,7 @@ async function recursivelyGatherFilesFromEnvironmentHelper(environment, basePath
109
119
  }
110
120
  else {
111
121
  const filePath = resolve(path, file);
112
- files[filePath.replace(basePath, '.')] =
122
+ files[toCleanPath(filePath, basePath)] =
113
123
  await environment.readFile(filePath);
114
124
  }
115
125
  }
@@ -158,7 +168,7 @@ export function createIgnore(path, includeProjectFiles = true) {
158
168
  export function cleanUpFiles(files, targetDir) {
159
169
  return Object.keys(files).reduce((acc, file) => {
160
170
  if (basename(file) !== '.cta.json') {
161
- acc[targetDir ? file.replace(targetDir, '.') : file] = files[file];
171
+ acc[targetDir ? toCleanPath(file, targetDir) : file] = files[file];
162
172
  }
163
173
  return acc;
164
174
  }, {});
@@ -166,7 +176,7 @@ export function cleanUpFiles(files, targetDir) {
166
176
  export function cleanUpFileArray(files, targetDir) {
167
177
  return files.reduce((acc, file) => {
168
178
  if (basename(file) !== '.cta.json') {
169
- acc.push(targetDir ? file.replace(targetDir, '.') : file);
179
+ acc.push(targetDir ? toCleanPath(file, targetDir) : file);
170
180
  }
171
181
  return acc;
172
182
  }, []);
@@ -1,12 +1,12 @@
1
1
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
- import { findFilesRecursively, isDirectory, readFileHelper, } from './file-helpers.js';
3
+ import { findFilesRecursively, isDirectory, readFileHelper, toCleanPath, } from './file-helpers.js';
4
4
  const frameworks = [];
5
5
  export function scanProjectDirectory(projectDirectory, baseDirectory) {
6
6
  const absolutePaths = {};
7
7
  findFilesRecursively(baseDirectory, absolutePaths);
8
8
  const files = Object.keys(absolutePaths).reduce((acc, path) => {
9
- acc[path.replace(baseDirectory, '.')] = absolutePaths[path];
9
+ acc[toCleanPath(path, baseDirectory)] = absolutePaths[path];
10
10
  return acc;
11
11
  }, {});
12
12
  const basePackageJSON = existsSync(resolve(baseDirectory, 'package.json'))
@@ -52,7 +52,7 @@ export function scanAddOnDirectories(addOnsDirectories) {
52
52
  }
53
53
  const files = {};
54
54
  for (const file of Object.keys(absoluteFiles)) {
55
- files[file.replace(assetsDir, '.')] = readFileHelper(file);
55
+ files[toCleanPath(file, assetsDir)] = readFileHelper(file);
56
56
  }
57
57
  const getFiles = () => {
58
58
  return Promise.resolve(Object.keys(files));
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { CONFIG_FILE } from './constants.js';
9
9
  export { DEFAULT_PACKAGE_MANAGER, SUPPORTED_PACKAGE_MANAGERS, getPackageManager, } from './package-manager.js';
10
10
  export { registerFramework, getFrameworkById, getFrameworkByName, getFrameworks, scanProjectDirectory, scanAddOnDirectories, } from './frameworks.js';
11
11
  export { writeConfigFileToEnvironment, readConfigFileFromEnvironment, readConfigFile, } from './config-file.js';
12
- export { cleanUpFiles, cleanUpFileArray, readFileHelper, getBinaryFile, recursivelyGatherFiles, relativePath, } from './file-helpers.js';
12
+ export { cleanUpFiles, cleanUpFileArray, readFileHelper, getBinaryFile, recursivelyGatherFiles, relativePath, toCleanPath, } from './file-helpers.js';
13
13
  export { formatCommand, handleSpecialURL } from './utils.js';
14
14
  export { initStarter, compileStarter } from './custom-add-ons/starter.js';
15
15
  export { initAddOn, compileAddOn } from './custom-add-ons/add-on.js';
@@ -4,6 +4,11 @@ export declare function isBinaryFile(path: string): boolean;
4
4
  export declare function convertBinaryContentsToBase64(contents: any): string;
5
5
  export declare function isBase64(content: string): boolean;
6
6
  export declare function getBinaryFile(content: string): string | null;
7
+ /**
8
+ * Convert an absolute path to a clean relative path by removing a base directory.
9
+ * Returns a path without leading ./ or / prefix.
10
+ */
11
+ export declare function toCleanPath(absolutePath: string, baseDir: string): string;
7
12
  export declare function relativePath(from: string, to: string, stripExtension?: boolean): string;
8
13
  export declare function isDirectory(path: string): boolean;
9
14
  export declare function findFilesRecursively(path: string, files: Record<string, string>): void;
@@ -9,7 +9,7 @@ export { CONFIG_FILE } from './constants.js';
9
9
  export { DEFAULT_PACKAGE_MANAGER, SUPPORTED_PACKAGE_MANAGERS, getPackageManager, } from './package-manager.js';
10
10
  export { registerFramework, getFrameworkById, getFrameworkByName, getFrameworks, scanProjectDirectory, scanAddOnDirectories, } from './frameworks.js';
11
11
  export { writeConfigFileToEnvironment, readConfigFileFromEnvironment, readConfigFile, } from './config-file.js';
12
- export { cleanUpFiles, cleanUpFileArray, readFileHelper, getBinaryFile, recursivelyGatherFiles, relativePath, } from './file-helpers.js';
12
+ export { cleanUpFiles, cleanUpFileArray, readFileHelper, getBinaryFile, recursivelyGatherFiles, relativePath, toCleanPath, } from './file-helpers.js';
13
13
  export { formatCommand, handleSpecialURL } from './utils.js';
14
14
  export { initStarter, compileStarter } from './custom-add-ons/starter.js';
15
15
  export { initAddOn, compileAddOn } from './custom-add-ons/add-on.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-engine",
3
- "version": "0.49.0",
3
+ "version": "0.49.1",
4
4
  "description": "Tanstack Application Builder Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -5,7 +5,7 @@ import { createMemoryEnvironment } from '../environment.js'
5
5
  import { finalizeAddOns, populateAddOnOptionsDefaults } from '../add-ons.js'
6
6
  import { getFrameworkById } from '../frameworks.js'
7
7
  import { readConfigFileFromEnvironment } from '../config-file.js'
8
- import { readFileHelper } from '../file-helpers.js'
8
+ import { readFileHelper, toCleanPath } from '../file-helpers.js'
9
9
  import { loadStarter } from '../custom-add-ons/starter.js'
10
10
 
11
11
  import type { Environment, Options, SerializedOptions } from '../types.js'
@@ -117,9 +117,10 @@ export async function runCreateApp(options: Required<Options>) {
117
117
  })
118
118
 
119
119
  output.files = Object.fromEntries(
120
- Object.entries(output.files).map(([key, value]) => {
121
- return [key.replace(targetDir, '.'), value]
122
- }),
120
+ Object.entries(output.files).map(([key, value]) => [
121
+ toCleanPath(key, targetDir),
122
+ value,
123
+ ]),
123
124
  )
124
125
 
125
126
  return output
@@ -36,6 +36,16 @@ export function getBinaryFile(content: string): string | null {
36
36
  return null
37
37
  }
38
38
 
39
+ /**
40
+ * Convert an absolute path to a clean relative path by removing a base directory.
41
+ * Returns a path without leading ./ or / prefix.
42
+ */
43
+ export function toCleanPath(absolutePath: string, baseDir: string): string {
44
+ let cleanPath = absolutePath.replace(baseDir, '')
45
+ if (cleanPath.startsWith('/')) cleanPath = cleanPath.slice(1)
46
+ return cleanPath
47
+ }
48
+
39
49
  export function relativePath(
40
50
  from: string,
41
51
  to: string,
@@ -122,7 +132,7 @@ async function recursivelyGatherFilesHelper(
122
132
  )
123
133
  } else {
124
134
  const filePath = resolve(path, file.name)
125
- files[filePath.replace(basePath, '.')] = await readFileHelper(filePath)
135
+ files[toCleanPath(filePath, basePath)] = await readFileHelper(filePath)
126
136
  }
127
137
  }
128
138
  }
@@ -159,7 +169,7 @@ async function recursivelyGatherFilesFromEnvironmentHelper(
159
169
  )
160
170
  } else {
161
171
  const filePath = resolve(path, file)
162
- files[filePath.replace(basePath, '.')] =
172
+ files[toCleanPath(filePath, basePath)] =
163
173
  await environment.readFile(filePath)
164
174
  }
165
175
  }
@@ -232,7 +242,7 @@ export function cleanUpFiles(
232
242
  ) {
233
243
  return Object.keys(files).reduce<Record<string, string>>((acc, file) => {
234
244
  if (basename(file) !== '.cta.json') {
235
- acc[targetDir ? file.replace(targetDir, '.') : file] = files[file]
245
+ acc[targetDir ? toCleanPath(file, targetDir) : file] = files[file]
236
246
  }
237
247
  return acc
238
248
  }, {})
@@ -241,7 +251,7 @@ export function cleanUpFiles(
241
251
  export function cleanUpFileArray(files: Array<string>, targetDir?: string) {
242
252
  return files.reduce<Array<string>>((acc, file) => {
243
253
  if (basename(file) !== '.cta.json') {
244
- acc.push(targetDir ? file.replace(targetDir, '.') : file)
254
+ acc.push(targetDir ? toCleanPath(file, targetDir) : file)
245
255
  }
246
256
  return acc
247
257
  }, [])
package/src/frameworks.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  findFilesRecursively,
6
6
  isDirectory,
7
7
  readFileHelper,
8
+ toCleanPath,
8
9
  } from './file-helpers.js'
9
10
 
10
11
  import type { AddOn, Framework, FrameworkDefinition } from './types.js'
@@ -20,7 +21,7 @@ export function scanProjectDirectory(
20
21
 
21
22
  const files = Object.keys(absolutePaths).reduce(
22
23
  (acc, path) => {
23
- acc[path.replace(baseDirectory, '.')] = absolutePaths[path]
24
+ acc[toCleanPath(path, baseDirectory)] = absolutePaths[path]
24
25
  return acc
25
26
  },
26
27
  {} as Record<string, string>,
@@ -59,13 +60,16 @@ export function scanAddOnDirectories(addOnsDirectories: Array<string>) {
59
60
 
60
61
  let packageAdditions: Record<string, any> = {}
61
62
  let packageTemplate: string | undefined = undefined
62
-
63
+
63
64
  if (existsSync(resolve(addOnsBase, dir, 'package.json'))) {
64
65
  packageAdditions = JSON.parse(
65
66
  readFileSync(resolve(addOnsBase, dir, 'package.json'), 'utf-8'),
66
67
  )
67
68
  } else if (existsSync(resolve(addOnsBase, dir, 'package.json.ejs'))) {
68
- packageTemplate = readFileSync(resolve(addOnsBase, dir, 'package.json.ejs'), 'utf-8')
69
+ packageTemplate = readFileSync(
70
+ resolve(addOnsBase, dir, 'package.json.ejs'),
71
+ 'utf-8',
72
+ )
69
73
  }
70
74
 
71
75
  let readme: string | undefined
@@ -88,7 +92,7 @@ export function scanAddOnDirectories(addOnsDirectories: Array<string>) {
88
92
  }
89
93
  const files: Record<string, string> = {}
90
94
  for (const file of Object.keys(absoluteFiles)) {
91
- files[file.replace(assetsDir, '.')] = readFileHelper(file)
95
+ files[toCleanPath(file, assetsDir)] = readFileHelper(file)
92
96
  }
93
97
 
94
98
  const getFiles = () => {
package/src/index.ts CHANGED
@@ -46,6 +46,7 @@ export {
46
46
  getBinaryFile,
47
47
  recursivelyGatherFiles,
48
48
  relativePath,
49
+ toCleanPath,
49
50
  } from './file-helpers.js'
50
51
 
51
52
  export { formatCommand, handleSpecialURL } from './utils.js'
@@ -34,7 +34,7 @@ const fakeCTAJSON: PersistedOptions = {
34
34
 
35
35
  beforeEach(() => {
36
36
  const fakeFiles = {
37
- './package.json': JSON.stringify({
37
+ 'package.json': JSON.stringify({
38
38
  name: 'test',
39
39
  version: '1.0.0',
40
40
  dependencies: {},
@@ -71,7 +71,7 @@ beforeEach(() => {
71
71
  },
72
72
  },
73
73
  dependsOn: [],
74
- getFiles: () => Promise.resolve(['./jack.txt']),
74
+ getFiles: () => Promise.resolve(['jack.txt']),
75
75
  getFileContents: () => Promise.resolve('foo'),
76
76
  getDeletedFiles: () => Promise.resolve([]),
77
77
  },
@@ -152,8 +152,8 @@ describe('writeFiles', () => {
152
152
  '/foo',
153
153
  {
154
154
  files: {
155
- './bar.txt': 'baz',
156
- './blarg.txt': 'blarg',
155
+ 'bar.txt': 'baz',
156
+ 'blarg.txt': 'blarg',
157
157
  },
158
158
  deletedFiles: [],
159
159
  },
@@ -177,8 +177,8 @@ describe('writeFiles', () => {
177
177
  '/foo',
178
178
  {
179
179
  files: {
180
- './bar.txt': 'baz',
181
- './blarg.txt': 'blarg',
180
+ 'bar.txt': 'baz',
181
+ 'blarg.txt': 'blarg',
182
182
  },
183
183
  deletedFiles: [],
184
184
  },
@@ -186,9 +186,9 @@ describe('writeFiles', () => {
186
186
  )
187
187
  environment.finishRun()
188
188
  expect(output.files).toEqual({
189
- './blooop.txt': 'blooop',
190
- './bar.txt': 'baz',
191
- './blarg.txt': 'blarg',
189
+ 'blooop.txt': 'blooop',
190
+ 'bar.txt': 'baz',
191
+ 'blarg.txt': 'blarg',
192
192
  })
193
193
  })
194
194
 
@@ -203,9 +203,9 @@ describe('writeFiles', () => {
203
203
  '/foo',
204
204
  {
205
205
  files: {
206
- './unchanged.jpg': 'base64::foobaz',
207
- './changing.jpg': 'base64::aGVsbG8=',
208
- './new.jpg': 'base64::aGVsbG8=',
206
+ 'unchanged.jpg': 'base64::foobaz',
207
+ 'changing.jpg': 'base64::aGVsbG8=',
208
+ 'new.jpg': 'base64::aGVsbG8=',
209
209
  },
210
210
  deletedFiles: [],
211
211
  },
@@ -214,9 +214,9 @@ describe('writeFiles', () => {
214
214
  environment.finishRun()
215
215
  // It's ok for unchanged.jpg not to be written, because it matches the existing file
216
216
  expect(output.files).toEqual({
217
- './unchanged.jpg': 'base64::foobaz',
218
- './changing.jpg': 'base64::aGVsbG8=',
219
- './new.jpg': 'base64::aGVsbG8=',
217
+ 'unchanged.jpg': 'base64::foobaz',
218
+ 'changing.jpg': 'base64::aGVsbG8=',
219
+ 'new.jpg': 'base64::aGVsbG8=',
220
220
  })
221
221
  })
222
222
 
@@ -245,7 +245,7 @@ describe('writeFiles', () => {
245
245
  '/foo',
246
246
  {
247
247
  files: {
248
- './package.json': JSON.stringify(
248
+ 'package.json': JSON.stringify(
249
249
  {
250
250
  scripts: {
251
251
  test: 'echo "test"',
@@ -264,7 +264,7 @@ describe('writeFiles', () => {
264
264
  )
265
265
  environment.finishRun()
266
266
  expect(output.files).toEqual({
267
- './package.json': JSON.stringify(
267
+ 'package.json': JSON.stringify(
268
268
  {
269
269
  name: 'test',
270
270
  version: '1.0.0',
@@ -291,11 +291,11 @@ describe('writeFiles', () => {
291
291
  await writeFiles(
292
292
  environment,
293
293
  '/foo',
294
- { files: {}, deletedFiles: ['./bloop.txt'] },
294
+ { files: {}, deletedFiles: ['bloop.txt'] },
295
295
  true,
296
296
  )
297
297
  environment.finishRun()
298
- expect(output.deletedFiles).toEqual(['./bloop.txt'])
298
+ expect(output.deletedFiles).toEqual(['bloop.txt'])
299
299
  })
300
300
  })
301
301
 
@@ -338,8 +338,8 @@ describe('addToApp', () => {
338
338
  })
339
339
  environment.finishRun()
340
340
  expect(output.files).toEqual({
341
- './jack.txt': 'foo',
342
- './package.json': JSON.stringify(
341
+ 'jack.txt': 'foo',
342
+ 'package.json': JSON.stringify(
343
343
  {
344
344
  name: 'test',
345
345
  version: '1.0.0',
@@ -35,7 +35,7 @@ const simpleOptions = {
35
35
  },
36
36
  },
37
37
  },
38
- getFiles: () => ['./src/test.txt'],
38
+ getFiles: () => ['src/test.txt'],
39
39
  getFileContents: () => 'Hello',
40
40
  getDeletedFiles: () => [],
41
41
  },
@@ -78,7 +78,7 @@ describe('createApp', () => {
78
78
  command: 'echo',
79
79
  args: ['Hello'],
80
80
  },
81
- getFiles: () => ['./src/test2.txt'],
81
+ getFiles: () => ['src/test2.txt'],
82
82
  getFileContents: () => 'Hello-2',
83
83
  getDeletedFiles: () => [],
84
84
  } as unknown as AddOn,
@@ -106,7 +106,7 @@ describe('createApp', () => {
106
106
  dependencies: {},
107
107
  devDependencies: {},
108
108
  },
109
- getFiles: () => ['./src/test2.txt', './public/foo.jpg'],
109
+ getFiles: () => ['src/test2.txt', 'public/foo.jpg'],
110
110
  getFileContents: () => 'base64::aGVsbG8=',
111
111
  getDeletedFiles: () => [],
112
112
  } as unknown as AddOn,
@@ -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()