Skip to content

Commit

Permalink
feat: tsn to print platform, arch and NODE_OPTIONS warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillgroshkov committed Aug 12, 2024
1 parent b7f1e1c commit 575bc7f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 23 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"typescript": "^5.0.2"
},
"devDependencies": {
"@biomejs/biome": "^1.8.3",
"@naturalcycles/dev-lib": "^15.0.0",
"@types/node": "^22.2.0"
},
Expand Down
24 changes: 20 additions & 4 deletions src/bin/tsn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,26 @@ function main(): void {
// })
}

const { NODE_OPTIONS = 'not defined' } = process.env
const { node } = process.versions

console.log(dimGrey(`node ${node}, NODE_OPTIONS: ${NODE_OPTIONS}`))
const { NODE_OPTIONS } = process.env
const {
platform,
arch,
versions: { node },
} = process

console.log(
dimGrey(`node ${node} ${platform} ${arch}, NODE_OPTIONS: ${NODE_OPTIONS || 'not defined'}`),
)

if (!NODE_OPTIONS) {
console.warn(
`NODE_OPTIONS env variable is not defined. You may run into out-of-memory issues when running memory-intensive scripts. It's recommended to set it to:\n--max-old-space-size=12000`,
)
} else if (NODE_OPTIONS.includes('max_old')) {
console.warn(
`It looks like you're using "max_old_space_size" syntax with underscores instead of dashes - it's WRONG and doesn't work in environment variables. Strongly advised to rename it to "max-old-space-size"`,
)
}

// Resolve path
const dotTS = scriptPathOriginal.endsWith('.ts')
Expand Down
31 changes: 13 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,11 @@
typescript "^5.0.2"

"@naturalcycles/dev-lib@^15.0.0":
version "15.8.2"
resolved "https://registry.yarnpkg.com/@naturalcycles/dev-lib/-/dev-lib-15.8.2.tgz#4cc4b15831b1fa8e6a9f7fb8da4e1fd8d52b6557"
integrity sha512-+/Rtk45mMTQb94g3ujIYWzs+Mi+T8yi2dNi/VATlcKeX9zUv1t0Vqkf0pZj1+NSB4ATDQzsFKU1mEdG1ksW/Fg==
version "15.10.1"
resolved "https://registry.yarnpkg.com/@naturalcycles/dev-lib/-/dev-lib-15.10.1.tgz#7b16cfeaa4b5922665631d056b2cae2c90e14f9e"
integrity sha512-JKQIvlOORWyMLzcu7bqUVPDRr7lm7MSMnh/vVmNB+2OEXPhIUHhcY+a0n9OzyXPyuM6gDA3XaxHQRbmgkVBLgw==
dependencies:
"@biomejs/biome" "^1.8.3"
"@commitlint/cli" "^19.0.0"
"@commitlint/config-conventional" "^19.0.0"
"@eslint/js" "^9.7.0"
Expand All @@ -529,7 +530,6 @@
"@types/node" "^22.0.0"
"@types/yargs" "^16.0.0"
eslint "^9.0.0"
eslint-config-prettier "^9.0.0"
eslint-plugin-import-x "^3.1.0"
eslint-plugin-jest "^28.0.0"
eslint-plugin-jsdoc "^50.0.0"
Expand Down Expand Up @@ -1424,11 +1424,6 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==

eslint-config-prettier@^9.0.0:
version "9.1.0"
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f"
integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==

eslint-import-resolver-node@^0.3.9:
version "0.3.9"
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac"
Expand Down Expand Up @@ -1462,9 +1457,9 @@ eslint-plugin-jest@^28.0.0:
"@typescript-eslint/utils" "^6.0.0 || ^7.0.0 || ^8.0.0"

eslint-plugin-jsdoc@^50.0.0:
version "50.0.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.0.0.tgz#0d064e14e1a8a3624c0474359fc51325b38b0fc9"
integrity sha512-czyJ5F7/qY2LIhUD5Bl6q1CCZ8mjvfEA9HQN5nvIp/Pb8VLIlUNd+DMZdA2OKN74QQMS3pobC06hFqAOJyOv5Q==
version "50.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-50.0.1.tgz#4d8484d2268d9b69476f781906422a6d2bfc598a"
integrity sha512-UayhAysIk1Du8InV27WMbV4AMSJSu60+bekmeuGK2OUy4QJSFPr1srYT6AInykGkmMdRuHfDX6Q0tJEr8BtDtg==
dependencies:
"@es-joy/jsdoccomment" "~0.46.0"
are-docs-informative "^0.0.2"
Expand Down Expand Up @@ -1905,9 +1900,9 @@ iconv-lite@^0.4.24:
safer-buffer ">= 2.1.2 < 3"

ignore@^5.2.0, ignore@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.1.tgz#5073e554cd42c5b33b394375f538b8593e34d4ef"
integrity sha512-5Fytz/IraMjqpwfd34ke28PTVMjZjJG2MPn5t7OE4eUCUNf8BAa7b5WUS9/Qvr6mwOQS7Mk6vdsMno5he+T8Xw==
version "5.3.2"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.2.tgz#3cd40e729f3643fd87cb04e50bf0eb722bc596f5"
integrity sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==

import-fresh@^3.2.1, import-fresh@^3.3.0:
version "3.3.0"
Expand Down Expand Up @@ -2670,9 +2665,9 @@ pluralize@^8.0.0:
integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==

postcss-selector-parser@^6.0.15:
version "6.1.1"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz#5be94b277b8955904476a2400260002ce6c56e38"
integrity sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg==
version "6.1.2"
resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz#27ecb41fb0e3b6ba7a1ec84fff347f734c7929de"
integrity sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==
dependencies:
cssesc "^3.0.0"
util-deprecate "^1.0.2"
Expand Down

0 comments on commit 575bc7f

Please sign in to comment.