-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstarterpacknotes.txt
198 lines (155 loc) · 3.82 KB
/
starterpacknotes.txt
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
JavaScript Starter Kit - Boilerplate - JavaScript Development Environment - Seed - Starter Project
Notes:
Add
.editorconfig
Tabs vs Spaces
package manager
npm (most popular) --> alternatives Bower, JSPM, Jam, volo
install Node and npm (use nvm to control Node version)
package.json file (npm install) --> installs packages into node modules
Security Scanning
npm has build in security scanning
retire.js
npm install -g nsp (install globally)
(no longer available --> has build in security)
Development Webservers
http-server
live-server
Express
Webpack dev server
budo
Using Express
Sharing Work-in-progress
localtunnel, ngrok, Surge, now
npm install localtunnel -g
start app --port 3000
node buildScripts/srcServer.js
lt --port 3000 (--subdomain anynameyouwant)
browsersync with localtunnel ==> awesome
Automation
npm Scripts, Grunt, Gulp
npm Scripts delcared in package.json
-pre/post script naming for prior and after actions
Transpiling
Babel, TypeScript, Elm
Babel
configureation styles
.babelrc, package.json
example:
var chalk = require('chalk'); //ES5 Pattern
import chalk from 'chalk //ES6 --> babel-node
Bundler
npm packages use CommonJS pattern -> node can handle fine
Browser need bundled packages in format they can handle
Module formats
IIFE
Asynchronous Module Definition (AMD)
CommonJS (CJS)
Universal Module Definition (UMD)
ES6 Modules
future applications should use ES6
-Standardized
-Statically analyzable
-Named imports
Select a Bundler (takes JS code and bundles for an environment ie Browser, etc)
RequireJS (AMD pattern fallen out of favor)
Browserify (one of the originals)
Webpack (comprehensive, hot-reloading, also handles more than just JavaScript -> CSS images etc)
Rollup (Relatively new, Fast, Tree shaking -> eliminates code not using from final bundle)
JSPM (Uses SystemJS)
Using Webpack -> full featured CSS, Images, Fonts, HTML, Bundle splitting
Linting
Enforce consistency, Avoid mistakes
JSLint
JSHint
ESLint -> most popular
*choose between throwing errors vs warnings
Plugins
Presets available
Tweak according to team feedback
ESLint
eslint-watch
Testing
Unit - Single function or module
Integration - Interactions between modules
UI - Automate interactions with UI
Unit Testing Frameworks
Mocha (highly configurable)
Jasmine (assertion library built in)
Tape (leanest and minimal configuration)
QUnit (oldest -> created for JQuery)
AVA (runs tests in parallel, fast)
Jest (from facebook -> popular with react developers)
Mocha
Assertion Library (needed when not built in test framework)
Chai (most popular assertion library)
Helper Library
JSDOM (simulate the browser's DOM)
Cheerio (jQuery for the server)
Where to run tests?
Browser
-Karma, Testem
Headless Browser (no visible user interface)
-PhantomJS
In-memory DOM
-JSDOM
Where do test files belong?
Centralized
Alongside
Test Plan
Framework - Mocha
Assertion Library - Chai
Helper Library - JDSOM
Where to run tests - Node
Where to place tests - Alongside
When to run tests - Upon Save
Continuous Integration
CI Server
Travis (Linux)
Appveyor (Windows)
Jenkins
Circleci
Semaphore
SnapCI
Travis + Appveyor
Mac/Linux/Windows platform coverage
HTTP Calls in JS
Node -> http, request
Browser -> XMLHttpRequest (XHR), jQuery, Framework-based eg Angular, Fetch
Node & Browser -> isomorphic-fetch, xhr, SuperAgent, Axios
Regardless of choice:
Centralize API calls
Mock HTTP
Nock
Static JSON
Create development webserver
-api-mock
-JSON server
-JSON Schema faker
Generate random data:
faker.js
chance.js
randexp.js
Minification
Error Logging
TrackJS
Sentry
New Relic
Raygun
Next TODO Prod Build and deployment
Takeaway concepts:
Package Management
Bundling
Minification
Sourcemaps
Transpiling
Dynamic HTML Generation
Centralized HTTP
Mock API framework
Component libraries
Development Webserver
Linting
Automated testing
Continuous Integration
Automated build
Automated deployment