mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add js linting to github workflow
This commit is contained in:
parent
f57a31c9b5
commit
d0ccf8647d
12
.github/workflows/javascript.yaml
vendored
12
.github/workflows/javascript.yaml
vendored
@ -18,11 +18,19 @@ jobs:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
INVENTREE_DB_ENGINE: sqlite3
|
||||||
|
INVENTREE_DB_NAME: inventree
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install node.js
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
- run: npm install
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Check Files
|
- name: Check Templated Files
|
||||||
run: |
|
run: |
|
||||||
cd ci
|
cd ci
|
||||||
python check_js_templates.py
|
python check_js_templates.py
|
||||||
|
- name: Lint Javascript Files
|
||||||
|
run: |
|
||||||
|
invoke render-js-files
|
||||||
|
npx eslint js_tmp/*.js
|
@ -74,20 +74,27 @@ class RenderJavascriptFiles(TestCase):
|
|||||||
|
|
||||||
js_files = pathlib.Path(directory).rglob('*.js')
|
js_files = pathlib.Path(directory).rglob('*.js')
|
||||||
|
|
||||||
|
n = 0
|
||||||
|
|
||||||
for f in js_files:
|
for f in js_files:
|
||||||
js = os.path.basename(f)
|
js = os.path.basename(f)
|
||||||
|
|
||||||
self.download_file(js, prefix)
|
self.download_file(js, prefix)
|
||||||
|
|
||||||
|
n += 1
|
||||||
|
|
||||||
|
return n
|
||||||
|
|
||||||
def test_render_files(self):
|
def test_render_files(self):
|
||||||
"""
|
"""
|
||||||
Look for all javascript files
|
Look for all javascript files
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.download_files('translated', '/js/i18n')
|
n = 0
|
||||||
self.download_files('dynamic', '/js/dynamic')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
print("Rendering javascript files...")
|
||||||
|
|
||||||
|
n += self.download_files('translated', '/js/i18n')
|
||||||
|
n += self.download_files('dynamic', '/js/dynamic')
|
||||||
|
|
||||||
|
print(f"Rendered {n} javascript files.")
|
||||||
|
9
tasks.py
9
tasks.py
@ -457,3 +457,12 @@ def server(c, address="127.0.0.1:8000"):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
manage(c, "runserver {address}".format(address=address), pty=True)
|
manage(c, "runserver {address}".format(address=address), pty=True)
|
||||||
|
|
||||||
|
|
||||||
|
@task
|
||||||
|
def render_js_files(c):
|
||||||
|
"""
|
||||||
|
Render templated javascript files (used for static testing).
|
||||||
|
"""
|
||||||
|
|
||||||
|
manage(c, "test InvenTree.ci_render_js")
|
||||||
|
Loading…
Reference in New Issue
Block a user