diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-02 18:09:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-02 18:09:59 +0300 |
commit | 1c2ff01b694fd06be15bc20279eef71ee5adf402 (patch) | |
tree | 98a588172ab8021790538a515933cf83552c5086 /scripts | |
parent | 2e4e6e9bb63212c628e67c6865fa39f62217a83d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/frontend/startup_css/constants.js | 63 | ||||
-rwxr-xr-x | scripts/frontend/startup_css/startup_css_changed.sh | 36 | ||||
-rw-r--r-- | scripts/frontend/startup_css/write_startup_scss.js | 2 |
3 files changed, 71 insertions, 30 deletions
diff --git a/scripts/frontend/startup_css/constants.js b/scripts/frontend/startup_css/constants.js index 9b9dc522a8f..a76092f8b45 100644 --- a/scripts/frontend/startup_css/constants.js +++ b/scripts/frontend/startup_css/constants.js @@ -27,7 +27,6 @@ const CSS_TO_REMOVE = [ /\.commit/, /\.md/, /\.with-performance-bar/, - /\.identicon/, ]; const APPLICATION_CSS_PREFIX = 'application'; const APPLICATION_DARK_CSS_PREFIX = 'application_dark'; @@ -36,49 +35,55 @@ const UTILITIES_DARK_CSS_PREFIX = 'application_utilities_dark'; // paths ----------------------------------------------------------------------- const ROOT = path.resolve(__dirname, '../../..'); +const ROOT_RAILS = IS_EE ? path.join(ROOT, 'ee') : ROOT; const FIXTURES_FOLDER_NAME = IS_EE ? 'fixtures-ee' : 'fixtures'; const FIXTURES_ROOT = path.join(ROOT, 'tmp/tests/frontend', FIXTURES_FOLDER_NAME); const PATH_SIGNIN_HTML = path.join(FIXTURES_ROOT, 'startup_css/sign-in.html'); const PATH_ASSETS = path.join(ROOT, 'tmp/startup_css_assets'); -const PATH_STARTUP_SCSS = path.join(ROOT, 'app/assets/stylesheets/startup'); +const PATH_STARTUP_SCSS = path.join(ROOT_RAILS, 'app/assets/stylesheets/startup'); + +// helpers --------------------------------------------------------------------- +const createMainOutput = ({ outFile, cssKeys, type }) => ({ + outFile, + htmlPaths: [ + path.join(FIXTURES_ROOT, `startup_css/project-${type}.html`), + path.join(FIXTURES_ROOT, `startup_css/project-${type}-legacy-menu.html`), + path.join(FIXTURES_ROOT, `startup_css/project-${type}-legacy-sidebar.html`), + path.join(FIXTURES_ROOT, `startup_css/project-${type}-signed-out.html`), + ], + cssKeys, + purgeOptions: { + safelist: { + standard: [ + 'page-with-icon-sidebar', + 'sidebar-collapsed-desktop', + // We want to include the root dropdown-menu style since it should be hidden by default + 'dropdown-menu', + ], + // We want to include the identicon backgrounds + greedy: [/^bg[0-9]$/], + }, + }, +}); + const OUTPUTS = [ - { + createMainOutput({ + type: 'general', outFile: 'startup-general', - htmlPaths: [ - path.join(FIXTURES_ROOT, 'startup_css/project-general.html'), - path.join(FIXTURES_ROOT, 'startup_css/project-general-legacy-menu.html'), - path.join(FIXTURES_ROOT, 'startup_css/project-general-signed-out.html'), - ], cssKeys: [APPLICATION_CSS_PREFIX, UTILITIES_CSS_PREFIX], - // We want to include the root dropdown-menu style since it should be hidden by default - purgeOptions: { - safelist: { - standard: ['dropdown-menu'], - }, - }, - }, - { + }), + createMainOutput({ + type: 'dark', outFile: 'startup-dark', - htmlPaths: [ - path.join(FIXTURES_ROOT, 'startup_css/project-dark.html'), - path.join(FIXTURES_ROOT, 'startup_css/project-dark-legacy-menu.html'), - path.join(FIXTURES_ROOT, 'startup_css/project-dark-signed-out.html'), - ], cssKeys: [APPLICATION_DARK_CSS_PREFIX, UTILITIES_DARK_CSS_PREFIX], - // We want to include the root dropdown-menu styles since it should be hidden by default - purgeOptions: { - safelist: { - standard: ['dropdown-menu'], - }, - }, - }, + }), { outFile: 'startup-signin', htmlPaths: [PATH_SIGNIN_HTML], cssKeys: [APPLICATION_CSS_PREFIX, UTILITIES_CSS_PREFIX], purgeOptions: { safelist: { - standard: ['fieldset'], + standard: ['fieldset', 'hidden'], deep: [/login-page$/], }, }, diff --git a/scripts/frontend/startup_css/startup_css_changed.sh b/scripts/frontend/startup_css/startup_css_changed.sh new file mode 100755 index 00000000000..b1df97f2f42 --- /dev/null +++ b/scripts/frontend/startup_css/startup_css_changed.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +echo "-----------------------------------------------------------" +echo "If you are run into any issues with Startup CSS generation," +echo "please check out the feedback issue:" +echo "" +echo "https://gitlab.com/gitlab-org/gitlab/-/issues/331812" +echo "-----------------------------------------------------------" + +startup_glob="*stylesheets/startup*" + +echo "Staging changes to '${startup_glob}' so we can check for untracked files..." +git add ${startup_glob} + +if [ -n "$(git diff HEAD --name-only -- ${startup_glob})" ]; then + diff=$(git diff HEAD -- ${startup_glob}) + cat <<EOF + +Startup CSS changes detected! + +It looks like there have been recent changes which require +regenerating the Startup CSS files. + +Consider one of the following options: + + 1. Regenerating locally with "yarn run generate:startup_css". + 2. Copy and apply the following diff: + +----- start diff ----- +$diff + +----- end diff ------- +EOF + + exit 1 +fi diff --git a/scripts/frontend/startup_css/write_startup_scss.js b/scripts/frontend/startup_css/write_startup_scss.js index 3754b95cefd..245681bada3 100644 --- a/scripts/frontend/startup_css/write_startup_scss.js +++ b/scripts/frontend/startup_css/write_startup_scss.js @@ -9,7 +9,7 @@ const buildFinalContent = (raw) => { // https://gitlab.com/gitlab-org/gitlab/-/issues/331812 @charset "UTF-8"; ${raw} -@import 'cloaking'; +@import 'startup/cloaking'; @include cloak-startup-scss(none); `; |