Skip to content

Commit

Permalink
build: add cjs_module_lexer_version base64_version
Browse files Browse the repository at this point in the history
build: add cjs_module_lexer_version base64_version
  • Loading branch information
MrJithil committed Nov 26, 2022
1 parent 9bc00fd commit f5d3e71
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/base64_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define BASE64_VERSION "0.5.0" // NOLINT(build/header_guard)
1 change: 1 addition & 0 deletions src/cjs_module_lexer_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#define CJS_MODULE_LEXER_VERSION "1.2.2" // NOLINT(build/header_guard)
4 changes: 4 additions & 0 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "node_metadata.h"
#include "ares.h"
#include "base64_version.h"
#include "brotli/encode.h"
#include "cjs_module_lexer_version.h"
#include "llhttp.h"
#include "nghttp2/nghttp2ver.h"
#include "node.h"
Expand Down Expand Up @@ -89,6 +91,8 @@ Metadata::Versions::Versions() {
std::to_string((BrotliEncoderVersion() & 0xFFF000) >> 12) +
"." +
std::to_string(BrotliEncoderVersion() & 0xFFF);
cjs_module_lexer = CJS_MODULE_LEXER_VERSION;
base64 = BASE64_VERSION;

#if HAVE_OPENSSL
openssl = GetOpenSSLVersion();
Expand Down
2 changes: 2 additions & 0 deletions src/node_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace node {
V(nghttp2) \
V(napi) \
V(llhttp) \
V(cjs_module_lexer) \
V(base64)

#if HAVE_OPENSSL
#define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl)
Expand Down
8 changes: 8 additions & 0 deletions test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
const common = require('../common');
const assert = require('assert');

const cjs_module_lexer = require('../../deps/cjs-module-lexer/package.json');

const expected_keys = [
'ares',
'brotli',
Expand All @@ -13,6 +15,8 @@ const expected_keys = [
'nghttp2',
'napi',
'llhttp',
'cjs_module_lexer',
'base64'
];

if (common.hasCrypto) {
Expand Down Expand Up @@ -50,6 +54,7 @@ assert.match(
/^\d+\.\d+\.\d+(?:\.\d+)?-node\.\d+(?: \(candidate\))?$/
);
assert.match(process.versions.modules, /^\d+$/);
assert.match(process.versions.cjs_module_lexer, commonTemplate);

if (common.hasCrypto) {
const versionRegex = common.hasOpenSSL3 ?
Expand All @@ -69,3 +74,6 @@ for (let i = 0; i < expected_keys.length; i++) {

assert.strictEqual(process.config.variables.napi_build_version,
process.versions.napi);

const expectedCjsModuleLexerVersion = cjs_module_lexer.version;
assert.strictEqual(process.versions.cjs_module_lexer, expectedCjsModuleLexerVersion);
2 changes: 2 additions & 0 deletions tools/update-base64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ echo ""
echo "$ git add -A deps/base64/base64"
echo "$ git commit -m \"deps: update base64 to $BASE64_VERSION\""
echo ""

echo "#define BASE64_VERSION \"$BASE64_VERSION\" // NOLINT(build/header_guard)" > "$BASE_DIR/src/base64_version.h"
19 changes: 19 additions & 0 deletions tools/update-deps-version-files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# Shell script to update version file of the deps in the source tree.
# This script could be used to update the version file for deps doesn't have update scripts


# update cjs_module_lexer_version.h
{
ROOT="$PWD/"
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)

# cjs-module-lexer
cd deps/cjs-module-lexer || exit
# get cjs-module-lexer version
CJS_MODULE_LEXER_VERSION=$("$NODE" -p "require('./package.json').version")
# update this version information in src/cjs_module_lexer_version.h
echo "#define CJS_MODULE_LEXER_VERSION \"$CJS_MODULE_LEXER_VERSION\" // NOLINT(build/header_guard)" > "$ROOT/src/cjs_module_lexer_version.h"
}

0 comments on commit f5d3e71

Please sign in to comment.