Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-cli-build-process-scilla
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-build-process-scilla
Commits
3b5a19b4
Commit
3b5a19b4
authored
Dec 03, 2018
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加自动识别paths配置
parent
3ebfd9e0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
gulpfile.js
dev-config/gulpfile.js
+28
-4
No files found.
dev-config/gulpfile.js
View file @
3b5a19b4
...
...
@@ -2,6 +2,7 @@
* Created by rockyl on 2018/7/9.
*/
const
path
=
require
(
'path'
);
const
gulp
=
require
(
'gulp'
);
const
rollup
=
require
(
'rollup'
);
const
{
uglify
}
=
require
(
'rollup-plugin-uglify'
);
...
...
@@ -18,6 +19,29 @@ exports.setCallback = function (callback) {
completeCallback
=
callback
;
};
const
tsPaths
=
[
'**/*.ts'
];
const
tsconfig
=
require
(
path
.
resolve
(
'tsconfig.json'
));
const
pathsConfig
=
tsconfig
.
compilerOptions
.
paths
;
//console.log(pathsConfig);
if
(
pathsConfig
)
{
for
(
let
key
in
pathsConfig
)
{
let
paths
=
pathsConfig
[
key
];
for
(
let
path
of
paths
){
if
(
path
[
path
.
length
-
1
]
===
'*'
)
{
path
+=
'*/*.ts'
;
}
else
{
try
{
path
=
path
.
replace
(
/index$/
,
'**/*.ts'
)
}
catch
(
e
)
{
console
.
log
(
e
);
}
}
tsPaths
.
push
(
path
);
}
}
}
//console.log(tsPaths);
gulp
.
task
(
'compileTs'
,
async
function
()
{
let
plugins
=
[
resolve
({
...
...
@@ -25,7 +49,7 @@ gulp.task('compileTs', async function () {
}),
typescript
({
typescript
:
require
(
'typescript'
),
include
:
[
'**/*.ts'
,
'../common/**/*.ts'
,
'../../src/**/*.ts'
]
,
include
:
tsPaths
,
}),
commonjs
(),
];
...
...
@@ -68,12 +92,12 @@ gulp.task('watch', function () {
gulp
.
watch
(
'src/**'
,
[
'compile'
]);
});
gulp
.
task
(
'dev'
,
[
'compileTs'
,
'watch'
],
function
(
cb
)
{
gulp
.
task
(
'dev'
,
[
'compileTs'
,
'watch'
],
function
(
cb
)
{
completeCallback
&&
completeCallback
(
'success'
);
cb
();
});
gulp
.
task
(
'compile'
,
[
'compileTs'
],
function
(
cb
)
{
gulp
.
task
(
'compile'
,
[
'compileTs'
],
function
(
cb
)
{
completeCallback
&&
completeCallback
(
'success'
);
cb
();
});
...
...
@@ -82,7 +106,7 @@ gulp.task('build', async function () {
currentMode
=
'build'
;
version
=
Math
.
floor
(
Date
.
now
()
/
1000
).
toString
();
releasePath
=
`dist/
${
version
}
/`
;
gulp
.
start
([
'compileTs'
,
],
function
()
{
gulp
.
start
([
'compileTs'
,
],
function
()
{
console
.
log
(
'build success!
\
nversion:'
,
version
);
completeCallback
&&
completeCallback
(
version
);
});
...
...
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