Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a1d952b8
Commit
a1d952b8
authored
Aug 23, 2021
by
KunQian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add JH vue components entry
parent
2a93b6af
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
2 deletions
+48
-2
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+1
-0
app/assets/javascripts/main_jh.js
app/assets/javascripts/main_jh.js
+1
-0
config/webpack.config.js
config/webpack.config.js
+19
-2
jest.config.base.js
jest.config.base.js
+22
-0
jest.config.integration.js
jest.config.integration.js
+4
-0
lib/gitlab/gon_helper.rb
lib/gitlab/gon_helper.rb
+1
-0
No files found.
app/assets/javascripts/main.js
View file @
a1d952b8
...
@@ -37,6 +37,7 @@ import initBroadcastNotifications from './broadcast_notification';
...
@@ -37,6 +37,7 @@ import initBroadcastNotifications from './broadcast_notification';
import
{
initTopNav
}
from
'
./nav
'
;
import
{
initTopNav
}
from
'
./nav
'
;
import
'
ee_else_ce/main_ee
'
;
import
'
ee_else_ce/main_ee
'
;
import
'
jh_else_ce/main_jh
'
;
applyGitLabUIConfig
();
applyGitLabUIConfig
();
...
...
app/assets/javascripts/main_jh.js
0 → 100644
View file @
a1d952b8
// This is an empty file to satisfy jh_else_ce import for the JH main entry point
config/webpack.config.js
View file @
a1d952b8
...
@@ -157,6 +157,9 @@ const alias = {
...
@@ -157,6 +157,9 @@ const alias = {
// the following resolves files which are different between CE and EE
// the following resolves files which are different between CE and EE
ee_else_ce
:
path
.
join
(
ROOT_PATH
,
'
app/assets/javascripts
'
),
ee_else_ce
:
path
.
join
(
ROOT_PATH
,
'
app/assets/javascripts
'
),
// the following resolves files which are different between CE and JH
jh_else_ce
:
path
.
join
(
ROOT_PATH
,
'
app/assets/javascripts
'
),
// override loader path for icons.svg so we do not duplicate this asset
// override loader path for icons.svg so we do not duplicate this asset
'
@gitlab/svgs/dist/icons.svg
'
:
path
.
join
(
'
@gitlab/svgs/dist/icons.svg
'
:
path
.
join
(
ROOT_PATH
,
ROOT_PATH
,
...
@@ -180,10 +183,13 @@ if (IS_EE) {
...
@@ -180,10 +183,13 @@ if (IS_EE) {
if
(
IS_JH
)
{
if
(
IS_JH
)
{
Object
.
assign
(
alias
,
{
Object
.
assign
(
alias
,
{
jh
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/javascripts
'
),
jh
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/javascripts
'
),
jh_component
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/javascripts
'
),
jh_empty_states
:
path
.
join
(
ROOT_PATH
,
'
jh/app/views/shared/empty_states
'
),
jh_icons
:
path
.
join
(
ROOT_PATH
,
'
jh/app/views/shared/icons
'
),
jh_icons
:
path
.
join
(
ROOT_PATH
,
'
jh/app/views/shared/icons
'
),
jh_images
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/images
'
),
jh_images
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/images
'
),
jh_spec
:
path
.
join
(
ROOT_PATH
,
'
jh/spec/javascripts
'
),
jh_spec
:
path
.
join
(
ROOT_PATH
,
'
jh/spec/javascripts
'
),
jh_jest
:
path
.
join
(
ROOT_PATH
,
'
jh/spec/frontend
'
),
jh_jest
:
path
.
join
(
ROOT_PATH
,
'
jh/spec/frontend
'
),
jh_else_ce
:
path
.
join
(
ROOT_PATH
,
'
jh/app/assets/javascripts
'
),
});
});
}
}
...
@@ -519,6 +525,15 @@ module.exports = {
...
@@ -519,6 +525,15 @@ module.exports = {
);
);
}),
}),
!
IS_JH
&&
new
webpack
.
NormalModuleReplacementPlugin
(
/^jh_component
\/(
.*
)\.
vue/
,
(
resource
)
=>
{
// eslint-disable-next-line no-param-reassign
resource
.
request
=
path
.
join
(
ROOT_PATH
,
'
app/assets/javascripts/vue_shared/components/empty_component.js
'
,
);
}),
new
CopyWebpackPlugin
({
new
CopyWebpackPlugin
({
patterns
:
[
patterns
:
[
{
{
...
@@ -634,10 +649,12 @@ module.exports = {
...
@@ -634,10 +649,12 @@ module.exports = {
}),
}),
new
webpack
.
DefinePlugin
({
new
webpack
.
DefinePlugin
({
// Th
is one is used to define window.gon.ee
and other things properly in tests:
// Th
ese are used to define window.gon.ee, window.gon.jh
and other things properly in tests:
'
process.env.IS_EE
'
:
JSON
.
stringify
(
IS_EE
),
'
process.env.IS_EE
'
:
JSON
.
stringify
(
IS_EE
),
// This one is used to check against "EE" properly in application code
'
process.env.IS_JH
'
:
JSON
.
stringify
(
IS_JH
),
// These are used to check against "EE" properly in application code
IS_EE
:
IS_EE
?
'
window.gon && window.gon.ee
'
:
JSON
.
stringify
(
false
),
IS_EE
:
IS_EE
?
'
window.gon && window.gon.ee
'
:
JSON
.
stringify
(
false
),
IS_JH
:
IS_JH
?
'
window.gon && window.gon.jh
'
:
JSON
.
stringify
(
false
),
// This is used by Sourcegraph because these assets are loaded dnamically
// This is used by Sourcegraph because these assets are loaded dnamically
'
process.env.SOURCEGRAPH_PUBLIC_PATH
'
:
JSON
.
stringify
(
SOURCEGRAPH_PUBLIC_PATH
),
'
process.env.SOURCEGRAPH_PUBLIC_PATH
'
:
JSON
.
stringify
(
SOURCEGRAPH_PUBLIC_PATH
),
}),
}),
...
...
jest.config.base.js
View file @
a1d952b8
const
IS_EE
=
require
(
'
./config/helpers/is_ee_env
'
);
const
IS_EE
=
require
(
'
./config/helpers/is_ee_env
'
);
const
isESLint
=
require
(
'
./config/helpers/is_eslint
'
);
const
isESLint
=
require
(
'
./config/helpers/is_eslint
'
);
const
IS_JH
=
require
(
'
./config/helpers/is_jh_env
'
);
module
.
exports
=
(
path
,
options
=
{})
=>
{
module
.
exports
=
(
path
,
options
=
{})
=>
{
const
{
const
{
moduleNameMapper
:
extModuleNameMapper
=
{},
moduleNameMapper
:
extModuleNameMapper
=
{},
moduleNameMapperEE
:
extModuleNameMapperEE
=
{},
moduleNameMapperEE
:
extModuleNameMapperEE
=
{},
moduleNameMapperJH
:
extModuleNameMapperJH
=
{},
}
=
options
;
}
=
options
;
const
reporters
=
[
'
default
'
];
const
reporters
=
[
'
default
'
];
...
@@ -29,6 +31,9 @@ module.exports = (path, options = {}) => {
...
@@ -29,6 +31,9 @@ module.exports = (path, options = {}) => {
testMatch
.
push
(
`<rootDir>/ee/
${
glob
}
`
);
testMatch
.
push
(
`<rootDir>/ee/
${
glob
}
`
);
}
}
if
(
IS_JH
)
{
testMatch
.
push
(
`<rootDir>/jh/
${
glob
}
`
);
}
// workaround for eslint-import-resolver-jest only resolving in test files
// workaround for eslint-import-resolver-jest only resolving in test files
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
// see https://github.com/JoinColony/eslint-import-resolver-jest#note
if
(
isESLint
(
module
))
{
if
(
isESLint
(
module
))
{
...
@@ -41,8 +46,11 @@ module.exports = (path, options = {}) => {
...
@@ -41,8 +46,11 @@ module.exports = (path, options = {}) => {
'
^~(/.*)$
'
:
'
<rootDir>/app/assets/javascripts$1
'
,
'
^~(/.*)$
'
:
'
<rootDir>/app/assets/javascripts$1
'
,
'
^ee_component(/.*)$
'
:
'
^ee_component(/.*)$
'
:
'
<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js
'
,
'
<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js
'
,
'
^jh_component(/.*)$
'
:
'
<rootDir>/app/assets/javascripts/vue_shared/components/empty_component.js
'
,
'
^shared_queries(/.*)$
'
:
'
<rootDir>/app/graphql/queries$1
'
,
'
^shared_queries(/.*)$
'
:
'
<rootDir>/app/graphql/queries$1
'
,
'
^ee_else_ce(/.*)$
'
:
'
<rootDir>/app/assets/javascripts$1
'
,
'
^ee_else_ce(/.*)$
'
:
'
<rootDir>/app/assets/javascripts$1
'
,
'
^jh_else_ce(/.*)$
'
:
'
<rootDir>/app/assets/javascripts$1
'
,
'
^helpers(/.*)$
'
:
'
<rootDir>/spec/frontend/__helpers__$1
'
,
'
^helpers(/.*)$
'
:
'
<rootDir>/spec/frontend/__helpers__$1
'
,
'
^vendor(/.*)$
'
:
'
<rootDir>/vendor/assets/javascripts$1
'
,
'
^vendor(/.*)$
'
:
'
<rootDir>/vendor/assets/javascripts$1
'
,
[
TEST_FIXTURES_PATTERN
]:
'
<rootDir>/tmp/tests/frontend/fixtures$1
'
,
[
TEST_FIXTURES_PATTERN
]:
'
<rootDir>/tmp/tests/frontend/fixtures$1
'
,
...
@@ -70,6 +78,19 @@ module.exports = (path, options = {}) => {
...
@@ -70,6 +78,19 @@ module.exports = (path, options = {}) => {
collectCoverageFrom
.
push
(
rootDirEE
.
replace
(
'
$1
'
,
'
/**/*.{js,vue}
'
));
collectCoverageFrom
.
push
(
rootDirEE
.
replace
(
'
$1
'
,
'
/**/*.{js,vue}
'
));
}
}
if
(
IS_JH
)
{
const
rootDirJH
=
'
<rootDir>/jh/app/assets/javascripts$1
'
;
Object
.
assign
(
moduleNameMapper
,
{
'
^jh(/.*)$
'
:
rootDirJH
,
'
^jh_component(/.*)$
'
:
rootDirJH
,
'
^jh_else_ce(/.*)$
'
:
rootDirJH
,
'
^jh_jest/(.*)$
'
:
'
<rootDir>/jh/spec/frontend/$1
'
,
...
extModuleNameMapperJH
,
});
collectCoverageFrom
.
push
(
rootDirJH
.
replace
(
'
$1
'
,
'
/**/*.{js,vue}
'
));
}
const
coverageDirectory
=
()
=>
{
const
coverageDirectory
=
()
=>
{
if
(
process
.
env
.
CI_NODE_INDEX
&&
process
.
env
.
CI_NODE_TOTAL
)
{
if
(
process
.
env
.
CI_NODE_INDEX
&&
process
.
env
.
CI_NODE_TOTAL
)
{
return
`<rootDir>/coverage-frontend/jest-
${
process
.
env
.
CI_NODE_INDEX
}
-
${
process
.
env
.
CI_NODE_TOTAL
}
`
;
return
`<rootDir>/coverage-frontend/jest-
${
process
.
env
.
CI_NODE_INDEX
}
-
${
process
.
env
.
CI_NODE_TOTAL
}
`
;
...
@@ -107,6 +128,7 @@ module.exports = (path, options = {}) => {
...
@@ -107,6 +128,7 @@ module.exports = (path, options = {}) => {
testEnvironment
:
'
<rootDir>/spec/frontend/environment.js
'
,
testEnvironment
:
'
<rootDir>/spec/frontend/environment.js
'
,
testEnvironmentOptions
:
{
testEnvironmentOptions
:
{
IS_EE
,
IS_EE
,
IS_JH
,
},
},
};
};
};
};
jest.config.integration.js
View file @
a1d952b8
...
@@ -8,9 +8,13 @@ module.exports = {
...
@@ -8,9 +8,13 @@ module.exports = {
moduleNameMapper
:
{
moduleNameMapper
:
{
'
^test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
'
^jh_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/spec/frontend_integration/test_helpers$1
'
,
},
},
moduleNameMapperEE
:
{
moduleNameMapperEE
:
{
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/ee/spec/frontend_integration/test_helpers$1
'
,
'
^ee_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/ee/spec/frontend_integration/test_helpers$1
'
,
},
},
moduleNameMapperJH
:
{
'
^jh_else_ce_test_helpers(/.*)$
'
:
'
<rootDir>/jh/spec/frontend_integration/test_helpers$1
'
,
},
}),
}),
};
};
lib/gitlab/gon_helper.rb
View file @
a1d952b8
...
@@ -35,6 +35,7 @@ module Gitlab
...
@@ -35,6 +35,7 @@ module Gitlab
gon
.
first_day_of_week
=
current_user
&
.
first_day_of_week
||
Gitlab
::
CurrentSettings
.
first_day_of_week
gon
.
first_day_of_week
=
current_user
&
.
first_day_of_week
||
Gitlab
::
CurrentSettings
.
first_day_of_week
gon
.
time_display_relative
=
true
gon
.
time_display_relative
=
true
gon
.
ee
=
Gitlab
.
ee?
gon
.
ee
=
Gitlab
.
ee?
gon
.
jh
=
Gitlab
.
jh?
gon
.
dot_com
=
Gitlab
.
com?
gon
.
dot_com
=
Gitlab
.
com?
if
current_user
if
current_user
...
...
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