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
Upgrade build pipeline and remove n8-make #228
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering if we should use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My intent here was to do some cleanups before importing this project to the Calypso monorepo. Then it will use |
||
presets: [ | ||
[ | ||
'@babel/env', | ||
{ | ||
useBuiltIns: 'usage', | ||
corejs: 2, | ||
exclude: [ 'transform-typeof-symbol' ], | ||
}, | ||
], | ||
], | ||
plugins: [ '@babel/transform-runtime' ], | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
distclean
runclean
too? It seems odd for it to clearnode_modules
but leave previously built files behind.