Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
Manage
Activity
Members
Labels
Plan
Issues
342
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
28
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TransFem.org
Sharkey
Commits
8a369c99
Commit
8a369c99
authored
7 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring
parent
ef8b09a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gulpfile.ts
+21
-29
21 additions, 29 deletions
gulpfile.ts
src/version.ts
+5
-7
5 additions, 7 deletions
src/version.ts
webpack.config.ts
+60
-64
60 additions, 64 deletions
webpack.config.ts
with
86 additions
and
100 deletions
gulpfile.ts
+
21
−
29
View file @
8a369c99
...
...
@@ -20,7 +20,7 @@ import imagemin = require('gulp-imagemin');
import
*
as
rename
from
'
gulp-rename
'
;
import
*
as
mocha
from
'
gulp-mocha
'
;
import
*
as
replace
from
'
gulp-replace
'
;
import
getV
ersion
from
'
./src/version
'
;
import
v
ersion
from
'
./src/version
'
;
const
env
=
process
.
env
.
NODE_ENV
;
const
isProduction
=
env
===
'
production
'
;
...
...
@@ -129,21 +129,16 @@ gulp.task('build:client', [
'
copy:client
'
]);
gulp
.
task
(
'
build:client:scripts
'
,
done
=>
{
getVersion
.
then
(
version
=>
{
require
(
'
./webpack.config
'
).
then
(
webpackOptions
=>
{
es
.
merge
(
webpack
(
webpackOptions
,
require
(
'
webpack
'
))
.
pipe
(
gulp
.
dest
(
'
./built/web/assets/
'
))
as
any
,
gulp
.
src
(
'
./src/web/app/client/script.js
'
)
.
pipe
(
replace
(
'
VERSION
'
,
JSON
.
stringify
(
version
)))
//.pipe(isProduction ? uglify() : gutil.noop())
.
pipe
(
gulp
.
dest
(
'
./built/web/assets/client/
'
))
as
any
);
done
();
});
});
});
gulp
.
task
(
'
build:client:scripts
'
,
()
=>
es
.
merge
(
webpack
(
require
(
'
./webpack.config
'
),
require
(
'
webpack
'
))
.
pipe
(
gulp
.
dest
(
'
./built/web/assets/
'
))
as
any
,
gulp
.
src
(
'
./src/web/app/client/script.js
'
)
.
pipe
(
replace
(
'
VERSION
'
,
JSON
.
stringify
(
version
)))
//.pipe(isProduction ? uglify() : gutil.noop())
.
pipe
(
gulp
.
dest
(
'
./built/web/assets/client/
'
))
as
any
)
);
gulp
.
task
(
'
build:client:styles
'
,
()
=>
gulp
.
src
(
'
./src/web/app/init.css
'
)
...
...
@@ -172,16 +167,13 @@ gulp.task('build:client:pug', [
'
copy:client
'
,
'
build:client:scripts
'
,
'
build:client:styles
'
],
done
=>
{
getVersion
.
then
(
version
=>
{
gulp
.
src
(
'
./src/web/app/*/view.pug
'
)
.
pipe
(
pug
({
locals
:
{
version
:
version
,
themeColor
:
constants
.
themeColor
}
}))
.
pipe
(
gulp
.
dest
(
'
./built/web/app/
'
));
done
();
});
});
],
()
=>
gulp
.
src
(
'
./src/web/app/*/view.pug
'
)
.
pipe
(
pug
({
locals
:
{
version
:
version
,
themeColor
:
constants
.
themeColor
}
}))
.
pipe
(
gulp
.
dest
(
'
./built/web/app/
'
))
);
This diff is collapsed.
Click to expand it.
src/version.ts
+
5
−
7
View file @
8a369c99
const
getVersion
=
new
Promise
<
string
>
(
async
resolve
=>
{
const
ぱっけーじ
=
require
(
'
../package.json
'
);
/**
* Version
*/
const
version
=
ぱっけーじ
.
version
;
const
meta
=
require
(
'
../package.json
'
)
;
resolve
(
version
);
});
export
default
getVersion
;
export
default
meta
.
version
as
string
;
This diff is collapsed.
Click to expand it.
webpack.config.ts
+
60
−
64
View file @
8a369c99
...
...
@@ -4,77 +4,73 @@
import
*
as
webpack
from
'
webpack
'
;
const
StringReplacePlugin
=
require
(
'
string-replace-webpack-plugin
'
);
import
getV
ersion
from
'
./src/version
'
;
import
v
ersion
from
'
./src/version
'
;
const
constants
=
require
(
'
./src/const.json
'
);
const
env
=
process
.
env
.
NODE_ENV
;
const
isProduction
=
env
===
'
production
'
;
module
.
exports
=
new
Promise
(
async
resolve
=>
{
const
version
=
await
getVersion
.
then
();
const
pack
:
webpack
.
Configuration
=
{
entry
:
{
'
desktop
'
:
'
./src/web/app/desktop/script.js
'
,
'
mobile
'
:
'
./src/web/app/mobile/script.js
'
,
'
dev
'
:
'
./src/web/app/dev/script.js
'
,
'
auth
'
:
'
./src/web/app/auth/script.js
'
},
module
:
{
rules
:
[
{
enforce
:
'
pre
'
,
test
:
/
\.
tag$/
,
exclude
:
/node_modules/
,
loader
:
StringReplacePlugin
.
replace
({
replacements
:
[
{
pattern
:
/
\$
theme
\-
color
\-
foreground/g
,
replacement
:
()
=>
constants
.
themeColorForeground
},
{
pattern
:
/
\$
theme
\-
color/g
,
replacement
:
()
=>
constants
.
themeColor
},
]
})
},
{
test
:
/
\.
tag$/
,
exclude
:
/node_modules/
,
loader
:
'
riot-tag-loader
'
,
query
:
{
hot
:
false
,
style
:
'
stylus
'
,
expr
:
false
,
compact
:
true
,
parserOptions
:
{
style
:
{
compress
:
true
}
const
pack
:
webpack
.
Configuration
=
{
entry
:
{
'
desktop
'
:
'
./src/web/app/desktop/script.js
'
,
'
mobile
'
:
'
./src/web/app/mobile/script.js
'
,
'
dev
'
:
'
./src/web/app/dev/script.js
'
,
'
auth
'
:
'
./src/web/app/auth/script.js
'
},
module
:
{
rules
:
[
{
enforce
:
'
pre
'
,
test
:
/
\.
tag$/
,
exclude
:
/node_modules/
,
loader
:
StringReplacePlugin
.
replace
({
replacements
:
[
{
pattern
:
/
\$
theme
\-
color
\-
foreground/g
,
replacement
:
()
=>
constants
.
themeColorForeground
},
{
pattern
:
/
\$
theme
\-
color/g
,
replacement
:
()
=>
constants
.
themeColor
},
]
})
},
{
test
:
/
\.
tag$/
,
exclude
:
/node_modules/
,
loader
:
'
riot-tag-loader
'
,
query
:
{
hot
:
false
,
style
:
'
stylus
'
,
expr
:
false
,
compact
:
true
,
parserOptions
:
{
style
:
{
compress
:
true
}
}
},
{
test
:
/
\.
styl$/
,
exclude
:
/node_modules/
,
use
:
[
{
loader
:
'
style-loader
'
},
{
loader
:
'
css-loader
'
},
{
loader
:
'
stylus-loader
'
}
]
}
]
},
plugins
:
[
new
webpack
.
DefinePlugin
({
VERSION
:
JSON
.
stringify
(
version
),
THEME_COLOR
:
JSON
.
stringify
(
constants
.
themeColor
)
}),
new
StringReplacePlugin
()
],
output
:
{
filename
:
`[name]/script.
${
version
}
.js`
}
};
if
(
isProduction
)
{
//pack.plugins.push(new webpack.optimize.UglifyJsPlugin());
},
{
test
:
/
\.
styl$/
,
exclude
:
/node_modules/
,
use
:
[
{
loader
:
'
style-loader
'
},
{
loader
:
'
css-loader
'
},
{
loader
:
'
stylus-loader
'
}
]
}
]
},
plugins
:
[
new
webpack
.
DefinePlugin
({
VERSION
:
JSON
.
stringify
(
version
),
THEME_COLOR
:
JSON
.
stringify
(
constants
.
themeColor
)
}),
new
StringReplacePlugin
()
],
output
:
{
filename
:
`[name]/script.
${
version
}
.js`
}
};
if
(
isProduction
)
{
//pack.plugins.push(new webpack.optimize.UglifyJsPlugin());
}
resolve
(
pack
);
});
module
.
exports
=
pack
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment