Skip to content

Instantly share code, notes, and snippets.

@miy4
Last active November 25, 2024 15:48
Show Gist options
  • Select an option

  • Save miy4/c6fc1dc302f0581dc0cd09238285ca7a to your computer and use it in GitHub Desktop.

Select an option

Save miy4/c6fc1dc302f0581dc0cd09238285ca7a to your computer and use it in GitHub Desktop.
Add extra configuration to a new Deno project
#!/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