-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
183 lines (168 loc) · 6.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=1024"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<title>npm dependencies 🤯</title>
<meta name="author" content="Francesco e Alex"/>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:regular,semibold,italic,italicsemibold|PT+Sans:400,700,400italic,700italic|PT+Serif:400,700,400italic,700italic"
rel="stylesheet"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/css/reveal.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/css/theme/white.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/lib/css/zenburn.min.css">
<link rel="stylesheet" href="intre.css">
<link rel="shortcut icon" href="favicon.png"/>
<link rel="apple-touch-icon" href="apple-touch-icon.png"/>
</head>
<body>
<div class="reveal">
<div class="slides">
<section class="title-slide">
<div>npm dependencies</div>
<h1>🤯</h1>
</section>
<section>
<h2>Dependency types</h2>
<pre><code>{
"dependencies": {
"foo" : "1.0.0 - 2.9999.9999"
},
"devDependencies": {
"coffee-script": "~1.6.3"
},
"peerDependencies": {
"tea": "2.x"
}
}
</code></pre>
</section>
<section>
<section class="title-slide bam"><h1>Demo / Quiz</h1></section>
<section class="title-slide bam"><img src="images/dependency-graph.svg" style="width:100%;"/></section>
<section class="title-slide bam">
<div>1. Only peer installed</div>
</section>
<section class="title-slide bam">
<div>2. Yours more recent</div>
</section>
<section class="title-slide bam">
<div>3. Your less recent</div>
</section>
<section><img src="images/npm-publishes.png"/></section>
</section>
<section class="title-slide bam slide">
<h2>On npm install</h2>
<ul>
<li><b>dependencies</b>: If <i>compatible</i> version is present: does nothing. If not, gets required
version and puts it under its node_modules
</li>
<li><b>devDependencies</b>: nothing</li>
<li><b>peerDependencies</b>: if version not ok, gives a warning (mind package lock)</li>
</ul>
</section>
<section class="title-slide bam slide">
<section>
<h2>On execution</h2>
<p>Close to source version has precedence over global version</p>
<pre><code>a.v1
b
- a.v2
</code></pre>
</p><i>b code will use a-v2</i></p>
</section>
<section>
<h2>Webpack</h2>
<p>Does the same...</p>
<p>i.e. bundle contains multiple versions of the same library</p>
</section>
<section>
<h2>Webpack</h2>
<p>... in a smart way: removes same versions</p>
<pre><code>a
- b.v1
c
- b.v2
d
- b.v2
</code></pre>
<p><i>bundle contains b.v1 and b.v2</i></p>
</section>
</section>
<section class="title-slide bam slide">
<h2>So everything works?</h2>
</section>
<section>
<section class="title-slide bam">
<h1 style="text-align:center;">no</h1>
<ul>
<li>objects passed around could be of different kind</li>
<li>instance of</li>
<li>global variables or properties</li>
<li>all relies on semantic versioning</li>
</ul>
</section>
<section>
<h2>Semantic versioning</h2>
<img src="images/Elephant-on-ball.jpg" />
</section>
</section>
<section class="title-slide bam slide"><h2>So what?</h2></section>
<section>
<h2>In your project</h2>
<ul>
<li>dependencies or devDependencies are the same: both are installed with npm install (careful with npm
install --production)
</li>
<li>keep your dependencies up to date</li>
</ul>
</section>
<section>
<section>
<h2>In your library</h2>
<ul>
<li>use peer dependencies (for big libraries shared among components, e.g. react, plugin, ...)</li>
<li>use version ranges (^1.2.3 := >=1.2.3 & <2.0.0 )</li>
<li>while developing install peer dependency by hand or add it to devDependencies</li>
<li>use semantic versioning!</li>
</ul>
</section>
<section>
<h2>Semantic versioning</h2>
<img src="images/Elephant-on-ball.jpg" />
</section>
</section>
<section class="title-slide bam slide" data-x="-100" data-y="0" data-rotate="180" data-z="-2000"
data-scale=".01">
<p class="big center">Thanks</p>
<p><a href="https://github.com/npm/node-semver">https://github.com/npm/node-semver</a></p>
<p><a href="https://github.com/depsir">https://github.com/depsir</a></p>
</section>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/js/reveal.js"></script>
<script>
Reveal.initialize(
{
controlsTutorial: false,
transition: 'none',
backgroundTransition: 'none',
dependencies: [
// {src:'../reveal-footer/footer.js', async:true},
{src: 'https://cdn.jsdelivr.net/gh/depsir/reveal-footer@0.0.2/footer.js', async: true},
{
src: 'https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.7.0/plugin/highlight/highlight.min.js',
async: true,
callback: function () {
hljs.initHighlightingOnLoad();
}
},
],
footer: 'npm dependencies - i3 camp',
history: true,
slideNumber: 'h/v'
});
</script>
</body>
</html>