Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fbb6d69
Update Notification interface to match correct API
ScreamZ Jan 19, 2024
b845ef4
chore: use an other Docker image to run web and webpack snippets
alexandrebouthinon Oct 9, 2024
ad000ba
chore: upgrade the doc snippet node.js runner Docker image
alexandrebouthinon Oct 9, 2024
088bee6
ci: add Node.js 20 job in testing matrix
alexandrebouthinon Oct 9, 2024
96306fa
fix: use root user in the new puppeteer images
alexandrebouthinon Oct 9, 2024
f1e27d2
fix: ignore external library linting
alexandrebouthinon Oct 9, 2024
fb9f599
revert: revert skipLibCheck and use a fixed eslint version instead
alexandrebouthinon Oct 9, 2024
11d9d65
chore: try something with global install on eslint plugins
alexandrebouthinon Oct 9, 2024
b44ff92
chore: install the eslint plugins in the right directory
alexandrebouthinon Oct 9, 2024
afcf3ac
fix: ws vulnerability
afondard Oct 10, 2024
99ec86a
Merge pull request #751 from kuzzleio/KZLPRD-624-SDK-JavaScript-Fix-w…
afondard Oct 11, 2024
883052a
docs: Add triggerEvents flag to all api actions and reduces missing o…
Juiced66 Sep 17, 2024
adaf4e9
fix: eslint
thomas-mauran Oct 15, 2024
5272635
Merge pull request #739 from ScreamZ/improve-typings
rolljee Oct 16, 2024
0aa4222
feat: add options parameter to controller functions containing a query
cyrng Oct 16, 2024
4acefe8
style: format document to pass linter
cyrng Oct 16, 2024
d193eda
fix: change options in the right object
cyrng Oct 16, 2024
83d7ba9
ci(ci): update version inside tests files
rolljee Oct 31, 2024
3cddc8f
ci(ci): fix workflow typo
rolljee Oct 31, 2024
6adf747
ci: fix typo in workflow
rolljee Oct 31, 2024
e13c84e
ci: remove es-lint action to keep it inside workflow file
rolljee Oct 31, 2024
6a22528
ci: fix typo in ci
rolljee Oct 31, 2024
e4298bb
ci: fix ci
rolljee Oct 31, 2024
149a15a
ci: wip fixing snippet-tests
rolljee Oct 31, 2024
a923912
ci: remove not wanted file
rolljee Oct 31, 2024
ad8e533
fix(ci): Update ci to work with last version of puppeteer
rolljee Nov 4, 2024
102b224
fix(ci): Update ci to work with last version of puppeteer
rolljee Nov 4, 2024
ff6b29f
fix(ci): Update ci to work with last version of puppeteer
rolljee Nov 4, 2024
c413283
fix(ci): Update ci to work with last version of puppeteer
rolljee Nov 4, 2024
f4962e4
fix(ci): Update ci to work with last version of puppeteer
rolljee Nov 4, 2024
bb01572
Merge pull request #750 from kuzzleio/fix/KZLPRD-570-fix-web-snippet-…
rolljee Nov 5, 2024
e7b34aa
Merge branch '7-dev' into docs/add-options-doc-to-controllers
rolljee Nov 5, 2024
a13d054
Merge branch '7-dev' into KZLPRD-618-certaines-fonctions-nont-pas-enc…
rolljee Nov 5, 2024
d0ab528
Merge pull request #752 from kuzzleio/docs/add-options-doc-to-control…
rolljee Nov 5, 2024
9ec0c51
Merge branch 'beta' into 7-dev
rolljee Nov 5, 2024
0cd9d77
Merge branch '7-dev' of https://github.com/kuzzleio/sdk-javascript in…
rolljee Nov 5, 2024
35791f2
Merge pull request #753 from kuzzleio/KZLPRD-618-certaines-fonctions-…
rolljee Nov 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
76 changes: 76 additions & 0 deletions .ci/doc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
FROM node:20-bookworm-slim

USER root

RUN mkdir -p /home/node/.cache/puppeteer

# Puppeteer Chrome headless dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
fonts-liberation \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*

# Install all dependencies needed for both services
RUN npm install -g \
puppeteer \
eslint@8.38.0 \
eslint-plugin-html \
eslint-plugin-import \
eslint-plugin-node \
eslint-plugin-promise \
eslint-plugin-standard \
babel-loader \
@babel/core \
html-webpack-plugin \
webpack \
webpack-cli

RUN usermod -a -G video,audio node

# Create working directories for snippets
RUN mkdir -p /var/snippets/web && \
mkdir -p /var/snippets/webpack

# Set proper permissions
RUN chown -R node:node /var/snippets/
RUN chown -R node:node /home/node/.cache/puppeteer

USER node

# Keep container running
CMD ["tail", "-f", "/dev/null"]
14 changes: 7 additions & 7 deletions .ci/doc/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runners:
path: /var/snippets/node
lint:
global: true
cmd: eslint -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
cmd: npx eslint@8.38.0 -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
before: timeout 600 ash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
run:
cmd: node {{ snippet.source }}
Expand All @@ -23,22 +23,22 @@ runners:
path: /var/snippets/web
lint:
global: true
cmd: eslint -c /mnt/.ci/doc/eslint.json --parser-options ecmaVersion:12 {{ snippet.dir }}/*.html
before: timeout 600 bash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
cmd: npx eslint@8.38.0 -c /mnt/.ci/doc/eslint.json --parser-options ecmaVersion:12 {{ snippet.dir }}/*.html
before: timeout 600 bash -c 'until stat /home/node/runner_ready_to_lint; do sleep 1; done'
run:
cmd: node puppeteer.js {{ snippet.dir }}/{{ snippet.source }}
before: timeout 600 bash -c 'until stat /tmp/runner_is_ready && curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done'
before: timeout 600 bash -c 'until stat /home/node/runner_is_ready && curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done'

webpack:
service: doc-runner-webpack
path: /var/snippets/webpack
lint:
global: true
cmd: eslint -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
before: timeout 600 bash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
cmd: npx eslint8.38.0 -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
before: timeout 600 bash -c 'until stat /home/node/runner_ready_to_lint; do sleep 1; done'
build:
cmd: node webpackBuild.js {{ snippet.dir }}/{{ snippet.source }}
before: timeout 600 bash -c 'until stat /tmp/runner_is_ready; do sleep 1; done'
before: timeout 600 bash -c 'until stat /home/node/runner_is_ready; do sleep 1; done'
run:
cmd: node puppeteer.js /tmp/{{ snippet.name }}/index.html
before: timeout 600 bash -c 'until curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done'
73 changes: 22 additions & 51 deletions .ci/doc/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
kuzzle:
image: kuzzleio/kuzzle:2
Expand Down Expand Up @@ -44,17 +42,16 @@ services:
- CONFIG_FILE=/mnt/.ci/doc/config.yml

doc-runner-node:
image: node:18-alpine
image: node:20-alpine
command: >
ash -c '
mkdir -p /var/snippets/node;
apk add --no-cache curl;
npm install -g eslint@6.8.0;
cd /var/snippets/node;
npm install \
bluebird \
/mnt/ \
eslint \
eslint@8.38.0 \
eslint-plugin-html \
eslint-plugin-import \
eslint-plugin-node \
Expand All @@ -69,66 +66,40 @@ services:
- snippets:/var/snippets

doc-runner-web:
image: buildkite/puppeteer:latest
build: .
volumes:
- ../..:/mnt
- snippets:/var/snippets
working_dir: /var/snippets/web
command: >
bash -c '
mkdir -p /var/snippets/web;
apt-get update;
apt-get install -y curl;
npm install -g \
eslint@6.8.0;
cd /mnt;
npm install;
cd /var/snippets/web;
cp /mnt/.ci/doc/puppeteer.js /var/snippets/web/;
npm install \
/mnt/ \
eslint \
eslint-plugin-html \
eslint-plugin-import \
eslint-plugin-node \
eslint-plugin-promise \
eslint-plugin-standard;
touch /tmp/runner_ready_to_lint;
touch /tmp/runner_is_ready;
npm install /mnt/;
cp -fr /usr/local/lib/node_modules/* /var/snippets/web/node_modules;
cp -fr /usr/local/lib/node_modules/* /var/snippets/webpack/node_modules;
touch /home/node/runner_ready_to_lint;
touch /home/node/runner_is_ready;
tail -f /dev/null
'

doc-runner-webpack:
build: .
volumes:
- ../..:/mnt
- snippets:/var/snippets

doc-runner-webpack:
image: buildkite/puppeteer:latest
working_dir: /var/snippets/webpack
command: >
bash -c '
mkdir -p /var/snippets/webpack;
apt-get update;
apt-get install -y curl;
npm install -g \
eslint@6.8.0;
cd /var/snippets/webpack;
cp /mnt/.ci/doc/puppeteer.js /var/snippets/webpack/;
cp /mnt/.ci/doc/webpackBuild.js /var/snippets/webpack/;
npm install \
/mnt/ \
babel-loader \
@babel/core \
html-webpack-plugin \
webpack \
webpack-cli \
eslint \
eslint-plugin-html \
eslint-plugin-import \
eslint-plugin-node \
eslint-plugin-promise \
eslint-plugin-standard;
touch /tmp/runner_ready_to_lint;
touch /tmp/runner_is_ready;
npm install /mnt/;
cp -fr /usr/local/lib/node_modules/* /var/snippets/web/node_modules;
cp -fr /usr/local/lib/node_modules/* /var/snippets/webpack/node_modules;
touch /home/node/runner_ready_to_lint;
touch /home/node/runner_is_ready;
tail -f /dev/null
'
volumes:
- ../..:/mnt
- snippets:/var/snippets


volumes:
snippets:
10 changes: 10 additions & 0 deletions .ci/doc/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "docs",
"version": "1.0.0",
"description": "docs for kuzzle-sdk",
"author": "The Kuzzle Team <support@kuzzle.io>",
"main": "index.js",
"scripts": {},
"dependencies": {},
"devDependencies": {}
}
50 changes: 36 additions & 14 deletions .ci/doc/puppeteer.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,60 @@
const puppeteer = require('puppeteer');
const puppeteer = require("puppeteer");
const renderedSnippetPath = process.argv[2];

const runInBrowser = async snippetPath => {
const runInBrowser = async (snippetPath) => {
let browser;

try {
// Install Chrome browser first
const { execSync } = require('child_process');
execSync('npx puppeteer browsers install chrome', { stdio: 'inherit' });

browser = await puppeteer.launch({
dumpio: true,
args: ['--no-sandbox']
headless: "new",
// Remove executablePath to use the bundled Chromium
args: [
"--no-sandbox",
"--disable-setuid-sandbox",
"--disable-gpu",
"--disable-dev-shm-usage",
],
});
} catch (error) {
console.error(error);
return;
console.error('Browser launch error:', error);
process.exit(1);
}

try {
const page = await browser.newPage();

page.on('error', err => {
console.error(err);
page.on("error", (err) => {
console.error('Page error:', err);
});

page.on('pageerror', err => {
console.error(err);
page.on("pageerror", (err) => {
console.error('Page error:', err);
});

page.on('console', msg => {
console.log('Page console:', msg.text());
});

await page.goto(`file:${snippetPath}`, {
waitUntil: 'networkidle0'
waitUntil: "networkidle0",
timeout: 30000,
});
} catch (error) {
console.error(error);
console.error('Page processing error:', error);
} finally {
await browser.close();
if (browser) {
await browser.close();
}
}
};

runInBrowser(renderedSnippetPath);
if (!renderedSnippetPath) {
console.error('Please provide a path to the snippet file');
process.exit(1);
}

runInBrowser(renderedSnippetPath);
2 changes: 0 additions & 2 deletions .ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
kuzzle:
image: kuzzleio/kuzzle:2
Expand Down
1 change: 1 addition & 0 deletions .ci/test-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -ex
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$here"

docker compose -f ./doc/docker-compose.yml build
docker compose -f ./doc/docker-compose.yml pull
docker compose -f ./doc/docker-compose.yml run doc-tests node index
EXIT=$?
Expand Down
11 changes: 0 additions & 11 deletions .github/actions/es-lint/action.yml

This file was deleted.

Loading