This repository has been archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade build pipeline and remove n8-make
- Loading branch information
Showing
8 changed files
with
6,132 additions
and
2,571 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,66 @@ | ||
# get Makefile directory name: http://stackoverflow.com/a/5982798/376773 | ||
THIS_MAKEFILE_PATH:=$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) | ||
THIS_DIR:=$(shell cd $(dir $(THIS_MAKEFILE_PATH));pwd) | ||
babel = node_modules/.bin/babel | ||
webpack = node_modules/.bin/webpack | ||
eslint = node_modules/.bin/eslint | ||
mocha = node_modules/.bin/mocha | ||
|
||
ROOT := lib/ index.js | ||
include $(shell node -e "require('n8-make')") | ||
# Source files root directory | ||
ROOT := lib index.js | ||
|
||
# BIN directory | ||
BIN := $(THIS_DIR)/node_modules/.bin | ||
# The directory to place the compiled .js and .json files. | ||
BUILDDIR = build | ||
|
||
# Testing WEB APP port | ||
TESTAPP_DIR := webapp/tests | ||
TESTAPP_PORT := 3001 | ||
SOURCE_FILES = $(shell find $(ROOT) -name "*.js") | ||
COMPILED_FILES = $(addprefix $(BUILDDIR)/, $(SOURCE_FILES)) | ||
|
||
# Files | ||
JS_FILES := $(wildcard index.js lib/*.js test/*.js) | ||
JS_FILES := $(SOURCE_FILES) $(wildcard test/*.js) | ||
JS_TESTING_FILES := $(wildcard test/test*.js test-whitelist/test*.js) | ||
|
||
# applications | ||
NODE ?= node | ||
NPM ?= $(NODE) $(shell which npm) | ||
MOCHA ?= $(NODE) $(BIN)/mocha | ||
WEBPACK ?= $(NODE) $(BIN)/webpack | ||
all: build build/wpcom.js | ||
|
||
standalone: compile build/wpcom.js | ||
build: $(COMPILED_FILES) | ||
|
||
compile: | ||
make build --jobs=8 | ||
$(BUILDDIR)/%.js: %.js | ||
@mkdir -p $(dir $@) | ||
@echo JS source file: "$<" → "$@" | ||
@$(babel) "$<" --source-maps --out-file "$@" | ||
|
||
build/wpcom.js: | ||
@$(WEBPACK) -p --config ./webpack.config.js | ||
build/wpcom.js: build | ||
@$(webpack) --config ./webpack.config.js | ||
|
||
install: node_modules | ||
|
||
node_modules: | ||
@NODE_ENV= $(NPM) install | ||
@npm install | ||
@touch node_modules | ||
|
||
lint: node_modules/eslint node_modules/babel-eslint | ||
@$(BIN)/eslint $(JS_FILES) | ||
lint: | ||
@$(eslint) $(JS_FILES) | ||
|
||
eslint: lint | ||
|
||
test: | ||
@$(MOCHA) \ | ||
@$(mocha) \ | ||
--timeout 120s \ | ||
--slow 3s \ | ||
--grep "$(FILTER)" \ | ||
--bail \ | ||
--reporter spec \ | ||
--compilers js:babel-register \ | ||
--require @babel/register \ | ||
test/ | ||
|
||
test-watch: | ||
@$(MOCHA) \ | ||
@$(mocha) \ | ||
--timeout 120s \ | ||
--slow 3s \ | ||
--bail \ | ||
--reporter spec \ | ||
--compilers js:babel-register \ | ||
--require @babel/register \ | ||
--watch \ | ||
--grep "$(FILTER)" \ | ||
test/ | ||
|
||
webapp: | ||
@$(WEBPACK) -p --config webapp/webpack.config.js | ||
|
||
media-editor: | ||
@$(WEBPACK) -p --config examples/media-editor/webpack.config.js | ||
|
||
deploy: webapp media-editor | ||
mkdir -p tmp/ | ||
rm -rf tmp/* | ||
mkdir -p tmp/tests | ||
mkdir -p tmp/media-editor | ||
cp webapp/index.html tmp/ | ||
cp webapp/style.css tmp/ | ||
cp webapp/webapp-bundle.js tmp/ | ||
cp examples/media-editor/index.html tmp/media-editor | ||
cp examples/media-editor/app.css tmp/media-editor | ||
cp -rf examples/media-editor/built/ tmp/media-editor/built | ||
git checkout gh-pages | ||
cp -rf tmp/* . | ||
|
||
.PHONY: standalone test test-all node_modules lint eslint webapp compile | ||
clean: | ||
@rm -rfv $(BUILDDIR) | ||
|
||
distclean: | ||
@rm -rfv node_modules | ||
|
||
.PHONY: all test test-watch node_modules lint eslint clean distclean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
presets: [ | ||
[ | ||
'@babel/env', | ||
{ | ||
useBuiltIns: 'usage', | ||
corejs: 2, | ||
exclude: [ 'transform-typeof-symbol' ], | ||
}, | ||
], | ||
], | ||
plugins: [ '@babel/transform-runtime' ], | ||
}; |
Oops, something went wrong.