Skip to content

Commit 2413f68

Browse files
committed
build!: Move scripts->opeendx/scripts and expose legacy frontend console scripts
1 parent 2025fd0 commit 2413f68

107 files changed

Lines changed: 41 additions & 6 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def compile_sass_dir(
274274
click.echo(f" Source: {source_css_file}")
275275
click.echo(f" Target: {target_css_file}")
276276
if not dry:
277-
subprocess.run(["rtlcss", source_css_file, target_css_file])
277+
subprocess.run(["./node_modules/.bin/rtlcss", source_css_file, target_css_file])
278278
click.secho(" Generated.", fg="green")
279279

280280
# Information
@@ -312,12 +312,13 @@ def compile_sass_dir(
312312
if (theme_dir / theme / "lms").is_dir() or (theme_dir / theme / "cms").is_dir()
313313
]
314314

315-
# We expect this script to be run from the edx-platform root.
316-
repo = Path(".")
315+
# We need to run from the repo root.
316+
repo = Path(__file__).parent.parent.parent
317317
if not (repo / "xmodule").is_dir():
318-
# Sanity check: If the xmodule/ folder is missing, we're definitely not at the root
319-
# of edx-platform, so save the user some headache by exiting early.
320-
raise Exception(f"{__file__} must be run from the root of edx-platform")
318+
# Sanity check: If the xmodule/ folder is missing, we're definitely haven't found the
319+
# root of edx-platform, so save the user some headache by exiting early.
320+
raise Exception(f"{__file__} could not find the openedx-platform repository root")
321+
os.chdir(repo)
321322

322323
# Every Sass compilation will use have these directories as lookup paths,
323324
# regardless of theme.
File renamed without changes.
File renamed without changes.

openedx/scripts/run_webpack.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python
2+
"""
3+
Extremely simple wrapper to run webpack.
4+
5+
Don't add anything onto this, please. It's meant to a be a super-simple way
6+
of exposing the `webpack` build to those who `pip install openedx-platform`.
7+
"""
8+
import subprocess
9+
import sys
10+
from pathlib import Path
11+
12+
13+
def main():
14+
this_script = Path(__file__)
15+
repo_root = Path(__file__).parent.parent.parent
16+
if not (repo_root / "package.json").is_file():
17+
raise SystemExit(f"{this_script.name} could not find root of openedx-platform repository")
18+
# Always `npm ci`: the build toolchain (webpack et al.) lives in devDependencies, which npm ci installs by default.
19+
for command in (["npm", "ci"], ["npm", "run", "webpack"]):
20+
print(f"{this_script.name}: running {' '.join(command)} in {repo_root}", flush=True)
21+
result = subprocess.run(command, cwd=repo_root, check=False)
22+
if result.returncode != 0:
23+
raise SystemExit(result.returncode)
24+
25+
26+
if __name__ == "__main__":
27+
sys.exit(main())

0 commit comments

Comments
 (0)