Commit e464bca1 authored by nano's avatar nano

修改remove逻辑

parent ec3ca211
This diff is collapsed.
import axios from 'axios'; import axios from 'axios';
import config from './config'; import config from './config';
import * as uuid from 'uuid'; import * as uuid from 'uuid';
import * as _ from 'lodash'
import {XmlDocument} from 'xmldoc'; import {XmlDocument} from 'xmldoc';
...@@ -104,7 +103,7 @@ async function main() { ...@@ -104,7 +103,7 @@ async function main() {
let {data} = await axios.get(config.old_apps_json); let {data} = await axios.get(config.old_apps_json);
let newApps = await axios.get(config.new_apps_json); let newApps = await axios.get(config.new_apps_json);
newApps.data.map(app => { newApps.data.map(app => {
apps[app['id']] = app; apps[app['id']] = app;
}); });
...@@ -116,15 +115,19 @@ async function main() { ...@@ -116,15 +115,19 @@ async function main() {
} }
} }
// for (let app of data) { // for (let app of _.sampleSize(data, 1)) {
// if (['th10'].includes(app['id'])) { // if (!['ygopro', 'desmume', 'test'].includes(app['id'])) {
// await updateApp(app); // await updateApp(app);
// } // }
// } // }
for (let app of _.sampleSize(data, 1)) { for (let i = 0, t = 0; i <= data.length; i += 1, t += 60000) {
let app = data[i];
if (!['ygopro', 'desmume', 'test'].includes(app['id'])) { if (!['ygopro', 'desmume', 'test'].includes(app['id'])) {
await updateApp(app); setTimeout(async () => {
console.log(`正在处理${app['id']}`);
await updateApp(app);
}, t);
} }
} }
} catch (e) { } catch (e) {
......
...@@ -78,10 +78,9 @@ export async function bundle(...args) { ...@@ -78,10 +78,9 @@ export async function bundle(...args) {
let fullPath = path.join(path.dirname(filePath), `${fullHash}.tar.gz`); let fullPath = path.join(path.dirname(filePath), `${fullHash}.tar.gz`);
await fs.renameAsync(filePath, fullPath); await fs.renameAsync(filePath, fullPath);
await fs.removeAsync(uploadFile_path)
await fs.removeAsync(package_path)
return { return {
uploadFilePath: uploadFile_path,
pckagePath: package_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()),
......
...@@ -118,6 +118,8 @@ export const UploadPackage = async (ctx: Context) => { ...@@ -118,6 +118,8 @@ export const UploadPackage = async (ctx: Context) => {
// 上传完,干掉本地目录 // 上传完,干掉本地目录
await fs.removeAsync(bundled.distPath); await fs.removeAsync(bundled.distPath);
await fs.removeAsync(bundled.pckagePath);
await fs.removeAsync(bundled.uploadFilePath);
} catch (e) { } catch (e) {
...@@ -183,6 +185,8 @@ const uploadPackageUrl = async (ctx: Context) => { ...@@ -183,6 +185,8 @@ const uploadPackageUrl = async (ctx: Context) => {
// 上传完,干掉本地目录 // 上传完,干掉本地目录
await fs.removeAsync(bundled.distPath); await fs.removeAsync(bundled.distPath);
await fs.removeAsync(bundled.pckagePath);
await fs.removeAsync(bundled.uploadFilePath);
} catch (e) { } catch (e) {
console.trace(e); console.trace(e);
pack!.status = 'failed'; pack!.status = 'failed';
......
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