@tinybirdco/sdk 0.0.8 → 0.0.9
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/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +301 -205
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +67 -93
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/config.d.ts +3 -7
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +9 -20
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/config.test.js +11 -29
- package/dist/cli/config.test.js.map +1 -1
- package/dist/cli/git.d.ts +5 -0
- package/dist/cli/git.d.ts.map +1 -1
- package/dist/cli/git.js +15 -0
- package/dist/cli/git.js.map +1 -1
- package/dist/cli/index.js +42 -25
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/package-manager.d.ts +9 -0
- package/dist/cli/utils/package-manager.d.ts.map +1 -1
- package/dist/cli/utils/package-manager.js +130 -35
- package/dist/cli/utils/package-manager.js.map +1 -1
- package/dist/cli/utils/package-manager.test.js +124 -32
- package/dist/cli/utils/package-manager.test.js.map +1 -1
- package/dist/codegen/index.d.ts +4 -0
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +92 -0
- package/dist/codegen/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/init.test.ts +67 -107
- package/src/cli/commands/init.ts +350 -218
- package/src/cli/config.test.ts +12 -42
- package/src/cli/config.ts +9 -23
- package/src/cli/git.ts +15 -0
- package/src/cli/index.ts +46 -27
- package/src/cli/utils/package-manager.test.ts +165 -33
- package/src/cli/utils/package-manager.ts +133 -30
- package/src/codegen/index.ts +115 -0
|
@@ -25,41 +25,29 @@ describe("Init Command", () => {
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
describe("folder structure creation", () => {
|
|
28
|
-
it("creates tinybird
|
|
29
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
28
|
+
it("creates lib/tinybird.ts when project has no src folder", async () => {
|
|
29
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
30
30
|
|
|
31
31
|
expect(result.success).toBe(true);
|
|
32
|
-
expect(result.created).toContain("tinybird
|
|
33
|
-
expect(
|
|
34
|
-
expect(result.created).toContain("tinybird/client.ts");
|
|
35
|
-
expect(fs.existsSync(path.join(tempDir, "tinybird", "datasources.ts"))).toBe(true);
|
|
36
|
-
expect(fs.existsSync(path.join(tempDir, "tinybird", "endpoints.ts"))).toBe(true);
|
|
37
|
-
expect(fs.existsSync(path.join(tempDir, "tinybird", "client.ts"))).toBe(true);
|
|
32
|
+
expect(result.created).toContain("lib/tinybird.ts");
|
|
33
|
+
expect(fs.existsSync(path.join(tempDir, "lib", "tinybird.ts"))).toBe(true);
|
|
38
34
|
});
|
|
39
35
|
|
|
40
|
-
it("creates src/tinybird
|
|
36
|
+
it("creates src/lib/tinybird.ts when project has src folder", async () => {
|
|
41
37
|
// Create src folder to simulate existing project
|
|
42
38
|
fs.mkdirSync(path.join(tempDir, "src"));
|
|
43
39
|
|
|
44
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/tinybird" });
|
|
40
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/lib/tinybird.ts" });
|
|
45
41
|
|
|
46
42
|
expect(result.success).toBe(true);
|
|
47
|
-
expect(result.created).toContain("src/tinybird
|
|
48
|
-
expect(result.created).toContain("src/tinybird/endpoints.ts");
|
|
49
|
-
expect(result.created).toContain("src/tinybird/client.ts");
|
|
43
|
+
expect(result.created).toContain("src/lib/tinybird.ts");
|
|
50
44
|
expect(
|
|
51
|
-
fs.existsSync(path.join(tempDir, "src", "
|
|
52
|
-
).toBe(true);
|
|
53
|
-
expect(
|
|
54
|
-
fs.existsSync(path.join(tempDir, "src", "tinybird", "endpoints.ts"))
|
|
55
|
-
).toBe(true);
|
|
56
|
-
expect(
|
|
57
|
-
fs.existsSync(path.join(tempDir, "src", "tinybird", "client.ts"))
|
|
45
|
+
fs.existsSync(path.join(tempDir, "src", "lib", "tinybird.ts"))
|
|
58
46
|
).toBe(true);
|
|
59
47
|
});
|
|
60
48
|
|
|
61
|
-
it("creates tinybird.json with correct include
|
|
62
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
49
|
+
it("creates tinybird.json with correct include path for lib/tinybird.ts", async () => {
|
|
50
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
63
51
|
|
|
64
52
|
expect(result.success).toBe(true);
|
|
65
53
|
expect(result.created).toContain("tinybird.json");
|
|
@@ -67,32 +55,26 @@ describe("Init Command", () => {
|
|
|
67
55
|
const config = JSON.parse(
|
|
68
56
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
69
57
|
);
|
|
70
|
-
expect(config.include).toEqual([
|
|
71
|
-
"tinybird/datasources.ts",
|
|
72
|
-
"tinybird/endpoints.ts",
|
|
73
|
-
]);
|
|
58
|
+
expect(config.include).toEqual(["lib/tinybird.ts"]);
|
|
74
59
|
});
|
|
75
60
|
|
|
76
|
-
it("creates tinybird.json with correct include
|
|
61
|
+
it("creates tinybird.json with correct include path for src/lib/tinybird.ts", async () => {
|
|
77
62
|
fs.mkdirSync(path.join(tempDir, "src"));
|
|
78
63
|
|
|
79
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/tinybird" });
|
|
64
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/lib/tinybird.ts" });
|
|
80
65
|
|
|
81
66
|
expect(result.success).toBe(true);
|
|
82
67
|
|
|
83
68
|
const config = JSON.parse(
|
|
84
69
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
85
70
|
);
|
|
86
|
-
expect(config.include).toEqual([
|
|
87
|
-
"src/tinybird/datasources.ts",
|
|
88
|
-
"src/tinybird/endpoints.ts",
|
|
89
|
-
]);
|
|
71
|
+
expect(config.include).toEqual(["src/lib/tinybird.ts"]);
|
|
90
72
|
});
|
|
91
73
|
});
|
|
92
74
|
|
|
93
75
|
describe("config file creation", () => {
|
|
94
76
|
it("creates tinybird.json with default values", async () => {
|
|
95
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
77
|
+
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
96
78
|
|
|
97
79
|
const config = JSON.parse(
|
|
98
80
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
@@ -102,23 +84,29 @@ describe("Init Command", () => {
|
|
|
102
84
|
expect(config.baseUrl).toBe("https://api.tinybird.co");
|
|
103
85
|
});
|
|
104
86
|
|
|
105
|
-
it("
|
|
106
|
-
const existingConfig = {
|
|
87
|
+
it("updates tinybird.json if it already exists", async () => {
|
|
88
|
+
const existingConfig = {
|
|
89
|
+
include: ["custom.ts"],
|
|
90
|
+
token: "existing",
|
|
91
|
+
devMode: "local",
|
|
92
|
+
};
|
|
107
93
|
fs.writeFileSync(
|
|
108
94
|
path.join(tempDir, "tinybird.json"),
|
|
109
95
|
JSON.stringify(existingConfig)
|
|
110
96
|
);
|
|
111
97
|
|
|
112
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
98
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
113
99
|
|
|
114
100
|
expect(result.success).toBe(true);
|
|
115
|
-
expect(result.
|
|
101
|
+
expect(result.created).toContain("tinybird.json (updated)");
|
|
116
102
|
|
|
117
|
-
// Verify
|
|
103
|
+
// Verify include/devMode updated but token preserved
|
|
118
104
|
const config = JSON.parse(
|
|
119
105
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
120
106
|
);
|
|
121
|
-
expect(config.
|
|
107
|
+
expect(config.include).toEqual(["lib/tinybird.ts"]);
|
|
108
|
+
expect(config.devMode).toBe("branch");
|
|
109
|
+
expect(config.token).toBe("existing");
|
|
122
110
|
});
|
|
123
111
|
|
|
124
112
|
it("overwrites tinybird.json with force option", async () => {
|
|
@@ -128,7 +116,7 @@ describe("Init Command", () => {
|
|
|
128
116
|
JSON.stringify(existingConfig)
|
|
129
117
|
);
|
|
130
118
|
|
|
131
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, force: true, devMode: "branch", clientPath: "tinybird" });
|
|
119
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, force: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
132
120
|
|
|
133
121
|
expect(result.success).toBe(true);
|
|
134
122
|
expect(result.created).toContain("tinybird.json");
|
|
@@ -136,92 +124,71 @@ describe("Init Command", () => {
|
|
|
136
124
|
const config = JSON.parse(
|
|
137
125
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
138
126
|
);
|
|
139
|
-
expect(config.include).toEqual([
|
|
140
|
-
"tinybird/datasources.ts",
|
|
141
|
-
"tinybird/endpoints.ts",
|
|
142
|
-
]);
|
|
127
|
+
expect(config.include).toEqual(["lib/tinybird.ts"]);
|
|
143
128
|
});
|
|
144
129
|
});
|
|
145
130
|
|
|
146
131
|
describe("file content creation", () => {
|
|
147
|
-
it("creates
|
|
148
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
132
|
+
it("creates tinybird.ts with example datasource, endpoint, and client", async () => {
|
|
133
|
+
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
149
134
|
|
|
150
135
|
const content = fs.readFileSync(
|
|
151
|
-
path.join(tempDir, "
|
|
136
|
+
path.join(tempDir, "lib", "tinybird.ts"),
|
|
152
137
|
"utf-8"
|
|
153
138
|
);
|
|
154
139
|
|
|
140
|
+
// Check datasource content
|
|
155
141
|
expect(content).toContain("defineDatasource");
|
|
156
142
|
expect(content).toContain("export const pageViews");
|
|
157
143
|
expect(content).toContain("InferRow");
|
|
158
144
|
expect(content).toContain("PageViewsRow");
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it("creates endpoints.ts with example endpoint and types", async () => {
|
|
162
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
163
|
-
|
|
164
|
-
const content = fs.readFileSync(
|
|
165
|
-
path.join(tempDir, "tinybird", "endpoints.ts"),
|
|
166
|
-
"utf-8"
|
|
167
|
-
);
|
|
168
145
|
|
|
146
|
+
// Check endpoint content
|
|
169
147
|
expect(content).toContain("defineEndpoint");
|
|
170
148
|
expect(content).toContain("export const topPages");
|
|
171
149
|
expect(content).toContain("InferParams");
|
|
172
150
|
expect(content).toContain("InferOutputRow");
|
|
173
151
|
expect(content).toContain("TopPagesParams");
|
|
174
152
|
expect(content).toContain("TopPagesOutput");
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
it("creates client.ts with createTinybirdClient", async () => {
|
|
178
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
179
|
-
|
|
180
|
-
const content = fs.readFileSync(
|
|
181
|
-
path.join(tempDir, "tinybird", "client.ts"),
|
|
182
|
-
"utf-8"
|
|
183
|
-
);
|
|
184
153
|
|
|
154
|
+
// Check client content
|
|
185
155
|
expect(content).toContain("createTinybirdClient");
|
|
186
|
-
expect(content).toContain("export const tinybird");
|
|
187
|
-
expect(content).toContain("pageViews");
|
|
188
|
-
expect(content).toContain("topPages");
|
|
189
156
|
});
|
|
190
157
|
|
|
191
|
-
it("skips
|
|
192
|
-
fs.mkdirSync(path.join(tempDir, "
|
|
158
|
+
it("skips tinybird.ts if it already exists", async () => {
|
|
159
|
+
fs.mkdirSync(path.join(tempDir, "lib"), { recursive: true });
|
|
193
160
|
fs.writeFileSync(
|
|
194
|
-
path.join(tempDir, "
|
|
161
|
+
path.join(tempDir, "lib", "tinybird.ts"),
|
|
195
162
|
"// existing content"
|
|
196
163
|
);
|
|
197
164
|
|
|
198
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
165
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
199
166
|
|
|
200
167
|
expect(result.success).toBe(true);
|
|
201
|
-
expect(result.skipped).toContain("tinybird
|
|
168
|
+
expect(result.skipped).toContain("lib/tinybird.ts");
|
|
202
169
|
|
|
203
170
|
// Verify it wasn't overwritten
|
|
204
171
|
const content = fs.readFileSync(
|
|
205
|
-
path.join(tempDir, "
|
|
172
|
+
path.join(tempDir, "lib", "tinybird.ts"),
|
|
206
173
|
"utf-8"
|
|
207
174
|
);
|
|
208
175
|
expect(content).toBe("// existing content");
|
|
209
176
|
});
|
|
210
177
|
|
|
211
|
-
it("overwrites
|
|
212
|
-
fs.mkdirSync(path.join(tempDir, "
|
|
178
|
+
it("overwrites tinybird.ts with force option", async () => {
|
|
179
|
+
fs.mkdirSync(path.join(tempDir, "lib"), { recursive: true });
|
|
213
180
|
fs.writeFileSync(
|
|
214
|
-
path.join(tempDir, "
|
|
181
|
+
path.join(tempDir, "lib", "tinybird.ts"),
|
|
215
182
|
"// existing content"
|
|
216
183
|
);
|
|
217
184
|
|
|
218
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, force: true, devMode: "branch", clientPath: "tinybird" });
|
|
185
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, force: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
219
186
|
|
|
220
187
|
expect(result.success).toBe(true);
|
|
221
|
-
expect(result.created).toContain("tinybird
|
|
188
|
+
expect(result.created).toContain("lib/tinybird.ts");
|
|
222
189
|
|
|
223
190
|
const content = fs.readFileSync(
|
|
224
|
-
path.join(tempDir, "
|
|
191
|
+
path.join(tempDir, "lib", "tinybird.ts"),
|
|
225
192
|
"utf-8"
|
|
226
193
|
);
|
|
227
194
|
expect(content).toContain("defineDatasource");
|
|
@@ -236,7 +203,7 @@ describe("Init Command", () => {
|
|
|
236
203
|
JSON.stringify(packageJson, null, 2)
|
|
237
204
|
);
|
|
238
205
|
|
|
239
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
206
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
240
207
|
|
|
241
208
|
expect(result.success).toBe(true);
|
|
242
209
|
expect(result.created).toContain("package.json (added tinybird scripts)");
|
|
@@ -264,7 +231,7 @@ describe("Init Command", () => {
|
|
|
264
231
|
JSON.stringify(packageJson, null, 2)
|
|
265
232
|
);
|
|
266
233
|
|
|
267
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
234
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
268
235
|
|
|
269
236
|
expect(result.success).toBe(true);
|
|
270
237
|
expect(result.created).not.toContain("package.json (added tinybird scripts)");
|
|
@@ -284,7 +251,7 @@ describe("Init Command", () => {
|
|
|
284
251
|
JSON.stringify(packageJson, null, 2)
|
|
285
252
|
);
|
|
286
253
|
|
|
287
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
254
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
288
255
|
|
|
289
256
|
expect(result.success).toBe(true);
|
|
290
257
|
|
|
@@ -296,7 +263,7 @@ describe("Init Command", () => {
|
|
|
296
263
|
});
|
|
297
264
|
|
|
298
265
|
it("does not fail if no package.json exists", async () => {
|
|
299
|
-
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
266
|
+
const result = await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
300
267
|
|
|
301
268
|
expect(result.success).toBe(true);
|
|
302
269
|
expect(result.created).not.toContain("package.json (added tinybird scripts)");
|
|
@@ -304,21 +271,21 @@ describe("Init Command", () => {
|
|
|
304
271
|
});
|
|
305
272
|
|
|
306
273
|
describe("directory creation", () => {
|
|
307
|
-
it("creates
|
|
308
|
-
expect(fs.existsSync(path.join(tempDir, "
|
|
274
|
+
it("creates lib directory if it does not exist", async () => {
|
|
275
|
+
expect(fs.existsSync(path.join(tempDir, "lib"))).toBe(false);
|
|
309
276
|
|
|
310
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "tinybird" });
|
|
277
|
+
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "lib/tinybird.ts" });
|
|
311
278
|
|
|
312
|
-
expect(fs.existsSync(path.join(tempDir, "
|
|
279
|
+
expect(fs.existsSync(path.join(tempDir, "lib"))).toBe(true);
|
|
313
280
|
});
|
|
314
281
|
|
|
315
|
-
it("creates src/
|
|
282
|
+
it("creates src/lib directory if project has src folder", async () => {
|
|
316
283
|
fs.mkdirSync(path.join(tempDir, "src"));
|
|
317
|
-
expect(fs.existsSync(path.join(tempDir, "src", "
|
|
284
|
+
expect(fs.existsSync(path.join(tempDir, "src", "lib"))).toBe(false);
|
|
318
285
|
|
|
319
|
-
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/tinybird" });
|
|
286
|
+
await runInit({ cwd: tempDir, skipLogin: true, devMode: "branch", clientPath: "src/lib/tinybird.ts" });
|
|
320
287
|
|
|
321
|
-
expect(fs.existsSync(path.join(tempDir, "src", "
|
|
288
|
+
expect(fs.existsSync(path.join(tempDir, "src", "lib"))).toBe(true);
|
|
322
289
|
});
|
|
323
290
|
});
|
|
324
291
|
|
|
@@ -437,7 +404,7 @@ describe("Init Command", () => {
|
|
|
437
404
|
cwd: tempDir,
|
|
438
405
|
skipLogin: true,
|
|
439
406
|
devMode: "branch",
|
|
440
|
-
clientPath: "tinybird",
|
|
407
|
+
clientPath: "lib/tinybird.ts",
|
|
441
408
|
skipDatafilePrompt: true,
|
|
442
409
|
includeExistingDatafiles: true,
|
|
443
410
|
});
|
|
@@ -462,7 +429,7 @@ describe("Init Command", () => {
|
|
|
462
429
|
cwd: tempDir,
|
|
463
430
|
skipLogin: true,
|
|
464
431
|
devMode: "branch",
|
|
465
|
-
clientPath: "tinybird",
|
|
432
|
+
clientPath: "lib/tinybird.ts",
|
|
466
433
|
skipDatafilePrompt: true,
|
|
467
434
|
includeExistingDatafiles: false,
|
|
468
435
|
});
|
|
@@ -474,10 +441,7 @@ describe("Init Command", () => {
|
|
|
474
441
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
475
442
|
);
|
|
476
443
|
expect(config.include).not.toContain("datasources/events.datasource");
|
|
477
|
-
expect(config.include).toEqual([
|
|
478
|
-
"tinybird/datasources.ts",
|
|
479
|
-
"tinybird/endpoints.ts",
|
|
480
|
-
]);
|
|
444
|
+
expect(config.include).toEqual(["lib/tinybird.ts"]);
|
|
481
445
|
});
|
|
482
446
|
|
|
483
447
|
it("preserves TypeScript include paths alongside datafiles", async () => {
|
|
@@ -489,7 +453,7 @@ describe("Init Command", () => {
|
|
|
489
453
|
cwd: tempDir,
|
|
490
454
|
skipLogin: true,
|
|
491
455
|
devMode: "branch",
|
|
492
|
-
clientPath: "tinybird",
|
|
456
|
+
clientPath: "lib/tinybird.ts",
|
|
493
457
|
skipDatafilePrompt: true,
|
|
494
458
|
includeExistingDatafiles: true,
|
|
495
459
|
});
|
|
@@ -499,9 +463,8 @@ describe("Init Command", () => {
|
|
|
499
463
|
const config = JSON.parse(
|
|
500
464
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
501
465
|
);
|
|
502
|
-
// Should have both TypeScript
|
|
503
|
-
expect(config.include).toContain("tinybird
|
|
504
|
-
expect(config.include).toContain("tinybird/endpoints.ts");
|
|
466
|
+
// Should have both TypeScript file AND datafiles
|
|
467
|
+
expect(config.include).toContain("lib/tinybird.ts");
|
|
505
468
|
expect(config.include).toContain("datasources/events.datasource");
|
|
506
469
|
});
|
|
507
470
|
|
|
@@ -510,7 +473,7 @@ describe("Init Command", () => {
|
|
|
510
473
|
cwd: tempDir,
|
|
511
474
|
skipLogin: true,
|
|
512
475
|
devMode: "branch",
|
|
513
|
-
clientPath: "tinybird",
|
|
476
|
+
clientPath: "lib/tinybird.ts",
|
|
514
477
|
skipDatafilePrompt: true,
|
|
515
478
|
includeExistingDatafiles: true,
|
|
516
479
|
});
|
|
@@ -521,10 +484,7 @@ describe("Init Command", () => {
|
|
|
521
484
|
const config = JSON.parse(
|
|
522
485
|
fs.readFileSync(path.join(tempDir, "tinybird.json"), "utf-8")
|
|
523
486
|
);
|
|
524
|
-
expect(config.include).toEqual([
|
|
525
|
-
"tinybird/datasources.ts",
|
|
526
|
-
"tinybird/endpoints.ts",
|
|
527
|
-
]);
|
|
487
|
+
expect(config.include).toEqual(["lib/tinybird.ts"]);
|
|
528
488
|
});
|
|
529
489
|
});
|
|
530
490
|
});
|