您当前的位置: 首页 >  json

梁云亮

暂无认证

  • 2浏览

    0关注

    1211博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

vue package.json 语法

梁云亮 发布时间:2020-11-12 12:46:45 ,浏览量:2

vue-cli3.0致力于Vue生态中的工具基础标准化。它相比于vue-cli2.0少了build与config文件夹,提供了一个可选的配置文件vue.config.js。

name

name是项目的名字,注意:

  • 不要把node或者js放在名字中。因为你写了package.json它就被假定成为了js,不过你可以用"engine"字段指定一个引擎(见后文)。
  • 这个名字会作为在URL的一部分、命令行的参数或者文件夹的名字。任何non-url-safe的字符都是不能用的。
  • 这个名字可能会作为参数被传入require(),所以它应该比较短,但也要意义清晰。
  • 正式项目需要去npm registry查看一下这个名字是否已经被使用了。http://registry.npmjs.org/ version version必须能被node-semver解析,它被包在npm的依赖中。(要自己用可以执行npm install semver) 在package.json中最重要的就是name和version字段。他们都是必须的,如果没有就无法install。name和version一起组成的标识在假设中是唯一的。改变包应该同时改变version。
description

放简介,字符串,方便在npm search中搜索

keywords

关键字,数组、字符串,方便在npm search中搜索

license

用来指定一个许可证,让人知道使用的权利和限制。 假如你用一个像BSD或者MIT这样通用的许可证,就只需要指定一个许可证的名字,像这样: { “license” : “BSD” } 如果你有更复杂的许可条件,或者想要提供给更多地细节,可以这样: “licenses” : [{ “type” : “MyLicense” , “url” : “http://github.com/owner/project/path/to/license” }]

scripts

“scripts”是一个由脚本命令组成的hash对象,他们在包不同的生命周期中被执行。key是生命周期事件,value是要运行的命令。

repository

指定代码存放的地方。如果git仓库在github上:

"repository" :
  { "type" : "git"
  , "url" : "http://github.com/isaacs/npm.git"
  }
"repository" :
  { "type" : "svn"
  , "url" : "http://v8.googlecode.com/svn/trunk/"
  }

URL应该是公开的(即便是只读的)能直接被未经过修改的版本控制程序处理的url。不应该是一个html的项目页面。因为它是给计算机看的。

bugs

该项目的提交问题的url和(或)邮件地址:

{
 "url" : "http://github.com/owner/project/issues", 
"email" : "project@hostname.com"
}
dependencies

依赖是给一组包名指定版本范围的一个hash。这个版本范围是一个由一个或多个空格分隔的字符串。依赖还可以用tarball或者git URL。 请不要将测试或过渡性的依赖放在dependencies hash中。

devDependencies

如果有人要使用你的模块,那么他们可能不需要你开发使用的外部测试或者文档框架。 在这种情况下,最好将这些附属的项目列在devDependencies中。 这些东西会在执行npm link或者npm install的时候初始化,并可以像其他npm配置参数一样管理。

示例
{
  "name": "spring-boot-plus-vue",
  "version": "4.2.1",
  "description": "基于vue-element-admin开发的,对应spring-boot-plus接口的前端项目",
  "author": "369950806@qq.com",
  "license": "Apache License",
  "scripts": {
    "dev": "vue-cli-service serve",
    "build:prod": "vue-cli-service build",
    "build:stage": "vue-cli-service build --mode staging",
    "preview": "node build/index.js --preview",
    "lint": "eslint --ext .js,.vue src",
    "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml",
    "new": "plop"
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.{js,vue}": [
      "eslint --fix",
      "git add"
    ]
  },
  "keywords": [
    "vue",
    "admin",
    "dashboard",
    "element-ui",
    "boilerplate",
    "admin-template",
    "management-system"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/369950806/vue-element-admin.git"
  },
  "bugs": {
    "url": "https://github.com/369950806/vue-element-admin.git/issues"
  },
  "dependencies": {
    "axios": "0.18.1",
    "clipboard": "2.0.4",
    "codemirror": "5.45.0",
    "driver.js": "0.9.5",
    "dropzone": "5.5.1",
    "echarts": "4.2.1",
    "element-ui": "2.13.0",
    "file-saver": "2.0.1",
    "fuse.js": "3.4.4",
    "js-cookie": "2.2.0",
    "jsonlint": "1.6.3",
    "jszip": "3.2.1",
    "normalize.css": "7.0.0",
    "nprogress": "0.2.0",
    "path-to-regexp": "2.4.0",
    "screenfull": "4.2.0",
    "script-loader": "0.7.2",
    "showdown": "1.9.0",
    "sortablejs": "1.8.4",
    "tui-editor": "1.3.3",
    "vue": "2.6.10",
    "vue-count-to": "1.0.13",
    "vue-router": "3.0.2",
    "vue-splitpane": "1.0.4",
    "vuedraggable": "2.20.0",
    "vuex": "3.1.0",
    "xlsx": "0.14.1"
  },
  "devDependencies": {
    "@babel/core": "7.0.0",
    "@babel/register": "7.0.0",
    "@vue/cli-plugin-babel": "3.5.3",
    "@vue/cli-plugin-eslint": "^3.9.1",
    "@vue/cli-plugin-unit-jest": "3.5.3",
    "@vue/cli-service": "3.5.3",
    "autoprefixer": "^9.5.1",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "10.0.1",
    "babel-jest": "23.6.0",
    "chalk": "2.4.2",
    "chokidar": "2.1.5",
    "connect": "3.6.6",
    "eslint": "5.15.3",
    "eslint-plugin-vue": "5.2.2",
    "html-webpack-plugin": "3.2.0",
    "husky": "1.3.1",
    "lint-staged": "8.1.5",
    "node-sass": "^4.9.0",
    "plop": "2.3.0",
    "runjs": "^4.3.2",
    "sass-loader": "^7.1.0",
    "script-ext-html-webpack-plugin": "2.1.3",
    "serve-static": "^1.13.2",
    "svg-sprite-loader": "4.1.3",
    "svgo": "1.2.0",
    "vue-template-compiler": "2.6.10"
  },
  "engines": {
    "node": ">=8.9",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ]
}
关注
打赏
1665409997
查看更多评论
立即登录/注册

微信扫码登录

0.0451s