Skip to content

Instantly share code, notes, and snippets.

@lauriii
Created April 23, 2020 13:53
Show Gist options
  • Save lauriii/1416457faf3ae4b6a48b1c37c8ccfeb9 to your computer and use it in GitHub Desktop.
Save lauriii/1416457faf3ae4b6a48b1c37c8ccfeb9 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Clone Claro contrib theme into core/themes/claro
pushd core/themes
git clone --branch 8.x-2.x https://git.drupal.org/project/claro.git
# Remove the contrib module's git history.
pushd claro
curl https://www.drupal.org/files/issues/2019-10-11/claro-core-inclusion-3086983-6.patch | git apply -3v
rm -rf .git
sed -i '' 's|css/dist|css/src|g' claro.libraries.yml
sed -i '' 's|css/dist|css/src|g' claro.info.yml
# Remove unwanted files.
rm -rf .github
rm -rf scripts
rm composer.json
rm README.md
rm LICENSE
rm CODE_OF_CONDUCT.md
rm drupalci.yml
rm .eslintignore
rm .eslintrc.json
rm .eslintrc.passing.json
rm .gitignore
rm .stylelintrc.json
rm package.json
rm postcss.config.js
rm yarn.lock
# Change file type of all CSS files to .pcss.css.
pushd css
for file in $(find . -name '*.css')
do
sed -i '' 's|.css"|.pcss.css"|g' $file
mv $file $(echo "$file" | sed 's|.css|.pcss.css|g')
done
# Return to the Drupal root directory.
cd `dirs -l -0`
# Move tests to the right folder.
mkdir core/tests/Drupal/FunctionalJavascriptTests/Theme
mv core/themes/claro/tests/src/FunctionalJavascript/* core/tests/Drupal/FunctionalJavascriptTests/Theme
mv core/themes/claro/tests/src/Functional/* core/tests/Drupal/FunctionalTests/Theme
# Make the presence of this new core module known to Composer.
git apply << EOF
diff --git a/core/.stylelintignore b/core/.stylelintignore
new file mode 100644
index 0000000000..d5769bc7c0
--- /dev/null
+++ b/core/.stylelintignore
@@ -0,0 +1,2 @@
+themes/claro/**/*.css
+!themes/claro/**/*.pcss.css
diff --git a/core/composer.json b/core/composer.json
index 8a5d3bdf89..42b7e38dde 100644
--- a/core/composer.json
+++ b/core/composer.json
@@ -65,6 +65,7 @@
"drupal/book": "self.version",
"drupal/breakpoint": "self.version",
"drupal/ckeditor": "self.version",
+ "drupal/claro": "self.version",
"drupal/classy": "self.version",
"drupal/color": "self.version",
"drupal/comment": "self.version",
EOF
curl https://www.drupal.org/files/issues/2019-10-11/3087189-13-do-not-test.patch | git apply -3v
# Run yarn prettier.
pushd core
yarn install
yarn prettier
yarn build:js
# Return to the Drupal root directory.
cd `dirs -l -0`
# Create patch.
git add core/themes/claro
git add core/composer.json
git add core/.stylelintignore
git add core/tests/Drupal/FunctionalJavascriptTests/Theme
git add core/tests/Drupal/FunctionalTests/Theme
git diff --staged -C -C > 3079738-CID-source-only.patch
# Build all the CSS files.
pushd core
yarn install
yarn build:css
# Return to the Drupal root directory.
cd `dirs -l -0`
# Create patch.
git add core/themes/claro
git diff --staged -C -C > 3079738-CID.patch
# Clean up.
rm -rf core/themes/claro
git reset --hard HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment