Skip to content

Commit

Permalink
Generalize bundler language/variable names
Browse files Browse the repository at this point in the history
These changes are not specific to webpack, but apply to other bundlers
as well.
  • Loading branch information
martinpitt committed Feb 19, 2023
1 parent 182c1c4 commit d023933
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ your browser.

You can also use
[watch mode](https://webpack.js.org/guides/development/#using-watch-mode) to
automatically update the webpack on every code change with
automatically update the bundle on every code change with

$ make watch

When developing against a virtual machine, webpack can also automatically upload
When developing against a virtual machine, watch mode can also automatically upload
the code changes by setting the `RSYNC` environment variable to
the remote hostname.

Expand All @@ -41,7 +41,7 @@ set to upload code changes to `~/.local/share/cockpit/` instead of
Cockpit Podman uses [ESLint](https://eslint.org/) to automatically check
JavaScript code style in `.jsx` and `.js` files.

The linter is executed within every build as a webpack preloader.
eslint is executed within every build.

For developer convenience, the ESLint can be started explicitly by:

Expand All @@ -58,7 +58,7 @@ Rules configuration can be found in the `.eslintrc.json` file.
Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code
style in `.css` and `scss` files.

The linter is executed within every build as a webpack preloader.
styleint is executed within every build.

For developer convenience, the Stylelint can be started explicitly by:

Expand Down
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ APPSTREAMFILE=org.cockpit-project.$(PACKAGE_NAME).metainfo.xml
VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS)
# stamp file to check for node_modules/
NODE_MODULES_TEST=package-lock.json
# one example file in dist/ from webpack to check if that already ran
WEBPACK_TEST=dist/manifest.json
# one example file in dist/ from bundler to check if that already ran
DIST_TEST=dist/manifest.json
# one example file in pkg/lib to check if it was already checked out
COCKPIT_REPO_STAMP=pkg/lib/cockpit-po-plugin.js
# common arguments for tar, mostly to make the generated tarballs reproducible
Expand All @@ -25,7 +25,7 @@ RUN_TESTS_OPTIONS+=--coverage
NODE_ENV=development
endif

all: $(WEBPACK_TEST)
all: $(DIST_TEST)

# checkout common files from Cockpit repository required to build this project;
# this has no API stability guarantee, so check out a stable tag when you start
Expand Down Expand Up @@ -91,22 +91,22 @@ packaging/arch/PKGBUILD: packaging/arch/PKGBUILD.in
packaging/debian/changelog: packaging/debian/changelog.in
sed 's/VERSION/$(VERSION)/' $< > $@

$(WEBPACK_TEST): $(COCKPIT_REPO_STAMP) $(shell find src/ -type f) package.json webpack.config.js
$(DIST_TEST): $(COCKPIT_REPO_STAMP) $(shell find src/ -type f) package.json webpack.config.js
$(MAKE) package-lock.json && NODE_ENV=$(NODE_ENV) node_modules/.bin/webpack
# In development mode terser does not run and so no LICENSE.txt.gz is generated, so we explictly create it as it is required for building rpm's
if [ "$$NODE_ENV" = "development" ]; then \
gzip </dev/null >dist/index.js.LICENSE.txt.gz; \
fi

watch:
NODE_ENV=$(NODE_ENV) node_modules/.bin/webpack --watch
NODE_ENV=$(NODE_ENV) npm run watch

clean:
rm -rf dist/
rm -f $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog
rm -f po/LINGUAS

install: $(WEBPACK_TEST) po/LINGUAS
install: $(DIST_TEST) po/LINGUAS
mkdir -p $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME)
cp -r dist/* $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME)
mkdir -p $(DESTDIR)/usr/share/metainfo/
Expand All @@ -115,7 +115,7 @@ install: $(WEBPACK_TEST) po/LINGUAS
-o $(DESTDIR)/usr/share/metainfo/$(APPSTREAMFILE)

# this requires a built source tree and avoids having to install anything system-wide
devel-install: $(WEBPACK_TEST)
devel-install: $(DIST_TEST)
mkdir -p ~/.local/share/cockpit
ln -s `pwd`/dist ~/.local/share/cockpit/$(PACKAGE_NAME)

Expand All @@ -138,11 +138,11 @@ TEST_NPMS = \
dist: $(TARFILE)
@ls -1 $(TARFILE)

# when building a distribution tarball, call webpack with a 'production' environment by default
# when building a distribution tarball, call bundler with a 'production' environment by default
# we don't ship most node_modules for license and compactness reasons, only the ones necessary for running tests
# we ship a pre-built dist/ (so it's not necessary) and ship package-lock.json (so that node_modules/ can be reconstructed if necessary)
$(TARFILE): export NODE_ENV ?= production
$(TARFILE): $(WEBPACK_TEST) $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog
$(TARFILE): $(DIST_TEST) $(SPEC) packaging/arch/PKGBUILD packaging/debian/changelog
if type appstream-util >/dev/null 2>&1; then appstream-util validate-relax --nonet *.metainfo.xml; fi
tar --xz $(TAR_ARGS) -cf $(TARFILE) --transform 's,^,$(RPM_NAME)/,' \
--exclude '*.in' --exclude test/reference \
Expand Down
4 changes: 2 additions & 2 deletions packaging/debian/copyright
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Source: https://github.com/cockpit-project/cockpit-podman
Comment:
This does not directly cover the files in dist/*. These are "minified" and
compressed JavaScript/HTML files built from src/, lib/, po/, and node_modules/
with node, npm, and webpack. node_modules/ is not shipped as part of the
with node, npm, and a bundler. node_modules/ is not shipped as part of the
upstream release tarballs, but can be reconstructed precisely through the
shipped package-lock.json with the command "npm install". Rebuilding files in
dist/ requires internet access as that process needs to download additional
npm modules from the Internet, thus upstream ships the pre-minified webpacks
npm modules from the Internet, thus upstream ships the pre-minified bundles
as part of the upstream release tarball so that the package can be built
without internet access and lots of extra unpackaged build dependencies.

Expand Down

0 comments on commit d023933

Please sign in to comment.