Commit graph

455 commits

Author SHA1 Message Date
Martin Pitt
07017f79d8 Eliminate POTFILES.*.in files
The `find` is so cheap that there is little point in the POTFILES.*.in
indirection.
2021-01-04 14:01:59 +01:00
Martin Pitt
88fe99361b Simplify translation template
`this.po` is not being used anywhere, so drop the whole `!loaded` code
path. There is no defer mechanism, so `po.js` *must* be loaded after
cockpit.js. Let's trigger a crash instead of silently dropping
translations, to make such a bug obvious in manual and automatic tests.
2021-01-04 14:01:59 +01:00
Martin Pitt
bb15952fc4 Simplify po.js inclusion
There is no need to jump between directories and even invoke a glob --
the po.<LANG>.js files are right next to index.js.
2021-01-04 14:01:59 +01:00
Martin Pitt
c7f610f489 Fix po2json usage help
The output file is an option, not a positional argument.

`opts.args` is undefined if there are no positional arguments, so that
just calling `po/po2json` crashed with

    TypeError: Cannot read property 'length' of undefined
2021-01-04 14:01:59 +01:00
Martin Pitt
f93ccb26a8 Fix po2json default option arguments
Similarly to commit cbedf06704, provide default values, so that
`po2json po/de.po` does not error out with

    Option "--module" requires 1 arguments, but 0 were provided
2021-01-04 14:01:59 +01:00
Martin Pitt
43c51b979b po: Add Language: header value to German translations 2021-01-04 14:01:59 +01:00
Cockpit Project
de1efaccd3 package.json: Update core-js package dependency
Closes #412
2021-01-04 06:34:07 +01:00
Martin Pitt
670f528781 Adjust test for changed display language modal
f1542d54db rewrote
the language selector dialog. Update the tests to also work with
cockpit ≥ 233.

Do the version comparison dynamically for the time being, as this breaks
several image refreshes. We can drop this again and only use the new
code once all of these landed.
2021-01-01 08:37:23 +01:00
Martin Pitt
3dbd37a8c3
workflows: Move npm-update to Ubuntu 20.04
GitHub's 18.04 additional repositories break NPM. As "ubuntu-latest" is
going to switch to 20.04 soon anyway [1], do the jump now.

[1] https://github.com/actions/virtual-environments/issues/1816

Closes #409
2020-12-28 16:17:11 +01:00
Martin Pitt
539f293b7e webpack: Fix PatternFly font path
Copy the rule that cockpit and cockpit-podman use. Also change the
quoting, to avoid pointless diff noise. Now they are perfectly in sync.
2020-12-17 17:40:47 +01:00
Martin Pitt
dff4b66671 webpack: Only show errors and warnings
Otherwise there is just too much noise and when something is broken, the
error is above 3 pages of pointless logs.

See https://webpack.js.org/configuration/stats/

Cherry-picked from cockpit-podman commit 5989b20a05a.
2020-12-17 17:40:47 +01:00
Martin Pitt
6b8611caab Minimize CSS in production builds
Use optimize-css-assets-webpack-plugin for that. terser-webpack-plugin
was already being used by default, but explicitly import it as our
webpack config now references it directly.

https://webpack.js.org/plugins/mini-css-extract-plugin/#minimizing-for-production

Ported from cockpit-podman commit 3caf54fbfe2.
2020-12-17 17:40:47 +01:00
Martin Pitt
b9616257c2 spec: Add BuildRequires: make
See https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-17 08:47:17 +01:00
Cockpit Project
34f2b6253c package.json: Update @patternfly/react-core package dependency
Closes #405
2020-12-17 06:07:00 +01:00
Martin Pitt
50ef8a9362
webpack: Show sassc errors
`stdio` is not a valid value for the `stdio` option. This led to sassc's
stdout/err to be hidden, and thus it did not show error messages.

Closes #403

[1] https://nodejs.org/api/child_process.html#child_process_options_stdio
2020-12-16 17:49:02 +01:00
Martin Pitt
8821db1daf
webpack: Check if sassc is installed
If so, show the versions, which may be useful for comparing builds. If
not, show an useful error message. Previously, you were left with ~ 80
identical unintelligible error messages and leftover temporary
directories.

Closes #404
Fixes #391
2020-12-16 17:47:20 +01:00
Cockpit Project
18354174de package.json: Update @patternfly/patternfly package dependency
Closes #402
2020-12-16 10:01:01 +01:00
Cockpit Project
c2a5c6df77 package.json: Update @patternfly/react-core package dependency
Closes #401
2020-12-15 08:27:21 +01:00
Martin Pitt
8771907002 workflows: Fix apt installation in npm-update
GitHub's base VMs don't automatically refresh package indexes, so it can
happen that one of the package dependencies get out of date and are not
available on the mirrors any more.

Run `apt update` first to ensure that the workflow installs the latest
packages.
2020-12-11 10:11:57 +02:00
Cockpit Project
224d9a2a12 package.json: Update core-js package dependency
Closes #399
2020-12-06 07:50:14 +01:00
Martin Pitt
f95b9a0373
workflows: Update release container registry
With [1] the release container moved from dockerhub to GitHub's
container registry, as we both build and use it from GitHub. This avoids
running into docker.io pull limits.

[1] https://github.com/cockpit-project/cockpituous/pull/353

Closes #398
2020-12-02 10:29:38 +01:00
Martin Pitt
7fca9b9a26 webpack: Compress css in production mode
Adjust the WEBPACK_TEST file, as index.css is now not reliable (in
production mode it's .css.gz).

Closes #395
2020-11-26 11:17:04 +01:00
Martin Pitt
61db732b4a webpack: Drop compression plugin's minRatio option
The default of 0.8 is just fine, no need to tweak this.
2020-11-26 11:17:04 +01:00
Martin Pitt
8874e6a233 webpack: Declare constants as such 2020-11-26 11:17:04 +01:00
Martin Pitt
9fd1cf7f3f webpack: Simplify copied files
As `files` is now the only entry in `info`, rename it to a `copy_files`
constant, and drop `info` completely.

Drop the "qualify" loop and add the src/ subdirectory to the path
directly. This is more explicit, thus easier to understand, and simpler.

Drop the now unused "vpath" function.
2020-11-26 11:17:04 +01:00
Martin Pitt
230c338a5a webpack: Simplify module.entries
Drop the "qualify" loop and add the src/ subdirectory to the path
directly. This is more explicit, thus easier to understand, and simpler.

Also move it into the `modules` declaration directly, so that (1) it's
easier to see what it actually means, and (2) info.files is for a
completely different purpose.
2020-11-26 11:17:04 +01:00
Martin Pitt
8aad356edb webpack: Simplify externals declaration
This is simple enough to be inline, and it's also not meant to be
expanded: `cockpit` is the only legit external symbol, everything else
ought to be bundled.
2020-11-26 11:17:04 +01:00
Martin Pitt
8ea62cb4d7 webpack: Drop unnecessary output settings
The default of `path` and `sourceMapFilename` are already what we want,
no need to set them explicitly.

The `output.filename` is already `[name].js`, and it's totally not
important to name the file differently in production mode (it will then
just be `index.js.gz`, compared to index.js in development mode).
2020-11-26 11:17:04 +01:00
Cockpit Project
d3d1df5533 package.json: Update core-js package dependency
Closes #397
2020-11-26 06:25:38 +01:00
Martin Pitt
c1c2d83b81 Bump test/common dependency to 233
This gets rid of the hack for
<https://github.com/cockpit-project/cockpit/issues/14133>.
2020-11-25 21:09:53 +01:00
Cockpit Project
5f3c5c8436 package.json: Update @patternfly/patternfly package dependency
Closes #394
2020-11-22 11:51:57 +01:00
Cockpit Project
b49d1d48dc package.json: Update @patternfly/react-core package dependency
Closes #393
2020-11-19 05:48:47 +01:00
Cockpit Project
92f009d489 package.json: Update core-js package dependency
Closes #392
2020-11-07 16:25:28 +01:00
Cockpit Project
7dacf49b9a package.json: Update @patternfly/react-core package dependency
Closes #389
2020-10-30 06:21:08 +01:00
Martin Pitt
0ea06f9235 Run integration tests in Travis
Travis now offers /dev/kvm, and its machines are powerful enough to run
our browser integration tests, at least for small projects.

Building an RPM on the Ubuntu host environment is a bit tricky, as there
are no installed RPMs. Thus ignore the BuildRequires, and install
appstream-util explicitly. In the future, the rpm/deb build should
happen inside the VM (like Cockpit does).

Add two scenarios for current Fedora and CentOS 8.

Switch to the "minimal" environment to make the test easier to reproduce
locally and more explicit.

Closes #386
2020-10-29 07:23:54 +01:00
Martin Pitt
180dde395e Makefile: Fix PO template generation dependencies
*2po tools need the npm modules installed.
2020-10-29 07:23:54 +01:00
Cockpit Project
fcab193597 package.json: Update @patternfly/patternfly package dependency
Closes #387
2020-10-29 06:49:59 +01:00
Martin Pitt
233b5cfe04 Use sassc instead of node-sass
node-sass is a compiled ELF module, which is problematic for
distributions that want to rebuild everything from source. The sassc CLI
program is packaged everywhere, and both use the same libsass library.

So drop node-sass and sass-loader, and replace it with a simple loader
wrapper around sassc.

This also saves 122 npm packages (16 MB in node_modules/).

Closes #382
2020-10-28 14:49:52 +01:00
Martin Pitt
ea1377da1c Travis: Move to Ubuntu 20.04 LTS 2020-10-28 14:49:52 +01:00
Sanne Raymaekers
3703120a23
Makefile: Bump test/common to 230
Closes #385
2020-10-28 10:15:32 +01:00
Cockpituous
29fb8b5c98 package.json: Update react-dom package dependency
Closes #383
2020-10-20 09:08:39 +02:00
Martin Pitt
8e16b06df2
Run npm-update in a GitHub workflow
This avoids a lot of moving parts in our infrastructure (webhook,
npm-trigger roundtrip, tasks container), works in exactly the same way
for independent third-party projects, and does not need *any* secret
other than the automatically provided GitHub token.

Let this run early every morning, roughly similar frequency as
cockpituous used to do. Also add a manual trigger, so that we get a
button to run it on demand.

Closes #384
2020-10-20 09:08:08 +02:00
Cockpit Bots
7838cb70a9
package.json: Update react package dependency (#381)
Closes #381
2020-10-16 22:07:15 +02:00
Cockpituous
b6a10e5cfe package.json: Update @patternfly/patternfly package dependency
Closes #379
2020-10-13 19:34:14 +02:00
Martin Pitt
2a51e057d7 Show how to run the release in GitHub workflow
Enter the new world of GitHub actions [1]/GitLab pipelines [2]. This
simplifies our end of the infrastructure considerably:

* No need any more to set up webhooks, all the relevant configuration
  is right in the workflow file.

* Does not need any infrastructure on our side any more, and thus works
  for third-party projects. They just need to set up their own secrets.

* GitHub automatically provides a temporary `GITHUB_TOKEN` with
  sufficient write access to the project to publish a release, so we
  don't need to carry around that secret. Thus if your project only
  releases to GitHub, there is zero secrets management.

Also adjust cockpituous-release a bit (update Fedora version, fix
project name copy-pasta), point to the action workflow and necessary
secrets.

Closes #380
2020-10-13 09:37:35 +02:00
Cockpituous
499eca014b package.json: Update @patternfly/react-core package dependency
Closes #378
2020-10-09 22:30:48 +02:00
Martin Pitt
cbedf06704 Fix building PO template
The current version failed with

    Option "--directory" requires 1 arguments, but 0 were provided

In the current stdio npm module version, getopt() now requires a
`default:` attribute, otherwise it considers the options as required.

Also sync PO helpers with current cockpit.

Add PO template build to travis check, to make sure that it keeps
working.

Closes #375
2020-09-29 13:50:31 +03:00
Martin Pitt
6f8cd78783 Use standard "translate" marker in HTML
Cockpit's test-static-code complains about `translatable`, so let's use
the correct attribute to avoid spreading it further.
2020-09-29 13:50:31 +03:00
Martin Pitt
8f93db2234 npm: Upgrade eslint to current major versions
Closes #373
2020-09-28 07:49:01 +02:00
Martin Pitt
a5ade152a8 npm: Upgrade webpack related development dependencies
compression-webpack-plugin fixes https://www.npmjs.com/advisories/1548

Adjust to new copy-webpack-plugin API.

Thew new modules now create dist/index.html.gz in `NODE_ENV=production`
mode, so switch `WEBPACK_TEST` to index.css instead (which remains
uncompressed in both modes).
2020-09-28 07:49:01 +02:00