cognite-create 0.2.36 → 0.2.37
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/bin/index.js +29 -5
- package/bin/index.test.js +19 -28
- package/package.json +1 -1
- package/templates/src/App.tsx +1 -3
- /package/templates/src/{App.css → index.css} +0 -0
package/bin/index.js
CHANGED
|
@@ -79,16 +79,16 @@ async function main() {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Skip install and start prompts - we'll install our own dependencies
|
|
82
|
-
const
|
|
83
|
-
(arg) =>
|
|
84
|
-
arg === "--skip-install" || arg === "--install" || arg === "--no-install"
|
|
82
|
+
const hasNoInstallFlag = additionalArgs.some(
|
|
83
|
+
(arg) => arg === "--no-install" || arg === "--install"
|
|
85
84
|
);
|
|
86
|
-
if (!
|
|
87
|
-
additionalArgs.push("--
|
|
85
|
+
if (!hasNoInstallFlag) {
|
|
86
|
+
additionalArgs.push("--no-install");
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
const createArgs = ["create-vite@latest", projectDir, ...additionalArgs];
|
|
91
90
|
await runCreateVite(createArgs);
|
|
91
|
+
await cleanupViteDefaults(projectDir);
|
|
92
92
|
await addCogniteTemplates(projectDir);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -111,6 +111,30 @@ function runCreateVite(cliArgs) {
|
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
async function cleanupViteDefaults(projectDir) {
|
|
115
|
+
const targetRoot = path.resolve(process.cwd(), projectDir);
|
|
116
|
+
|
|
117
|
+
// Files to remove since we're using Tailwind CSS
|
|
118
|
+
const filesToRemove = [
|
|
119
|
+
path.join(targetRoot, "src", "App.css"),
|
|
120
|
+
path.join(targetRoot, "src", "index.css"),
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
for (const filePath of filesToRemove) {
|
|
124
|
+
try {
|
|
125
|
+
await fs.unlink(filePath);
|
|
126
|
+
console.log(`Removed ${path.relative(process.cwd(), filePath)}`);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
// File might not exist, that's okay
|
|
129
|
+
if (error.code !== "ENOENT") {
|
|
130
|
+
console.warn(
|
|
131
|
+
`Could not remove ${path.relative(process.cwd(), filePath)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
114
138
|
async function addCogniteTemplates(projectDir) {
|
|
115
139
|
const targetRoot = path.resolve(process.cwd(), projectDir);
|
|
116
140
|
const templateRoot = path.resolve(__dirname, "..", "templates");
|
package/bin/index.test.js
CHANGED
|
@@ -135,7 +135,7 @@ describe("CLI Command Tests", () => {
|
|
|
135
135
|
]);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
it("should add --no-rolldown and --
|
|
138
|
+
it("should add --no-rolldown and --no-install flags by default", () => {
|
|
139
139
|
const args = ["my-project"];
|
|
140
140
|
let projectDir;
|
|
141
141
|
let additionalArgs = [];
|
|
@@ -164,14 +164,11 @@ describe("CLI Command Tests", () => {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// Skip install and start prompts - we'll install our own dependencies
|
|
167
|
-
const
|
|
168
|
-
(arg) =>
|
|
169
|
-
arg === "--skip-install" ||
|
|
170
|
-
arg === "--install" ||
|
|
171
|
-
arg === "--no-install"
|
|
167
|
+
const hasNoInstallFlag = additionalArgs.some(
|
|
168
|
+
(arg) => arg === "--no-install" || arg === "--install"
|
|
172
169
|
);
|
|
173
|
-
if (!
|
|
174
|
-
additionalArgs.push("--
|
|
170
|
+
if (!hasNoInstallFlag) {
|
|
171
|
+
additionalArgs.push("--no-install");
|
|
175
172
|
}
|
|
176
173
|
|
|
177
174
|
const createArgs = ["create-vite@latest", projectDir, ...additionalArgs];
|
|
@@ -181,7 +178,7 @@ describe("CLI Command Tests", () => {
|
|
|
181
178
|
"--template",
|
|
182
179
|
"react-ts",
|
|
183
180
|
"--no-rolldown",
|
|
184
|
-
"--
|
|
181
|
+
"--no-install",
|
|
185
182
|
]);
|
|
186
183
|
expect(createArgs).toEqual([
|
|
187
184
|
"create-vite@latest",
|
|
@@ -189,7 +186,7 @@ describe("CLI Command Tests", () => {
|
|
|
189
186
|
"--template",
|
|
190
187
|
"react-ts",
|
|
191
188
|
"--no-rolldown",
|
|
192
|
-
"--
|
|
189
|
+
"--no-install",
|
|
193
190
|
]);
|
|
194
191
|
});
|
|
195
192
|
|
|
@@ -222,14 +219,11 @@ describe("CLI Command Tests", () => {
|
|
|
222
219
|
}
|
|
223
220
|
|
|
224
221
|
// Skip install and start prompts
|
|
225
|
-
const
|
|
226
|
-
(arg) =>
|
|
227
|
-
arg === "--skip-install" ||
|
|
228
|
-
arg === "--install" ||
|
|
229
|
-
arg === "--no-install"
|
|
222
|
+
const hasNoInstallFlag = additionalArgs.some(
|
|
223
|
+
(arg) => arg === "--no-install" || arg === "--install"
|
|
230
224
|
);
|
|
231
|
-
if (!
|
|
232
|
-
additionalArgs.push("--
|
|
225
|
+
if (!hasNoInstallFlag) {
|
|
226
|
+
additionalArgs.push("--no-install");
|
|
233
227
|
}
|
|
234
228
|
|
|
235
229
|
const createArgs = ["create-vite@latest", projectDir, ...additionalArgs];
|
|
@@ -239,7 +233,7 @@ describe("CLI Command Tests", () => {
|
|
|
239
233
|
"--rolldown",
|
|
240
234
|
"--template",
|
|
241
235
|
"react-ts",
|
|
242
|
-
"--
|
|
236
|
+
"--no-install",
|
|
243
237
|
]);
|
|
244
238
|
expect(createArgs).toEqual([
|
|
245
239
|
"create-vite@latest",
|
|
@@ -247,7 +241,7 @@ describe("CLI Command Tests", () => {
|
|
|
247
241
|
"--rolldown",
|
|
248
242
|
"--template",
|
|
249
243
|
"react-ts",
|
|
250
|
-
"--
|
|
244
|
+
"--no-install",
|
|
251
245
|
]);
|
|
252
246
|
});
|
|
253
247
|
|
|
@@ -280,14 +274,11 @@ describe("CLI Command Tests", () => {
|
|
|
280
274
|
}
|
|
281
275
|
|
|
282
276
|
// Skip install and start prompts
|
|
283
|
-
const
|
|
284
|
-
(arg) =>
|
|
285
|
-
arg === "--skip-install" ||
|
|
286
|
-
arg === "--install" ||
|
|
287
|
-
arg === "--no-install"
|
|
277
|
+
const hasNoInstallFlag = additionalArgs.some(
|
|
278
|
+
(arg) => arg === "--no-install" || arg === "--install"
|
|
288
279
|
);
|
|
289
|
-
if (!
|
|
290
|
-
additionalArgs.push("--
|
|
280
|
+
if (!hasNoInstallFlag) {
|
|
281
|
+
additionalArgs.push("--no-install");
|
|
291
282
|
}
|
|
292
283
|
|
|
293
284
|
const createArgs = ["create-vite@latest", projectDir, ...additionalArgs];
|
|
@@ -297,7 +288,7 @@ describe("CLI Command Tests", () => {
|
|
|
297
288
|
"--no-rolldown",
|
|
298
289
|
"--template",
|
|
299
290
|
"react-ts",
|
|
300
|
-
"--
|
|
291
|
+
"--no-install",
|
|
301
292
|
]);
|
|
302
293
|
expect(createArgs).toEqual([
|
|
303
294
|
"create-vite@latest",
|
|
@@ -305,7 +296,7 @@ describe("CLI Command Tests", () => {
|
|
|
305
296
|
"--no-rolldown",
|
|
306
297
|
"--template",
|
|
307
298
|
"react-ts",
|
|
308
|
-
"--
|
|
299
|
+
"--no-install",
|
|
309
300
|
]);
|
|
310
301
|
});
|
|
311
302
|
|
package/package.json
CHANGED
package/templates/src/App.tsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import "./App.css";
|
|
2
|
-
|
|
3
1
|
function App() {
|
|
4
2
|
return (
|
|
5
|
-
<div className="min-h-screen bg-linear-to-br from-blue-50 to-indigo-100 flex items-center justify-center">
|
|
3
|
+
<div className="min-w-screen min-h-screen bg-linear-to-br from-blue-50 to-indigo-100 flex items-center justify-center">
|
|
6
4
|
<div className="text-center px-8">
|
|
7
5
|
<h1 className="text-6xl md:text-8xl font-bold text-gray-900 mb-8">
|
|
8
6
|
Welcome to{" "}
|
|
File without changes
|