Last active
November 25, 2024 15:48
-
-
Save miy4/c6fc1dc302f0581dc0cd09238285ca7a to your computer and use it in GitHub Desktop.
Add extra configuration to a new Deno project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import sys | |
| from pathlib import Path | |
| archives = [ | |
| { | |
| "name": ".vscode/settings.json", | |
| "data": """ | |
| { | |
| "deno.enable": true, | |
| "deno.lint": true, | |
| "deno.unstable": true, | |
| "editor.formatOnSave": true, | |
| "editor.defaultFormatter": "denoland.vscode-deno" | |
| } | |
| """.strip(), | |
| }, | |
| ] | |
| for archive_item in archives: | |
| new_file = Path(archive_item["name"]) | |
| new_file_dir = new_file.parent | |
| new_file_dir.mkdir(parents=True, exist_ok=True) | |
| if new_file.exists(): | |
| print(f"File already exists: {new_file}\nAborted.", file=sys.stderr) | |
| sys.exit(1) | |
| with new_file.open("w") as f: | |
| f.write(archive_item["data"]) | |
| print(f"Created: {new_file}") | |
| print("\nDone. Now run:\n") | |
| print(" deno init") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment