Skip to content

Commit dedd1bb

Browse files
authored
Merge branch 'ByteInternet:master' into autosuggest-linter
2 parents 8cb6f71 + 99cb9e4 commit dedd1bb

File tree

94 files changed

+2165
-2679
lines changed

Some content is hidden

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

94 files changed

+2165
-2679
lines changed

.github/workflows/cleanup_acceptance.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
cleanup:
99
runs-on: ubuntu-latest
10-
container: quay.io/hypernode/deploy:3-php8.1-node18
10+
container: quay.io/hypernode/deploy:latest-php8.3-node20
1111
environment: acceptance
1212
steps:
1313
- uses: actions/checkout@v2

.github/workflows/deploy.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
jobs:
1313
build:
1414
runs-on: ubuntu-latest
15-
container: quay.io/hypernode/deploy:3-php8.1-node18
15+
container: quay.io/hypernode/deploy:latest-php8.3-node20
1616
steps:
1717
- uses: actions/checkout@v3
1818
with:
@@ -34,7 +34,7 @@ jobs:
3434
echo "DOCS_INDEX_FOLLOW=1" >> $GITHUB_ENV
3535
- run: hypernode-deploy build -vvv
3636
- name: archive production artifacts
37-
uses: actions/upload-artifact@v3
37+
uses: actions/upload-artifact@v4
3838
with:
3939
name: deployment-build
4040
path: build/build.tgz
@@ -47,13 +47,13 @@ jobs:
4747
name: acceptance
4848
url: ${{ steps.get_brancher_hostname.outputs.BRANCHER_URL }}
4949
if: github.ref != 'refs/heads/master'
50-
container: quay.io/hypernode/deploy:3-php8.1-node18
50+
container: quay.io/hypernode/deploy:latest-php8.3-node20
5151
steps:
5252
- uses: actions/checkout@v3
5353
with:
5454
fetch-depth: 0
5555
- name: download build artifact
56-
uses: actions/download-artifact@v3
56+
uses: actions/download-artifact@v4
5757
with:
5858
name: deployment-build
5959
path: build/
@@ -102,11 +102,11 @@ jobs:
102102
name: production
103103
url: https://docs.hypernode.io
104104
if: github.ref == 'refs/heads/master'
105-
container: quay.io/hypernode/deploy:3-php8.1-node18
105+
container: quay.io/hypernode/deploy:latest-php8.3-node20
106106
steps:
107107
- uses: actions/checkout@v3
108108
- name: download build artifact
109-
uses: actions/download-artifact@v3
109+
uses: actions/download-artifact@v4
110110
with:
111111
name: deployment-build
112112
path: build/

.github/workflows/detect_renamed_docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
echo "$result" >> $GITHUB_OUTPUT
2121
echo "EOF" >> $GITHUB_OUTPUT
2222
shell: bash
23-
- name: Comment hostname on PR
23+
- name: Comment changed files on PR
2424
if: ${{ steps.changed_files.outputs.CHANGED_FILES }}
2525
uses: thollander/actions-comment-pull-request@v1
2626
with:

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: ['3.7', '3.8', '3.9', '3.10']
11+
python-version: ['3.8', '3.9', '3.10', '3.11']
1212

1313
steps:
1414
- uses: actions/checkout@v3

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
## Generating new docs
44

5-
``` bash
5+
```bash
66
DOC_URL=https://support.hypernode.com/en/ecommerce/magento-1/how-to-enable-mysql-query-logging-for-magento-1-x
77
bin/download_doc --output-dir=docs/ecommerce-applications $DOC_URL
88
```
99

1010
## Setting up the project
1111

12-
``` bash
12+
```bash
1313
mkvirtualenv hypernode-docs-next
1414
echo "export PYTHONPATH=$(pwd)" >> $VIRTUAL_ENV/bin/postactivate
1515
workon hypernode-docs-next
@@ -19,35 +19,40 @@ pre-commit install
1919

2020
## Building the docs
2121

22-
``` bash
22+
```bash
2323
bin/build_docs
2424
```
2525

2626
## Serving the docs
2727

28-
``` bash
28+
```bash
2929
bin/serve_docs
3030
```
31+
3132
## Setup Frontend step by step
33+
3234
```
3335
clone the repository
3436
pip install -r requirements/development.txt
3537
bin/build_docs
3638
bin/serve_docs
3739
```
40+
3841
in another terminal run
39-
``` bin/watch ```
42+
`bin/watch`
4043

4144
open localhost and now you can make changes in style and refresh the page without rebuilding
4245

4346
when you're working on scss to compile it automatically run
47+
4448
```
45-
sass --watch docs/_static/scss:docs/_static/css
49+
npx sass --watch docs/_static/scss:docs/_static/css
4650
```
4751

48-
or after changes compile scss once:
52+
or as a production build:
53+
4954
```
50-
sass docs/_static/scss:docs/_static/css
55+
npx sass --style compressed --no-source-map docs/_static/scss:docs/_static/css
5156
```
5257

5358
## Deployment
@@ -57,6 +62,7 @@ Deploys automatically after merging branchers to master.
5762
### Deploy with Hypernode Deploy
5863

5964
To deploy to a local Hypernode Docker environment:
65+
6066
```
6167
$ docker pull docker.hypernode.com/byteinternet/hypernode-buster-docker:latest
6268
$ docker run docker.hypernode.com/byteinternet/hypernode-buster-docker:latest
@@ -66,6 +72,7 @@ $ # Note the IP address, it should be 172.17.0.2 (otherwise refer to deploy.php)
6672
Next make sure your `~/.ssh/yourdeploykey` equivalent can log in to the Docker host (172.17.0.2) as the app user. You can add it to the `/data/web/.ssh/authorized_keys` file on in the instance manually.
6773

6874
Then deploy to your local Hypernode Docker:
75+
6976
```
7077
docker run --rm -it --env SSH_PRIVATE_KEY="$(cat ~/.ssh/yourdeploykey | base64)" -v ${PWD}:/build quay.io/hypernode/deploy:latest hypernode-deploy build -vvv # First build the artifact
7178
docker run --rm -it --env SSH_PRIVATE_KEY="$(cat ~/.ssh/yourdeploykey | base64)" -v ${PWD}:/build quay.io/hypernode/deploy:latest hypernode-deploy deploy docker -vvv # Then perform the deploy
@@ -74,6 +81,7 @@ docker run --rm -it --env SSH_PRIVATE_KEY="$(cat ~/.ssh/yourdeploykey | base64)"
7481
## Building the manpage deb
7582

7683
The docs are also packaged as a debian package named `hndocsnext` so that on a Hypernode you can run `man hypernode` (or `hypernode-manual`) and page through a `manpage` version of the Hypernode docs. To build that debian package on a Debian machine you can run these commands:
84+
7785
```
7886
# First create the cow environment
7987
export ARCH=amd64
@@ -91,16 +99,19 @@ gbp buildpackage --git-pbuilder --git-dist=$DIST --git-arch=$ARCH --git-ignore-b
9199
```
92100

93101
Then after building the Deb you could install it with dpkg. For example:
102+
94103
```
95104
dpkg -i ../hndocsnext_20230121.173551_all.deb
96105
```
97106

98107
And test it out with:
108+
99109
```
100110
man hypernode
101111
```
102112

103113
To inspect the contents of the deb archive you can run:
114+
104115
```
105116
# dpkg -L hndocsnext
106117
/.

bin/watch

Lines changed: 45 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/usr/bin/env python3
2-
import datetime
2+
import os
33
import subprocess
4-
5-
from inotify.adapters import InotifyTree
4+
import time
5+
from pathlib import Path
6+
from time import sleep
67

78

89
def build_docs():
@@ -15,54 +16,57 @@ def refresh_assets():
1516
)
1617

1718

18-
def watch_for_changes(debug=False):
19-
i = InotifyTree("docs")
19+
def watch_for_changes():
20+
"""Watch for changes using watchdog."""
21+
from watchdog.events import FileSystemEvent, FileSystemEventHandler
22+
from watchdog.observers import Observer
23+
24+
class MyHandler(FileSystemEventHandler):
25+
def __init__(self):
26+
super().__init__()
27+
self.last_build = time.time()
2028

21-
IGNORED_EVENTS = ["IN_CLOSE_WRITE", "IN_CLOSE_NOWRITE", "IN_ACCESS", "IN_OPEN"]
22-
IGNORED_PATHS = ["docs/_build"]
29+
def on_modified(self, event: FileSystemEvent):
30+
cwd = os.getcwd()
31+
file_path = Path(event.src_path)
2332

24-
last_build = None
33+
IGNORED_PATHS = ["docs/_build"]
2534

26-
for event in i.event_gen(yield_nones=False):
27-
(_, type_names, path, filename) = event
35+
if event.is_directory:
36+
return
2837

29-
ignore = False
30-
for ignored_event_type in IGNORED_EVENTS:
31-
if ignored_event_type in type_names:
32-
ignore = True
33-
break
38+
if file_path.name.isdigit():
39+
return
3440

35-
for ignored_path in IGNORED_PATHS:
36-
if path.startswith(ignored_path):
37-
ignore = True
38-
break
41+
if (
42+
file_path.name.endswith(".swx")
43+
or file_path.name.endswith(".swp")
44+
or file_path.name.endswith("~")
45+
):
46+
return
3947

40-
if (
41-
filename.endswith(".swx")
42-
or filename.endswith(".swp")
43-
or filename.endswith("~")
44-
):
45-
ignore = True
48+
for ignored_path in IGNORED_PATHS:
49+
ignored_path = os.path.join(cwd, ignored_path)
50+
if str(file_path).startswith(ignored_path):
51+
return
4652

47-
if ignore:
48-
continue
53+
if self.last_build and time.time() - self.last_build < 0.5:
54+
return
4955

50-
if last_build:
51-
# If build has been triggered in the last 50 ms, skip
52-
delta = (datetime.datetime.now() - last_build).microseconds / 1000
53-
if delta < 50:
54-
continue
56+
build_docs()
57+
refresh_assets()
58+
self.last_build = time.time()
5559

56-
build_docs()
57-
refresh_assets()
58-
last_build = datetime.datetime.now()
60+
event_handler = MyHandler()
61+
observer = Observer()
62+
observer.schedule(event_handler, path="docs", recursive=True)
63+
observer.start()
5964

60-
if debug:
61-
print(
62-
"PATH=[{}] FILENAME=[{}] EVENT_TYPES={}".format(
63-
path, filename, type_names
64-
)
65-
)
65+
try:
66+
while True:
67+
sleep(1)
68+
except KeyboardInterrupt:
69+
observer.stop()
6670

6771

6872
if __name__ == "__main__":

deploy.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
run('ln -sf docs/_build/html pub');
4848
});
4949

50+
task('node:build:scss', static function() {
51+
run('npx sass --style compressed --no-source-map docs/_static/scss:docs/_static/css');
52+
});
53+
5054
# HMV configuration for when this is running in a docker
5155
task('deploy:hmv_docker', static function () use (&$DOCKER_HOST, &$DOCKER_WEBROOT) {
5256
if (test('[ -f /etc/hypernode/is_docker ]')) {
@@ -71,6 +75,7 @@
7175
});
7276

7377
$configuration = new Configuration();
78+
$configuration->addBuildTask('node:build:scss');
7479
$configuration->addBuildTask('python:venv:create');
7580
$configuration->addBuildTask('python:venv:requirements');
7681
$configuration->addBuildTask('python:build_documentation');

docs/_static/css/breakpoints.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/_static/css/colors.css

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)