[英]Gulp I need /dist to have node_modules and .git
I have folder structure like this我有这样的文件夹结构
I need to upload /dist to Heroku and it requires git.我需要将 /dist 上传到 Heroku,它需要 git。 And I need node_modules too in project.
而且我在项目中也需要 node_modules。 package.json on top includes express and socket.io depencencies and gulp as devDependencies.
顶部的 package.json 包括 express 和 socket.io 依赖项以及作为 devDependencies 的 gulp。 Should I upload whole thing to git and heroku or install just devDependencies in package.json on top and in /src create another package.json and node_modules and git and move it to /dist.
我应该将整个内容上传到 git 和 heroku 还是只安装 devDependencies 在顶部的 package.json 和 /src 创建另一个 package.json 和 node_modules 和 git 并将其移动到 /dist。 I want /dist to be self-sufficient.
我希望 /dist 能够自给自足。 But how ?
但是怎么样?
Hoping this explanation will help you:希望这个解释能帮助你:
The /dist folder would be self-sufficient if you have a npm script to build your project to the dist folder and then the npm script start to run your application from this folder.如果您有一个 npm 脚本将项目构建到 dist 文件夹,然后 npm 脚本开始从该文件夹运行您的应用程序,则 /dist 文件夹将是自给自足的。
Another thing, the node_modules and the dist folder shouldn't go to any repository, since they're obtained from npm scripts (npm install and npm run build, in sequence).另一件事,node_modules 和 dist 文件夹不应该转到任何存储库,因为它们是从 npm 脚本(依次为 npm install 和 npm run build)获得的。
Furthermore, as mentioned in their documentation, the "dependencies" part of package.json must include all the necessary packages to build your application此外,如他们的文档中所述,package.json 的“依赖项”部分必须包含构建应用程序所需的所有包
Why's that so?为什么会这样?
"After running the installation and build steps Heroku will strip out the packages declared under devDependencies before deploying the application." “在运行安装和构建步骤之后, Heroku 将在部署应用程序之前去除在 devDependencies 下声明的包。” - Heroku Team
- Heroku 团队
If you have any other question, reply here...如果您有任何其他问题,请在此处回复...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.