Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.gradle
bin
.idea
.parcel-cache
.includepath
.ignorepath
.settings
Expand Down
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
# and takes longer to build but that is worth it.
FROM bitnami/minideb:buster AS base

RUN echo "deb http://archive.debian.org/debian/ buster main" > /etc/apt/sources.list && \
echo "deb http://archive.debian.org/debian-security/ buster/updates main" >> /etc/apt/sources.list
RUN install_packages apt-transport-https gnupg2 ca-certificates

RUN echo "deb https://archive.debian.org/debian/ buster main" > /etc/apt/sources.list && \
echo "deb https://archive.debian.org/debian-security/ buster/updates main" >> /etc/apt/sources.list

# TODO install_packages calls apt-get update and then nukes the list files after. We should avoid multiple calls to apt-get update.....
# We could probably fix this by running the update and installs ourself with `RUN --mount type=cache` but that is "experimental"

RUN install_packages apt-transport-https gnupg2 ca-certificates
COPY .docker/apt/keys/nodesource.gpg /
RUN apt-key add /nodesource.gpg
COPY .docker/apt/sources.list.d/nodesource.list /etc/apt/sources.list.d/
RUN install_packages \
build-essential python2 \
# needed for compiling native modules on ARM
nodejs ruby \
curl ruby \
# Used both to install dependencies and at run time
bash less \
# Just in case you have to shell into the image
Expand All @@ -36,6 +37,8 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN curl -sL https://deb.nodesource.com/setup_22.x | bash -
RUN install_packages nodejs

FROM base AS ruby_deps
RUN install_packages \
Expand Down
46 changes: 45 additions & 1 deletion air_gapped/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
FROM docker.elastic.co/docs/preview:latest
FROM docker.elastic.co/docs/preview:latest AS build

COPY air_gapped/work/target_repo.git /docs_build/.repos/target_repo.git

FROM chainguard/wolfi-base:latest
#FROM perl:5.42-bookworm
RUN apk update
RUN apk add perl
RUN apk add curl
RUN apk add perl-app-cpanminus

RUN apk add gcc make git patch perl-dev wget
RUN apk add openssl-dev
RUN apk add zlib-dev
RUN apk add perl-net-ssleay

ENV PERL5LIB=/usr/local/lib/perl5
ENV PATH=/usr/local/bin:$PATH

WORKDIR /
RUN cpanm -n XML::LibXML
RUN cpanm -n File::Copy::Recursive
RUN cpanm -n Path::Class
RUN cpanm -n Parallel::ForkManager
RUN cpanm -n YAML
#RUN apt update -y
#RUN apt-get install -y perl
#RUN apt-get install -y nginx
#RUN apt-get install -y nodejs
#RUN apt-get install -y git

#RUN apt-get install -y libxml-simple-perl
#RUN apt-get install -y libfile-copy-recursive-perl
#RUN apt-get install -y libpath-class-perl
#RUN apt-get install -y libcapture-tiny-perl
#RUN apt-get install -y libparallel-forkmanager-perl
#RUN apt-get install -y libyaml-perl

RUN apk add nginx
RUN apk add nodejs

COPY --from=build /docs_build /docs_build
COPY --from=build /node_modules /node_modules

RUN adduser -D nginx
RUN mkdir -p /var/lib/nginx/tmp/

CMD ["/docs_build/build_docs.pl", "--in_standard_docker", "--gapped", "--preview"]

2 changes: 2 additions & 0 deletions air_gapped/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ cd $(git rev-parse --show-toplevel)
source ./air_gapped/build.sh
id=$(docker run --rm \
--publish 8000:8000/tcp \
--tmpfs /run/nginx \
--tmpfs /root \
-d \
$AIR_GAPPED)
echo "Started the air gapped docs. Some useful commands:"
Expand Down
10 changes: 5 additions & 5 deletions lib/ES/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -691,10 +691,10 @@ sub start_web_resources_watcher {

close STDIN;
open( STDIN, "</dev/null" );
exec( qw(/node_modules/parcel/bin/cli.js serve
exec( qw(npx parcel serve
--public-url /guide/static/
--hmr-port 8001
-d /tmp/parcel/
--dist-dir /tmp/parcel/
resources/web/docs_js/index-v1.js resources/web/styles-v1.pcss) );
}

Expand Down Expand Up @@ -731,10 +731,10 @@ sub build_web_resources {
# when you run the integration tests and saves about 1.5 seconds on
# every docs build.
say "Compiling web resources";
run '/node_modules/parcel/bin/cli.js', 'build',
run 'npx', 'parcel', 'build',
'--public-url', '/guide/static/',
'--experimental-scope-hoisting', '--no-source-maps',
'-d', $parcel_out,
'--no-source-maps',
'--dist-dir', $parcel_out,
'resources/web/docs_js/index-v1.js', 'resources/web/styles-v1.pcss';
die "Parcel didn't make $compiled_js" unless -e $compiled_js;
die "Parcel didn't make $compiled_css" unless -e $compiled_css;
Expand Down
21 changes: 16 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"license": "SEE LICENSE IN README.asciidoc",
"devDependencies": {
"jest": "^24.8.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^30.0.5",
"nock": "^10.0.6",
"rmfr": "^2.0.0"
},
Expand All @@ -11,16 +12,17 @@
"jest": {
"setupFiles": [
"./jest.js"
]
],
"testEnvironment": "jsdom"
},
"dependencies": {
"dedent": "^0.7.0",
"details-polyfill": "^1.1.0",
"jquery": "^1.11.3",
"jquery": "^3.5.0",
"js-cookie": "^2.1.0",
"linkstate": "^1.1.1",
"parcel": "^1.12.3",
"postcss-assets": "^5.0.0",
"parcel": "^2.15.4",
"postcss-assets": "^6.0.0",
"preact": "^8.4.2",
"preact-context": "^1.1.3",
"preact-redux": "^2.1.0",
Expand All @@ -31,5 +33,14 @@
"redux-thunk": "^2.3.0",
"url-search-params-polyfill": "^8.0.0",
"yargs": "^14.0.0"
},
"resolutions": {
"postcss": "^8.5.6"
},
"overrides": {
"postcss": "^8.5.6"
},
"engines": {
"node": ">= 22"
}
}
2 changes: 2 additions & 0 deletions preview/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ const toStringHandler = (resolve, reject, onMissing) => (err, stdout) => {
if (err) {
if (err.message.includes("Not a valid object name")) {
onMissing("missing");
} else if (err.message.includes("does not exist in")) {
onMissing("missing");
} else {
reject(err);
}
Expand Down
2 changes: 1 addition & 1 deletion resources/web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jest: tests
.PHONY: tests
tests:
rm -rf tests
$(DOCKER) node_test /node_modules/parcel/bin/cli.js build ./docs_js/__tests__/**/* ./docs_js/__tests__/* -d ./tests/ --target node --no-minify --no-source-maps
$(DOCKER) node_test npx parcel build ./docs_js/__tests__/**/*.j{s,sx} ./docs_js/__tests__/*.j{s,sx} --dist-dir ./tests/ --no-optimize --no-source-maps
2 changes: 1 addition & 1 deletion resources/web/docs_js/__tests__/actions/settings.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Cookies from "../../../../../../node_modules/js-cookie";
import Cookies from "../../../../../node_modules/js-cookie";
import * as actions from "../../actions/settings";
import store from "../../store";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {h, render} from "../../../../../../node_modules/preact";
import {h, render} from "preact";
import {_AlternativePicker} from "../../components/alternative_picker";

describe(_AlternativePicker, () => {
Expand Down
5 changes: 3 additions & 2 deletions resources/web/docs_js/__tests__/components/mount.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {h} from "../../../../../../node_modules/preact";
import {connect} from "../../../../../../node_modules/preact-redux";
import {h} from "preact";
import {connect} from "preact-redux";
import {newStore} from "../../store";
import {mount} from "../../components/mount";
import {describe} from "yargs";

const Component = connect(state => ({
msg: state.settings.msg
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/__tests__/docs.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {jQuery} from "../deps";
import dedent from "../../../../../node_modules/dedent";
import dedent from "../../../../node_modules/dedent";
import {init_console_widgets, init_headers} from "../index-v1";
import * as utils from "../utils";
import * as l from "../localization";
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/__tests__/localization.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as l from "../localization";
import * as R from "../../../../../node_modules/ramda";
import * as R from "../../../../node_modules/ramda";

describe("Localization of strings", () => {
const specs = R.toPairs(l.lang_spec);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PR from "../../../lib/prettify/prettify";
import "../../prettify/lang-asciidoc";
import dedent from "../../../../../../node_modules/dedent";
import dedent from "../../../../../node_modules/dedent";

const prettyAsciidoc = str => PR.prettyPrintOne(str, "asciidoc");
const tag = str => `<span class="tag">${str}</span>`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PR from "../../../lib/prettify/prettify";
import "../../prettify/lang-console";
import dedent from "../../../../../../node_modules/dedent";
import dedent from "../../../../../node_modules/dedent";

const prettyConsole = str => PR.prettyPrintOne(str, "console");
const prettyJs = str => PR.prettyPrintOne(str, "js");
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {combineReducers} from "../../../../../node_modules/redux";
import {combineReducers} from "redux";
import {reducer as settingsReducer} from "./settings";
import {reducer as modalReducer} from "./modal";

Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/actions/modal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {dissoc} from "../../../../../node_modules/ramda";
import {dissoc} from "../../../../node_modules/ramda";

const initialState = {isOpen: false, Component: null, props: null};

Expand Down
4 changes: 2 additions & 2 deletions resources/web/docs_js/actions/settings.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Cookies from "../../../../../node_modules/js-cookie";
import {omit, merge, toPairs, forEach} from "../../../../../node_modules/ramda";
import Cookies from "../../../../node_modules/js-cookie";
import {omit, merge, toPairs, forEach} from "../../../../node_modules/ramda";
import {closeModal} from "./modal";

const SAVE_SETTING = "SAVE_SETTING";
Expand Down
6 changes: 3 additions & 3 deletions resources/web/docs_js/components/alternative_picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* instead of "Console".
*/

import {h, Component} from "../../../../../../node_modules/preact";
import {pick, merge} from "../../../../../node_modules/ramda";
import {connect} from "../../../../../node_modules/preact-redux";
import {h, Component} from "preact";
import {pick, merge} from "../../../../node_modules/ramda";
import {connect} from "preact-redux";
import {saveSettings} from "../actions/settings";

const alternativePrettyName = rawName => {
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/components/alternative_switcher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {curry} from "../../../../../node_modules/ramda";
import {curry} from "../../../../node_modules/ramda";

/*
* Widget to switch the displayed alternative langauge when the configured
Expand Down
8 changes: 4 additions & 4 deletions resources/web/docs_js/components/console_widget.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as utils from "../utils";
import {prop, pick, merge, omit} from "../../../../../node_modules/ramda";
import {h, Component} from "../../../../../node_modules/preact";
import linkState from "../../../../../node_modules/linkstate";
import {connect} from "../../../../../node_modules/preact-redux";
import {prop, pick, merge, omit} from "../../../../node_modules/ramda";
import {h, Component} from "preact";
import linkState from "../../../../node_modules/linkstate";
import {connect} from "preact-redux";
import {openModal} from "../actions/modal";
import {saveSettings} from "../actions/settings";
import AlternativePicker from "./alternative_picker";
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/components/feedback_modal.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, Component } from '../../../../../../node_modules/preact';
import { h, Component } from 'preact';

const FEEDBACK_URL = 'https://docs.elastic.co/api/feedback'
const MAX_COMMENT_LENGTH = 1000;
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/components/feedback_widget.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { h, Component } from '../../../../../../node_modules/preact';
import { h, Component } from 'preact';

export default class FeedbackWidget extends Component {
render() {
Expand Down
4 changes: 2 additions & 2 deletions resources/web/docs_js/components/modal.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {h} from "../../../../../node_modules/preact";
import {connect} from "../../../../../node_modules/preact-redux";
import {h} from "preact";
import {connect} from "preact-redux";
import {closeModal} from "../actions/modal";

export const Modal = ({Component, props, isOpen, closeModal}) => {
Expand Down
4 changes: 2 additions & 2 deletions resources/web/docs_js/components/mount.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provider } from '../../../../../node_modules/preact-redux';
import { h, render } from '../../../../../node_modules/preact';
import { Provider } from 'preact-redux';
import { h, render } from 'preact';
import store from "../store";

export const mount = ({el, Component, props = {}, store}) =>
Expand Down
2 changes: 1 addition & 1 deletion resources/web/docs_js/deps.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import _Cookies from "../../../../node_modules/js-cookie";
import _Cookies from "../../../node_modules/js-cookie";

export const jQuery = window.jQuery;
export const $ = window.jQuery;
Expand Down
4 changes: 2 additions & 2 deletions resources/web/docs_js/index-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import "../lib/prettify/lang-sql.js";
import "../lib/prettify/lang-yaml.js";

// Add support for <details> in IE and the like
import "../../../../../node_modules/details-polyfill";
import "../../../node_modules/details-polyfill";

// Add support for URLSearchParams Web API in IE
import "../../../../../node_modules/url-search-params-polyfill";
import "../../../node_modules/url-search-params-polyfill";

export function init_landing_page() {
// Because of the nature of the injected links, we need to adjust the layout to
Expand Down
4 changes: 2 additions & 2 deletions resources/web/docs_js/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import thunk from '../../../../node_modules/redux-thunk';
import { createStore, applyMiddleware } from '../../../../node_modules/redux';
import thunk from '../../../node_modules/redux-thunk';
import { createStore, applyMiddleware } from 'redux';
import reducer from "./actions";

export const newStore = initialState =>
Expand Down
Loading