Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Node 21 upgrade #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

salomoneb
Copy link

@salomoneb salomoneb commented May 15, 2024

Description

Changes so that we can upgrade to Node 21.

  • Replaces node-sass with sass.
  • Removes vue-hot-reload-api.

Testing

Local testing is a little tricky since we're working with nested dependencies.

In the claycli directory that is using this package:

  1. Replace the @nymag/vueify version value with "@nymag/vueify": "file:<path-to-your-local-vueify>". On my setup, this looks like:
"@nymag/vueify": "file:../vueify",
  1. rm -rf package-lock.json node_modules
  2. npm i
  3. In your site app directory, making sure that you've pointed to whatever version of claycli that is referencing the modified version of vueify, try running the build command that calls claycli. You may need to delete package-lock and node_modules there as well. I found that the build would hang indefinitely if there were conflicts.

If you're using claycli version "5.1.0-0", I don't think you need to make any changes to that repo for this to work.

- Replace node-sass with sass
- Remove vue-hot-reload-api
Comment on lines -94 to -97
var prevParts = resolvedPartsCache[id] || {}
resolvedPartsCache[id] = resolvedParts
var scriptChanged = resolvedParts.script !== prevParts.script
var templateChanged = resolvedParts.template !== prevParts.template
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These vars were used by the hot reload code below and aren't referenced now.

}
)
try {
let res = sass.renderSync(sassOptions)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render is deprecated and not recommended if you're using sass via npm. I replaced it with renderSync, which takes the same LegacyOptions param. renderSync returns a result or throws an error, so I wrapped everything in a try..catch to handle the callbacks.

@@ -3,8 +3,8 @@ var path = require('path')
var ensureRequire = require('../ensure-require.js')

module.exports = function (raw, cb, compiler, filePath) {
ensureRequire('sass', 'node-sass')
var sass = require('node-sass')
ensureRequire('sass', 'sass')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if this is actually necessary, but I didn't want to rewrite too much right now.

@salomoneb salomoneb marked this pull request as ready for review May 15, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant