Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-cli
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
game-cli
Commits
97cbe806
Commit
97cbe806
authored
Mar 11, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加自动识别paths配置
parent
b6de9e21
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
24 deletions
+18
-24
game-cli-upload.js
bin/game-cli-upload.js
+6
-6
index.js
bin/json-server/index.js
+0
-1
tools.js
bin/tools.js
+12
-17
No files found.
bin/game-cli-upload.js
View file @
97cbe806
const
path
=
require
(
'path'
);
const
program
=
require
(
'commander'
);
const
{
exit
,
get
Manifest
}
=
require
(
'./tools'
);
const
{
exit
,
get
BuildConfig
}
=
require
(
'./tools'
);
const
ossUpload
=
require
(
'./oss-upload'
);
program
...
...
@@ -13,11 +13,11 @@ async function execute() {
let
version
=
program
.
versionCode
;
let
releasePath
=
'./bin-release/web/'
;
const
manifest
=
getManifest
();
if
(
manifest
&&
manifest
.
build
){
remotePath
=
manifest
.
build
[
'remote-path'
];
version
=
version
?
version
:
manifest
.
build
[
'version'
];
releasePath
=
manifest
.
build
[
'release-path'
]
||
releasePath
;
const
buildConfig
=
getBuildConfig
();
if
(
buildConfig
){
remotePath
=
buildConfig
[
'remote-path'
];
version
=
version
?
version
:
buildConfig
[
'version'
];
releasePath
=
buildConfig
[
'release-path'
]
||
releasePath
;
}
if
(
version
){
...
...
bin/json-server/index.js
View file @
97cbe806
...
...
@@ -42,7 +42,6 @@ function handler(request, response) {
const
headers
=
{
'Content-Type'
:
'application/json'
,
'Access-Control-Allow-Origin'
:
'*'
,
'Access-Control-Allow-Credentials'
:
'true'
,
'Access-Control-Allow-Methods'
:
'POST,GET,PUT,OPTIONS'
,
'Access-Control-Allow-Headers'
:
'Content-Type,Access-Token'
,
};
...
...
bin/tools.js
View file @
97cbe806
...
...
@@ -76,28 +76,22 @@ function savePackage(){
}
}
const
get
Manifest
=
exports
.
getManifest
=
function
()
{
const
get
BuildConfig
=
exports
.
getBuildConfig
=
function
()
{
if
(
!
ensurePackage
()){
console
.
log
(
'package.json is not exist'
);
return
;
}
let
manifest
=
packageObj
.
manifest
;
if
(
!
manifest
)
{
manifest
=
packageObj
.
manifest
=
{};
let
build
=
packageObj
.
build
;
if
(
!
build
)
{
build
=
packageObj
.
build
=
{};
}
return
manifest
;
return
build
;
};
exports
.
updateBuildConfig
=
function
(
key
,
value
)
{
const
manifest
=
getManifest
();
if
(
manifest
)
{
let
build
=
manifest
.
build
;
if
(
!
build
)
{
build
=
manifest
.
build
=
{};
}
build
[
key
]
=
value
;
savePackage
();
}
const
build
=
getBuildConfig
();
build
[
key
]
=
value
;
savePackage
();
};
function
findGlobalModulePath
(
moduleName
){
...
...
@@ -123,9 +117,9 @@ exports.executeBuildProcess = function (cmd) {
return
new
Promise
((
resolve
,
reject
)
=>
{
let
buildProcessName
;
const
manifest
=
getManifest
();
const
buildConfig
=
getBuildConfig
();
try
{
buildProcessName
=
manifest
.
build
[
'build-process'
];
buildProcessName
=
buildConfig
[
'build-process'
];
}
catch
(
e
)
{
console
.
log
(
'invalid manifest config'
)
}
...
...
@@ -141,7 +135,8 @@ exports.executeBuildProcess = function (cmd) {
console
.
log
(
`Build process [
${
buildProcessName
}
] has not implement
${
cmd
}
function`
)
}
}
catch
(
e
)
{
reject
(
'Build process is not found, please install with --global
\
n'
+
'GLOBAL_NPM_PATH: '
+
npm
.
GLOBAL_NPM_PATH
);
console
.
log
(
e
);
reject
(
'Build process is not found, please install with --global
\
n'
+
'GLOBAL_NPM_PATH: '
+
globalModulePath
);
}
}
reject
(
'Build process name is not found, please setup '
+
packageJsonFile
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment