From 75182afe7a6405b166ffb7a131f7fae583559927 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 1 Oct 2022 10:42:41 -0400 Subject: [PATCH] chore: update docs --- README.md | 13 ++++++++++--- dprint.json | 7 +++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 042ac5c..ce45130 100644 --- a/README.md +++ b/README.md @@ -33,16 +33,23 @@ console.log(tsFormatter.formatText("file.ts", "const t = 5;")); ## Node.js +Use the following: + ```ts import { createFromBuffer } from "@dprint/formatter"; -import { getBuffer } from "@dprint/json"; +// You may have to use `getBuffer` on plugins that haven't updated yet. +// See the plugins README.md for details. +import { getPath } from "@dprint/json"; +import * as fs from "fs"; -// or provide something like fs.readFileSync("./json.wasm") -const formatter = createFromBuffer(getBuffer()); +const buffer = fs.readFileSync(getPath()); +const formatter = createFromBuffer(buffer); console.log(formatter.formatText("test.json", "{test: 5}")); ``` +Unfortunately Node.js doesn't have any way to cache compiles at the moment and so it will have a slower than ideal startup time. + ### Plugin NPM Packages - [@dprint/json](https://www.npmjs.com/package/@dprint/json) diff --git a/dprint.json b/dprint.json index acc6d9f..fa3210d 100644 --- a/dprint.json +++ b/dprint.json @@ -1,5 +1,4 @@ { - "incremental": true, "typescript": { "indentWidth": 2 }, @@ -14,8 +13,8 @@ "**/*-lock.json" ], "plugins": [ - "https://plugins.dprint.dev/typescript-0.61.0.wasm", - "https://plugins.dprint.dev/json-0.14.0.wasm", - "https://plugins.dprint.dev/markdown-0.12.0.wasm" + "https://plugins.dprint.dev/typescript-0.74.0.wasm", + "https://plugins.dprint.dev/json-0.15.6.wasm", + "https://plugins.dprint.dev/markdown-0.14.1.wasm" ] }