Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
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
黄庭坚
jinfa-platform
Commits
5838f8b3
Commit
5838f8b3
authored
Nov 18, 2021
by
前端-许佳敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 优化构建流程
parent
e5c8a1ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
8 deletions
+25
-8
run.js
scripts/run.js
+5
-6
envTool.js
scripts/utils/envTool.js
+17
-0
ytt.config.ts
ytt.config.ts
+3
-2
No files found.
scripts/run.js
View file @
5838f8b3
...
...
@@ -2,6 +2,7 @@ const gulp = require('gulp')
const
envValue
=
require
(
'../env'
)
const
path
=
require
(
'path'
)
const
fs
=
require
(
'fs'
)
const
{
setEnv
,
getEnv
}
=
require
(
'./utils/envTool'
)
const
isProduction
=
process
.
env
.
NODE_ENV
===
'production'
...
...
@@ -36,13 +37,11 @@ function genarateConfig() {
// 构建时带上的环境变量
const
PRO_ENV
=
process
.
env
.
PRO_ENV
if
(
PRO_ENV
)
{
process
.
env
.
SITE_ID
=
envValue
[
PRO_ENV
].
SITE_ID
process
.
env
.
BACK_GATEWAY
=
envValue
[
PRO_ENV
].
BACK_GATEWAY
process
.
env
.
USE_ROUTE_CONFIG
=
envValue
[
PRO_ENV
].
USE_ROUTE_CONFIG
process
.
env
.
SOCKET_URL
=
envValue
[
PRO_ENV
].
SOCKET_URL
process
.
env
.
ssh
=
envValue
[
PRO_ENV
].
ssh
if
(
!
PRO_ENV
)
{
throw
`请传入PRO_ENV`
}
setEnv
(
getEnv
(
envValue
))
function
runTask
(
toRun
)
{
const
metadata
=
{
task
:
toRun
};
...
...
scripts/utils/envTool.js
0 → 100644
View file @
5838f8b3
function
getEnv
(
envConfig
)
{
if
(
!
envConfig
)
{
throw
`检查是否传入PRO_ENV`
}
return
envConfig
[
process
.
env
.
PRO_ENV
]
}
function
setEnv
(
envs
)
{
Object
.
keys
(
envs
).
forEach
(
key
=>
{
process
.
env
[
key
]
=
envs
[
key
]
})
}
module
.
exports
=
{
getEnv
,
setEnv
,
}
ytt.config.ts
View file @
5838f8b3
const
YAPI_URL
=
require
(
'./env.js'
)[
process
.
env
.
PRO_ENV
]
process
.
env
.
YAPI_URL
=
require
(
'./env'
)[
process
.
env
.
PRO_ENV
].
YAPI_URL
if
(
!
YAPI_URL
)
{
if
(
!
process
.
env
.
YAPI_URL
)
{
throw
'yapi链接不存在'
}
const
tokenList
=
[
{
name
:
'LogisticsV2'
,
token
:
'732fb8e33970ff5dee830423a630e8e85c3ef3293abba7581b16749dfce8608b'
,
categoryIds
:
[
0
],
},
// 物流服务
{
name
:
'ProductV2'
,
token
:
'df37f2a0e3829c4288708ae211920bdbdee55e5e2f48b1e8cf7d1925ac618d9a'
,
categoryIds
:
[
0
],
},
// 商品服务V2
...
...
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