Commit b2c1b370 authored by nano's avatar nano

complete

parent 34a9559e
This diff is collapsed.
...@@ -7,7 +7,7 @@ export default { ...@@ -7,7 +7,7 @@ export default {
upload_path: path.join(__dirname, './test/upload'), upload_path: path.join(__dirname, './test/upload'),
download_path: path.join(__dirname, './test/release/downloads'), download_path: path.join(__dirname, './test/release/downloads'),
new_apps_json: `${baseUrl}/v2/apps`, new_apps_json: `${baseUrl}/v2/apps`,
upload_url: `${baseUrl}/v1/upload/packageUrl`, upload_url: `${testUrl}/v1/upload/packageUrl`,
old_apps_json: 'https://api.moecube.com/apps.json', old_apps_json: 'https://api.moecube.com/apps.json',
new_package: `${baseUrl}/v1/package/`, new_package: `${baseUrl}/v1/package/`,
new_app: (appId) => `${baseUrl}/v1/app/${appId}`, new_app: (appId) => `${baseUrl}/v1/app/${appId}`,
......
...@@ -82,6 +82,7 @@ export async function bundle(...args) { ...@@ -82,6 +82,7 @@ export async function bundle(...args) {
await fs.removeAsync(package_path); await fs.removeAsync(package_path);
return { return {
archivePath: archive_path,
distPath: dist_path, distPath: dist_path,
files: Array.from(files.values()), files: Array.from(files.values()),
archives: Array.from(archives.values()), archives: Array.from(archives.values()),
......
...@@ -117,7 +117,7 @@ export const UploadPackage = async (ctx: Context) => { ...@@ -117,7 +117,7 @@ export const UploadPackage = async (ctx: Context) => {
await pack!.save(); await pack!.save();
// 上传完,干掉本地目录 // 上传完,干掉本地目录
await fs.removeAsync(bundled.distPath); await fs.removeAsync(bundled.archivePath);
} catch (e) { } catch (e) {
...@@ -187,12 +187,13 @@ const uploadPackageUrl = async (ctx: Context) => { ...@@ -187,12 +187,13 @@ const uploadPackageUrl = async (ctx: Context) => {
await pack!.save(); await pack!.save();
// 上传完,干掉本地目录 // 上传完,干掉本地目录
await fs.removeAsync(bundled.distPath); await fs.removeAsync(bundled.archivePath);
} catch (e) { } catch (e) {
console.trace(e); console.trace(e);
pack!.status = 'failed'; pack!.status = 'failed';
await pack!.save(); await pack!.save();
} }
await downloader.close();
} }
}; };
...@@ -204,6 +205,7 @@ const uploadPackageUrl = async (ctx: Context) => { ...@@ -204,6 +205,7 @@ const uploadPackageUrl = async (ctx: Context) => {
if (ctx.request.body.url == url.uri) { if (ctx.request.body.url == url.uri) {
pack!.status = 'failed'; pack!.status = 'failed';
await pack!.save(); await pack!.save();
await downloader.close();
console.log(err); console.log(err);
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment