Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Use webpack to build final product #117

Merged
merged 38 commits into from
Nov 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bdeaeed
Use webpack to build final product
dmsnell Sep 9, 2015
168ed90
Small updates: formatting, version, main file
dmsnell Oct 1, 2015
e687f6c
Remove 'only' that was hogging the test suites
dmsnell Oct 2, 2015
e27b382
Update Makefile and tests to use minified build
dmsnell Oct 2, 2015
255aa55
Push new distribution build of minified files.
dmsnell Oct 2, 2015
da5dbb3
Settle on a build layout.
dmsnell Oct 2, 2015
ef24996
Figure out public build process
dmsnell Oct 22, 2015
4cf07e5
Make tests use `dist` version
dmsnell Oct 22, 2015
3f63b0d
Update CircleCI config to build dist version
dmsnell Oct 22, 2015
4188dca
fixup! Update CircleCI config to build dist version
dmsnell Oct 22, 2015
3c3d212
Add the standalone file back into the repo
dmsnell Oct 23, 2015
42adf06
Added phony targets to .PHONY in Makefile
mattsherman Nov 3, 2015
500d902
Added dist/lib, dist/util, dist/test to .gitignore
mattsherman Nov 3, 2015
c153740
Cleaned up dist target dependencies in Makefile
mattsherman Nov 3, 2015
17ae5b0
Remove prepublish npm script, create publish make target
mattsherman Nov 3, 2015
cb2e1f9
Remove install make target
mattsherman Nov 3, 2015
f68831d
dist
retrofox Nov 3, 2015
33e910f
Use webpack to build final product
retrofox Nov 3, 2015
94df1ab
Small updates: formatting, version, main file
dmsnell Oct 1, 2015
854f212
Push new distribution build of minified files.
retrofox Nov 3, 2015
76e2084
Settle on a build layout.
retrofox Nov 3, 2015
c7968a0
Figure out public build process
retrofox Nov 3, 2015
df4cccb
Update CircleCI config to build dist version
dmsnell Oct 22, 2015
a3ddbab
fixup! Update CircleCI config to build dist version
dmsnell Oct 22, 2015
c30cc98
Add the standalone file back into the repo
retrofox Nov 3, 2015
accc3d3
examples-cors: remove node.js server
retrofox Nov 3, 2015
dfd1ab6
Fix example server to grab config from test/config instead of test/data
mattsherman Nov 4, 2015
9ed9b74
Committing dist files
mattsherman Nov 4, 2015
32a7a6a
pkg: move babel into "dependencies" key
retrofox Nov 4, 2015
4a1cb85
Clean up .gitignore, remove dist/index.js
mattsherman Nov 4, 2015
503466a
Merge branch 'update/webpack-build-system' of github.com:Automattic/w…
mattsherman Nov 4, 2015
fe07656
Added self to list of contributors
mattsherman Nov 4, 2015
793bcdd
remove `fs` from building process
retrofox Nov 5, 2015
53498ba
example: update uploading testing file (proxy)
retrofox Nov 5, 2015
8eba5e8
dist:updated
retrofox Nov 5, 2015
7021e6f
Fixed `examples/browser-cors/upload-images.html`
mattsherman Nov 5, 2015
6cff4f1
example: tweak upload images cors example
retrofox Nov 6, 2015
c77b18d
example: rename uploading testing file
retrofox Nov 6, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"blacklist": [ "strict" ]
"blacklist": [ "strict" ],
"sourceMaps": "true"
}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ npm-debug.log
/gh-tmp
.DS_Store
.idea
/dist
!/dist/wpcom.js
!/dist/wpcom.js.map
46 changes: 29 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,43 @@ BIN := $(THIS_DIR)/node_modules/.bin
NODE ?= node
NPM ?= $(NODE) $(shell which npm)
MOCHA ?= $(NODE) $(BIN)/mocha
BROWSERIFY ?= $(NODE) $(BIN)/browserify
BABEL ?= $(NODE) $(BIN)/babel
WEBPACK ?= $(NODE) $(BIN)/webpack

standalone: dist/wpcom.js

install: node_modules

clean:
@rm -rf node_modules dist
@rm -rf dist

distclean: clean
@rm -rf node_modules

dist: dist/lib dist/test
@mkdir -p $@

dist/lib: dist/lib/util
@mkdir -p $@

dist/lib/util:
@mkdir -p $@

dist:
dist/test:
@mkdir -p $@

dist/wpcom.js: node_modules *.js dist lib/*.js
@$(BROWSERIFY) -s WPCOM . > $@
dist/wpcom.js: *.js dist lib/*.js
@$(WEBPACK) -p --config webpack.config.js

node_modules: package.json
@NODE_ENV= $(NPM) install
@touch node_modules
babelify: dist
@$(BABEL) index.js --out-file dist/index.js
@$(BABEL) lib --out-dir dist/lib
@$(BABEL) lib/util --out-dir dist/lib/util
@$(BABEL) test --out-dir dist/test

example-server:
cd examples/server/; $(NPM) install
$(NODE) examples/server/index.js

example-browser-cors: all
cd examples/browser-cors/; $(NPM) install
$(NODE) examples/browser-cors/index.js

test: node_modules
test: babelify
@$(MOCHA) \
--compilers js:babel/register \
--timeout 120s \
Expand All @@ -46,12 +55,15 @@ test: node_modules
--bail \
--reporter spec

test-all: node_modules
test-all: babelify
@$(MOCHA) \
--compilers js:babel/register \
--timeout 120s \
--slow 3s \
--bail \
--reporter spec

.PHONY: all standalone install clean test test-all
publish: clean standalone
$(NPM) publish

.PHONY: all standalone clean distclean babelify example-server example-browser-cors test test-all publish
4 changes: 3 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ blog.posts({ number: 8 })

### Browser

Include `dist/wpcom.js` in a `<script>` tag:
Include `dist/wpcom.js` and a suitable browser shim if needed
to support the ES2015 features in `<script>` tags:

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.25/browser-polyfill.js"></script>
<script src="wpcom.js"></script>
<script>
var wpcom = WPCOM('<your-token>');
Expand Down
Loading