Fix unpkg links in docs (#6872)

This commit is contained in:
fisker Cheung authored and Simon Lydell committed 2019-11-08 17:33:28 +01:00
1 parent 85912a738d
commit d05be09406
3 files changed
+18 -10

No files matched your search

+1
View File
@@ -362,6 +362,7 @@
"unparenthesized",
"unparseable",
"unpause",
"unpkg",
"unrestrict",
"untracked",
"valourous",
+12 -10
View File
@@ -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
<!-- prettier-ignore -->
```html
<script src="https://unpkg.com/prettier@1.13.0/standalone.js"></script>
<script src="https://unpkg.com/prettier@1.13.0/parser-graphql.js"></script>
<script type="text/javascript">
prettier.format("query { }", { parser: "graphql", plugins: prettierPlugins });
<script src="https://unpkg.com/prettier@1.18.2/standalone.js"></script>
<script src="https://unpkg.com/prettier@1.18.2/parser-graphql.js"></script>
<script>
prettier.format("query { }", {
parser: "graphql",
plugins: prettierPlugins
});
</script>
```
@@ -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 });
```
+5
View File
@@ -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"
});