Merge branch 'main' of https://github.com/cockpit-project/starter-kit
This commit is contained in:
commit
a55c3d5b6f
11 changed files with 23 additions and 36 deletions
2
.flake8
Normal file
2
.flake8
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[flake8]
|
||||||
|
max-line-length = 118
|
||||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
|
|
@ -21,3 +21,9 @@ updates:
|
||||||
patternfly:
|
patternfly:
|
||||||
patterns:
|
patterns:
|
||||||
- "@patternfly*"
|
- "@patternfly*"
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
open-pull-requests-limit: 3
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
|
|
||||||
2
.github/workflows/cockpit-lib-update.yml
vendored
2
.github/workflows/cockpit-lib-update.yml
vendored
|
|
@ -22,7 +22,7 @@ jobs:
|
||||||
echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/github-token
|
echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/github-token
|
||||||
|
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run cockpit-lib-update
|
- name: Run cockpit-lib-update
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,7 @@
|
||||||
{
|
{
|
||||||
"extends": "stylelint-config-standard-scss",
|
"extends": "stylelint-config-standard-scss",
|
||||||
"rules": {
|
"rules": {
|
||||||
"declaration-colon-newline-after": null,
|
|
||||||
"selector-list-comma-newline-after": null,
|
|
||||||
|
|
||||||
"at-rule-empty-line-before": null,
|
"at-rule-empty-line-before": null,
|
||||||
"declaration-colon-space-before": null,
|
|
||||||
"declaration-empty-line-before": null,
|
"declaration-empty-line-before": null,
|
||||||
"custom-property-empty-line-before": null,
|
"custom-property-empty-line-before": null,
|
||||||
"comment-empty-line-before": null,
|
"comment-empty-line-before": null,
|
||||||
|
|
@ -19,9 +15,7 @@
|
||||||
"declaration-block-single-line-max-declarations": null,
|
"declaration-block-single-line-max-declarations": null,
|
||||||
"font-family-no-duplicate-names": null,
|
"font-family-no-duplicate-names": null,
|
||||||
"function-url-quotes": null,
|
"function-url-quotes": null,
|
||||||
"indentation": null,
|
|
||||||
"keyframes-name-pattern": null,
|
"keyframes-name-pattern": null,
|
||||||
"max-line-length": null,
|
|
||||||
"no-descending-specificity": null,
|
"no-descending-specificity": null,
|
||||||
"no-duplicate-selectors": null,
|
"no-duplicate-selectors": null,
|
||||||
"scss/at-extend-no-missing-placeholder": null,
|
"scss/at-extend-no-missing-placeholder": null,
|
||||||
|
|
|
||||||
6
Makefile
6
Makefile
|
|
@ -29,10 +29,11 @@ all: $(DIST_TEST)
|
||||||
COCKPIT_REPO_FILES = \
|
COCKPIT_REPO_FILES = \
|
||||||
pkg/lib \
|
pkg/lib \
|
||||||
test/common \
|
test/common \
|
||||||
|
test/static-code \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git
|
COCKPIT_REPO_URL = https://github.com/cockpit-project/cockpit.git
|
||||||
COCKPIT_REPO_COMMIT = fca64d4b989ceadabbfda311b971a41490aa2187 # 310 + 2 commits
|
COCKPIT_REPO_COMMIT = d2a0a971cde5af5353691ee030620be06c2dbc67 # 310.2 + 1 commits
|
||||||
|
|
||||||
$(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP)
|
$(COCKPIT_REPO_FILES): $(COCKPIT_REPO_STAMP)
|
||||||
COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}'
|
COCKPIT_REPO_TREE = '$(strip $(COCKPIT_REPO_COMMIT))^{tree}'
|
||||||
|
|
@ -178,6 +179,9 @@ prepare-check: $(NODE_MODULES_TEST) $(VM_IMAGE) test/common
|
||||||
check: prepare-check
|
check: prepare-check
|
||||||
test/common/run-tests ${RUN_TESTS_OPTIONS}
|
test/common/run-tests ${RUN_TESTS_OPTIONS}
|
||||||
|
|
||||||
|
codecheck: test/static-code $(NODE_MODULES_TEST)
|
||||||
|
test/static-code
|
||||||
|
|
||||||
# checkout Cockpit's bots for standard test VM images and API to launch them
|
# checkout Cockpit's bots for standard test VM images and API to launch them
|
||||||
bots: $(COCKPIT_REPO_STAMP)
|
bots: $(COCKPIT_REPO_STAMP)
|
||||||
test/common/make-bots
|
test/common/make-bots
|
||||||
|
|
|
||||||
10
README.md
10
README.md
|
|
@ -108,7 +108,7 @@ remove manually the symlink:
|
||||||
Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check
|
Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check
|
||||||
JavaScript code style in `.js` and `.jsx` files.
|
JavaScript code style in `.js` and `.jsx` files.
|
||||||
|
|
||||||
eslint is executed within every build.
|
eslint is executed as part of `test/static-code`, aka. `make codecheck`.
|
||||||
|
|
||||||
For developer convenience, the ESLint can be started explicitly by:
|
For developer convenience, the ESLint can be started explicitly by:
|
||||||
|
|
||||||
|
|
@ -125,7 +125,7 @@ Rules configuration can be found in the `.eslintrc.json` file.
|
||||||
Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code
|
Cockpit uses [Stylelint](https://stylelint.io/) to automatically check CSS code
|
||||||
style in `.css` and `scss` files.
|
style in `.css` and `scss` files.
|
||||||
|
|
||||||
styleint is executed within every build.
|
styleint is executed as part of `test/static-code`, aka. `make codecheck`.
|
||||||
|
|
||||||
For developer convenience, the Stylelint can be started explicitly by:
|
For developer convenience, the Stylelint can be started explicitly by:
|
||||||
|
|
||||||
|
|
@ -137,12 +137,6 @@ Violations of some rules can be fixed automatically by:
|
||||||
|
|
||||||
Rules configuration can be found in the `.stylelintrc.json` file.
|
Rules configuration can be found in the `.stylelintrc.json` file.
|
||||||
|
|
||||||
During fast iterative development, you can also choose to not run eslint/stylelint.
|
|
||||||
This speeds up the build and avoids build failures due to e. g. ill-formatted
|
|
||||||
css or other issues:
|
|
||||||
|
|
||||||
$ ./build.js -es
|
|
||||||
|
|
||||||
# Running tests locally
|
# Running tests locally
|
||||||
|
|
||||||
Run `make check` to build an RPM, install it into a standard Cockpit test VM
|
Run `make check` to build an RPM, install it into a standard Cockpit test VM
|
||||||
|
|
|
||||||
9
build.js
9
build.js
|
|
@ -11,19 +11,14 @@ import { cockpitCompressPlugin } from './pkg/lib/esbuild-compress-plugin.js';
|
||||||
import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js';
|
import { cockpitPoEsbuildPlugin } from './pkg/lib/cockpit-po-plugin.js';
|
||||||
import { cockpitRsyncEsbuildPlugin } from './pkg/lib/cockpit-rsync-plugin.js';
|
import { cockpitRsyncEsbuildPlugin } from './pkg/lib/cockpit-rsync-plugin.js';
|
||||||
import { esbuildStylesPlugins } from './pkg/lib/esbuild-common.js';
|
import { esbuildStylesPlugins } from './pkg/lib/esbuild-common.js';
|
||||||
import { eslintPlugin } from './pkg/lib/esbuild-eslint-plugin.js';
|
|
||||||
import { stylelintPlugin } from './pkg/lib/esbuild-stylelint-plugin.js';
|
|
||||||
|
|
||||||
const production = process.env.NODE_ENV === 'production';
|
const production = process.env.NODE_ENV === 'production';
|
||||||
const useWasm = os.arch() !== 'x64';
|
const useWasm = os.arch() !== 'x64';
|
||||||
const esbuild = (await import(useWasm ? 'esbuild-wasm' : 'esbuild')).default;
|
const esbuild = (await import(useWasm ? 'esbuild-wasm' : 'esbuild')).default;
|
||||||
const lintDefault = process.env.LINT ? process.env.LINT === '0' : production;
|
|
||||||
|
|
||||||
const parser = (await import('argparse')).default.ArgumentParser();
|
const parser = (await import('argparse')).default.ArgumentParser();
|
||||||
parser.add_argument('-r', '--rsync', { help: "rsync bundles to ssh target after build", metavar: "HOST" });
|
parser.add_argument('-r', '--rsync', { help: "rsync bundles to ssh target after build", metavar: "HOST" });
|
||||||
parser.add_argument('-w', '--watch', { action: 'store_true', help: "Enable watch mode", default: process.env.ESBUILD_WATCH === "true" });
|
parser.add_argument('-w', '--watch', { action: 'store_true', help: "Enable watch mode", default: process.env.ESBUILD_WATCH === "true" });
|
||||||
parser.add_argument('-e', '--no-eslint', { action: 'store_true', help: "Disable eslint linting", default: lintDefault });
|
|
||||||
parser.add_argument('-s', '--no-stylelint', { action: 'store_true', help: "Disable stylelint linting", default: lintDefault });
|
|
||||||
const args = parser.parse_args();
|
const args = parser.parse_args();
|
||||||
|
|
||||||
if (args.rsync)
|
if (args.rsync)
|
||||||
|
|
@ -55,8 +50,6 @@ function notifyEndPlugin() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const cwd = process.cwd();
|
|
||||||
|
|
||||||
// similar to fs.watch(), but recursively watches all subdirectories
|
// similar to fs.watch(), but recursively watches all subdirectories
|
||||||
function watch_dirs(dir, on_change) {
|
function watch_dirs(dir, on_change) {
|
||||||
const callback = (ev, dir, fname) => {
|
const callback = (ev, dir, fname) => {
|
||||||
|
|
@ -95,8 +88,6 @@ const context = await esbuild.context({
|
||||||
target: ['es2020'],
|
target: ['es2020'],
|
||||||
plugins: [
|
plugins: [
|
||||||
cleanPlugin(),
|
cleanPlugin(),
|
||||||
...args.no_stylelint ? [] : [stylelintPlugin({ filter: new RegExp(cwd + '\/src\/.*\.(css?|scss?)$') })],
|
|
||||||
...args.no_eslint ? [] : [eslintPlugin({ filter: new RegExp(cwd + '\/src\/.*\.(jsx?|js?)$') })],
|
|
||||||
// Esbuild will only copy assets that are explicitly imported and used
|
// Esbuild will only copy assets that are explicitly imported and used
|
||||||
// in the code. This is a problem for index.html and manifest.json which are not imported
|
// in the code. This is a problem for index.html and manifest.json which are not imported
|
||||||
copy({
|
copy({
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@
|
||||||
"jed": "1.1.1",
|
"jed": "1.1.1",
|
||||||
"qunit": "2.20.0",
|
"qunit": "2.20.0",
|
||||||
"sass": "1.70.0",
|
"sass": "1.70.0",
|
||||||
"stylelint": "15.11.0",
|
"stylelint": "16.2.1",
|
||||||
"stylelint-config-standard": "34.0.0",
|
"stylelint-config-standard": "36.0.0",
|
||||||
"stylelint-config-standard-scss": "11.1.0",
|
"stylelint-config-standard-scss": "13.0.0",
|
||||||
"stylelint-formatter-pretty": "3.2.1"
|
"stylelint-formatter-pretty": "4.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@patternfly/patternfly": "5.2.0",
|
"@patternfly/patternfly": "5.2.0",
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ rm -rf dist
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%build
|
%build
|
||||||
LINT=0 NODE_ENV=production make
|
NODE_ENV=production make
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%make_install PREFIX=/usr
|
%make_install PREFIX=/usr
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export TEST_BROWSER=${TEST_BROWSER:-firefox}
|
||||||
|
|
||||||
TESTS="$(realpath $(dirname "$0"))"
|
TESTS="$(realpath $(dirname "$0"))"
|
||||||
export SOURCE="$(realpath $TESTS/../..)"
|
export SOURCE="$(realpath $TESTS/../..)"
|
||||||
export LOGS="$(pwd)/logs"
|
export LOGS="${TMT_TEST_DATA:-$(pwd)/logs}"
|
||||||
mkdir -p "$LOGS"
|
mkdir -p "$LOGS"
|
||||||
chmod a+w "$LOGS"
|
chmod a+w "$LOGS"
|
||||||
|
|
||||||
|
|
|
||||||
6
test/run
6
test/run
|
|
@ -8,9 +8,5 @@ TEST_SCENARIO="${TEST_SCENARIO:-}"
|
||||||
[ "${TEST_SCENARIO}" = "${TEST_SCENARIO##firefox}" ] || export TEST_BROWSER=firefox
|
[ "${TEST_SCENARIO}" = "${TEST_SCENARIO##firefox}" ] || export TEST_BROWSER=firefox
|
||||||
export RUN_TESTS_OPTIONS=--track-naughties
|
export RUN_TESTS_OPTIONS=--track-naughties
|
||||||
|
|
||||||
# linters are off by default for production builds, but we want to run them in CI
|
make codecheck
|
||||||
export LINT=1
|
|
||||||
|
|
||||||
make check
|
make check
|
||||||
|
|
||||||
ruff check test/check*
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue