0.4.3 • Published 3 years ago
@darkflare/wjson v0.4.3
Installation
npm i -D @darkflare/wjsonUsage (CLI)
Run the below command and wjson will automatically search for your configuration file and generate a wrangler.toml for you.
wjsonAutomatically Detectable Files
wrangler.jsonwrangler.jsoncwrangler.jswrangler.mjswrangler.cjswrangler.tswrangler.yamlwrangler.yml
Options
--configto use a custom config, e.g.wjson --config="./my.json"
Usage (API)
import { join } from 'node:path'
import { generateConfig, parseConfig } from 'wjson'
// get the config from a file
const config = await parseConfig(join(someDirectory, './custom.json'))
// alternatively, you can only specify the directory name
const config = await parseConfig(someDirectory)
// generate a wrangler.toml from a config
await generateConfig(config)Config Files
json/jsonc
{
"$schema": "https://raw.githubusercontent.com/azurydev/wjson/dev/schema.json",
// your config (w/ autocomplete)
}js/mjs/ts
import { defineConfig } from 'wjson'
export default defineConfig({
// your config (w/ autocomplete)
})js/cjs
const { defineConfig } = require('wjson')
module.exports = defineConfig({
// your config (w/ autocomplete)
})yaml/yml
accountId: '0123456789'
development:
name: 'my-awesome-worker'
# your configConfig Syntax
- all options must be specified in
camelCase varsoption was renamed tovariablesnodeCompoption was renamed tonodeCompatibility- any environment-related options must be specified under
development(global, default),staging, orproduction