@playcraft/cli 0.0.53 → 0.0.55
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/commands/create.js +164 -98
- package/dist/index.js +4 -1
- package/dist/scaffold/templates.js +35 -0
- package/package.json +3 -3
- package/project-templates/playable-template-phaser/.playcraftignore +10 -0
- package/project-templates/playable-template-phaser/CLAUDE.md +178 -0
- package/project-templates/playable-template-phaser/PLAYCRAFT-MIGRATION.md +328 -0
- package/project-templates/playable-template-phaser/README.md +381 -0
- package/project-templates/playable-template-phaser/assets/brain.png +0 -0
- package/project-templates/playable-template-phaser/assets/button.png +0 -0
- package/project-templates/playable-template-phaser/assets/interact.png +0 -0
- package/project-templates/playable-template-phaser/assets/logo.webp +0 -0
- package/project-templates/playable-template-phaser/assets/warn_brain.png +0 -0
- package/project-templates/playable-template-phaser/builds.config.js +12 -0
- package/project-templates/playable-template-phaser/globals.d.ts +2 -0
- package/project-templates/playable-template-phaser/index.html +12 -0
- package/project-templates/playable-template-phaser/package.json +45 -0
- package/project-templates/playable-template-phaser/scripts/base64-to-mp3.js +340 -0
- package/project-templates/playable-template-phaser/scripts/convert-to-webp.js +370 -0
- package/project-templates/playable-template-phaser/src/Game.ts +154 -0
- package/project-templates/playable-template-phaser/src/config/LoadingConfig.ts +40 -0
- package/project-templates/playable-template-phaser/src/config/ThemeConfig.ts +81 -0
- package/project-templates/playable-template-phaser/src/index.css +18 -0
- package/project-templates/playable-template-phaser/src/index.html +9 -0
- package/project-templates/playable-template-phaser/src/index.ts +30 -0
- package/project-templates/playable-template-phaser/src/json5.d.ts +4 -0
- package/project-templates/playable-template-phaser/src/managers/AudioManager.ts +559 -0
- package/project-templates/playable-template-phaser/src/scenes/MainScene.ts +301 -0
- package/project-templates/playable-template-phaser/src/scenes/PreloadScene.ts +256 -0
- package/project-templates/playable-template-phaser/src/theme/README.md +194 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/assets/.gitkeep +24 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/index.ts +27 -0
- package/project-templates/playable-template-phaser/src/theme/blue-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/index.ts +20 -0
- package/project-templates/playable-template-phaser/src/theme/green-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/index.ts +1 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/index.ts +20 -0
- package/project-templates/playable-template-phaser/src/theme/red-theme/theme.data.json5 +19 -0
- package/project-templates/playable-template-phaser/src/theme/theme.metadata.md +60 -0
- package/project-templates/playable-template-phaser/src/theme/theme.schema.json5 +149 -0
- package/project-templates/playable-template-phaser/src/ui/BrainAgeUI.ts +681 -0
- package/project-templates/playable-template-phaser/src/ui/CountdownUI.ts +565 -0
- package/project-templates/playable-template-phaser/src/ui/PlayButton.ts +51 -0
- package/project-templates/playable-template-phaser/src/ui/ScoreUI.ts +207 -0
- package/project-templates/playable-template-phaser/src/ui/SuccessUI.ts +43 -0
- package/project-templates/playable-template-phaser/src/ui/index.ts +15 -0
- package/project-templates/playable-template-phaser/tsconfig.json +26 -0
- package/project-templates/playable-template-phaser/vite.config.ts +64 -0
- package/project-templates/playable-template-phaser//346/226/260/346/211/213/345/274/200/345/217/221/346/214/207/345/215/227.md +209 -0
- package/project-templates/playable-template-three/README.md +795 -0
- package/project-templates/playable-template-three/assets/Stork.glb +0 -0
- package/project-templates/playable-template-three/assets/button.png +0 -0
- package/project-templates/playable-template-three/assets/logo.webp +0 -0
- package/project-templates/playable-template-three/build.json +7 -0
- package/project-templates/playable-template-three/builds.config.example.js +151 -0
- package/project-templates/playable-template-three/builds.config.js +158 -0
- package/project-templates/playable-template-three/package.json +36 -0
- package/project-templates/playable-template-three/scripts/convert-to-webp.js +370 -0
- package/project-templates/playable-template-three/scripts/theme-builds.js +514 -0
- package/project-templates/playable-template-three/src/Game.ts +215 -0
- package/project-templates/playable-template-three/src/config/LoadingConfig.ts +27 -0
- package/project-templates/playable-template-three/src/config/ThemeConfig.ts +36 -0
- package/project-templates/playable-template-three/src/global.d.ts +108 -0
- package/project-templates/playable-template-three/src/index.css +18 -0
- package/project-templates/playable-template-three/src/index.html +9 -0
- package/project-templates/playable-template-three/src/index.ts +20 -0
- package/project-templates/playable-template-three/src/managers/AudioManager.ts +538 -0
- package/project-templates/playable-template-three/src/scenes/PreloadScene.ts +305 -0
- package/project-templates/playable-template-three/src/theme/README.md +225 -0
- package/project-templates/playable-template-three/src/theme/blue-theme/assets/.gitkeep +28 -0
- package/project-templates/playable-template-three/src/theme/blue-theme/index.ts +45 -0
- package/project-templates/playable-template-three/src/theme/current.ts +12 -0
- package/project-templates/playable-template-three/src/theme/green-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-three/src/theme/green-theme/index.ts +34 -0
- package/project-templates/playable-template-three/src/theme/red-theme/assets/.gitkeep +3 -0
- package/project-templates/playable-template-three/src/theme/red-theme/index.ts +34 -0
- package/project-templates/playable-template-three/tsconfig.json +24 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 批量构建配置文件示例 - Three.js Template
|
|
3
|
+
*
|
|
4
|
+
* 将此文件复制为 builds.config.js 并根据项目需求修改配置
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
// ==================== 项目基本信息 ====================
|
|
9
|
+
|
|
10
|
+
projectName: 'My Three Game',
|
|
11
|
+
projectCode: '0001',
|
|
12
|
+
|
|
13
|
+
// ==================== 渠道配置 ====================
|
|
14
|
+
|
|
15
|
+
channels: [
|
|
16
|
+
'google',
|
|
17
|
+
'facebook',
|
|
18
|
+
'tiktok',
|
|
19
|
+
'applovin',
|
|
20
|
+
'ironSource',
|
|
21
|
+
'unity',
|
|
22
|
+
'moloco',
|
|
23
|
+
'liftoff',
|
|
24
|
+
'bigoads'
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
// ==================== 主题配置 ====================
|
|
28
|
+
|
|
29
|
+
themes: {
|
|
30
|
+
// 是否启用主题切换功能
|
|
31
|
+
enabled: true,
|
|
32
|
+
|
|
33
|
+
// 主题目录(相对于项目根目录)
|
|
34
|
+
sourceDir: 'src/theme',
|
|
35
|
+
|
|
36
|
+
// 入口文件路径(相对于项目根目录)
|
|
37
|
+
entryFile: 'src/index.ts',
|
|
38
|
+
|
|
39
|
+
// 主题白名单过滤函数(可选)
|
|
40
|
+
// 返回 true 表示包含该主题,返回 false 表示排除
|
|
41
|
+
whitelist: (themeName) => {
|
|
42
|
+
// 示例:只构建包含 "FakeGame" 的主题
|
|
43
|
+
// return themeName.includes('FakeGame');
|
|
44
|
+
|
|
45
|
+
// 示例:排除测试主题
|
|
46
|
+
// return !themeName.startsWith('test-');
|
|
47
|
+
|
|
48
|
+
// 默认:包含所有主题
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
// ==================== 文件命名配置 ====================
|
|
54
|
+
|
|
55
|
+
naming: {
|
|
56
|
+
language: 'EN',
|
|
57
|
+
format: '无',
|
|
58
|
+
supplier: 'AIX',
|
|
59
|
+
follower: 'ZQL',
|
|
60
|
+
|
|
61
|
+
// 自定义文件名生成函数(可选)
|
|
62
|
+
// 参数:themeName, channel, date (YYYYMMDD), month (X月)
|
|
63
|
+
// 返回:文件名(不含扩展名)
|
|
64
|
+
generator: (themeName, channel, date, month) => {
|
|
65
|
+
// 默认格式:主题-EN-无-2月-20260224-AIX-ZQL-google
|
|
66
|
+
const parts = [
|
|
67
|
+
themeName,
|
|
68
|
+
'EN',
|
|
69
|
+
'无',
|
|
70
|
+
month,
|
|
71
|
+
date,
|
|
72
|
+
'AIX',
|
|
73
|
+
'ZQL',
|
|
74
|
+
channel.toLowerCase()
|
|
75
|
+
];
|
|
76
|
+
return parts.join('-');
|
|
77
|
+
|
|
78
|
+
// 示例:自定义格式
|
|
79
|
+
// return `${themeName}-${channel}-${date}`;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
// ==================== 构建配置 ====================
|
|
84
|
+
|
|
85
|
+
build: {
|
|
86
|
+
// 批量构建输出目录
|
|
87
|
+
outputDir: 'dist-all',
|
|
88
|
+
|
|
89
|
+
// 单次构建临时目录
|
|
90
|
+
tempDir: 'dist',
|
|
91
|
+
|
|
92
|
+
// 单个渠道失败后是否继续构建
|
|
93
|
+
continueOnError: true,
|
|
94
|
+
|
|
95
|
+
// 构建后是否清理临时目录
|
|
96
|
+
cleanTemp: true
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// ==================== 实际项目示例 ====================
|
|
101
|
+
|
|
102
|
+
// 示例1:Three.js 麻将俄罗斯方块项目
|
|
103
|
+
/*
|
|
104
|
+
module.exports = {
|
|
105
|
+
projectName: 'Three-Mahjong-Tetris',
|
|
106
|
+
projectCode: 'TMT',
|
|
107
|
+
|
|
108
|
+
channels: [
|
|
109
|
+
'google', 'facebook', 'tiktok', 'applovin',
|
|
110
|
+
'ironSource', 'unity', 'moloco', 'liftoff', 'bigoads'
|
|
111
|
+
],
|
|
112
|
+
|
|
113
|
+
themes: {
|
|
114
|
+
enabled: true,
|
|
115
|
+
sourceDir: 'src/theme',
|
|
116
|
+
entryFile: 'src/index.ts'
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
naming: {
|
|
120
|
+
language: 'EN',
|
|
121
|
+
format: '无',
|
|
122
|
+
supplier: 'AIX',
|
|
123
|
+
follower: 'ZQL',
|
|
124
|
+
// 自定义文件名格式:主题-渠道-EN-无-月-日期-AIX-ZQL
|
|
125
|
+
generator: (theme, channel, date, month) => {
|
|
126
|
+
return `${theme}-${channel}-EN-无-${month}-${date}-AIX-ZQL`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
// 示例2:无主题切换的简单项目
|
|
133
|
+
/*
|
|
134
|
+
module.exports = {
|
|
135
|
+
projectName: 'Simple-Three-Game',
|
|
136
|
+
projectCode: 'STG',
|
|
137
|
+
|
|
138
|
+
channels: ['google', 'facebook'],
|
|
139
|
+
|
|
140
|
+
themes: {
|
|
141
|
+
enabled: false // 不启用主题切换
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
naming: {
|
|
145
|
+
language: 'EN',
|
|
146
|
+
format: 'S',
|
|
147
|
+
supplier: 'AIX',
|
|
148
|
+
follower: 'YOUR_NAME'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
*/
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three.js Template 批量构建配置
|
|
3
|
+
*
|
|
4
|
+
* 支持多主题批量构建,适合 A/B 测试和版本迭代
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
// ==================== 项目基本信息 ====================
|
|
9
|
+
|
|
10
|
+
// 项目名称(用于文件名生成)
|
|
11
|
+
projectName: 'Three-Template',
|
|
12
|
+
|
|
13
|
+
// 商店链接配置
|
|
14
|
+
googlePlayUrl: 'https://play.google.com/store/games',
|
|
15
|
+
appStoreUrl: 'https://www.apple.com/app-store/',
|
|
16
|
+
|
|
17
|
+
// ==================== 渠道配置 ====================
|
|
18
|
+
|
|
19
|
+
channels: [
|
|
20
|
+
'google',
|
|
21
|
+
'facebook',
|
|
22
|
+
'tiktok',
|
|
23
|
+
'applovin',
|
|
24
|
+
'ironSource',
|
|
25
|
+
'unity',
|
|
26
|
+
'moloco',
|
|
27
|
+
'liftoff',
|
|
28
|
+
'bigoads'
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
// ==================== 主题配置 ====================
|
|
32
|
+
|
|
33
|
+
themes: {
|
|
34
|
+
// 是否启用主题切换功能
|
|
35
|
+
// - true: 支持多主题批量构建(src/theme/ 下的每个目录是一个主题)
|
|
36
|
+
// - false: 不使用主题系统,直接使用 src/Game.ts
|
|
37
|
+
enabled: true,
|
|
38
|
+
|
|
39
|
+
// 主题目录(相对于项目根目录)
|
|
40
|
+
sourceDir: 'src/theme',
|
|
41
|
+
|
|
42
|
+
// 入口文件路径(批量构建时会自动修改此文件)
|
|
43
|
+
entryFile: 'src/theme/current.ts',
|
|
44
|
+
|
|
45
|
+
// 主题白名单过滤函数(可选)
|
|
46
|
+
// 参数:themeName - 主题目录名
|
|
47
|
+
// 返回:true 包含该主题,false 排除该主题
|
|
48
|
+
whitelist: (themeName) => {
|
|
49
|
+
// 示例 1:排除测试主题
|
|
50
|
+
// return !themeName.startsWith('test-');
|
|
51
|
+
|
|
52
|
+
// 示例 2:只构建特定主题
|
|
53
|
+
// return ['theme1', 'theme2'].includes(themeName);
|
|
54
|
+
|
|
55
|
+
// 示例 3:排除包含特定关键字的主题
|
|
56
|
+
// return !themeName.includes('old');
|
|
57
|
+
|
|
58
|
+
// 默认:包含所有主题
|
|
59
|
+
return true;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// 主题切换配置(可选)
|
|
63
|
+
switching: {
|
|
64
|
+
// 自定义入口文件生成函数
|
|
65
|
+
// 默认使用: export { default } from './themeName';
|
|
66
|
+
// 如果需要自定义格式,可以取消注释以下代码:
|
|
67
|
+
// generateEntryFile: (themeName) => {
|
|
68
|
+
// return `/**
|
|
69
|
+
// * 🎨 主题系统 - 统一出口
|
|
70
|
+
// */
|
|
71
|
+
//
|
|
72
|
+
// import Theme from './${themeName}';
|
|
73
|
+
// export default Theme;
|
|
74
|
+
// `;
|
|
75
|
+
// }
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
// ==================== 文件命名配置 ====================
|
|
81
|
+
|
|
82
|
+
naming: {
|
|
83
|
+
// 语言代码
|
|
84
|
+
language: 'EN',
|
|
85
|
+
|
|
86
|
+
// 格式标识
|
|
87
|
+
format: '无',
|
|
88
|
+
|
|
89
|
+
// 供应商名称
|
|
90
|
+
supplier: 'YOUR_COMPANY',
|
|
91
|
+
|
|
92
|
+
// 跟进人标识
|
|
93
|
+
follower: 'YOUR_NAME',
|
|
94
|
+
|
|
95
|
+
// 自定义文件名生成函数(可选)
|
|
96
|
+
// 参数:
|
|
97
|
+
// - themeName: 主题名称
|
|
98
|
+
// - channel: 渠道名称
|
|
99
|
+
// - date: 日期 (格式: 20260212)
|
|
100
|
+
// - month: 月份 (格式: 2月)
|
|
101
|
+
// 返回:文件名(不含扩展名)
|
|
102
|
+
generator: (themeName, channel, date, month) => {
|
|
103
|
+
// 示例格式: My-Game-主题名-EN-无-2月-20260212-AIX-ZQL-google
|
|
104
|
+
const parts = [
|
|
105
|
+
'My-Game',
|
|
106
|
+
themeName,
|
|
107
|
+
'EN',
|
|
108
|
+
'无',
|
|
109
|
+
month,
|
|
110
|
+
date,
|
|
111
|
+
'YOUR_COMPANY',
|
|
112
|
+
'YOUR_NAME',
|
|
113
|
+
channel.toLowerCase()
|
|
114
|
+
];
|
|
115
|
+
return parts.join('-');
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// ==================== 构建配置 ====================
|
|
120
|
+
|
|
121
|
+
build: {
|
|
122
|
+
outputDir: 'dist-all',
|
|
123
|
+
tempDirPrefix: 'dist-temp',
|
|
124
|
+
continueOnError: true,
|
|
125
|
+
cleanTemp: true
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
// ==================== 打包参数配置 ====================
|
|
129
|
+
|
|
130
|
+
// 代码混淆等级 (1-4)
|
|
131
|
+
obfuscateLevel: 4,
|
|
132
|
+
|
|
133
|
+
// fflate 压缩
|
|
134
|
+
fflateCompression: true,
|
|
135
|
+
|
|
136
|
+
// 广告协议 ('none', 'mraid', 'dapi')
|
|
137
|
+
// protocol: 'none',
|
|
138
|
+
|
|
139
|
+
// 语言设置
|
|
140
|
+
// language: 'en',
|
|
141
|
+
|
|
142
|
+
// 屏幕方向 ('portrait', 'landscape', 'both')
|
|
143
|
+
// orientation: 'both',
|
|
144
|
+
|
|
145
|
+
// 跳过推荐的 META 标签注入
|
|
146
|
+
// skipRecommendedMeta: false,
|
|
147
|
+
|
|
148
|
+
// ==================== 高级配置 ====================
|
|
149
|
+
|
|
150
|
+
// Webpack DefinePlugin 配置(可选)
|
|
151
|
+
// defines: {},
|
|
152
|
+
|
|
153
|
+
// 编译选项(可选)
|
|
154
|
+
// compilation: {},
|
|
155
|
+
|
|
156
|
+
// 渠道名称映射(可选)
|
|
157
|
+
// adNetworkNames: {}
|
|
158
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "playable-template-three",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A starter template for creating playable ads using Three.js and @playcraft/adsdk with TypeScript support",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "playable-scripts dev",
|
|
7
|
+
"build": "playable-scripts build",
|
|
8
|
+
"builds": "playable-scripts builds",
|
|
9
|
+
"webp": "node scripts/convert-to-webp.js",
|
|
10
|
+
"webp:80": "node scripts/convert-to-webp.js 80"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"playable",
|
|
14
|
+
"ads",
|
|
15
|
+
"template",
|
|
16
|
+
"three",
|
|
17
|
+
"threejs",
|
|
18
|
+
"webgl",
|
|
19
|
+
"3d",
|
|
20
|
+
"typescript",
|
|
21
|
+
"game"
|
|
22
|
+
],
|
|
23
|
+
"author": "Smoud",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@playcraft/adsdk": "*",
|
|
26
|
+
"three": "^0.174.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@playcraft/devkit": "*",
|
|
30
|
+
"@types/three": "^0.174.0",
|
|
31
|
+
"prettier": "^2.7.1"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|