From d05be0940602419ae353aa60fd623c730b78099a Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Sat, 9 Nov 2019 00:33:28 +0800 Subject: [PATCH] Fix unpkg links in docs (#6872) --- cspell.json | 1 + docs/browser.md | 22 ++++++++++++---------- scripts/release/steps/update-version.js | 5 +++++ 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/cspell.json b/cspell.json index 724cc709d..74a7b7e56 100644 --- a/cspell.json +++ b/cspell.json @@ -362,6 +362,7 @@ "unparenthesized", "unparseable", "unpause", + "unpkg", "unrestrict", "untracked", "valourous", diff --git a/docs/browser.md b/docs/browser.md index 80b627925..3a4abf94a 100644 --- a/docs/browser.md +++ b/docs/browser.md @@ -3,7 +3,7 @@ id: browser title: Browser --- -Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The new UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins. +Run Prettier in the browser with the `standalone.js` UMD bundle shipped in the NPM package (starting in version 1.13). The UMD bundle only formats the code and has no support for config files, ignore files, CLI usage, or automatic loading of plugins. ### `prettier.format(code, options)` @@ -15,12 +15,14 @@ See [Usage](#usage) below for examples. ### Global - ```html - - - + + ``` @@ -40,8 +42,8 @@ prettier.format("query { }", { ```js define([ - "https://unpkg.com/prettier@1.13.0/standalone.js", - "https://unpkg.com/prettier@1.13.0/parser-graphql.js" + "https://unpkg.com/prettier@1.18.2/standalone.js", + "https://unpkg.com/prettier@1.18.2/parser-graphql.js" ], (prettier, ...plugins) => { prettier.format("query { }", { parser: "graphql", plugins }); }); @@ -60,7 +62,7 @@ This syntax doesn't necessarily work in the browser, but it can be used when bun ### Worker ```js -importScripts("https://unpkg.com/prettier@1.13.0/standalone.js"); -importScripts("https://unpkg.com/prettier@1.13.0/parser-graphql.js"); +importScripts("https://unpkg.com/prettier@1.18.2/standalone.js"); +importScripts("https://unpkg.com/prettier@1.18.2/parser-graphql.js"); prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins }); ``` diff --git a/scripts/release/steps/update-version.js b/scripts/release/steps/update-version.js index b9c932f63..32723b44b 100644 --- a/scripts/release/steps/update-version.js +++ b/scripts/release/steps/update-version.js @@ -16,6 +16,11 @@ async function bump({ version }) { content.replace(/^(- Prettier Version: ).*?$/m, `$1${version}`) ); + // Update unpkg link in docs + processFile("docs/browser.md", content => + content.replace(/(\/\/unpkg\.com\/prettier@)(?:.*?)\//g, `$1${version}/`) + ); + await execa("yarn", ["update-stable-docs"], { cwd: "./website" });