@yeow/create-yeow 0.1.5 → 0.2.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/cli.test.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync } from 'fs';
|
|
3
|
+
import { resolve } from 'path';
|
|
4
|
+
import { tmpdir } from 'os';
|
|
5
|
+
|
|
6
|
+
const originalCwd = process.cwd;
|
|
7
|
+
|
|
8
|
+
describe('@yeow/create-yeow CLI', () => {
|
|
9
|
+
let testDir;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
testDir = resolve(tmpdir(), 'yeow-test-' + Date.now());
|
|
13
|
+
mkdirSync(testDir, { recursive: true });
|
|
14
|
+
process.cwd = () => testDir;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
process.cwd = originalCwd;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should generate project directory with required files', async () => {
|
|
22
|
+
// These tests are structural - verify template files exist
|
|
23
|
+
const templateDir = resolve(import.meta.dirname, '..', 'templates', 'javascript');
|
|
24
|
+
|
|
25
|
+
expect(existsSync(templateDir)).toBe(true);
|
|
26
|
+
expect(existsSync(resolve(templateDir, 'yeow.config.js'))).toBe(true);
|
|
27
|
+
expect(existsSync(resolve(templateDir, 'package.json'))).toBe(true);
|
|
28
|
+
expect(existsSync(resolve(templateDir, 'rspack.config.js'))).toBe(true);
|
|
29
|
+
expect(existsSync(resolve(templateDir, '.yeow', 'build.js'))).toBe(true);
|
|
30
|
+
expect(existsSync(resolve(templateDir, '.yeow', 'dev-server.js'))).toBe(true);
|
|
31
|
+
expect(existsSync(resolve(templateDir, 'src', 'index.js'))).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('template yeow.config.js has correct structure', () => {
|
|
35
|
+
const configPath = resolve(
|
|
36
|
+
import.meta.dirname, '..', 'templates', 'javascript', 'yeow.config.js'
|
|
37
|
+
);
|
|
38
|
+
const config = require(configPath);
|
|
39
|
+
expect(config).toHaveProperty('plugin');
|
|
40
|
+
expect(config.plugin).toHaveProperty('name');
|
|
41
|
+
expect(config.plugin).toHaveProperty('version');
|
|
42
|
+
expect(config).toHaveProperty('build');
|
|
43
|
+
expect(config.build).toHaveProperty('entry');
|
|
44
|
+
expect(config.build).toHaveProperty('output');
|
|
45
|
+
expect(config).toHaveProperty('dev');
|
|
46
|
+
expect(config.dev).toHaveProperty('port');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('template src/index.js registers commands', () => {
|
|
50
|
+
const srcPath = resolve(
|
|
51
|
+
import.meta.dirname, '..', 'templates', 'javascript', 'src', 'index.js'
|
|
52
|
+
);
|
|
53
|
+
const content = readFileSync(srcPath, 'utf-8');
|
|
54
|
+
expect(content).toContain('yeow.command.register');
|
|
55
|
+
expect(content).toContain('yeow.player.get');
|
|
56
|
+
});
|
|
57
|
+
});
|
package/package.json
CHANGED
|
@@ -6,10 +6,13 @@
|
|
|
6
6
|
"build": "node .yeow/build.js",
|
|
7
7
|
"dev": "node .yeow/dev-server.js"
|
|
8
8
|
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@yeow/server-api": "^0.1.0"
|
|
11
|
+
},
|
|
9
12
|
"devDependencies": {
|
|
10
13
|
"@rspack/cli": "^1.0.0",
|
|
11
14
|
"@rspack/core": "^1.0.0",
|
|
12
15
|
"adm-zip": "^0.5.10",
|
|
13
16
|
"https-proxy-agent": "^9.0.0"
|
|
14
17
|
}
|
|
15
|
-
}
|
|
18
|
+
}
|