简体   繁体   English

Gulp 我需要 /dist 来拥有 node_modules 和 .git

[英]Gulp I need /dist to have node_modules and .git

I have folder structure like this我有这样的文件夹结构

  • dist
  • src源文件
    • public民众
      • index.html索引.html
      • main.js主文件
    • server服务器
      • server.js服务器.js
  • package.json包.json
  • Procfile配置文件
  • .env .env
  • .gitignore .gitignore
  • .git .git
  • gulpfile.js gulpfile.js
  • node_modules节点模块

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.

相关问题 我的 Gulp 生成的 Dist 文件夹是否可能包含在 node_modules 中发现的漏洞? - Is it possible that my Dist folder generated by Gulp contains a vulnerability found in node_modules? 持续集成、dist 文件夹和 node_modules - Continuous integration, dist folder and node_modules 将CI用于Bitbucket存储库-我是否需要在根文件夹中包含node_modules? - Using CI for Bitbucket repository - do I need to have node_modules inside my root folder? 当我运行“ npm run dist_win”时,出现错误:“ node_modules”不是内部命令还是外部命令? - when i run “npm run dist_win”, get a error: “node_modules” Not an internal or external command? 更改git分支时切换node_modules文件夹 - Switch node_modules folder when I change git branch 我是否需要Live Server上的“node_modules”文件夹 - Do I Need “node_modules” Folder on Live Server 我应该有 Travis 缓存 node_modules 还是 $HOME/.npm - Should I have Travis cache node_modules or $HOME/.npm 每次安装 package 时都必须重新安装 node_modules - Have to reinstall node_modules every time I install a package 当npm在本地项目中安装GULP时-在node_modules中有很多文件夹-为什么? - When npm installing GULP in local project - I get a ton of folders in node_modules - why? 需要有关使用node_modules的一些说明 - Need some clarification on using node_modules
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM