构建和创建Apollo Graphphql服务器应用程序包的npm命令是什么?

0pizxfdo  于 5个月前  发布在  PHP
关注(0)|答案(1)|浏览(44)

什么是npm命令来构建和创建Apollo Graphphql服务器应用程序的包?我使用nodemon start命令来运行应用程序。但我想创建包并在服务器上发布它。我们可以使用哪个npm命令来构建和打包?
我使用nodemon启动命令来运行应用程序。但我想创建包并在服务器上发布它

f45qwnt8

f45qwnt81#

在Azure Pipelines中,您可以使用npm task执行相关的npm命令(例如**npm installnpm run buildnpm publish**等)来构建和发布您的应用。
有关更多npm命令,请参阅“npm CLI“。

编辑:

要为您的项目执行**in the package.json文件中的npm run build**命令,您需要定义要为构建过程运行的脚本。该脚本可以包含构建过程所需的命令行。请参阅下面的示例作为参考。

// package.json

{
  "name": "xxxx",
  "version": "xxxx",
  "description": "xxxx",
  "main": "xxxx",
  // Define the scripts for build and test.
  "scripts": {
    "build": "echo \"Building nodejs project...\" && node app.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "eslint": "^8.33.0"
  },
  "dependencies": {
    "canvas": "^2.11.0"
  }
}

字符串
在Azure Pipelines中,使用npm任务执行**npm run build命令时,在“Command”字段中选择“custom”后,您只需在“Command and arguments”字段中填写“run build”和所需的参数即可。任务将自动将“npm”与“run build**”组合合并'和提供的参数作为一个完整的命令行来运行。请参见下面的示例。

- task: Npm@1
  displayName: 'npm run build'
  inputs:
    command: custom
    workingDir: '$(Build.SourcesDirectory)/ProjectDir'
    verbose: false
    customCommand: 'run build'


的数据

相关问题