diff --git a/.circleci/config.yml b/.circleci/config.yml index e0ee7ca74..1db280c45 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -31,10 +31,10 @@ jobs: command: cd api-docs && bash generate-api-docs.sh - run: name: Inject Flux stdlib frontmatter - command: node ./flux-build-scripts/inject-flux-stdlib-frontmatter.js + command: node ./flux-build-scripts/inject-flux-stdlib-frontmatter.cjs - run: name: Update Flux/InfluxDB versions - command: node ./flux-build-scripts/update-flux-versions.js + command: node ./flux-build-scripts/update-flux-versions.cjs - save_cache: key: install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }} paths: diff --git a/.gitignore b/.gitignore index a701b05a8..20fef5ab8 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,8 @@ node_modules !telegraf-build/scripts !telegraf-build/README.md /cypress/screenshots/* +/cypress/videos/* +test-results.xml /influxdb3cli-build-scripts/content .vscode/* .idea diff --git a/.husky/_/serve b/.husky/_/serve new file mode 100755 index 000000000..df25a7d09 --- /dev/null +++ b/.husky/_/serve @@ -0,0 +1,57 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook -h >/dev/null 2>&1 + then + lefthook "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "serve" "$@" diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..945c17819 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v23.10.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dad714a79..ecf5c9cd4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,8 +28,10 @@ For the linting and tests to run, you need to install Docker and Node.js dependencies. \_**Note:** -We strongly recommend running linting and tests, but you can skip them -(and avoid installing dependencies) +The git pre-commit and pre-push hooks are configured to run linting and tests automatically +when you commit or push changes. +We strongly recommend letting them run, but you can skip them +(and avoid installing related dependencies) by including the `--no-verify` flag with your commit--for example, enter the following command in your terminal: ```sh @@ -51,7 +53,7 @@ dev dependencies used in pre-commit hooks for linting, syntax-checking, and test Dev dependencies include: - [Lefthook](https://github.com/evilmartians/lefthook): configures and -manages pre-commit hooks for linting and testing Markdown content. +manages git pre-commit and pre-push hooks for linting and testing Markdown content. - [prettier](https://prettier.io/docs/en/): formats code, including Markdown, according to style rules for consistency - [Cypress]: e2e testing for UI elements and URLs in content @@ -93,9 +95,11 @@ Make your suggested changes being sure to follow the [style and formatting guide ## Lint and test your changes +`package.json` contains scripts for running tests and linting. + ### Automatic pre-commit checks -docs-v2 uses Lefthook to manage Git hooks, such as pre-commit hooks that lint Markdown and test code blocks. +docs-v2 uses Lefthook to manage Git hooks that run during pre-commit and pre-push. The hooks run the scripts defined in `package.json` to lint Markdown and test code blocks. When you try to commit changes (`git commit`), Git runs the commands configured in `lefthook.yml` which pass your **staged** files to Vale, Prettier, Cypress (for UI tests and link-checking), and Pytest (for testing Python and shell code in code blocks). diff --git a/api-docs/.config.yml b/api-docs/.config.yml index e337b7689..f075dddec 100644 --- a/api-docs/.config.yml +++ b/api-docs/.config.yml @@ -1,5 +1,5 @@ plugins: - - './../openapi/plugins/docs-plugin.js' + - './../openapi/plugins/docs-plugin.cjs' extends: - recommended - docs/all diff --git a/api-docs/influxdb/cloud/.config.yml b/api-docs/influxdb/cloud/.config.yml index e2c6e000f..25a391d42 100644 --- a/api-docs/influxdb/cloud/.config.yml +++ b/api-docs/influxdb/cloud/.config.yml @@ -1,5 +1,5 @@ plugins: - - '../../openapi/plugins/docs-plugin.js' + - '../../openapi/plugins/docs-plugin.cjs' extends: - recommended - docs/all diff --git a/api-docs/influxdb/v2/.config.yml b/api-docs/influxdb/v2/.config.yml index d17efcdfc..c99715a57 100644 --- a/api-docs/influxdb/v2/.config.yml +++ b/api-docs/influxdb/v2/.config.yml @@ -1,5 +1,5 @@ plugins: - - '../../openapi/plugins/docs-plugin.js' + - '../../openapi/plugins/docs-plugin.cjs' extends: - recommended - docs/all diff --git a/api-docs/influxdb/v2/v2/ref.yml b/api-docs/influxdb/v2/v2/ref.yml index c2f5e9308..547f37265 100644 --- a/api-docs/influxdb/v2/v2/ref.yml +++ b/api-docs/influxdb/v2/v2/ref.yml @@ -218,11 +218,11 @@ tags: |:-----------:|:------------------------ |:--------------------- | | `200` | Success | | | `204` | Success. No content | InfluxDB doesn't return data for the request. | - | `400` | Bad request | May indicate one of the following: