drgame-cc 1.0.9 → 1.0.11
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/package.json +3 -7
- package/scripts/postinstall.js +15 -25
- package/bin/drgame.d.ts +0 -632
- package/bin/drgame.js +0 -3010
- package/gulpfile.js +0 -68
- package/tsconfig.json +0 -26
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drgame-cc",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.11",
|
|
4
|
+
"description": "道然游戏适配包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
@@ -41,11 +41,7 @@
|
|
|
41
41
|
"files": [
|
|
42
42
|
"tvui/**/*",
|
|
43
43
|
"build-templates/**/*",
|
|
44
|
-
"scripts/postinstall.js"
|
|
45
|
-
"bin/**/*",
|
|
46
|
-
"gulpfile.js",
|
|
47
|
-
"tsconfig.json",
|
|
48
|
-
"README.md"
|
|
44
|
+
"scripts/postinstall.js"
|
|
49
45
|
],
|
|
50
46
|
"engines": {
|
|
51
47
|
"node": ">=18.0.0"
|
package/scripts/postinstall.js
CHANGED
|
@@ -5,34 +5,14 @@ const fs = require('fs');
|
|
|
5
5
|
const fse = require('fs-extra');
|
|
6
6
|
|
|
7
7
|
// ============================================================
|
|
8
|
-
// 1.
|
|
8
|
+
// 1. 宿主项目根目录(npm install 时 = node_modules 的父目录)
|
|
9
9
|
// ============================================================
|
|
10
|
-
const projectRoot = path.resolve(__dirname, '..', '..');
|
|
10
|
+
const projectRoot = path.resolve(__dirname, '..', '..', '..');
|
|
11
11
|
|
|
12
12
|
// ============================================================
|
|
13
13
|
// 2. 加载宿主项目根目录下的 .env
|
|
14
14
|
// ============================================================
|
|
15
|
-
|
|
16
|
-
const envPath = path.join(projectRoot, '.env');
|
|
17
|
-
if (fs.existsSync(envPath)) {
|
|
18
|
-
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
19
|
-
envContent.split('\n').forEach(line => {
|
|
20
|
-
const trimmedLine = line.trim();
|
|
21
|
-
if (trimmedLine && !trimmedLine.startsWith('#')) {
|
|
22
|
-
const [key, ...valueParts] = trimmedLine.split('=');
|
|
23
|
-
if (key && valueParts.length > 0) {
|
|
24
|
-
const value = valueParts.join('=').trim();
|
|
25
|
-
if (!process.env[key]) {
|
|
26
|
-
process.env[key] = value.replace(/^["']|["']$/g, '');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
console.log('✅ 已加载 .env');
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
loadEnvFile();
|
|
15
|
+
console.log('✅ 开始拷贝资源');
|
|
36
16
|
|
|
37
17
|
// ============================================================
|
|
38
18
|
// 3. 确定目标目录
|
|
@@ -47,7 +27,12 @@ console.log(`📦 目标目录: ${COCOS_ROOT}`);
|
|
|
47
27
|
// ============================================================
|
|
48
28
|
try {
|
|
49
29
|
// build-templates
|
|
50
|
-
const buildTemplatesSrc = path.join(
|
|
30
|
+
const buildTemplatesSrc = path.join(
|
|
31
|
+
projectRoot,
|
|
32
|
+
'node_modules',
|
|
33
|
+
'drgame-cc',
|
|
34
|
+
'build-templates'
|
|
35
|
+
);
|
|
51
36
|
const buildTemplatesDest = path.join(COCOS_ROOT, 'build-templates');
|
|
52
37
|
|
|
53
38
|
if (fs.existsSync(buildTemplatesSrc)) {
|
|
@@ -58,7 +43,12 @@ try {
|
|
|
58
43
|
}
|
|
59
44
|
|
|
60
45
|
// tvui
|
|
61
|
-
const tvuiSrc = path.join(
|
|
46
|
+
const tvuiSrc = path.join(
|
|
47
|
+
projectRoot,
|
|
48
|
+
'node_modules',
|
|
49
|
+
'drgame-cc',
|
|
50
|
+
'tvui'
|
|
51
|
+
);
|
|
62
52
|
const tvuiDest = path.join(COCOS_ROOT, 'assets', 'resources', 'tvui');
|
|
63
53
|
|
|
64
54
|
if (fs.existsSync(tvuiSrc)) {
|