@matthesketh/utopia-cli 0.4.0 → 0.5.0
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/index.js +16 -0
- package/package.json +5 -3
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
preview as vitePreview
|
|
11
11
|
} from "vite";
|
|
12
12
|
import utopia from "@matthesketh/utopia-vite-plugin";
|
|
13
|
+
import { utopiaTestPlugin } from "@matthesketh/utopia-test/plugin";
|
|
13
14
|
function parseArgs(argv) {
|
|
14
15
|
const args = argv.slice(2);
|
|
15
16
|
const META_FLAGS = /* @__PURE__ */ new Set(["-v", "--version", "-h", "--help"]);
|
|
@@ -91,6 +92,17 @@ async function preview(args) {
|
|
|
91
92
|
const server = await vitePreview(config);
|
|
92
93
|
server.printUrls();
|
|
93
94
|
}
|
|
95
|
+
async function test(args) {
|
|
96
|
+
const { startVitest } = await import("vitest/node");
|
|
97
|
+
const config = buildInlineConfig(args, "test");
|
|
98
|
+
const plugins = config.plugins ?? [];
|
|
99
|
+
plugins.push(utopiaTestPlugin());
|
|
100
|
+
config.plugins = plugins;
|
|
101
|
+
const vitest = await startVitest("test", args.rest, {
|
|
102
|
+
...config
|
|
103
|
+
});
|
|
104
|
+
await vitest?.close();
|
|
105
|
+
}
|
|
94
106
|
function printVersion() {
|
|
95
107
|
const require2 = createRequire(import.meta.url);
|
|
96
108
|
const pkg = require2("../package.json");
|
|
@@ -107,6 +119,7 @@ function printHelp() {
|
|
|
107
119
|
dev Start development server
|
|
108
120
|
build Build for production
|
|
109
121
|
preview Preview production build
|
|
122
|
+
test Run component tests
|
|
110
123
|
create Create a new project
|
|
111
124
|
|
|
112
125
|
Options:
|
|
@@ -131,6 +144,9 @@ async function main() {
|
|
|
131
144
|
case "preview":
|
|
132
145
|
await preview(args);
|
|
133
146
|
break;
|
|
147
|
+
case "test":
|
|
148
|
+
await test(args);
|
|
149
|
+
break;
|
|
134
150
|
case "create":
|
|
135
151
|
console.log("To create a new UtopiaJS project, run:");
|
|
136
152
|
console.log(" npx create-utopia [project-name]");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matthesketh/utopia-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CLI for the UtopiaJS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@matthesketh/utopia-vite-plugin": "0.
|
|
34
|
+
"@matthesketh/utopia-vite-plugin": "0.5.0",
|
|
35
|
+
"@matthesketh/utopia-test": "0.5.0"
|
|
35
36
|
},
|
|
36
37
|
"peerDependencies": {
|
|
37
|
-
"vite": "^6.0.0 || ^7.0.0"
|
|
38
|
+
"vite": "^6.0.0 || ^7.0.0",
|
|
39
|
+
"vitest": "^3.0.0"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"vite": "^7.3.1"
|