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
cada902e
Commit
cada902e
authored
7 years ago
by
syuilo
Browse files
Options
Downloads
Patches
Plain Diff
✌️
parent
a94c0460
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.eslintrc
+5
-0
5 additions, 0 deletions
.eslintrc
gulpfile.ts
+2
-1
2 additions, 1 deletion
gulpfile.ts
src/web/app/boot.js
+3
-1
3 additions, 1 deletion
src/web/app/boot.js
webpack.config.ts
+10
-11
10 additions, 11 deletions
webpack.config.ts
with
20 additions
and
13 deletions
.eslintrc
+
5
−
0
View file @
cada902e
...
...
@@ -17,5 +17,10 @@
"no-console": 0,
"no-unused-vars": 0,
"no-empty": 0
},
"globals": {
"ENV": true,
"VERSION": true,
"API": true
}
}
This diff is collapsed.
Click to expand it.
gulpfile.ts
+
2
−
1
View file @
cada902e
...
...
@@ -28,7 +28,7 @@ import config from './src/conf';
const
uglify
=
uglifyComposer
(
uglifyes
,
console
);
const
env
=
process
.
env
.
NODE_ENV
;
const
env
=
process
.
env
.
NODE_ENV
||
'
development
'
;
const
isProduction
=
env
===
'
production
'
;
const
isDebug
=
!
isProduction
;
...
...
@@ -123,6 +123,7 @@ gulp.task('build:client:script', () =>
gulp
.
src
([
'
./src/web/app/boot.js
'
,
'
./src/web/app/safe.js
'
])
.
pipe
(
replace
(
'
VERSION
'
,
JSON
.
stringify
(
version
)))
.
pipe
(
replace
(
'
API
'
,
JSON
.
stringify
(
config
.
api_url
)))
.
pipe
(
replace
(
'
ENV
'
,
JSON
.
stringify
(
env
)))
.
pipe
(
isProduction
?
uglify
({
toplevel
:
true
}
as
any
)
:
gutil
.
noop
())
...
...
This diff is collapsed.
Click to expand it.
src/web/app/boot.js
+
3
−
1
View file @
cada902e
...
...
@@ -36,6 +36,7 @@
let
lang
=
navigator
.
language
.
split
(
'
-
'
)[
0
];
if
(
!
/^
(
en|ja
)
$/
.
test
(
lang
))
lang
=
'
en
'
;
if
(
localStorage
.
getItem
(
'
lang
'
))
lang
=
localStorage
.
getItem
(
'
lang
'
);
if
(
ENV
!=
'
production
'
)
lang
=
'
ja
'
;
// Detect the user agent
const
ua
=
navigator
.
userAgent
.
toLowerCase
();
...
...
@@ -69,7 +70,8 @@
const
isDebug
=
localStorage
.
getItem
(
'
debug
'
)
==
'
true
'
;
// Whether use raw version script
const
raw
=
localStorage
.
getItem
(
'
useRawScript
'
)
==
'
true
'
&&
isDebug
;
const
raw
=
(
localStorage
.
getItem
(
'
useRawScript
'
)
==
'
true
'
&&
isDebug
)
||
ENV
!=
'
production
'
;
// Load an app script
// Note: 'async' make it possible to load the script asyncly.
...
...
This diff is collapsed.
Click to expand it.
webpack.config.ts
+
10
−
11
View file @
cada902e
...
...
@@ -21,7 +21,7 @@ import locales from './locales';
const
meta
=
require
(
'
./package.json
'
);
const
version
=
meta
.
version
;
const
env
=
process
.
env
.
NODE_ENV
;
const
env
=
process
.
env
.
NODE_ENV
||
'
development
'
;
const
isProduction
=
env
===
'
production
'
;
//#region Replacer definitions
...
...
@@ -42,11 +42,12 @@ global['base64replacement'] = (_, key) => {
const
langs
=
Object
.
keys
(
locales
);
let
entries
=
langs
.
map
(
l
=>
[
l
,
false
]);
entries
=
entries
.
concat
(
langs
.
map
(
l
=>
[
l
,
true
]));
const
entries
=
isProduction
?
langs
.
map
(
l
=>
[
l
,
false
]).
concat
(
langs
.
map
(
l
=>
[
l
,
true
]))
:
[[
'
ja
'
,
false
]];
module
.
exports
=
entries
.
map
(
x
=>
{
const
[
lang
,
doMinify
]
=
x
;
const
[
lang
,
shouldOptimize
]
=
x
;
// Chunk name
const
name
=
lang
;
...
...
@@ -65,7 +66,7 @@ module.exports = entries.map(x => {
const
output
=
{
path
:
__dirname
+
'
/built/web/assets
'
,
filename
:
`[name].
${
version
}
.
${
lang
}
.
${
doMinify
?
'
min
'
:
'
raw
'
}
.js`
filename
:
`[name].
${
version
}
.
${
lang
}
.
${
shouldOptimize
?
'
min
'
:
'
raw
'
}
.js`
};
const
i18nReplacer
=
new
I18nReplacer
(
lang
as
string
);
...
...
@@ -106,9 +107,7 @@ module.exports = entries.map(x => {
}),
new
webpack
.
DefinePlugin
(
_consts
),
new
webpack
.
DefinePlugin
({
'
process.env
'
:
{
NODE_ENV
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
)
}
'
process.env.NODE_ENV
'
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
)
}),
new
WebpackOnBuildPlugin
(
stats
=>
{
fs
.
writeFileSync
(
'
./version.json
'
,
JSON
.
stringify
({
...
...
@@ -117,7 +116,7 @@ module.exports = entries.map(x => {
})
];
if
(
doMinify
)
{
if
(
shouldOptimize
)
{
plugins
.
push
(
new
webpack
.
optimize
.
ModuleConcatenationPlugin
());
}
...
...
@@ -243,10 +242,10 @@ module.exports = entries.map(x => {
cache
:
true
,
devtool
:
false
,
//'source-map',
optimization
:
{
minimize
:
isProduction
&&
doMinify
minimize
:
isProduction
&&
shouldOptimize
},
mode
:
isProduction
?
doMinify
?
shouldOptimize
?
'
production
'
:
'
development
'
:
'
development
'
...
...
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