【纱线】尝试逐一测试Yarn的命令
你好,我是IT专业的学生阿玛米亚。
虽然我最近刚刚在Qiita上发布了一篇文章,但既然有机会,我想再写一篇投稿。
我通常使用nodejs和yarn来开发Web应用程序,但实际上只使用yarn(yarn install)或yarn add这种程度。因此,我想利用这个机会尝试一些不同的命令。
版本,版本的不同
如果你已经安装了yarn,我认为你可以运行yarn -v命令来确保它正常工作。(顺便说一下,只输入yarn可能会自动开始下载。?)
请你用中文将以下内容进行改述,只需要一种版本:
请用中文改述版本
顺便提一下,根据官方文档的说法
yarn version
指令的内容如下:
info Current version: 1.0.1
question New version: 1.0.2
info New version: 1.0.2
✨ Done in 9.42s.
看起来可以对这个应用程序进行版本更改开发。
順便提一下,我也實際上嘗試執行了這個。
$ yarn version
yarn version v1.22.19
info Current version: 0.4.1
question New version: 0.4.2
info New version: 0.4.2
Done in 4.16s.
命令已在命令行中完成了更改。
只需给我一个选项,用中文来释义以下内容:
尝试使用cat package.json命令查看文件,
cat package.json
{
"name": "vx",
"version": "0.4.2",
"main": "index.js",
"license": "MIT",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
...(以下略)
已经正确变更了。
版本
拼写相似,但是如果是versions的话
$ yarn versions
yarn versions v1.22.19
{
yarn: '1.22.19',
vx: '0.4.2',
node: '18.18.0',
acorn: '8.10.0',
ada: '2.6.0',
ares: '1.19.1',
brotli: '1.0.9',
cldr: '43.1',
icu: '73.2',
llhttp: '6.0.11',
modules: '108',
napi: '9',
nghttp2: '1.55.0',
nghttp3: '0.7.0',
ngtcp2: '0.8.1',
openssl: '3.0.10+quic',
simdutf: '3.2.14',
tz: '2023c',
undici: '5.22.1',
unicode: '15.0',
uv: '1.46.0',
uvwasi: '0.0.18',
v8: '10.2.154.26-node.26',
zlib: '1.2.13.1-motley'
}
当运行该命令时,将会显示Node.js和JavaScript引擎的版本,以及自己的应用程序版本。
为什么
为什么!?虽然它是一个命令,但它似乎可以显示每个库的使用方式和文件夹容量。
我尝试用React来执行看看。
$ yarn why react
yarn why v1.22.19
[1/4] Why do we have the module "react"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "react@18.2.0"
info Has been hoisted to "react"
info Reasons this module exists
- Specified in "dependencies"
- Hoisted from "@metamask#sdk-react#@metamask#sdk#@metamask#sdk-install-modal-web#react"
info Disk size without dependencies: "376KB"
info Disk size with unique dependencies: "408KB"
info Disk size with transitive dependencies: "436KB"
info Number of shared dependencies: 2
Done in 0.54s.
这样的感觉。
由于node_modules(库文件的存放位置)可能会变得庞大,因此Node.js可能会很有用。
尝试执行Next.js和react-dom。
下一代JS
yarn why next
yarn why v1.22.19
[1/4] Why do we have the module "next"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "next@13.4.9"
info Has been hoisted to "next"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "63.98MB"
info Disk size with unique dependencies: "72.58MB"
info Disk size with transitive dependencies: "73.07MB"
info Number of shared dependencies: 14
=> Found "@types/next#next@14.0.3"
info This module exists because "@types#next" depends on it.
info Disk size without dependencies: "98.61MB"
info Disk size with unique dependencies: "106.5MB"
info Disk size with transitive dependencies: "107MB"
info Number of shared dependencies: 13
Done in 2.75s.
react-dom – 反应文档模型
yarn why react-dom
yarn why v1.22.19
[1/4] Why do we have the module "react-dom"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "react-dom@18.2.0"
info Has been hoisted to "react-dom"
info Reasons this module exists
- Specified in "dependencies"
- Hoisted from "@metamask#sdk-react#@metamask#sdk#@metamask#sdk-install-modal-web#react-dom"
info Disk size without dependencies: "4.53MB"
info Disk size with unique dependencies: "4.71MB"
info Disk size with transitive dependencies: "4.73MB"
info Number of shared dependencies: 3
Done in 0.56s.
真没想到Next.js的体积这么大,大约有100MB左右。
作者的话
日常生活中,我会做一些奇怪的事情或者制作应用程序。
另外也请支持我的手机应用。
请参考以下网站