Skip to content

Commit e9373b3

Browse files
authored
Merge pull request #755 from kuzzleio/beta
New Release 7.14.0
2 parents 9ee5862 + b5be1d6 commit e9373b3

File tree

445 files changed

+2832
-751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

445 files changed

+2832
-751
lines changed

.ci/doc/Dockerfile

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
FROM node:20-bookworm-slim
2+
3+
USER root
4+
5+
RUN mkdir -p /home/node/.cache/puppeteer
6+
7+
# Puppeteer Chrome headless dependencies
8+
RUN apt-get update && apt-get install -y \
9+
ca-certificates \
10+
curl \
11+
fonts-liberation \
12+
libasound2 \
13+
libatk-bridge2.0-0 \
14+
libatk1.0-0 \
15+
libc6 \
16+
libcairo2 \
17+
libcups2 \
18+
libdbus-1-3 \
19+
libexpat1 \
20+
libfontconfig1 \
21+
libgbm1 \
22+
libgcc1 \
23+
libglib2.0-0 \
24+
libgtk-3-0 \
25+
libnspr4 \
26+
libnss3 \
27+
libpango-1.0-0 \
28+
libpangocairo-1.0-0 \
29+
libstdc++6 \
30+
libx11-6 \
31+
libx11-xcb1 \
32+
libxcb1 \
33+
libxcomposite1 \
34+
libxcursor1 \
35+
libxdamage1 \
36+
libxext6 \
37+
libxfixes3 \
38+
libxi6 \
39+
libxrandr2 \
40+
libxrender1 \
41+
libxss1 \
42+
libxtst6 \
43+
lsb-release \
44+
wget \
45+
xdg-utils \
46+
&& rm -rf /var/lib/apt/lists/*
47+
48+
# Install all dependencies needed for both services
49+
RUN npm install -g \
50+
puppeteer \
51+
52+
eslint-plugin-html \
53+
eslint-plugin-import \
54+
eslint-plugin-node \
55+
eslint-plugin-promise \
56+
eslint-plugin-standard \
57+
babel-loader \
58+
@babel/core \
59+
html-webpack-plugin \
60+
webpack \
61+
webpack-cli
62+
63+
RUN usermod -a -G video,audio node
64+
65+
# Create working directories for snippets
66+
RUN mkdir -p /var/snippets/web && \
67+
mkdir -p /var/snippets/webpack
68+
69+
# Set proper permissions
70+
RUN chown -R node:node /var/snippets/
71+
RUN chown -R node:node /home/node/.cache/puppeteer
72+
73+
USER node
74+
75+
# Keep container running
76+
CMD ["tail", "-f", "/dev/null"]

.ci/doc/config.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ runners:
1212
path: /var/snippets/node
1313
lint:
1414
global: true
15-
cmd: eslint -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
15+
cmd: npx eslint@8.38.0 -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
1616
before: timeout 600 ash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
1717
run:
1818
cmd: node {{ snippet.source }}
@@ -23,22 +23,22 @@ runners:
2323
path: /var/snippets/web
2424
lint:
2525
global: true
26-
cmd: eslint -c /mnt/.ci/doc/eslint.json --parser-options ecmaVersion:12 {{ snippet.dir }}/*.html
27-
before: timeout 600 bash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
26+
cmd: npx eslint@8.38.0 -c /mnt/.ci/doc/eslint.json --parser-options ecmaVersion:12 {{ snippet.dir }}/*.html
27+
before: timeout 600 bash -c 'until stat /home/node/runner_ready_to_lint; do sleep 1; done'
2828
run:
2929
cmd: node puppeteer.js {{ snippet.dir }}/{{ snippet.source }}
30-
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'
30+
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'
3131

3232
webpack:
3333
service: doc-runner-webpack
3434
path: /var/snippets/webpack
3535
lint:
3636
global: true
37-
cmd: eslint -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
38-
before: timeout 600 bash -c 'until stat /tmp/runner_ready_to_lint; do sleep 1; done'
37+
cmd: npx eslint8.38.0 -c /mnt/.ci/doc/eslint.json {{ snippet.dir }}
38+
before: timeout 600 bash -c 'until stat /home/node/runner_ready_to_lint; do sleep 1; done'
3939
build:
4040
cmd: node webpackBuild.js {{ snippet.dir }}/{{ snippet.source }}
41-
before: timeout 600 bash -c 'until stat /tmp/runner_is_ready; do sleep 1; done'
41+
before: timeout 600 bash -c 'until stat /home/node/runner_is_ready; do sleep 1; done'
4242
run:
4343
cmd: node puppeteer.js /tmp/{{ snippet.name }}/index.html
4444
before: timeout 600 bash -c 'until curl -f -s -o /dev/null http://kuzzle:7512/_now; do sleep 1; done'

.ci/doc/docker-compose.yml

+22-51
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
kuzzle:
53
image: kuzzleio/kuzzle:2
@@ -44,17 +42,16 @@ services:
4442
- CONFIG_FILE=/mnt/.ci/doc/config.yml
4543

4644
doc-runner-node:
47-
image: node:18-alpine
45+
image: node:20-alpine
4846
command: >
4947
ash -c '
5048
mkdir -p /var/snippets/node;
5149
apk add --no-cache curl;
52-
npm install -g [email protected];
5350
cd /var/snippets/node;
5451
npm install \
5552
bluebird \
5653
/mnt/ \
57-
eslint \
54+
eslint@8.38.0 \
5855
eslint-plugin-html \
5956
eslint-plugin-import \
6057
eslint-plugin-node \
@@ -69,66 +66,40 @@ services:
6966
- snippets:/var/snippets
7067

7168
doc-runner-web:
72-
image: buildkite/puppeteer:latest
69+
build: .
70+
volumes:
71+
- ../..:/mnt
72+
- snippets:/var/snippets
73+
working_dir: /var/snippets/web
7374
command: >
7475
bash -c '
75-
mkdir -p /var/snippets/web;
76-
apt-get update;
77-
apt-get install -y curl;
78-
npm install -g \
79-
80-
cd /mnt;
81-
npm install;
82-
cd /var/snippets/web;
8376
cp /mnt/.ci/doc/puppeteer.js /var/snippets/web/;
84-
npm install \
85-
/mnt/ \
86-
eslint \
87-
eslint-plugin-html \
88-
eslint-plugin-import \
89-
eslint-plugin-node \
90-
eslint-plugin-promise \
91-
eslint-plugin-standard;
92-
touch /tmp/runner_ready_to_lint;
93-
touch /tmp/runner_is_ready;
77+
npm install /mnt/;
78+
cp -fr /usr/local/lib/node_modules/* /var/snippets/web/node_modules;
79+
cp -fr /usr/local/lib/node_modules/* /var/snippets/webpack/node_modules;
80+
touch /home/node/runner_ready_to_lint;
81+
touch /home/node/runner_is_ready;
9482
tail -f /dev/null
9583
'
84+
85+
doc-runner-webpack:
86+
build: .
9687
volumes:
9788
- ../..:/mnt
9889
- snippets:/var/snippets
99-
100-
doc-runner-webpack:
101-
image: buildkite/puppeteer:latest
90+
working_dir: /var/snippets/webpack
10291
command: >
10392
bash -c '
104-
mkdir -p /var/snippets/webpack;
105-
apt-get update;
106-
apt-get install -y curl;
107-
npm install -g \
108-
109-
cd /var/snippets/webpack;
11093
cp /mnt/.ci/doc/puppeteer.js /var/snippets/webpack/;
11194
cp /mnt/.ci/doc/webpackBuild.js /var/snippets/webpack/;
112-
npm install \
113-
/mnt/ \
114-
babel-loader \
115-
@babel/core \
116-
html-webpack-plugin \
117-
webpack \
118-
webpack-cli \
119-
eslint \
120-
eslint-plugin-html \
121-
eslint-plugin-import \
122-
eslint-plugin-node \
123-
eslint-plugin-promise \
124-
eslint-plugin-standard;
125-
touch /tmp/runner_ready_to_lint;
126-
touch /tmp/runner_is_ready;
95+
npm install /mnt/;
96+
cp -fr /usr/local/lib/node_modules/* /var/snippets/web/node_modules;
97+
cp -fr /usr/local/lib/node_modules/* /var/snippets/webpack/node_modules;
98+
touch /home/node/runner_ready_to_lint;
99+
touch /home/node/runner_is_ready;
127100
tail -f /dev/null
128101
'
129-
volumes:
130-
- ../..:/mnt
131-
- snippets:/var/snippets
102+
132103
133104
volumes:
134105
snippets:

.ci/doc/package.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "docs",
3+
"version": "1.0.0",
4+
"description": "docs for kuzzle-sdk",
5+
"author": "The Kuzzle Team <[email protected]>",
6+
"main": "index.js",
7+
"scripts": {},
8+
"dependencies": {},
9+
"devDependencies": {}
10+
}

.ci/doc/puppeteer.js

+36-14
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,60 @@
1-
const puppeteer = require('puppeteer');
1+
const puppeteer = require("puppeteer");
22
const renderedSnippetPath = process.argv[2];
33

4-
const runInBrowser = async snippetPath => {
4+
const runInBrowser = async (snippetPath) => {
55
let browser;
6-
76
try {
7+
// Install Chrome browser first
8+
const { execSync } = require('child_process');
9+
execSync('npx puppeteer browsers install chrome', { stdio: 'inherit' });
10+
811
browser = await puppeteer.launch({
912
dumpio: true,
10-
args: ['--no-sandbox']
13+
headless: "new",
14+
// Remove executablePath to use the bundled Chromium
15+
args: [
16+
"--no-sandbox",
17+
"--disable-setuid-sandbox",
18+
"--disable-gpu",
19+
"--disable-dev-shm-usage",
20+
],
1121
});
1222
} catch (error) {
13-
console.error(error);
14-
return;
23+
console.error('Browser launch error:', error);
24+
process.exit(1);
1525
}
1626

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

20-
page.on('error', err => {
21-
console.error(err);
30+
page.on("error", (err) => {
31+
console.error('Page error:', err);
2232
});
2333

24-
page.on('pageerror', err => {
25-
console.error(err);
34+
page.on("pageerror", (err) => {
35+
console.error('Page error:', err);
36+
});
37+
38+
page.on('console', msg => {
39+
console.log('Page console:', msg.text());
2640
});
2741

2842
await page.goto(`file:${snippetPath}`, {
29-
waitUntil: 'networkidle0'
43+
waitUntil: "networkidle0",
44+
timeout: 30000,
3045
});
3146
} catch (error) {
32-
console.error(error);
47+
console.error('Page processing error:', error);
3348
} finally {
34-
await browser.close();
49+
if (browser) {
50+
await browser.close();
51+
}
3552
}
3653
};
3754

38-
runInBrowser(renderedSnippetPath);
55+
if (!renderedSnippetPath) {
56+
console.error('Please provide a path to the snippet file');
57+
process.exit(1);
58+
}
59+
60+
runInBrowser(renderedSnippetPath);

.ci/docker-compose.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3'
2-
31
services:
42
kuzzle:
53
image: kuzzleio/kuzzle:2

.ci/test-docs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -ex
55
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
66
cd "$here"
77

8+
docker compose -f ./doc/docker-compose.yml build
89
docker compose -f ./doc/docker-compose.yml pull
910
docker compose -f ./doc/docker-compose.yml run doc-tests node index
1011
EXIT=$?

.github/actions/es-lint/action.yml

-11
This file was deleted.

0 commit comments

Comments
 (0)