On October 13, npm@7.0.0 was released . The release is experimental and available for download from the public npm registry with the next-7 tag. Also npm 7 comes with node.js 15.
, node.js . LTS . npm, , , .
1. Workspaces
, npm workspaces โ npm@7. Workspaces , โ (proof).
, . , npm.
workspaces package.json . :
{
"name": "root-project",
"workspaces": [
"workspace-a",
"packages/*"
]
}
npm install
node_modules
. , package.json
, package-lock.json
, .
, npm ci package.json
, package-lock.json
.
. npm . , babel-core
lerna
awesome-package
:
lerna add babel-core --scope=awesome-package
npm
, awesome-package
babel-core
--prefix
:
npm i babel-core --prefix=packages/awesome-package
package.json
, package-lock.json
node_modules
. , npm packages/awesome-package/package.json
. npm i
npm
ยซยป . , . :
, lib-a
npm-. . , ? , .
, , npm workspaces โ CLI .
2. peerDependencies
npm@7 peerDependencies
, npm .
, npm@7 peerDependencies
. , npm peerDependencies
.
, . --legacy-peer-deps
, .
: ยซ ยป. .
3. yarn.lock
: package.json
yarn.lock
.
: npm install
:
yarn.lock
.
package-lock.json
.
package.json
.
npm 6. yarn.lock
?
npm
lock-
, yarn.lock
. , package-lock.json
. , package-lock.json
- npm
yarn.lock
.
, npm
ยซยป ยซยป. yarn .
4. The standalone npx is deprecated
, npx . npx npm exec .
npm exec
, ?
npm exec
npm ( ) , npm run
npx : npm exec
--
:
npx foo@latest bar --package=@npmcli/foo
:
foo bar --package=@npmcli/foo
--package
, npx , . npm exec
:
npm exec foo@latest bar --package=@npmcli/foo
:
foo@latest bar
, :
npm exec -- foo@latest bar --package=@npmcli/foo
npx : , npm
. --yes
--no
5. - npm@7.1 โ npm set-script
, npm@7.1. npm set-script
scripts
package.json
.
, , scripts
npm run
:
npm init -y && npm install --save-dev http-server && npm set-script start "http-server ."&& npm start
npm .
โ peerDependencies
, โ workspaces
npx
. developer preview .
, npm .