@tanstack/cta-engine 0.15.5 → 0.15.6

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.
@@ -29,16 +29,23 @@ export function getBinaryFile(content) {
29
29
  return null;
30
30
  }
31
31
  export function relativePath(from, to) {
32
- const cleanedFrom = from.startsWith('./') ? from.slice(2) : from;
32
+ const fixedOnWindows = from.startsWith('.\\')
33
+ ? from.replace(/\\/g, '/')
34
+ : from;
35
+ const cleanedFrom = fixedOnWindows.startsWith('./')
36
+ ? fixedOnWindows.slice(2)
37
+ : from;
33
38
  const cleanedTo = to.startsWith('./') ? to.slice(2) : to;
39
+ const fromSegments = cleanedFrom.split('/');
40
+ const toSegments = cleanedTo.split('/');
34
41
  if (process.env.CTA_DEBUG) {
42
+ console.log('process.platform', process.platform);
43
+ console.log('fixedOnWindows', fixedOnWindows);
35
44
  console.log('from', from);
36
45
  console.log('to', to);
37
46
  console.log('cleanedFrom', cleanedFrom);
38
47
  console.log('cleanedTo', cleanedTo);
39
48
  }
40
- const fromSegments = cleanedFrom.split('/');
41
- const toSegments = cleanedTo.split('/');
42
49
  fromSegments.pop();
43
50
  toSegments.pop();
44
51
  let commonIndex = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/cta-engine",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
4
4
  "description": "Tanstack Application Builder Engine",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,19 +37,26 @@ export function getBinaryFile(content: string): string | null {
37
37
  }
38
38
 
39
39
  export function relativePath(from: string, to: string) {
40
- const cleanedFrom = from.startsWith('./') ? from.slice(2) : from
40
+ const fixedOnWindows = from.startsWith('.\\')
41
+ ? from.replace(/\\/g, '/')
42
+ : from
43
+ const cleanedFrom = fixedOnWindows.startsWith('./')
44
+ ? fixedOnWindows.slice(2)
45
+ : from
41
46
  const cleanedTo = to.startsWith('./') ? to.slice(2) : to
42
47
 
48
+ const fromSegments = cleanedFrom.split('/')
49
+ const toSegments = cleanedTo.split('/')
50
+
43
51
  if (process.env.CTA_DEBUG) {
52
+ console.log('process.platform', process.platform)
53
+ console.log('fixedOnWindows', fixedOnWindows)
44
54
  console.log('from', from)
45
55
  console.log('to', to)
46
56
  console.log('cleanedFrom', cleanedFrom)
47
57
  console.log('cleanedTo', cleanedTo)
48
58
  }
49
59
 
50
- const fromSegments = cleanedFrom.split('/')
51
- const toSegments = cleanedTo.split('/')
52
-
53
60
  fromSegments.pop()
54
61
  toSegments.pop()
55
62
 
@@ -47,14 +47,14 @@ describe('relativePath', () => {
47
47
  ),
48
48
  ).toBe('../integrations/tanstack-query/layout.tsx')
49
49
  })
50
- // it('windows', () => {
51
- // expect(
52
- // relativePath(
53
- // 'c:\\test-app\\src\\main.tsx',
54
- // 'src/integrations/tanstack-query/root-provider.tsx',
55
- // ),
56
- // ).toBe('./integrations/tanstack-query/root-provider.tsx')
57
- // })
50
+ it('windows', () => {
51
+ expect(
52
+ relativePath(
53
+ '.\\src\\main.tsx.ejs',
54
+ 'src/integrations/tanstack-query/root-provider.tsx',
55
+ ),
56
+ ).toBe('./integrations/tanstack-query/root-provider.tsx')
57
+ })
58
58
  })
59
59
 
60
60
  describe('readFileHelper', () => {