@bubblydoo/uxp-test-framework 0.0.2 → 0.0.4
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/cli.js +5 -0
- package/package.json +11 -7
- package/bin/create-uxp-test-plugin.js +0 -68
package/bin/cli.js
ADDED
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bubblydoo/uxp-test-framework",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Hans Otto Wirtz <hansottowirtz@gmail.com>",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/bubblydoo/uxp-toolkit.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/bubblydoo/uxp-toolkit/tree/main/packages/uxp-test-framework",
|
|
7
12
|
"bin": {
|
|
8
|
-
"
|
|
13
|
+
"uxp-test": "bin/cli.js"
|
|
9
14
|
},
|
|
10
15
|
"exports": {
|
|
11
16
|
".": {
|
|
@@ -21,16 +26,15 @@
|
|
|
21
26
|
"access": "public"
|
|
22
27
|
},
|
|
23
28
|
"dependencies": {
|
|
24
|
-
"
|
|
25
|
-
"@bubblydoo/uxp-test-framework-base": "0.0.
|
|
26
|
-
"@bubblydoo/uxp-test-framework-plugin": "0.0.2"
|
|
29
|
+
"@bubblydoo/uxp-test-framework-plugin": "0.0.4",
|
|
30
|
+
"@bubblydoo/uxp-test-framework-base": "0.0.4"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
|
-
"vite": "^
|
|
33
|
+
"vite": "^6.4.1",
|
|
30
34
|
"tsup": "^8.5.1",
|
|
31
35
|
"@types/node": "^20.8.7",
|
|
32
36
|
"typescript": "^5.8.3",
|
|
33
|
-
"@bubblydoo/tsconfig": "^0.0.
|
|
37
|
+
"@bubblydoo/tsconfig": "^0.0.3"
|
|
34
38
|
},
|
|
35
39
|
"scripts": {
|
|
36
40
|
"build": "tsup src/index.ts --format esm --dts --outDir dist"
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { build, createServer } from 'vite'
|
|
4
|
-
import { createViteConfig } from '@bubblydoo/uxp-test-framework-plugin/create-vite-config';
|
|
5
|
-
import arg from 'arg';
|
|
6
|
-
import path from 'path';
|
|
7
|
-
import z from 'zod';
|
|
8
|
-
import fs from 'fs/promises';
|
|
9
|
-
|
|
10
|
-
const configSchema = z.object({
|
|
11
|
-
testsFile: z.string(),
|
|
12
|
-
testFixturesDir: z.string().optional(),
|
|
13
|
-
outDir: z.string().optional().default('uxp-tests-plugin'),
|
|
14
|
-
plugin: z.object({
|
|
15
|
-
id: z.string(),
|
|
16
|
-
name: z.string(),
|
|
17
|
-
}),
|
|
18
|
-
vite: z.object({
|
|
19
|
-
alias: z.record(z.string(), z.string()).optional().default({}),
|
|
20
|
-
}).optional().default({}),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
const actionSchema = z.enum(['build', 'dev']);
|
|
24
|
-
|
|
25
|
-
const args = arg({
|
|
26
|
-
'--config': String,
|
|
27
|
-
'-c': '--config',
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const action = actionSchema.parse(args._[0]);
|
|
31
|
-
|
|
32
|
-
const configFileName = args['--config'] || 'uxp-tests.json';
|
|
33
|
-
const configFilePath = path.resolve(process.cwd(), configFileName);
|
|
34
|
-
|
|
35
|
-
if (!await fileExists(configFilePath)) {
|
|
36
|
-
console.error(`Config file ${configFilePath} does not exist`);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const configString = await fs.readFile(configFilePath, 'utf8');
|
|
41
|
-
const config = configSchema.parse(JSON.parse(configString));
|
|
42
|
-
const configDirName = path.dirname(configFilePath);
|
|
43
|
-
|
|
44
|
-
const resolvedConfig = {
|
|
45
|
-
outDir: path.resolve(configDirName, config.outDir),
|
|
46
|
-
testsFile: path.resolve(configDirName, config.testsFile),
|
|
47
|
-
testFixturesDir: config.testFixturesDir ? path.resolve(configDirName, config.testFixturesDir) : undefined,
|
|
48
|
-
plugin: {
|
|
49
|
-
id: config.plugin.id,
|
|
50
|
-
name: config.plugin.name,
|
|
51
|
-
},
|
|
52
|
-
vite: {
|
|
53
|
-
alias: Object.fromEntries(Object.entries(config.vite.alias).map(([key, value]) => [key, path.resolve(configDirName, value)])),
|
|
54
|
-
},
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const viteConfig = createViteConfig(resolvedConfig, action);
|
|
58
|
-
|
|
59
|
-
await build(viteConfig);
|
|
60
|
-
|
|
61
|
-
async function fileExists(path) {
|
|
62
|
-
try {
|
|
63
|
-
await fs.stat(path);
|
|
64
|
-
return true;
|
|
65
|
-
} catch {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
}
|