Commit 34253ff3 authored by rockyl's avatar rockyl

修改上传

parent 575723b0
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
const program = require('commander'); const program = require('commander');
program program
.version('1.0.1') .version('1.0.2')
.description('game command line interface') .description('game command line interface')
.command('init [name]', 'Initialize a project with template').alias('i') .command('init [name]', 'Initialize a project with template').alias('i')
.command('mock', 'Mock server').alias('m') .command('mock', 'Mock server').alias('m')
......
const path = require('path');
const program = require('commander'); const program = require('commander');
const {exit, getProjectConfig} = require('./tools'); const {exit, getProjectConfig} = require('./tools');
const ossUpload = require('./oss-upload'); const ossUpload = require('./oss-upload');
...@@ -10,11 +11,13 @@ program ...@@ -10,11 +11,13 @@ program
async function execute() { async function execute() {
let remotePath; let remotePath;
let version = program.versionCode; let version = program.versionCode;
let releasePath = './bin-release/web/';
const gameProjectConfig = getProjectConfig(); const gameProjectConfig = getProjectConfig();
if(gameProjectConfig){ if(gameProjectConfig){
remotePath = gameProjectConfig['remote-path']; remotePath = gameProjectConfig['remote-path'];
version = version ? version : gameProjectConfig['version']; version = version ? version : gameProjectConfig['version'];
releasePath = gameProjectConfig['release-path'];
} }
if(version){ if(version){
...@@ -22,7 +25,7 @@ async function execute() { ...@@ -22,7 +25,7 @@ async function execute() {
if(remotePath){ if(remotePath){
try { try {
await ossUpload({ await ossUpload({
localDir: './bin-release/web/' + version, localDir: path.join(releasePath, version),
remoteDir: `/db_games/${remotePath}/${version}` remoteDir: `/db_games/${remotePath}/${version}`
}, program.mode); }, program.mode);
}catch (e) { }catch (e) {
......
...@@ -41,7 +41,10 @@ function handler(request, response) { ...@@ -41,7 +41,10 @@ function handler(request, response) {
const headers = { const headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Origin': 'http://localhost:3001',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Methods': 'POST,GET,PUT,OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type,Access-Token',
}; };
if (content) { if (content) {
......
This diff is collapsed.
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