@bubblydoo/uxp-test-framework 0.0.2

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.
@@ -0,0 +1,68 @@
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
+ }
@@ -0,0 +1 @@
1
+ export * from '@bubblydoo/uxp-test-framework-base';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // src/index.ts
2
+ export * from "@bubblydoo/uxp-test-framework-base";
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@bubblydoo/uxp-test-framework",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "author": "Hans Otto Wirtz <hansottowirtz@gmail.com>",
7
+ "bin": {
8
+ "create-uxp-test-plugin": "./bin/create-uxp-test-plugin.js"
9
+ },
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "dependencies": {
24
+ "zod": "^4.3.6",
25
+ "@bubblydoo/uxp-test-framework-base": "0.0.2",
26
+ "@bubblydoo/uxp-test-framework-plugin": "0.0.2"
27
+ },
28
+ "devDependencies": {
29
+ "vite": "^7.3.1",
30
+ "tsup": "^8.5.1",
31
+ "@types/node": "^20.8.7",
32
+ "typescript": "^5.8.3",
33
+ "@bubblydoo/tsconfig": "^0.0.1"
34
+ },
35
+ "scripts": {
36
+ "build": "tsup src/index.ts --format esm --dts --outDir dist"
37
+ }
38
+ }