Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spurte/deno-config
Easy to use JavaScript API for Deno Configuration (deno.json)
https://github.com/spurte/deno-config
deno typescript
Last synced: 23 days ago
JSON representation
Easy to use JavaScript API for Deno Configuration (deno.json)
- Host: GitHub
- URL: https://github.com/spurte/deno-config
- Owner: spurte
- License: mit
- Created: 2024-07-08T20:49:13.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-07-09T13:50:22.000Z (6 months ago)
- Last Synced: 2024-08-09T02:12:55.121Z (5 months ago)
- Topics: deno, typescript
- Language: TypeScript
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# Deno JS API for `deno.json`
[![JSR](https://jsr.io/badges/@dyte/deno-config)](https://jsr.io/badges/@dyte/deno-config)This package represents a simple-to-use and platform-agnostic JavaScript API and Schema for the `deno.json` file.
Given a `deno.json` file like this
```json
{
"tasks": {
"dev": "deno run -A --watch main.ts",
"build": "deno compile -A main.ts"
},
"compilerOptions": {
"lib": [
"dom",
"dom.iterable",
"dom.asynciterable",
"deno.ns"
]
}
}
```
We can extract and manipulate the json file with perfect typing using this package as shown:```typescript
import deno from "./deno.json" with { type: "json" };
import { DenoConfig } from "jsr:@dyte/deno-config";const denoConfig = deno as DenoConfig;
console.log(denoConfig.tasks?.dev) // "deno run -A --watch main.ts"
console.log(denoConfig.tasks?.build) // "deno compile -A main.ts"
console.log(denoConfig.name) // undefined
console.log(denoConfig.compilerOptions?.lib) // ["dom", "dom.iterable", "dom.asynciterable", "deno.ns"]
```You can also use it to build one from scratch.
## Using this package
```bash
deno add @dyte/deno-config
npx jsr add @dyte/deno-config
pnpm dlx jsr add @dyte/deno-config
yarn dlx jsr add @dyte/deno-config
bunx jsr add @dyte/deno-config
```