envoyer-npm-deployment

授权协议 Readme
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 匡凌
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Asset Compilation w/ Laravel Envoyer

The Problem(s)

  1. Running gulp --production before deployment is tedious and often forgotten, especialy when you are running gulp watch and assets are being compiled after any change.
  2. Running npm install on a server during every deployment and compiling it after is slow.
  3. Compiling locally and committing your versioned assets doesn't allow you to make tiny commits unless you leave out the versioned file until you are done.
  4. Using Envoyer for zero-downtime deployments doesn't handle this for you.

The Solution

Using Envoyer's deployment hooks we can fix the problems so that our assets are compiled when the project is deployed. We can also eliminate how long it takes NPM to download all of the packages we need by storing them in a shared node_modules folder.

Below are the steps required to download your node dependencies and compile your assets during deployment.

Performance

After the deployment hook runs for the first time, the deployment time drastically decreases. This is because we need to download all the node packages during the first deployment and then from there we symlink the project's node_modules directory to the release's node_modules directory.

  1. Running NPM install and gulp on server w/out symlinks (see example below): 4 min
  2. Using .envoyer deployment hook (first deployment): 2 min
  3. Using .envoyer deployment hook (after first deployment): 55s

Example w/out symlinks

Using one deployment hook containing:

npm install
gulp --production

Usage

  1. Login to your envoyer.io account and go to your projects deployment screen.
  2. Click "Deployment Hooks" tab
  3. Click cog wheel icon/button on the "Activate New Release" hook
  4. In the "Before This Action" panel click add hook
  5. Add a hook name
  6. Add the user to run the hook as (default: forge)
  7. Copy and paste the .envoyer file into the editor*

The Psuedo-Code Steps

  1. Go to the release directory
  2. Copy the package.json file to the projects directory
  3. Go to the project directory
  4. Run npm install
  5. Run npm update
  6. Symlink the {{project}}/node_modules directory to the {{release}}/node_modules directory
  7. Go to the release directory
  8. Run gulp

My Hooks*

I broke down the steps into 5 different hooks so I could see how long certain steps were taking. The hooks names are listed below.

  1. Copy package.json
  2. Install node packages
  3. Update node packages
  4. Create node_modules symlink
  5. Compile assets
 相关资料
  • 问题内容: 我更新到最新的节点v9.1.0,现在npm不起作用。 npm WARN npm npm不支持Node.js v9.1.0 问题答案: 事实证明,当前安装的版本与新版本不兼容,并且很难进行更新。 解决方案是先卸载然后重新安装,其中将包含的正确版本。 这是如何做: 卸载。 从https://nodejs.org安装

  • npm

    1 npm的历史、现状和发展 历史 2009年,npm(Node 包管理器)初次发布早期预览版; 2011年,npm 1.0:发布; 2015年,npm 支持私有模块 现状 npm公司发布了其软件包管理工具npm 5.0版,npm 5提升了性能,使其保持了对同类软件的竞争力。 npm的出现使我们分享代码或者复用代码变得更加简单。 发展 npm作为随同node.JS一起安装的包管理工具,在node包

  • npm

    npm 是 Node.js 的包管理工具,用来安装各种 Node.js 的扩展。 npm 是 JavaScript 的包管理工具,也是世界上最大的软件注册表。有超过 60 万个 JavaScript 代码包可供下载,每周下载约 30 亿次。npm 让 JavaScript 开发人员可以轻松地使用其他开发人员共享的代码。 npm 由三个不同的部分组成: 网站 注册表 命令行界面(CLI) 示例:查找

  • npm模块升级工具npm-check,提供命令行下的图形界面,可以手动选择升级哪些模块。 检查是否有需要更新、错误的和未使用的依赖: 功能特性: 依赖更新及时提醒 提供软件包更新接链,可以及时更新升级 友好的提示你所缺少的依赖包,减少不必要的盲目查找 支持安装在全局工作环境,via -g 平滑更新升级,via -u 支持公有域和私有域@scoped/packages 支持ES6-style 可交替

  • npm-upgrade Interactive CLI utility to easily update outdated NPM dependencies with changelogs inspection support. What is this for? If you are tired of manually upgrading package.json every time your

  • Overview Codebox npm is a serverless npm registry to allow companies that wish to keep their intellectual property. It allows sharing of npm modules within a company but additionally allows access to