tt-minigame-ide-cli 1.0.1 → 1.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.
- package/lib/preview.js +8 -2
- package/lib/upload.js +3 -2
- package/lib/util/helper.js +1 -0
- package/lib/util/request.js +3 -1
- package/package.json +1 -1
package/lib/preview.js
CHANGED
@@ -38,14 +38,20 @@ async function preview(entry, options) {
|
|
38
38
|
|
39
39
|
const tempDir = options.tempDir || path.join(__dirname, '../temp');
|
40
40
|
await fs.emptyDir(tempDir);
|
41
|
-
const { filePath } = await zipFile(entry, tempDir);
|
41
|
+
const { filePath, gameConfig } = await zipFile(entry, tempDir);
|
42
42
|
if (!filePath) {
|
43
43
|
const errMsg = `[CLI PREVIEW ERROR]`;
|
44
44
|
console.log(chalk.red(errMsg));
|
45
45
|
throw new Error(errMsg);
|
46
46
|
return;
|
47
47
|
}
|
48
|
-
await uploadProject({
|
48
|
+
await uploadProject({
|
49
|
+
type: 'preview',
|
50
|
+
appId,
|
51
|
+
zipPath: filePath,
|
52
|
+
proxy: options.proxy,
|
53
|
+
gameConfig
|
54
|
+
});
|
49
55
|
|
50
56
|
outputResult('info', 'WAIT', 'Compiling...\n');
|
51
57
|
return await new Promise((resolve, reject) => {
|
package/lib/upload.js
CHANGED
@@ -44,7 +44,7 @@ async function upload(entry, options) {
|
|
44
44
|
const {
|
45
45
|
success: beforeSuccess,
|
46
46
|
msg: beforeMsg,
|
47
|
-
appId
|
47
|
+
appId,
|
48
48
|
} = await checkBeforeUpload(entry);
|
49
49
|
if (!beforeSuccess) {
|
50
50
|
const errMsg = `[CLI UPLOAD ERROR]: ${beforeMsg}`;
|
@@ -75,7 +75,7 @@ async function upload(entry, options) {
|
|
75
75
|
throw new Error(errMsg);
|
76
76
|
}
|
77
77
|
|
78
|
-
const { filePath } = await zipFile(entry, tempDir);
|
78
|
+
const { filePath, gameConfig } = await zipFile(entry, tempDir);
|
79
79
|
if (!filePath) {
|
80
80
|
const errMsg = `[CLI UPLOAD ERROR]`;
|
81
81
|
console.log(chalk.red(errMsg));
|
@@ -88,6 +88,7 @@ async function upload(entry, options) {
|
|
88
88
|
versionInfo: options.appVersion,
|
89
89
|
updateInfo: options.appChangelog,
|
90
90
|
proxy: options.proxy,
|
91
|
+
gameConfig,
|
91
92
|
});
|
92
93
|
|
93
94
|
outputResult('info', 'WAIT', 'Compiling...\n');
|
package/lib/util/helper.js
CHANGED
@@ -29,6 +29,7 @@ async function zipFile(sourcePath, targetPath) {
|
|
29
29
|
const subPackagesArr = projectConfigJson.subPackages || projectConfigJson.subpackages;
|
30
30
|
const zipFileRet = {
|
31
31
|
filePath: null,
|
32
|
+
gameConfig: projectConfigJson,
|
32
33
|
};
|
33
34
|
if (subPackagesArr && subPackagesArr.length > 0) {
|
34
35
|
const ifSubPackageUploadable = await verifySubPackageSize(projectConfigJson, sourcePath);
|
package/lib/util/request.js
CHANGED
@@ -168,7 +168,8 @@ exports.uploadProject = function ({
|
|
168
168
|
zipPath,
|
169
169
|
versionInfo,
|
170
170
|
updateInfo,
|
171
|
-
proxy
|
171
|
+
proxy,
|
172
|
+
gameConfig,
|
172
173
|
}) {
|
173
174
|
return new Promise(function (resolve, reject) {
|
174
175
|
let path;
|
@@ -185,6 +186,7 @@ exports.uploadProject = function ({
|
|
185
186
|
// form.append('render_type', 3);
|
186
187
|
form.append('source', fs.createReadStream(zipPath));
|
187
188
|
form.append('local_compile_version', '4.0.0-rc.12.ide');
|
189
|
+
form.append('subpackage', String((gameConfig.subPackages || gameConfig.subpackages || []).length > 0));
|
188
190
|
const uploadOptions = {
|
189
191
|
method: 'put',
|
190
192
|
headers: {
|