Skip to content

Conversation

vprab
Copy link

@vprab vprab commented Sep 30, 2023

Fixes: #194

"src/node-constants.cc",
"src/settings.cc",
],
"cflags": [ '-DLLNODE_VERSION=<!(grep -Po \'"version": \K(".*")\' <(module_root_dir)/package.json)' ],
Copy link

@zhxinyu zhxinyu Sep 30, 2023

Choose a reason for hiding this comment

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

Will the new feature support in Mac OS system? As far as I know, option P is not supported in grep in Mac OS, neither as \K

Copy link
Author

Choose a reason for hiding this comment

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

This is a compile-time step, so technically the feature would support any OS once we have a built artifact, but you're right that this wouldn't build on MacOS. We can change this line to:
"cflags": [ '-DLLNODE_VERSION=<!(grep \\"version\\" <(module_root_dir)/package.json | sed \'s/.*\\("[0-9\\.]*"\\).*/\\1/g\')' ],
if that works on Mac? Although I guess that also brings up the issue of Windows...

Copy link

@zhxinyu zhxinyu Oct 4, 2023

Choose a reason for hiding this comment

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

Yes. I confirm that it should work on Mac. and I think the double \ in \\"version\\" can be replaced by single \.

In particular, I tried grep "version" < package.json | sed 's/.*\("[0-9\.]*"\).*/\1/g' and echo "$(grep \"version\" < package.json | sed 's/.*\("[0-9\.]*"\).*/\1/g')"in cli.

@vprab
Copy link
Author

vprab commented Oct 3, 2023

Tagging @danielleadams for visibility 😄

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.

"v8 version" or "llnode --version"
2 participants