Skip to content

Commit 61e5c33

Browse files
committed
Update rules for generating bundles
1 parent 2814e4d commit 61e5c33

1 file changed

Lines changed: 37 additions & 23 deletions

File tree

tools/make/lib/bundle/browser.mk

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,61 @@
1818

1919
# VARIABLES #
2020

21-
# Define the command for generating distributable browser bundles:
22-
DIST_BROWSER_BUNDLES ?= NODE_PATH="$(NODE_PATH)" $(NODE) \
23-
--max_old_space_size=4096 \
24-
--expose_gc \
25-
$(TOOLS_PKGS_DIR)/bundle/scripts/dist_browser_bundles
21+
# Define the command for listing distributable bundle package directories:
22+
DIST_PKG_DIRS ?= NODE_PATH="$(NODE_PATH)" $(NODE) \
23+
$(DIST_DIR)/scripts/bundle_dirs.js
2624

27-
# Define the command-line options to be used when executing the command:
28-
DIST_BROWSER_BUNDLES_FLAGS ?=
25+
# Define the command for listing build scripts for generating distributable bundles:
26+
DIST_BUILD_SCRIPTS ?= NODE_PATH="$(NODE_PATH)" $(NODE) \
27+
$(DIST_DIR)/scripts/bundle_scripts.js
2928

30-
# Define the command for updating distributable browser bundle stats in the dist README:
31-
UPDATE_DIST_README_BROWSER_BUNDLE_STATS ?= $(NODE) $(TOOLS_PKGS_DIR)/bundle/scripts/update_dist_readme_browser_bundle_stats
29+
# Define the command for updating distributable package versions:
30+
DIST_UPDATE_VERSIONS ?= NODE_PATH="$(NODE_PATH)" $(NODE) \
31+
$(DIST_DIR)/scripts/update_versions.js
3232

33-
# Define the command-line options to be used when executing the command:
34-
UPDATE_DIST_README_BROWSER_BUNDLE_STATS_FLAGS ?=
33+
# Define the command for verifying distributable package versions:
34+
DIST_VERIFY_VERSIONS ?= NODE_PATH="$(NODE_PATH)" $(NODE) \
35+
$(DIST_DIR)/scripts/verify_versions.js
3536

3637

3738
# RULES #
3839

3940
#/
40-
# Generates distributable browser bundles.
41+
# Generates distributable bundles.
4142
#
4243
# @example
43-
# make dist-browser-bundles
44+
# make dist-bundles
4445
#/
45-
dist-browser-bundles: $(NODE_MODULES)
46-
$(QUIET) echo 'Generating distributable browser bundles...'
47-
$(QUIET) $(DIST_BROWSER_BUNDLES) $(DIST_BROWSER_BUNDLES_FLAGS)
48-
$(QUIET) for file in $(DIST_DIR)/*.min.js; do \
46+
dist-bundles: $(NODE_MODULES)
47+
$(QUIET) echo 'Generating distributable bundles...'
48+
$(QUIET) $(DIST_BUILD_SCRIPTS) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r file; do \
49+
echo ""; \
50+
echo "Running build script: $$file"; \
51+
NODE_PATH="$(NODE_PATH)" \
52+
$(NODE) $$file || exit 1; \
53+
done
54+
$(QUIET) for file in $(DIST_DIR)/*/build/*.min.js; do \
4955
echo "Compressing file: $$file"; \
5056
$(GZIP) "$$file" -9 -c > "$$file".gz; \
5157
done
5258

53-
.PHONY: dist-browser-bundles
59+
.PHONY: dist-bundles
5460

5561
#/
56-
# Updates a README file documenting distributable browser bundles to include the most recent bundle statistics.
62+
# Publishes distributable bundles to the npm package registry.
5763
#
5864
# @example
59-
# make update-dist-readme-browser-bundle-stats
65+
# make publish-dist-bundles
6066
#/
61-
update-dist-readme-browser-bundle-stats: $(NODE_MODULES)
62-
$(QUIET) NODE_PATH="$(NODE_PATH)" $(UPDATE_DIST_README_BROWSER_BUNDLE_STATS) $(UPDATE_DIST_README_BROWSER_BUNDLE_STATS_FLAGS)
67+
publish-dist-bundles: $(NODE_MODULES)
68+
$(QUIET) $(DIST_UPDATE_VERSIONS)
69+
$(QUIET) $(DIST_VERIFY_VERSIONS)
70+
$(QUIET) $(DIST_PKG_DIRS) | grep '^[\/]\|^[a-zA-Z]:[/\]' | while read -r pkg; do \
71+
echo ""; \
72+
echo "Publishing package: $$pkg"; \
73+
cd $$pkg; \
74+
$(NPM) publish --access public || exit 1; \
75+
done
76+
6377

64-
.PHONY: update-dist-readme-browser-bundle-stats
78+
.PHONY: publish-dist-bundles

0 commit comments

Comments
 (0)