Commit d8b7b157 authored by nano's avatar nano

fix

parent 1d3da742
This diff is collapsed.
......@@ -7,7 +7,7 @@ export default {
upload_path: path.join(__dirname, './test/upload'),
download_path: path.join(__dirname, './test/release/downloads'),
new_apps_json: `${baseUrl}/v2/apps`,
upload_url: `${testUrl}/v1/upload/packageUrl`,
upload_url: `${baseUrl}/v1/upload/packageUrl`,
old_apps_json: 'https://api.moecube.com/apps.json',
new_package: `${baseUrl}/v1/package/`,
new_app: (appId) => `${baseUrl}/v1/app/${appId}`,
......
......@@ -103,17 +103,21 @@ async function updateApp(app) {
async function main() {
let {data} = await axios.get(config.old_apps_json);
let newApps = await axios.get(config.new_apps_json);
newApps.data.map(app => {
apps[app['id']] = app;
})
try {
for (let app of data) {
if (!['ygopro', 'desmume', 'test'].includes(app['id'])) {
apps[app['id']] = app;
if (!['ygopro', 'desmume', 'test'].includes(app['id']) && !apps[app['id']]) {
await createApp(app)
}
}
for (let app of _.sampleSize(data, 2)) {
if (!['ygopro', 'desmume', 'test'].includes(app['id'])) {
for (let app of _.sampleSize(data, 1)) {
if (['ygopro', 'desmume', 'test'].includes(app['id'])) {
await updateApp(app);
}
}
......
......@@ -70,7 +70,6 @@ export async function bundle(...args) {
let filePath = path.join(dist_path, `${package_id}.tar.gz`);
await fs.removeAsync(filePath);
await archive(filePath, await fs.readdirAsync(package_path), package_path);
const fullHash = await caculateSHA256(filePath);
......@@ -79,6 +78,7 @@ export async function bundle(...args) {
let fullPath = path.join(path.dirname(filePath), `${fullHash}.tar.gz`);
await fs.renameAsync(filePath, fullPath);
await fs.removeAsync(filePath);
await fs.removeAsync(uploadFile_path)
await fs.removeAsync(package_path)
......
......@@ -183,7 +183,6 @@ const uploadPackageUrl = async (ctx: Context) => {
// 上传完,干掉本地目录
await fs.removeAsync(bundled.distPath);
} catch (e) {
console.log(e);
pack!.status = 'failed';
......
<?xml version="1.0" encoding="UTF-8"?>
<metalink xmlns="urn:ietf:params:xml:ns:metalink">
{{#files}}
<file name="{{name}}">
<size>{{size}}</size>
<hash type="sha-256">{{hash}}</hash>
<url priority="1">https://cdn01.moecube.com/test-release/{{hash}}.tar.gz</url>
<url priority="1">https://cdn01.moecube.com/test-release/{{hash}}.tar.gz</url>
</file>
{{/files}}
</metalink>
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