@tanstack/cta-engine 0.10.0-alpha.27 → 0.10.0-alpha.31
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/dist/environment.js +3 -12
- package/dist/template-file.js +3 -3
- package/package.json +1 -1
- package/src/environment.ts +3 -12
- package/src/template-file.ts +3 -3
package/dist/environment.js
CHANGED
|
@@ -78,23 +78,14 @@ export function createMemoryEnvironment(returnPathsRelativeTo = '') {
|
|
|
78
78
|
deletedFiles: [],
|
|
79
79
|
};
|
|
80
80
|
const { fs, vol } = memfs({});
|
|
81
|
-
const cwd = process.cwd();
|
|
82
|
-
const isInCwd = (path) => path.startsWith(cwd);
|
|
83
|
-
const isTemplatePath = (path) => !isInCwd(path);
|
|
84
81
|
environment.appendFile = async (path, contents) => {
|
|
85
82
|
fs.mkdirSync(dirname(path), { recursive: true });
|
|
86
83
|
await fs.appendFileSync(path, contents);
|
|
87
84
|
};
|
|
88
85
|
environment.copyFile = async (from, to) => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
fs.writeFileSync(to, contents);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
fs.mkdirSync(dirname(to), { recursive: true });
|
|
96
|
-
fs.copyFileSync(from, to);
|
|
97
|
-
}
|
|
86
|
+
fs.mkdirSync(dirname(to), { recursive: true });
|
|
87
|
+
fs.copyFileSync(from, to);
|
|
88
|
+
return Promise.resolve();
|
|
98
89
|
};
|
|
99
90
|
environment.execute = async (command, args) => {
|
|
100
91
|
output.commands.push({
|
package/dist/template-file.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
1
|
+
import { resolve, sep } from 'node:path';
|
|
2
2
|
import { render } from 'ejs';
|
|
3
3
|
import { format } from 'prettier';
|
|
4
4
|
import { CODE_ROUTER, FILE_ROUTER } from './constants.js';
|
|
@@ -7,9 +7,9 @@ import { getPackageManagerInstallCommand, getPackageManagerScriptCommand, } from
|
|
|
7
7
|
import { relativePath } from './file-helpers.js';
|
|
8
8
|
function convertDotFilesAndPaths(path) {
|
|
9
9
|
return path
|
|
10
|
-
.split(
|
|
10
|
+
.split(sep)
|
|
11
11
|
.map((segment) => segment.replace(/^_dot_/, '.'))
|
|
12
|
-
.join(
|
|
12
|
+
.join(sep);
|
|
13
13
|
}
|
|
14
14
|
export function createTemplateFile(environment, options) {
|
|
15
15
|
function getPackageManagerAddScript(packageName, isDev = false) {
|
package/package.json
CHANGED
package/src/environment.ts
CHANGED
|
@@ -111,23 +111,14 @@ export function createMemoryEnvironment(returnPathsRelativeTo: string = '') {
|
|
|
111
111
|
|
|
112
112
|
const { fs, vol } = memfs({})
|
|
113
113
|
|
|
114
|
-
const cwd = process.cwd()
|
|
115
|
-
const isInCwd = (path: string) => path.startsWith(cwd)
|
|
116
|
-
const isTemplatePath = (path: string) => !isInCwd(path)
|
|
117
|
-
|
|
118
114
|
environment.appendFile = async (path: string, contents: string) => {
|
|
119
115
|
fs.mkdirSync(dirname(path), { recursive: true })
|
|
120
116
|
await fs.appendFileSync(path, contents)
|
|
121
117
|
}
|
|
122
118
|
environment.copyFile = async (from: string, to: string) => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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()
|
|
131
122
|
}
|
|
132
123
|
environment.execute = async (command: string, args: Array<string>) => {
|
|
133
124
|
output.commands.push({
|
package/src/template-file.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve } from 'node:path'
|
|
1
|
+
import { resolve, sep } from 'node:path'
|
|
2
2
|
import { render } from 'ejs'
|
|
3
3
|
import { format } from 'prettier'
|
|
4
4
|
|
|
@@ -14,9 +14,9 @@ import type { AddOn, Environment, Options } from './types.js'
|
|
|
14
14
|
|
|
15
15
|
function convertDotFilesAndPaths(path: string) {
|
|
16
16
|
return path
|
|
17
|
-
.split(
|
|
17
|
+
.split(sep)
|
|
18
18
|
.map((segment) => segment.replace(/^_dot_/, '.'))
|
|
19
|
-
.join(
|
|
19
|
+
.join(sep)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function createTemplateFile(environment: Environment, options: Options) {
|