Skip to Content
精通模块化JavaScript
book

精通模块化JavaScript

by Nicolás Bevacqua
April 2020
Intermediate to advanced
177 pages
1h 45m
Chinese
Publishing House of Electronics Industry
Content preview from 精通模块化JavaScript
6.2
 显式依赖管理
143
还有许多其他存储应用程序设置的方式,每一种都有自己的优缺点。不过
我们刚刚讨论的方法实施起来相对简单,而且在启动阶段足够可靠。你还
可以了解一下如何使用
AWS Secrets Manager
,它相当于这些方法的升级版。
这样,在团队的环境中,你就只需要处理一个私密信息而不是所有的私密
信息。
私密信息服务还负责加密、安全存储、私密信息轮换(在数据泄露的情况
下有用)以及其他高级功能。
6.2
 显式依赖管理
有时我们会想将依赖项放到源代码控制中,这样每次在不同环境下都能根
据依赖关系树获取完全相同的版本。
但是,将依赖树放到代码库中是不切实际的,因为它们的大小通常是数
百兆字节,并且经常包含基于目标环境和操作系统
1
构建的编译资源,这意
味着构建过程本身就是依赖环境的,所以不适用于可能与平台无关的代码
库。
在开发过程中,我们希望确保对依赖项进行非破坏性升级,这可以帮助我
们解决上游的
bug
,加强对安全漏洞的控制,并使用一些新功能或改进项。
但是,对于部署而言,我们要求构建应该是可重现的,即每一次安装依赖
项都产生相同的结果。
解决方案是创建一个依赖清单,说明要安装的依赖关系树中的库的确切版
本。可以通过
npm
(从版本
5
开始)及其
package-lock.json
清单来实现,
1
 当我们运行
npm install
时,
npm
也会在
npm install
结束后执行重建步骤。重建步骤会
重新编译本机二进制文件,根据执行环境和本地计算机的操作系统来构建不同的资源。
144
6
开发的方法论与哲学 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据驱动力:企业数据分析实战

数据驱动力:企业数据分析实战

Carl Anderson
基于Python的智能文本分析

基于Python的智能文本分析

Benjamin Bengfort, Rebecca Bilbro, Tony Ojeda
Lua游戏AI开发指南

Lua游戏AI开发指南

Posts & Telecom Press, David Young

Publisher Resources

ISBN: 9787121387074