fix: use mise idiomatic version parsing for node (#431)

* test: make sure nvmrc and node-version are tested

* fix: remove custom parsers for nvmrc and node-version in favor of mise idiomatic parsing

* test: update snapshots

* test: removing snapshot that it doesn't look like we need anymore?

* test: update snapshot

* test: increase docker pull timeout
This commit is contained in:
Michael Bianco
2026-01-16 08:55:11 -07:00
committed by GitHub
parent 86314dc9d8
commit 4514ee617c
9 changed files with 16 additions and 193 deletions
+3
View File
@@ -59,6 +59,9 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Start BuildKit
env:
# in rare cases, docker hub can timeout
DOCKER_CLIENT_TIMEOUT: 300
run: |
docker run --rm --privileged -d \
--name buildkit \
@@ -1,177 +0,0 @@
{
"caches": {
"apt": {
"directory": "/var/cache/apt",
"type": "locked"
},
"apt-lists": {
"directory": "/var/lib/apt/lists",
"type": "locked"
},
"node-modules": {
"directory": "/app/node_modules/.cache",
"type": "shared"
},
"npm-install": {
"directory": "/root/.npm",
"type": "shared"
}
},
"deploy": {
"base": {
"step": "packages:apt:runtime"
},
"inputs": [
{
"include": [
"/mise/shims",
"/mise/installs",
"/usr/local/bin/mise",
"/etc/mise/config.toml",
"/root/.local/state/mise"
],
"step": "packages:mise"
},
{
"include": [
"/app/node_modules"
],
"step": "build"
},
{
"exclude": [
"node_modules",
".yarn"
],
"include": [
"/root/.cache",
"."
],
"step": "build"
}
],
"variables": {
"CI": "true",
"NODE_ENV": "production",
"NPM_CONFIG_FUND": "false",
"NPM_CONFIG_PRODUCTION": "false",
"NPM_CONFIG_UPDATE_NOTIFIER": "false"
}
},
"steps": [
{
"assets": {
"mise.toml": "[mise.toml]"
},
"commands": [
{
"path": "/mise/shims"
},
{
"customName": "create mise config",
"name": "mise.toml",
"path": "/etc/mise/config.toml"
},
{
"cmd": "mise install",
"customName": "install mise packages: node"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-builder:latest"
}
],
"name": "packages:mise",
"variables": {
"MISE_CACHE_DIR": "/mise/cache",
"MISE_CONFIG_DIR": "/mise",
"MISE_DATA_DIR": "/mise",
"MISE_IDIOMATIC_VERSION_FILE_ENABLE_TOOLS": "python,node,ruby,elixir,go,java,yarn",
"MISE_INSTALLS_DIR": "/mise/installs",
"MISE_NODE_VERIFY": "false",
"MISE_PARANOID": "1",
"MISE_SHIMS_DIR": "/mise/shims",
"MISE_TRUSTED_CONFIG_PATHS": "/app"
}
},
{
"caches": [
"npm-install"
],
"commands": [
{
"path": "/app/node_modules/.bin"
},
{
"cmd": "mkdir -p /app/node_modules/.cache"
},
{
"cmd": "npm install"
}
],
"inputs": [
{
"step": "packages:mise"
},
{
"include": [
"."
],
"local": true
}
],
"name": "install",
"variables": {
"CI": "true",
"NODE_ENV": "production",
"NPM_CONFIG_FUND": "false",
"NPM_CONFIG_PRODUCTION": "false",
"NPM_CONFIG_UPDATE_NOTIFIER": "false"
}
},
{
"caches": [
"node-modules"
],
"commands": [
{
"cmd": "npm run build"
}
],
"inputs": [
{
"step": "install"
},
{
"include": [
"."
],
"local": true
}
],
"name": "build",
"secrets": [
"*"
]
},
{
"caches": [
"apt",
"apt-lists"
],
"commands": [
{
"cmd": "sh -c 'apt-get update \u0026\u0026 apt-get install -y libatomic1'",
"customName": "install apt packages: libatomic1"
}
],
"inputs": [
{
"image": "ghcr.io/railwayapp/railpack-runtime:latest"
}
],
"name": "packages:apt:runtime"
}
]
}
@@ -69,6 +69,10 @@
{
"path": "/mise/shims"
},
{
"dest": ".node-version",
"src": ".node-version"
},
{
"customName": "create mise config",
"name": "mise.toml",
@@ -108,6 +112,10 @@
{
"cmd": "mkdir -p /app/node_modules/.cache"
},
{
"dest": ".node-version",
"src": ".node-version"
},
{
"dest": ".yarnrc.yml",
"src": ".yarnrc.yml"
@@ -15,7 +15,7 @@
],
"inputs": [
{
"image": "dunglas/frankenphp:php8.4.16-bookworm"
"image": "dunglas/frankenphp:php8.4.17-bookworm"
}
],
"name": "packages:image"
-13
View File
@@ -293,19 +293,6 @@ func (p *NodeProvider) applyNodeVersionResolution(ctx *generate.GenerateContext,
if p.packageJson != nil && p.packageJson.Engines != nil && p.packageJson.Engines["node"] != "" {
miseStep.Version(nodeToolRef, p.packageJson.Engines["node"], "package.json > engines > node")
}
// TODO both nvmrc and node-version should be parsed via mise idiomatic version parsing
if nvmrc, err := ctx.App.ReadFile(".nvmrc"); err == nil {
if len(nvmrc) > 0 && nvmrc[0] == 'v' {
nvmrc = nvmrc[1:]
}
miseStep.Version(nodeToolRef, string(nvmrc), ".nvmrc")
}
if nodeVersionFile, err := ctx.App.ReadFile(".node-version"); err == nil {
miseStep.Version(nodeToolRef, string(nodeVersionFile), ".node-version")
}
}
func (p *NodeProvider) InstallMisePackages(ctx *generate.GenerateContext, miseStep *generate.MiseStepBuilder) {
+1 -1
View File
@@ -1,5 +1,5 @@
[
{
"expectedOutput": "Hello from pnpm workspaces"
"expectedOutput": ["Node v: v22.2.0", "Hello from pnpm workspaces"]
}
]
+1
View File
@@ -0,0 +1 @@
18.20.5
+1
View File
@@ -5,6 +5,7 @@ function getYarnVersion() {
return /\byarn\/([^\s]+)/.exec(ua)?.[1] ?? null; // e.g. "1.22.22", "3.6.1"
}
console.log("Node " + process.version);
console.log(
cowsay.say({
text: `Hello from Yarn ${getYarnVersion()}`,
+1 -1
View File
@@ -1,5 +1,5 @@
[
{
"expectedOutput": "Hello from Yarn 2.4.3"
"expectedOutput": ["Node v18.20.5", "Hello from Yarn 2.4.3"]
}
]