2222NPM_VERSION ?=
2323
2424# Define a Git commit message when incrementing the project version:
25- NPM_VERSION_MESSAGE ?=
25+ NPM_VERSION_COMMIT_MESSAGE ?= 'Increment version'
2626
27- # Define command-line options when incrementing the project version:
28- npm_version_flags ?=
29- ifdef NPM_VERSION_MESSAGE
30- npm_version_flags += -m $(NPM_VERSION_MESSAGE)
31- endif
27+ # Specify the output build directory when generating a gzipped archive:
28+ NPM_TARBALL_BUILD_OUT ?= $(BUILD_DIR ) /npm
29+
30+ # Specify the gzipped archive basename:
31+ npm_tarball_basename := "stdlib_v$(shell $(CURRENT_PROJECT_VERSION ) ) .tgz"
32+
33+ # Specify the output gzipped archive basename:
34+ NPM_TARBALL ?= $(npm_tarball_basename )
35+
36+ # Specify the output gzipped archive file path:
37+ npm_tarball := $(NPM_TARBALL_BUILD_OUT ) /$(NPM_TARBALL )
3238
3339# Define the version upgrade prerequisite...
3440ifeq ($(NPM_VERSION ) , pre-patch)
@@ -61,51 +67,45 @@ endif
6167endif
6268endif
6369
64- # Specify the output build directory when generating an npm gzipped archive:
65- NPM_TARBALL_BUILD_OUT := $(BUILD_DIR ) /npm
66-
67- # Specify the gzipped archive basename:
68- npm_tarball_basename := "stdlib-stdlib-$(shell $(CURRENT_PROJECT_VERSION ) ) .tgz"
6970
70- # Specify the output npm gzipped archive:
71- NPM_TARBALL ?= $(NPM_TARBALL_BUILD_OUT ) /$(npm_tarball_basename )
71+ # RULES #
7272
73-
74- # TARGETS #
75-
76- # Generate an npm tarball.
73+ # /
74+ # Generates a gzipped archive for publishing to npm.
7775#
78- # This target generates an npm gzipped archive.
79-
80- $(NPM_TARBALL ) :
76+ # @private
77+ # /
78+ $(npm_tarball ) :
8179 $(QUIET ) $(MKDIR_RECURSIVE ) $(NPM_TARBALL_BUILD_OUT )
8280 $(QUIET ) $(NPM_PACK ) $(ROOT_DIR ) > /dev/null
8381 $(QUIET ) mv $(ROOT_DIR ) /$(npm_tarball_basename ) $@
8482
85-
86- # Generate an npm tarball .
83+ # /
84+ # Generates a gzipped archive for publishing to npm .
8785#
88- # This target generates an npm gzipped archive.
89-
90- npm-tarball : $(NPM_TARBALL )
86+ # @example
87+ # make npm-tarball
88+ # /
89+ npm-tarball : $(npm_tarball )
9190
9291.PHONY : npm-tarball
9392
94-
95- # Run pre-version tasks.
96- #
97- # This target runs tasks which should be completed before incrementing the project version.
93+ # /
94+ # Performs checks to prevent unintended behavior when attempting to publish to npm.
9895#
9996# TODO: once we have a `master` branch, swap `develop` for `master`
100-
101- npm-pre-version : dedupe-node-modules
97+ #
98+ # @example
99+ # make npm-publish-check
100+ # /
101+ npm-publish-check :
102102 $(QUIET ) if [[ " $( shell $( GIT_BRANCH) ) " != " develop" ]]; then \
103103 echo ' Error: invalid operation. New versions should only be performed on the `develop`' ; \
104104 echo ' branch.' ; \
105105 exit 1; \
106106 fi
107107
108- .PHONY : npm-pre-version
108+ .PHONY : npm-publish-check
109109
110110
111111# Run pre-patch tasks.
@@ -185,9 +185,8 @@ npm-version-pre-release: npm-pre-version
185185# TODO: move recipe guts to a script
186186# TODO: on version, regenerate SVG equations and update README equation elements
187187
188- npm-version : dist-browser-bundles update-dist-readme-browser-bundle-stats
189- $(QUIET ) $(MAKE ) -f $(this_file ) list-pkgs-installed-logical-tree-json > $(DIST_DIR ) /npm_ls.json && \
190- $(GIT_ADD ) -A dist && \
188+ npm-version : dist-browser-bundles
189+ $(QUIET ) $(GIT_ADD ) -A dist && \
191190 $(GIT_COMMIT ) -m ' Update distributable browser bundles' && \
192191 $(MAKE ) -f $(this_file ) $(npm_version_target ) && \
193192 $(MAKE ) -f $(this_file ) npm-post-version
@@ -213,12 +212,12 @@ npm-post-version:
213212
214213.PHONY : npm-post-version
215214
216-
215+ # /
217216# Remove npm tarball(s).
218217#
219218# This target removes npm gzipped archives.
220-
219+ # /
221220clean-npm-tarball :
222- $(QUIET ) -rm -f $(NPM_TARBALL_BUILD_OUT ) /* .tgz
221+ $(QUIET ) $( DELETE ) $( DELETE_FLAGS ) $(NPM_TARBALL_BUILD_OUT ) /* .tgz
223222
224223.PHONY : clean-npm-tarball
0 commit comments