Compare commits

..

4 Commits

Author SHA1 Message Date
Priya Gupta
4f481c88d7 Merge 8f225c52ce into 89d709d423 2025-09-26 08:01:09 +00:00
Priyagupta108
8f225c52ce add devEngines.packageManager detection logic for npm auto-caching 2025-09-26 13:31:00 +05:30
Priyagupta108
7024c214c6 refactor: enhance package manager detection for auto-caching 2025-09-23 12:50:33 +05:30
Priyagupta108
470d7fe388 default to auto-caching only for npm package manager and documentation update 2025-09-22 15:31:26 +05:30
12 changed files with 98 additions and 125 deletions

View File

@@ -16,4 +16,4 @@ jobs:
name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with:
node-version: '24.x'
node-version: '20.x'

View File

@@ -18,8 +18,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Clean global cache
@@ -41,8 +41,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Install pnpm
@@ -74,8 +74,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 24]
steps:
- uses: actions/checkout@v5
- name: Yarn version
@@ -106,8 +106,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Update yarn
@@ -139,7 +139,7 @@ jobs:
name: Test yarn subprojects
strategy:
matrix:
node-version: [20, 22, 24]
node-version: [18, 20, 22, 24]
runs-on: ubuntu-latest
steps:
@@ -166,7 +166,7 @@ jobs:
name: Test yarn subprojects all locally managed
strategy:
matrix:
node-version: [20, 22, 24]
node-version: [18, 20, 22, 24]
runs-on: ubuntu-latest
steps:
@@ -193,7 +193,7 @@ jobs:
name: Test yarn subprojects some locally managed
strategy:
matrix:
node-version: [20, 22, 24]
node-version: [18, 20, 22, 24]
runs-on: ubuntu-latest
steps:
@@ -220,7 +220,7 @@ jobs:
name: Test yarn subprojects managed by git
strategy:
matrix:
node-version: [20, 22, 24]
node-version: [18, 20, 22, 24]
runs-on: ubuntu-latest
steps:
@@ -244,14 +244,14 @@ jobs:
sub2/*.lock
sub3/*.lock
node-npm-packageManager-auto-cache:
name: Test auto cache with top-level packageManager
node-npm-package-manager-cache:
name: Test enabling cache if package manager field is present (Node ${{ matrix.node-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22]
steps:
- uses: actions/checkout@v5
- name: Create package.json with packageManager field
@@ -268,37 +268,3 @@ jobs:
- name: Verify node and npm
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash
node-npm-devEngines-auto-cache:
name: Test auto cache with devEngines.packageManager
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Create package.json with devEngines field
run: |
echo '{
"name": "test-project",
"version": "1.0.0",
"devEngines": {
"packageManager": {
"name": "npm",
"onFail": "error"
}
}
}' > package.json
- name: Clean global cache
run: npm cache clean --force
- name: Setup Node with caching enabled
uses: ./
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Verify node and npm
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
shell: bash

View File

@@ -28,12 +28,12 @@ jobs:
- uses: actions/checkout@v5
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 24
- name: Setup node 14
uses: ./
with:
node-version: 24.x
node-version: 14.x
- name: Verify node and npm
run: __tests__/verify-node.sh 24
run: __tests__/verify-node.sh 14
test-bypass-proxy:
runs-on: ubuntu-latest
@@ -44,9 +44,9 @@ jobs:
- uses: actions/checkout@v5
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 24
- name: Setup node 11
uses: ./
with:
node-version: 24
node-version: 11
- name: Verify node and npm
run: __tests__/verify-node.sh 24
run: __tests__/verify-node.sh 11

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.4.0
uses: actions/publish-action@v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@@ -17,8 +17,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Setup Node
@@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
steps:
- uses: actions/checkout@v5
@@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version:
[
'20-v8-canary',
@@ -81,8 +81,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20-nightly, 25-nightly, 24.0.0-nightly]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [20-nightly, 21-nightly, 18.0.0-nightly]
steps:
- uses: actions/checkout@v5
- name: Setup Node
@@ -101,8 +101,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20.0.0-rc.1, 22.14.0-rc.1, 24.0.0-rc.4]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
steps:
- uses: actions/checkout@v5
- name: Setup Node
@@ -121,8 +121,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20.10.0, 22.0.0, 24.9.0]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18.20.0, 20.10.0, 22.0.0]
steps:
- uses: actions/checkout@v5
- name: Setup Node
@@ -138,8 +138,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
node-version: [20, 22, 24]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [18, 20, 22, 24]
steps:
- uses: actions/checkout@v5
- name: Setup Node and check latest
@@ -156,7 +156,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version-file:
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
steps:
@@ -173,7 +173,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v5
- name: Setup node from node version file
@@ -188,7 +188,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
steps:
- uses: actions/checkout@v5
- name: Setup node from node version file
@@ -203,7 +203,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [17, 19]
steps:
- uses: actions/checkout@v5
@@ -220,7 +220,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v5
# test old versions which didn't have npm and layout different
@@ -250,7 +250,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
node-version: [current, latest, node]
steps:
- name: Get node version

View File

@@ -12,14 +12,10 @@ This action provides the following functionality for GitHub Actions users:
- Registering problem matchers for error output
- Configuring authentication for GPR or npm
## Breaking changes in V6
- Caching is now automatically enabled for npm projects when either the `devEngines.packageManager` field or the top-level `packageManager` field in `package.json` is set to `npm`. For other package managers, such as Yarn and pnpm, caching is disabled by default and must be configured manually using the `cache` input.
## Breaking changes in V5
- Enabled caching by default with package manager detection if no cache input is provided.
> For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching by setting `package-manager-cache: false` when caching is not needed for secure operation.
- Enabled caching for npm dependencies by default when the package manager is detected and no cache input is provided.
> For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching for npm by setting `package-manager-cache: false` when caching is not needed for secure operation.
- Upgraded action from node20 to node24.
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
@@ -32,7 +28,7 @@ See [action.yml](action.yml)
<!-- start usage -->
```yaml
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
# Version Spec of the version to use in SemVer notation.
# It also admits such aliases as lts/*, latest, nightly and canary builds
@@ -71,7 +67,7 @@ See [action.yml](action.yml)
# Default: ''
cache: ''
# Controls automatic caching for npm. By default, caching for npm is enabled if either the devEngines.packageManager field or the top-level packageManager field in package.json specifies npm and no explicit cache input is provided.
# Controls automatic caching for npm. By default, caching for npm is enabled if the packageManager field in package.json specifies npm and no explicit cache input is provided.
# To disable automatic caching for npm, set package-manager-cache to false.
# default: true
package-manager-cache: true
@@ -118,7 +114,7 @@ See [action.yml](action.yml)
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: 24
- run: npm ci
@@ -139,7 +135,7 @@ Examples:
- Major versions: `22`, `24`
- More specific versions: `20.19`, `22.17.1` , `24.8.0`
- NVM LTS syntax: `lts/iron`, `lts/jod`, `lts/*`, `lts/-n`
- NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n`
- Latest release: `*` or `latest`/`current`/`node`
**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input.
@@ -167,7 +163,7 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
@@ -180,7 +176,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
@@ -189,14 +185,14 @@ steps:
- run: npm test
```
Caching for npm dependencies is automatically enabled when your `package.json` contains either `devEngines.packageManager` field or top-level `packageManager` field set to `npm`, and no explicit cache input is provided.
Caching for npm dependencies is automatically enabled when your `package.json` contains a `packageManager` field set to `npm` and no explicit cache input is provided.
This behavior is controlled by the `package-manager-cache` input, which defaults to `true`. To turn off automatic caching, set `package-manager-cache` to `false`.
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
package-manager-cache: false
- run: npm ci
@@ -216,7 +212,7 @@ jobs:
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node }}
- run: npm ci
@@ -230,7 +226,7 @@ jobs:
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
```yaml
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
token: ${{ secrets.GH_DOTCOM_TOKEN }}
node-version: 24

View File

@@ -24,7 +24,7 @@ inputs:
cache:
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
package-manager-cache:
description: 'Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager.'
description: 'Set to false to disable automatic caching. By default, caching is enabled when npm is the specified package manager in package.json.'
default: true
cache-dependency-path:
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'

12
dist/setup/index.js vendored
View File

@@ -99844,9 +99844,15 @@ function getNameFromPackageManagerField() {
const packageJson = JSON.parse(fs_1.default.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'package.json'), 'utf-8'));
// Check devEngines.packageManager first (object or array)
const devPM = (_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.devEngines) === null || _a === void 0 ? void 0 : _a.packageManager;
const devPMArray = devPM ? (Array.isArray(devPM) ? devPM : [devPM]) : [];
for (const obj of devPMArray) {
if (typeof (obj === null || obj === void 0 ? void 0 : obj.name) === 'string' && npmRegex.test(obj.name)) {
if (devPM) {
if (Array.isArray(devPM)) {
for (const obj of devPM) {
if (typeof (obj === null || obj === void 0 ? void 0 : obj.name) === 'string' && npmRegex.test(obj.name)) {
return 'npm';
}
}
}
else if (typeof (devPM === null || devPM === void 0 ? void 0 : devPM.name) === 'string' && npmRegex.test(devPM.name)) {
return 'npm';
}
}

View File

@@ -46,7 +46,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
check-latest: true
@@ -64,7 +64,7 @@ See [supported version syntax](https://github.com/actions/setup-node#supported-v
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version-file: '.nvmrc'
- run: npm ci
@@ -98,7 +98,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
@@ -119,7 +119,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.0.0-v8-canary' # it will install the latest v8 canary release for node 24.0.0
- run: npm ci
@@ -134,7 +134,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24-v8-canary' # it will install the latest v8 canary release for node 24
- run: npm ci
@@ -150,7 +150,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: 'v24.0.0-v8-canary2025030537242e55ac'
- run: npm ci
@@ -170,7 +170,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24-nightly' # it will install the latest nightly release for node 24
- run: npm ci
@@ -186,7 +186,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.0.0-nightly' # it will install the latest nightly release for node 24.0.0
- run: npm ci
@@ -202,7 +202,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.0.0-nightly202505066102159fa1'
- run: npm ci
@@ -220,7 +220,7 @@ jobs:
name: Node sample
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.0.0-rc.4'
- run: npm ci
@@ -238,7 +238,7 @@ Yarn caching handles both Yarn Classic (v1) and Yarn Berry (v2, v3, v4+).
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'yarn'
@@ -260,7 +260,7 @@ steps:
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'pnpm'
@@ -276,7 +276,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'npm'
@@ -289,7 +289,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24'
cache: 'npm'
@@ -320,14 +320,14 @@ jobs:
- x64
# an extra windows-x86 run:
include:
- os: windows-latest
- os: windows-2022
node_version: 24
architecture: x86
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: Setup node
uses: actions/setup-node@v6
uses: actions/setup-node@v5
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }}
@@ -339,7 +339,7 @@ jobs:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
@@ -347,7 +347,7 @@ steps:
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
registry-url: 'https://npm.pkg.github.com'
- run: npm publish
@@ -359,7 +359,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.x'
registry-url: <registry url>
@@ -367,7 +367,7 @@ steps:
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
registry-url: 'https://npm.pkg.github.com'
- run: yarn publish
@@ -379,7 +379,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
@@ -399,7 +399,7 @@ Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you
```yaml
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.x'
- name: Setup .yarnrc.yml
@@ -428,7 +428,7 @@ It is possible to specify a token to authenticate with the mirror using the `mir
The token will be passed as a bearer token in the `Authorization` header.
```yaml
- uses: actions/setup-node@v6
- uses: actions/setup-node@v5
with:
node-version: '24.x'
mirror: 'https://nodejs.org/dist'

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "setup-node",
"version": "6.0.0",
"version": "5.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "setup-node",
"version": "6.0.0",
"version": "5.0.0",
"license": "MIT",
"dependencies": {
"@actions/cache": "^4.0.3",

View File

@@ -1,6 +1,6 @@
{
"name": "setup-node",
"version": "6.0.0",
"version": "5.0.0",
"private": true,
"description": "setup node action",
"main": "lib/setup-node.js",

View File

@@ -149,9 +149,14 @@ export function getNameFromPackageManagerField(): string | undefined {
// Check devEngines.packageManager first (object or array)
const devPM = packageJson?.devEngines?.packageManager;
const devPMArray = devPM ? (Array.isArray(devPM) ? devPM : [devPM]) : [];
for (const obj of devPMArray) {
if (typeof obj?.name === 'string' && npmRegex.test(obj.name)) {
if (devPM) {
if (Array.isArray(devPM)) {
for (const obj of devPM) {
if (typeof obj?.name === 'string' && npmRegex.test(obj.name)) {
return 'npm';
}
}
} else if (typeof devPM?.name === 'string' && npmRegex.test(devPM.name)) {
return 'npm';
}
}