-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #996 from caolan/modularization
Modularization
- Loading branch information
Showing
119 changed files
with
5,194 additions
and
2,739 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["es2015"] | ||
} |
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,6 +1,10 @@ | ||
node_modules | ||
dist | ||
perf/versions | ||
nyc_output | ||
coverage | ||
*.log | ||
.DS_Store | ||
npm-debug.log | ||
tmp | ||
build | ||
build-es |
This file was deleted.
Oops, something went wrong.
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,3 +1,4 @@ | ||
{ | ||
"validateIndentation": 4 | ||
} | ||
"validateIndentation": 4, | ||
"esnext": true | ||
} |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
lib | ||
scripts | ||
support/dependencies.json | ||
support/module_template.md |
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,37 +1,123 @@ | ||
# This makefile is meant to be run on OSX/Linux. Make sure any artifacts | ||
# created here are checked in so people on all platforms can run npm scripts. | ||
# This build should be run once per release. | ||
|
||
export PATH := ./node_modules/.bin/:$(PATH):./bin/ | ||
|
||
PACKAGE = asyncjs | ||
XYZ = node_modules/.bin/xyz --repo git@github.com:caolan/async.git | ||
REQUIRE_NAME = async | ||
BABEL_NODE = babel-node | ||
UGLIFY = uglifyjs | ||
XYZ = support/xyz.sh --repo git@github.com:caolan/async.git | ||
|
||
BUILDDIR = build | ||
BUILD_ES = build-es | ||
DIST = dist | ||
SRC = lib/index.js | ||
SCRIPTS = ./support | ||
JS_SRC = $(shell find lib/ -type f -name '*.js') | ||
LINT_FILES = lib/ test/ mocha_test/ $(shell find perf/ -maxdepth 2 -type f) support/ gulpfile.js karma.conf.js | ||
|
||
BUILDDIR = dist | ||
SRC = lib/async.js | ||
UMD_BUNDLE = $(BUILDDIR)/dist/async.js | ||
UMD_BUNDLE_MIN = $(BUILDDIR)/dist/async.min.js | ||
CJS_BUNDLE = $(BUILDDIR)/index.js | ||
ES_MODULES = $(patsubst lib/%.js, build-es/%.js, $(JS_SRC)) | ||
|
||
all: lint test clean build | ||
|
||
build: $(wildcard lib/*.js) | ||
mkdir -p $(BUILDDIR) | ||
cp $(SRC) $(BUILDDIR)/async.js | ||
uglifyjs $(BUILDDIR)/async.js -mc \ | ||
--source-map $(BUILDDIR)/async.min.map \ | ||
-o $(BUILDDIR)/async.min.js | ||
all: clean lint build test | ||
|
||
test: | ||
nodeunit test | ||
npm test | ||
|
||
clean: | ||
rm -rf $(BUILDDIR) | ||
rm -rf $(BUILD_ES) | ||
rm -rf $(DIST) | ||
rm -rf tmp/ | ||
|
||
lint: | ||
jshint $(SRC) test/*.js mocha_test/* perf/*.js | ||
jscs $(SRC) test/*.js mocha_test/* perf/*.js | ||
jshint $(LINT_FILES) | ||
jscs $(LINT_FILES) | ||
|
||
.PHONY: test lint build all clean | ||
# Compile the ES6 modules to singular bundles, and individual bundles | ||
build-bundle: build-modules $(UMD_BUNDLE) $(CJS_BUNDLE) | ||
|
||
build-modules: | ||
$(BABEL_NODE) $(SCRIPTS)/build/modules-cjs.js | ||
|
||
$(UMD_BUNDLE): $(JS_SRC) package.json | ||
mkdir -p "$(@D)" | ||
$(BABEL_NODE) $(SCRIPTS)/build/aggregate-bundle.js | ||
|
||
$(CJS_BUNDLE): $(JS_SRC) package.json | ||
$(BABEL_NODE) $(SCRIPTS)/build/aggregate-cjs.js | ||
|
||
# Create the minified UMD versions and copy them to dist/ for bower | ||
build-dist: $(DIST) $(UMD_BUNDLE) $(UMD_BUNDLE_MIN) $(DIST)/async.js $(DIST)/async.min.js | ||
|
||
$(DIST): | ||
mkdir -p $@ | ||
|
||
$(UMD_BUNDLE_MIN): $(UMD_BUNDLE) | ||
mkdir -p "$(@D)" | ||
$(UGLIFY) $< --mangle --compress \ | ||
--source-map $(DIST)/async.min.map \ | ||
-o $@ | ||
|
||
$(DIST)/async.js: $(UMD_BUNDLE) | ||
cp $< $@ | ||
|
||
$(DIST)/async.min.js: $(UMD_BUNDLE_MIN) | ||
cp $< $@ | ||
|
||
build-es: $(ES_MODULES) | ||
|
||
$(BUILD_ES)/%.js: lib/%.js | ||
mkdir -p "$(@D)" | ||
sed -r "s/(import.+)lodash/\1lodash-es/g" $< > $@ | ||
|
||
test-build: | ||
mocha support/build.test.js | ||
|
||
build-config: $(BUILDDIR)/package.json $(BUILDDIR)/component.json $(BUILDDIR)/bower.json $(BUILDDIR)/README.md $(BUILDDIR)/LICENSE $(BUILDDIR)/CHANGELOG.md | ||
|
||
build-es-config: $(BUILD_ES)/package.json $(BUILD_ES)/README.md $(BUILD_ES)/LICENSE $(BUILD_ES)/CHANGELOG.md | ||
|
||
bower.json: package.json | ||
support/sync-package-managers.js | ||
|
||
component.json: package.json | ||
support/sync-package-managers.js | ||
|
||
$(BUILDDIR)/package.json: package.json | ||
mkdir -p "$(@D)" | ||
support/sync-cjs-package.js > $@ | ||
|
||
$(BUILDDIR)/%: % | ||
mkdir -p "$(@D)" | ||
cp $< $@ | ||
|
||
$(BUILD_ES)/package.json: package.json | ||
mkdir -p "$(@D)" | ||
support/sync-es-package.js > $@ | ||
|
||
$(BUILD_ES)/%: % | ||
mkdir -p "$(@D)" | ||
cp $< $@ | ||
|
||
.PHONY: build-modules build-bundle build-dist build-es build-config build-es-config test-build | ||
|
||
build: clean build-bundle build-dist build-es build-config build-es-config test-build | ||
|
||
.PHONY: test lint build all clean | ||
|
||
.PHONY: release-major release-minor release-patch | ||
release-major release-minor release-patch: all | ||
./support/sync-package-managers.js | ||
git add --force *.json | ||
git add --force $(BUILDDIR) | ||
git add --force $(DIST) | ||
git commit -am "update minified build"; true | ||
$(XYZ) --increment $(@:release-%=%) | ||
# build again to propagate the version | ||
$(MAKE) build-config | ||
$(MAKE) build-es-config | ||
cd build/ && npm pack | ||
cd build-es/ && npm pack |
Oops, something went wrong.