Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
db-game-template
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
崔立强
db-game-template
Commits
280e6cf9
Commit
280e6cf9
authored
Sep 17, 2018
by
wildfirecode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add build.js
parent
658d5005
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
0 deletions
+127
-0
.buildrc.js
.buildrc.js
+48
-0
.npmrc
.npmrc
+1
-0
build.js
build.js
+17
-0
cli.js
cli.js
+61
-0
No files found.
.buildrc.js
0 → 100644
View file @
280e6cf9
module
.
exports
=
{
devPort
:
8080
}
// const path = require('path');
// module.exports = {
// context: __dirname,
// src: [path.resolve(__dirname, 'src'),path.resolve(__dirname, 'unit')],
// backup: path.resolve(__dirname, 'backup'),
// skins: path.resolve(__dirname, 'src/skins'),
// mock: path.resolve(__dirname, 'mock'),
// templates: path.resolve(__dirname, 'src/templates'),
// alias: {
// src: path.resolve(__dirname, 'src'),
// '@src': path.resolve(__dirname, 'src'),
// '@unit': path.resolve(__dirname, 'unit'),
// '@skins': path.resolve(__dirname, 'src/skins'),
// '@common': path.resolve(__dirname, 'src/common'),
// react: 'preact-compat',
// 'react-dom': 'preact-compat'
// },
// customEntry: ['index', 'components'], // 自定义入口 每个皮肤的entry
// publicEntry: {
// // 皮肤入口以外的常驻入口 js会按顺序加载执行
// 'common/base': '@src/common/base/base.js',
// 'common/common': '@src/common/base/common.js',
// entry: '@src/entry.js'
// },
// entryHtmlPath: path.resolve(__dirname, 'src/entry.html'),
// remUnit: 234.375, // 640算法: 234.375 750算法: 100
// urlLimit: 1024 * 3, // url-loader 图片转base64
// devPort: 6868,
// ossPath: '/h5/activity_custom/', // oss 文件夹路径
// domain_production: '//yun.duiba.com.cn',
// domain_development: '//yun.dui88.com',
// tinify: true, // 是否需要图片压缩
// autoUpload: true, // 是否需要自动上传cdn
// tinifyKey: 'A0Wm6WCH62JcnL28CjEletF5uFqaFXYN',
// tinify: true, // 是否需要图片压缩
// autoUpload: true, // 是否需要自动上传cdn
// imageExts: ['jpg', 'jpeg', 'png'], // tinypng要压缩的图片类型
// uploadExts: ['js', 'map', 'css', 'png', 'jpg'],
// useApiProxy: false,
// proxyTarget:
// 'http://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=3&uri='
// };
\ No newline at end of file
.npmrc
0 → 100644
View file @
280e6cf9
registry = http://npm.dui88.com/
\ No newline at end of file
build.js
0 → 100644
View file @
280e6cf9
let
argvs
=
JSON
.
parse
(
process
.
env
.
npm_config_argv
);
let
remain
=
argvs
.
remain
;
let
cmd
=
process
.
argv
[
2
];
const
DBGBuild
=
require
(
'duiba-game-build'
);
const
config
=
require
(
'./.buildrc'
);
let
build
=
new
DBGBuild
(
config
);
if
(
cmd
===
'build'
&&
process
.
argv
[
3
]
===
'prod'
)
{
// if (cmd === 'build' && remain[1] === 'prod') {
cmd
=
'buildProd'
;
if
(
process
.
argv
[
4
]
===
'ts'
)
cmd
=
'buildProdTS'
;
if
(
process
.
argv
[
4
]
===
'exml'
)
cmd
=
'buildProdEXML'
;
}
build
[
cmd
](...
remain
);
\ No newline at end of file
cli.js
0 → 100644
View file @
280e6cf9
let
inquirer
=
require
(
'inquirer'
);
const
spawn
=
require
(
'cross-spawn'
);
const
questions
=
require
(
'./question'
);
let
moment
=
require
(
'moment'
);
const
today
=
moment
().
format
(
'YYYYMMDD'
);
inquirer
.
prompt
(
questions
).
then
(
answers
=>
{
let
cmdType
=
answers
.
commandType
||
''
;
let
skinName
=
answers
.
skinName
||
''
;
let
branchName
=
answers
.
branchName
||
''
;
let
cmd
=
''
;
switch
(
cmdType
)
{
case
'create'
:
cmd
=
`npm run copy
${
skinName
}
`
;
break
;
case
'create_react'
:
cmd
=
`npm run copy
${
skinName
}
custom-react`
;
break
;
case
'prettier'
:
cmd
=
'npm run lint'
;
break
;
case
'develop'
:
cmd
=
`npm run dev
${
skinName
}
`
;
break
;
case
'build_test'
:
cmd
=
`npm run build
${
skinName
}
`
;
break
;
case
'build_prod'
:
cmd
=
`npm run build
${
skinName
}
prod`
;
break
;
case
'backup'
:
cmd
=
`npm run backup`
;
break
;
case
'create_branch'
:
cmd
=
`git checkout -b feature/
${
today
}
-
${
branchName
}
`
;
break
;
default
:
break
;
}
if
(
cmd
)
{
cmd
=
cmd
.
split
(
' '
);
let
_cmd
=
cmd
[
0
];
let
_args
=
cmd
.
slice
(
1
);
var
ls
=
spawn
(
_cmd
,
_args
);
ls
.
stdout
.
on
(
'data'
,
data
=>
{
console
.
log
(
`
${
data
}
`
);
});
ls
.
stderr
.
on
(
'data'
,
data
=>
{
console
.
log
(
`stderr:
${
data
}
`
);
});
ls
.
on
(
'close'
,
code
=>
{
// console.log(`子进程退出码:${code}`);
});
}
});
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