Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modularization #996

Merged
merged 39 commits into from Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7127b67
Initial work in progress - modularization
Kikobeats Dec 15, 2015
18e61d4
[WIP] modularization (#984)
megawac Dec 23, 2015
1448f24
Fix implementations (test green lights)
megawac Dec 23, 2015
90656cf
Set up async bundles
megawac Dec 29, 2015
08af90e
Adjust commonjs builds and use umd format
megawac Dec 29, 2015
85f5be9
Avoid including lodash string parsing in bundle
megawac Jan 4, 2016
41489b2
Update make build tasks
megawac Jan 4, 2016
1f79497
use npm for lodash-es, rather than a git submodule
Kikobeats Dec 15, 2015
74e44ad
Improve bundle error reporting
megawac Jan 10, 2016
fbe3992
prevent having to require('async/foo').default
Jan 13, 2016
f694f09
use lodash from npm, now that 4.0 is released
Jan 13, 2016
9f5a7d0
update locations of lodash methods
Jan 13, 2016
f984553
update code style, increase linter coverage, refactor makefile
Jan 16, 2016
af0a2ed
rename build files, add smoke test for build
aearly Jan 16, 2016
d8bdb7a
fix karma test
aearly Jan 20, 2016
a191cb4
clean up makefile, add smoke test to build process
aearly Jan 21, 2016
f7abefd
add es modules to build, with lodash replaced with lodash-es
aearly Jan 22, 2016
f4f2742
fix es build test
aearly Feb 9, 2016
34f666a
move package manager files during build process, update main paths
aearly Feb 10, 2016
8a7f864
fix lint error
aearly Feb 10, 2016
b001e4a
handle moved lodash internal methods
aearly Feb 10, 2016
8423f0b
use tweaked version of xyz for our publish process
aearly Feb 11, 2016
cfbf7ae
check in dist for bower support
aearly Feb 14, 2016
0d09f43
pull in readme changes from master
aearly Feb 14, 2016
db9acac
add note about in-progress docs for 2.0
aearly Feb 14, 2016
e46c8a6
merge from master
aearly Feb 14, 2016
636908b
update build
aearly Feb 14, 2016
9688db3
Skip failing test case
megawac Feb 15, 2016
10ac9e9
filter, reject, detect, some, every with error
Feb 16, 2016
d611a47
fix readme
Feb 16, 2016
b73cedc
Merge pull request #1028 from charlierudolph/cr-withErrorModular
aearly Feb 16, 2016
430e42f
removed old lib/async.js
aearly Feb 16, 2016
73d57d2
move es build to separate folder/package
aearly Feb 16, 2016
943dbed
remove esnext:main from package json
aearly Feb 16, 2016
54411fc
move build/async.js to build/dist/async.js
aearly Feb 16, 2016
5da468f
make the package json main dist/async.js
aearly Feb 18, 2016
e642157
added a base implementation for unsaturation event #868
ecasilla Feb 20, 2016
3cf46d0
Merge pull request #1030 from ecasilla/modularization
aearly Feb 23, 2016
070ed49
gitignore build directories
aearly Feb 24, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my information

}
7 changes: 7 additions & 0 deletions .editorconfig
Expand Up @@ -8,3 +8,10 @@ trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 4

[package.json]
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 4
6 changes: 5 additions & 1 deletion .gitignore
@@ -1,6 +1,10 @@
node_modules
dist
perf/versions
nyc_output
coverage
*.log
.DS_Store
npm-debug.log
tmp
build
build-es
9 changes: 0 additions & 9 deletions .gitmodules

This file was deleted.

5 changes: 3 additions & 2 deletions .jscsrc
@@ -1,3 +1,4 @@
{
"validateIndentation": 4
}
"validateIndentation": 4,
"esnext": true
}
5 changes: 4 additions & 1 deletion .jshintrc
Expand Up @@ -9,6 +9,7 @@
"trailing": true,
"evil": true,
"laxcomma": true,
"esnext": true,

// Relaxing options
"onevar": false,
Expand All @@ -24,6 +25,8 @@
"define": true,
"describe": true,
"context": true,
"it": true
"it": true,
"before": true,
"after": true
}
}
4 changes: 4 additions & 0 deletions .npmignore
@@ -0,0 +1,4 @@
lib
scripts
support/dependencies.json
support/module_template.md
120 changes: 103 additions & 17 deletions Makefile
@@ -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" $< > $@
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Really liking this makefile @aearly

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 I'm totally a Make fanboy.

This does force windows maintainers to use something like MinGW, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats fine, as long as they can write and run tests its okay for me


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