Skip to content

Commit

Permalink
Move update post scripts into one script called post
Browse files Browse the repository at this point in the history
Simplify the update shell script by combining the Node.js post scripts
into one mega script.

We also move the final message from update script to very end.
  • Loading branch information
lfdebrux committed Aug 3, 2022
1 parent 3a5b6ad commit 5e5e10b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
5 changes: 5 additions & 0 deletions lib/_update/post.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { updateJavascripts } = require('./update-javascripts')
const { updateScss } = require('./update-scss')

updateJavascripts()
updateScss()
5 changes: 0 additions & 5 deletions lib/_update/update-javascripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,5 @@ async function updateJavascripts () {
}

module.exports = {
/* exported for tests only */
updateJavascripts
}

if (require.main === module) {
updateJavascripts()
}
10 changes: 6 additions & 4 deletions lib/_update/update-scss/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ const {
removeLegacyIE8Sass
} = require('./update_scss')

removeKitSassFromApplicationSass()
removeKitSassFromAppSassPath(appSassPatternsPath, libSassPatternsPath)
removeKitSassFromAppSassPath(appSassPath, libSassPath)
removeLegacyIE8Sass()
module.exports.updateScss = function () {
removeKitSassFromApplicationSass()
removeKitSassFromAppSassPath(appSassPatternsPath, libSassPatternsPath)
removeKitSassFromAppSassPath(appSassPath, libSassPath)
removeLegacyIE8Sass()
}
20 changes: 11 additions & 9 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ copy () {

trap - ERR

update_gitignore
}

post () {
if [ -f 'update/lib/_update/post.js' ]; then
node 'update/lib/_update/post'
fi
}

finish () {
msg
msg "Your prototype kit files have now been updated, from version ${OLD_VERSION} to ${NEW_VERSION}."
msg 'If you need to make configuration changes, follow the steps at'
Expand All @@ -180,15 +190,6 @@ copy () {
update_gitignore
}

post () {
if [ -d "update/lib/_update/update-scss" ]; then
node "update/lib/_update/update-scss"
fi
if [ -f "update/lib/_update/update-javascripts.js" ]; then
node "update/lib/_update/update-javascripts"
fi
}

if [ "$0" == "${BASH_SOURCE:-$0}" ]
then
check
Expand All @@ -197,4 +198,5 @@ then
extract
copy
post
finish
fi

0 comments on commit 5e5e10b

Please sign in to comment.