Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite "tools/" scripts in Deno #8223

Closed
bartlomieju opened this issue Nov 2, 2020 · 3 comments · Fixed by #8247
Closed

Rewrite "tools/" scripts in Deno #8223

bartlomieju opened this issue Nov 2, 2020 · 3 comments · Fixed by #8247
Assignees
Labels
build build system or continuous integration related refactor

Comments

@bartlomieju
Copy link
Member

bartlomieju commented Nov 2, 2020

Various utility scripts in deno repository, that are used during development and CI, are written in Python. Those are scripts in tools/ directory. They are used for formatting, linting, parsing benchmarks output, etc.

I think it would be beneficial to rewrite them to use Deno instead of Python. Doing so would completely remove dependency on Python (unsure about that, rusty_v8 probably still needs it?) and close #5114 and #2893.

Changes needed to resolve this issue:

  • install deno in CI script (.github/workflows/ci.yml)
  • for each script in tools/:
    • rewrite the script in deno
    • replace invocation of the script to call deno

The easiest to rewrite would be tools/format.py and tools/lint.py. Here are respective example scripts from deno_lint repository which can be used as a basis for this refactor:

@bartlomieju bartlomieju added build build system or continuous integration related refactor labels Nov 2, 2020
@crowlKats
Copy link
Member

for installing deno in CI script, would be using https://github.com/denolib/setup-deno alright, or rather do it manually?

@bartlomieju
Copy link
Member Author

@crowlKats I think we should use deno_install script

@MarkTiedemann
Copy link
Contributor

If you just want to determine the latest Deno executable, download and unzip it, you can do that in a shell or cmd one-liner (or 3-liner, nicely formatted).

v=$(curl -sSf https://github.com/denoland/deno/releases | grep -o \/denoland/deno/releases/download/.*/deno-x86_64-unknown-linux-gnu.zip | head -1 | cut -d/ -f6)
curl -Lo deno.zip https://github.com/denoland/deno/releases/download/$v/deno-x86_64-unknown-linux-gnu.zip
unzip deno.zip
for /f "delims=/ tokens=6" %%v in ('"curl -sSf https://github.com/denoland/deno/releases | findstr \/denoland/deno/releases/download/.*/deno-x86_64-pc-windows-msvc.zip | findstr /n . | findstr ^1:"') do (
    curl -Lo deno.zip https://github.com/denoland/deno/releases/download/%%v/deno-x86_64-pc-windows-msvc.zip
    tar xf deno.zip
)

Both setup-deno and deno_install deal with edge cases, different arguments, versions, putting Deno in the PATH, etc. If the requirements are simpler than that, you could get away with simpler scripts...

// Note that curl and tar are installed by default on recent Windows. unzip is not available by default on all *nixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build system or continuous integration related refactor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants