Does NPM run scripts called dependencies when running npm i?

Is npm i supposed to run run scripts called dependencies when npm i is run?

It does in my case in the lastest version of node (v19.8.1) and I’m wondering if this is a bug?

To reproduce try this:

mkdir test
cd test
npm init -y

And just make the package.json look like this:

{
  "name": "temp",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "dependencies": "cd app",
    "echo": "echo "$PWD""
  },  
  "main": "index.js",
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cpx": "^1.5.0",
    "node-pretty-log": "*"
  }
}

And try running npm i. The following should be the output:

npm i
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! code 1
npm ERR! path /Users/oleersoy/Temp/temp
npm ERR! command failed
npm ERR! command sh -c cd app
npm ERR! sh: line 0: cd: app: No such file or directory

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/oleersoy/.npm/_logs/2023-04-17T18_50_22_257Z-debug-0.log
oleersoy@Oles-MacBook-Pro temp % npm i
npm ERR! code 1
npm ERR! path /Users/oleersoy/Temp/temp
npm ERR! command failed
npm ERR! command sh -c cd app
npm ERR! sh: line 0: cd: app: No such file or directory

We can see that it tried to cd app, and since the directory app does not exist the error was created when it tried to run the dependencies script.