Website (#2241)
* initial docusaurus set-up * Delete why-prettier.md * Update README.md * Update Docusaurus structure * Update package.json * Update siteConfig.js * Remove ~ files * chore(website): update build script * Add redirect script * Get eslint working on website * Fix to allow for baseUrl of '/' * Update docusaurus version * Update README.md * Change redirect script to use baseUrl of '/' * Fix index.js formatting * Load redirect script * General cleanup * Add projects using prettier * Update service worker to just scope to playground * Reduce link repeatition * Link "Try it out" button to /playground/ * Make header of playground approximately same as main site * Remove .html from URLs (e.g. users.html -> users/) * Link Gitter Chat * Add circleci.yml * Only run builds on master * Do deployment using Travismaster
parent
6f32a40edd
commit
80f38ce75b
|
@ -1,7 +1,8 @@
|
|||
!/*.js
|
||||
/docs/lib/
|
||||
/tests/**/*.js
|
||||
!/tests/**/jsfmt.spec.js
|
||||
!/**/.eslintrc.js
|
||||
/test.js
|
||||
/dist/
|
||||
**/node_modules/**
|
||||
/website/static/lib/
|
||||
|
|
10
.eslintrc.js
10
.eslintrc.js
|
@ -5,8 +5,8 @@ module.exports = {
|
|||
es6: true,
|
||||
node: true
|
||||
},
|
||||
extends: ["eslint:recommended"],
|
||||
plugins: ["prettier"],
|
||||
extends: ["eslint:recommended", "plugin:react/recommended"],
|
||||
plugins: ["prettier", "react"],
|
||||
rules: {
|
||||
curly: "error",
|
||||
"no-console": "off",
|
||||
|
@ -16,6 +16,12 @@ module.exports = {
|
|||
"prefer-arrow-callback": "error",
|
||||
"prefer-const": "error",
|
||||
"prettier/prettier": "error",
|
||||
"react/no-deprecated": "off",
|
||||
strict: "error"
|
||||
},
|
||||
parserOptions: {
|
||||
ecmaFeatures: {
|
||||
jsx: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,3 +6,5 @@ npm-debug.log
|
|||
/test.css
|
||||
/.vscode
|
||||
/dist
|
||||
/website/node_modules
|
||||
.DS_Store
|
||||
|
|
|
@ -21,3 +21,9 @@ before_script:
|
|||
script:
|
||||
- yarn lint
|
||||
- AST_COMPARE=1 yarn test -- --runInBand
|
||||
deploy:
|
||||
provider: script
|
||||
script: website/deploy.sh
|
||||
skip_cleanup: true
|
||||
on:
|
||||
branch: master
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
# Why Prettier?
|
||||
---
|
||||
id: why-prettier
|
||||
title: Why Prettier?
|
||||
layout: docs
|
||||
category: Prettier
|
||||
permalink: docs/en/why-prettier.html
|
||||
---
|
||||
|
||||
## Building and enforcing a style guide
|
||||
|
|
@ -1 +0,0 @@
|
|||
prettierVersion = "1.5.2";
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
Copyright 2016 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
(function() {
|
||||
'use strict';
|
||||
var workerScript = document.currentScript && document.currentScript.dataset.serviceWorker;
|
||||
|
||||
if (workerScript && 'serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register(workerScript);
|
||||
}
|
||||
})();
|
|
@ -1,11 +1,12 @@
|
|||
{
|
||||
"name": "prettier",
|
||||
"version": "1.5.2",
|
||||
"description": "Prettier is an opinionated JavaScript formatter",
|
||||
"description": "Prettier is an opinionated code formatter",
|
||||
"bin": {
|
||||
"prettier": "./bin/prettier.js"
|
||||
},
|
||||
"repository": "prettier/prettier",
|
||||
"homepage": "https://prettier.io",
|
||||
"author": "James Long",
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
|
@ -39,6 +40,7 @@
|
|||
"eslint": "4.1.1",
|
||||
"eslint-friendly-formatter": "3.0.0",
|
||||
"eslint-plugin-prettier": "2.1.2",
|
||||
"eslint-plugin-react": "7.1.0",
|
||||
"jest": "20.0.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"prettier": "1.4.2",
|
||||
|
|
|
@ -7,6 +7,7 @@ const shell = require("shelljs");
|
|||
const pkg = require("../../package.json");
|
||||
|
||||
const rootDir = path.join(__dirname, "..", "..");
|
||||
const docs = path.join(rootDir, "website/static/lib");
|
||||
const parsers = [
|
||||
"babylon",
|
||||
"flow",
|
||||
|
@ -26,8 +27,8 @@ function pipe(string) {
|
|||
shell.set("-e");
|
||||
shell.cd(rootDir);
|
||||
|
||||
shell.rm("-Rf", "dist/", "docs/lib/");
|
||||
shell.mkdir("-p", "docs/lib/");
|
||||
shell.rm("-Rf", "dist/", docs);
|
||||
shell.mkdir("-p", docs);
|
||||
|
||||
// --- Lib ---
|
||||
|
||||
|
@ -62,9 +63,9 @@ shell.echo();
|
|||
// --- Docs ---
|
||||
|
||||
shell.echo("Bundling docs index...");
|
||||
shell.cp("dist/index.js", "docs/lib/index.js");
|
||||
shell.cp("dist/index.js", `${docs}/index.js`);
|
||||
shell.exec(
|
||||
"node_modules/babel-cli/bin/babel.js dist/index.js --out-file docs/lib/index.js --presets=es2015"
|
||||
`node_modules/babel-cli/bin/babel.js dist/index.js --out-file ${docs}/index.js --presets=es2015`
|
||||
);
|
||||
|
||||
shell.echo("Bundling docs babylon...");
|
||||
|
@ -72,7 +73,7 @@ shell.exec(
|
|||
"rollup -c scripts/build/rollup.docs.config.js --environment filepath:parser-babylon.js"
|
||||
);
|
||||
shell.exec(
|
||||
"node_modules/babel-cli/bin/babel.js docs/lib/parser-babylon.js --out-file docs/lib/parser-babylon.js --presets=es2015"
|
||||
`node_modules/babel-cli/bin/babel.js ${docs}/parser-babylon.js --out-file ${docs}/parser-babylon.js --presets=es2015`
|
||||
);
|
||||
|
||||
for (const parser of parsers) {
|
||||
|
@ -99,14 +100,10 @@ shell.sed(
|
|||
);
|
||||
|
||||
shell.echo("Create prettier-version.js");
|
||||
pipe(`prettierVersion = "${pkg.version}";`).to("docs/lib/prettier-version.js");
|
||||
pipe(`prettierVersion = "${pkg.version}";`).to(`${docs}/prettier-version.js`);
|
||||
|
||||
shell.echo("Copy sw-toolbox.js to docs");
|
||||
shell.cp("node_modules/sw-toolbox/sw-toolbox.js", "docs/lib/sw-toolbox.js");
|
||||
shell.cp(
|
||||
"node_modules/sw-toolbox/companion.js",
|
||||
"docs/lib/sw-toolbox-companion.js"
|
||||
);
|
||||
shell.cp("node_modules/sw-toolbox/sw-toolbox.js", `${docs}/sw-toolbox.js`);
|
||||
|
||||
shell.echo("Copy package.json");
|
||||
const pkgWithoutDependencies = Object.assign({}, pkg);
|
||||
|
|
|
@ -10,7 +10,7 @@ const basename = filename.replace(/\..+/, "");
|
|||
|
||||
export default Object.assign(baseConfig, {
|
||||
entry: "dist/" + filepath,
|
||||
dest: "docs/lib/" + filename,
|
||||
dest: "website/static/lib/" + filename,
|
||||
format: "iife",
|
||||
plugins: [json(), resolve({ preferBuiltins: true }), commonjs(), globals()],
|
||||
useStrict: false,
|
||||
|
|
|
@ -1 +1,102 @@
|
|||
We need a website, let's start putting content in here :)
|
||||
|
||||
## Configuration
|
||||
In the project repo, the `docs` folder is used to hold documentation written in markdown. A `blog` folder can be used to hold blog posts written in markdown.
|
||||
|
||||
### Document and Blog Front Matters
|
||||
|
||||
Documentation should contain front matter that follows this example:
|
||||
```
|
||||
---
|
||||
id: doc1 <!-- used for docs to find each other and to map links -->
|
||||
title: Document Title
|
||||
layout: docs1 <!-- used to determine different sidebar groupings -->
|
||||
category: Sidebar Category 1 <!-- Category on the sidebar under which this doc goes -->
|
||||
permalink: docs/en/doc1.html <!-- link to the document that is used for site -->
|
||||
previous: doc0 <!-- previous doc on sidebar for navigation -->
|
||||
next: doc2 <!-- next doc on the sidebar for navigation -->
|
||||
<!-- don't include next if this is the last doc; don't include previous if first doc -->
|
||||
---
|
||||
```
|
||||
|
||||
Blog posts should be written as markdown files with the following front matter:
|
||||
```
|
||||
---
|
||||
title: Blog Post Title
|
||||
author: Author Name
|
||||
authorURL: http://twitter.com/author <!-- (or some other link) -->
|
||||
authorFBID: 21315325 <!-- id to get author's picture -->
|
||||
---
|
||||
```
|
||||
In the blog post you should include a line `<!--truncate-->`. This will determine under which point text will be ignored when generating the preview of your blog post. Blog posts should have the file name format: `yyyy-mm-dd-your-file-name.md`.
|
||||
|
||||
### Language Configurations
|
||||
|
||||
The `examples` script will generate a `languages.js` file and `i18n` folder for translation support, but if you only wish to support English, then these are not needed.
|
||||
|
||||
### Site Configurations
|
||||
|
||||
Configure the siteConfig.js file which has comments guiding you through what needs to be done and how each configuration affects your website.
|
||||
|
||||
Customize core/Footer.js which will serve as the footer for each page on your website.
|
||||
|
||||
Include your own top-level pages as React components in `pages/`. These components should just be the body sections of the pages you want, and they will be included with the header and footer that the rest of Docusaurus uses. Examples are provided for your reference. Currently, if you want to add other React components to your pages, you must include all of it inside that file due to how `require` paths are set-up. You may also include `.html` files directly, but this is not recommended, and these will just be served as is and will not have any of the header/footer/styles shared by the rest of Docusaurus.
|
||||
|
||||
All images and other static assets you wish to include should be placed inside the `static` folder. Any `.css` files provided in `static` will be concatenated to the standard styles provided by Docusaurus and used site-wide.
|
||||
|
||||
Files placed in `static/` will be accessible in the following way: `static/img/image.png` will be accessible at `img/image.png`.
|
||||
|
||||
## Using Docusaurus
|
||||
|
||||
### Run the Server
|
||||
|
||||
To run your website locally run the script:
|
||||
|
||||
```
|
||||
yarn start
|
||||
```
|
||||
|
||||
This will start a server hosting your website locally at `localhost:3000`. This server will ignore any occurences `siteConfig.baseUrl` in URLs, e.g. `localhost:3000/your-site/index.html` will be the same as `localhost:3000/index.html`. Any changes to configured files will be reflected by refreshing the page, i.e. the server does not need to be restarted to show changes.
|
||||
|
||||
|
||||
### Build Static Pages
|
||||
|
||||
To create a static build of your website, run the script:
|
||||
|
||||
```
|
||||
yarn build
|
||||
```
|
||||
|
||||
This will generate `.html` files from all of your docs and other pages included in `pages/`. This allows you to check whether or not all your files are being generated correctly. The build folder is inside Docusaurus's directory inside `node_modules`.
|
||||
|
||||
### Publishing Your Website
|
||||
|
||||
Use CircleCI to publish your website whenever your project repo is updated. Configure your circle.yml file in your project repo to run commands to publish to GitHub Pages. An example is shown here:
|
||||
|
||||
```yaml
|
||||
machine:
|
||||
node:
|
||||
version: 6.10.3
|
||||
npm:
|
||||
version: 3.10.10
|
||||
|
||||
test:
|
||||
override:
|
||||
- "true"
|
||||
|
||||
deployment:
|
||||
website:
|
||||
branch: master
|
||||
commands:
|
||||
- git config --global user.email "test-site-bot@users.noreply.github.com"
|
||||
- git config --global user.name "Website Deployment Script"
|
||||
- echo "machine github.com login test-site-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
- cd website && npm install && GIT_USER=test-site-bot npm run publish-gh-pages
|
||||
```
|
||||
|
||||
Note that in this case a GitHub user `test-site-bot` is created to use just for publishing. Make sure to give your Git user push permissions for your project and to set a GITHUB_TOKEN environment variable in Circle if you choose to publish this way.
|
||||
|
||||
If you wish to manually publish your website with the `publish-gh-pages` script, run the following example command with the appropriate variables for your project:
|
||||
|
||||
```
|
||||
DEPLOY_USER=deltice GIT_USER=test-site-bot CIRCLE_PROJECT_USERNAME=deltice CIRCLE_PROJECT_REPONAME=test-site CIRCLE_BRANCH=master npm run publish-gh-pages
|
||||
```
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
"use strict";
|
||||
|
||||
const React = require("react");
|
||||
|
||||
const GithubButton = props =>
|
||||
<a
|
||||
className="github-button"
|
||||
href={props.config.githubUrl}
|
||||
data-icon="octicon-star"
|
||||
data-count-href={`/${props.config.repo}/stargazers`}
|
||||
data-count-api={`/repos/${props.config.repo}#stargazers_count`}
|
||||
data-count-aria-label="# stargazers on GitHub"
|
||||
aria-label="Star this project on GitHub"
|
||||
>
|
||||
Star
|
||||
</a>;
|
||||
|
||||
GithubButton.propTypes = {
|
||||
config: React.PropTypes.object
|
||||
};
|
||||
|
||||
class Footer extends React.Component {
|
||||
render() {
|
||||
// const currentYear = new Date().getFullYear();
|
||||
return (
|
||||
<footer className="nav-footer" id="footer">
|
||||
<section className="sitemap">
|
||||
<a href={this.props.config.baseUrl} className="nav-home">
|
||||
<img
|
||||
src={this.props.config.baseUrl + this.props.config.footerIcon}
|
||||
alt={this.props.config.title}
|
||||
/>
|
||||
</a>
|
||||
<div>
|
||||
<h5>Docs</h5>
|
||||
<a
|
||||
href={
|
||||
this.props.config.baseUrl +
|
||||
"docs/" +
|
||||
this.props.language +
|
||||
"/why-prettier.html"
|
||||
}
|
||||
>
|
||||
Getting Started (or other categories)
|
||||
</a>
|
||||
<a
|
||||
href={
|
||||
this.props.config.baseUrl +
|
||||
"docs/" +
|
||||
this.props.language +
|
||||
"/why-prettier.html"
|
||||
}
|
||||
>
|
||||
Guides (or other categories)
|
||||
</a>
|
||||
<a
|
||||
href={
|
||||
this.props.config.baseUrl +
|
||||
"docs/" +
|
||||
this.props.language +
|
||||
"/why-prettier.html"
|
||||
}
|
||||
>
|
||||
API Reference (or other categories)
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<h5>Community</h5>
|
||||
<a
|
||||
href={this.props.config.baseUrl + this.props.language + "/users/"}
|
||||
>
|
||||
User Showcase
|
||||
</a>
|
||||
<a
|
||||
href="http://stackoverflow.com/questions/tagged/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Stack Overflow
|
||||
</a>
|
||||
<a href="https://gitter.im/jlongster/prettier">Chat on Gitter</a>
|
||||
<a
|
||||
href="https://twitter.com/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Twitter
|
||||
</a>
|
||||
</div>
|
||||
<div>
|
||||
<h5>More</h5>
|
||||
{/*<a href={this.props.config.baseUrl + "blog"}>Blog</a>*/}
|
||||
<a href={this.props.config.githubUrl}>GitHub</a>
|
||||
<GithubButton config={this.props.config} />
|
||||
</div>
|
||||
</section>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Footer.propTypes = {
|
||||
language: React.PropTypes.string,
|
||||
config: React.PropTypes.object
|
||||
};
|
||||
|
||||
module.exports = Footer;
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! $GITHUB_TOKEN ]; then
|
||||
>&2 echo "error: GITHUB_TOKEN not present in env"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git config --global user.email "prettier-bot@users.noreply.github.com"
|
||||
git config --global user.name "Prettier Bot"
|
||||
echo "machine github.com login prettier-bot password $GITHUB_TOKEN" > ~/.netrc
|
||||
|
||||
cd website
|
||||
yarn --pure-lockfile && GIT_USER=prettier-bot yarn run publish-gh-pages
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"scripts": {
|
||||
"start": "docusaurus-start",
|
||||
"build": "docusaurus-build",
|
||||
"publish-gh-pages": "docusaurus-publish"
|
||||
},
|
||||
"devDependencies": {
|
||||
"docusaurus": "^1.0.0-alpha.9"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
|
||||
const React = require("react");
|
||||
|
||||
const CompLibrary = require("../../../core/CompLibrary.js");
|
||||
const Container = CompLibrary.Container;
|
||||
const GridBlock = CompLibrary.GridBlock;
|
||||
|
||||
// const siteConfig = require(process.cwd() + "/siteConfig.js");
|
||||
|
||||
class Help extends React.Component {
|
||||
render() {
|
||||
const supportLinks = [
|
||||
{
|
||||
content:
|
||||
"Learn more using the [documentation on this site.](/docs/en/why-prettier.html)\n",
|
||||
title: "Browse Docs"
|
||||
},
|
||||
{
|
||||
content: "Ask questions about the documentation and project\n",
|
||||
title: "Join the community"
|
||||
},
|
||||
{
|
||||
content: "Find out what's new with this project\n",
|
||||
title: "Stay up to date"
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="docMainWrapper wrapper">
|
||||
<Container className="mainContainer documentContainer postContainer">
|
||||
<div className="post">
|
||||
<header className="postHeader">
|
||||
<h2>Need help?</h2>
|
||||
</header>
|
||||
<p>This project is maintained by a dedicated group of people;</p>
|
||||
<GridBlock contents={supportLinks} layout="threeColumn" />
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Help.defaultProps = {
|
||||
language: "en"
|
||||
};
|
||||
|
||||
module.exports = Help;
|
|
@ -0,0 +1,190 @@
|
|||
"use strict";
|
||||
|
||||
const React = require("react");
|
||||
|
||||
const CompLibrary = require("../../core/CompLibrary.js");
|
||||
const Marked = CompLibrary.Marked; /* Used to read markdown */
|
||||
const Container = CompLibrary.Container;
|
||||
const GridBlock = CompLibrary.GridBlock;
|
||||
|
||||
const siteConfig = require(process.cwd() + "/siteConfig.js");
|
||||
|
||||
class Button extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="pluginWrapper buttonWrapper">
|
||||
<a className="button" href={this.props.href} target={this.props.target}>
|
||||
{this.props.children}
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Button.defaultProps = {
|
||||
target: "_self"
|
||||
};
|
||||
|
||||
Button.propTypes = {
|
||||
href: React.PropTypes.string,
|
||||
target: React.PropTypes.string,
|
||||
children: React.PropTypes.any
|
||||
};
|
||||
|
||||
class HomeSplash extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div className="homeContainer">
|
||||
<div className="homeSplashFade">
|
||||
<div className="wrapper homeWrapper">
|
||||
<div className="projectLogo">
|
||||
<img src="/icon.png" />
|
||||
</div>
|
||||
<div className="inner">
|
||||
<h2 className="projectTitle">
|
||||
{siteConfig.title}
|
||||
<small>{siteConfig.tagline}</small>
|
||||
</h2>
|
||||
<div className="section promoSection">
|
||||
<div className="promoRow">
|
||||
<div className="pluginRowBlock">
|
||||
<Button href="/playground/">Try It Out</Button>
|
||||
<Button
|
||||
href={
|
||||
"/docs/" + this.props.language + "/why-prettier.html"
|
||||
}
|
||||
>
|
||||
Example Link
|
||||
</Button>
|
||||
<Button
|
||||
href={
|
||||
"/docs/" + this.props.language + "/why-prettier.html"
|
||||
}
|
||||
>
|
||||
Example Link 2
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
HomeSplash.propTypes = {
|
||||
language: React.PropTypes.string
|
||||
};
|
||||
|
||||
class Index extends React.Component {
|
||||
render() {
|
||||
const language = this.props.language || "en";
|
||||
const showcase = siteConfig.users
|
||||
.filter(user => {
|
||||
return user.pinned;
|
||||
})
|
||||
.map((user, i) => {
|
||||
return (
|
||||
<a key={i} href={user.infoLink}>
|
||||
<img src={user.image} title={user.caption} />
|
||||
</a>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<script src="redirect.js" />
|
||||
<HomeSplash language={language} />
|
||||
<div className="mainContainer">
|
||||
<Container padding={["bottom", "top"]}>
|
||||
<GridBlock
|
||||
align="center"
|
||||
contents={[
|
||||
{
|
||||
content: "This is the content of my feature",
|
||||
image: "/prettier.png",
|
||||
imageAlign: "top",
|
||||
title: "Feature One"
|
||||
},
|
||||
{
|
||||
content: "The content of my second feature",
|
||||
image: "/prettier.png",
|
||||
imageAlign: "top",
|
||||
title: "Feature Two"
|
||||
}
|
||||
]}
|
||||
layout="fourColumn"
|
||||
/>
|
||||
</Container>
|
||||
|
||||
<div
|
||||
className="productShowcaseSection paddingBottom"
|
||||
style={{ textAlign: "center" }}
|
||||
>
|
||||
<h2>Feature Callout</h2>
|
||||
<Marked>These are features of this project</Marked>
|
||||
</div>
|
||||
|
||||
<Container padding={["bottom", "top"]} background="light">
|
||||
<GridBlock
|
||||
contents={[
|
||||
{
|
||||
content: "Talk about learning how to use this",
|
||||
image: "/prettier.png",
|
||||
imageAlign: "right",
|
||||
title: "Learn How"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Container>
|
||||
|
||||
<Container padding={["bottom", "top"]} background="dark">
|
||||
<GridBlock
|
||||
contents={[
|
||||
{
|
||||
content:
|
||||
"This is another description of how this project is useful",
|
||||
image: "/prettier.png",
|
||||
imageAlign: "left",
|
||||
title: "Description"
|
||||
}
|
||||
]}
|
||||
/>
|
||||
</Container>
|
||||
|
||||
<div className="productShowcaseSection paddingBottom">
|
||||
<h2>Who{"'"}s Using Prettier?</h2>
|
||||
<p>
|
||||
A few of the
|
||||
{" "}
|
||||
<a href="https://www.npmjs.com/browse/depended/prettier">
|
||||
many projects
|
||||
</a>
|
||||
{" "}using Prettier
|
||||
</p>
|
||||
<div className="logos">
|
||||
{showcase}
|
||||
</div>
|
||||
<div className="more-users">
|
||||
<a
|
||||
className="button"
|
||||
href={siteConfig.baseUrl + language + "/users/"}
|
||||
target="_self"
|
||||
>
|
||||
More Prettier Users
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Index.propTypes = {
|
||||
language: React.PropTypes.string
|
||||
};
|
||||
|
||||
module.exports = Index;
|
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
const React = require("react");
|
||||
|
||||
const CompLibrary = require("../../../core/CompLibrary.js");
|
||||
const Container = CompLibrary.Container;
|
||||
|
||||
const siteConfig = require(process.cwd() + "/siteConfig.js");
|
||||
|
||||
class Users extends React.Component {
|
||||
render() {
|
||||
const showcase = siteConfig.users.map((user, i) => {
|
||||
return (
|
||||
<a key={i} href={user.infoLink}>
|
||||
<img src={user.image} title={user.caption} />
|
||||
</a>
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="mainContainer">
|
||||
<Container padding={["bottom", "top"]}>
|
||||
<div className="showcaseSection">
|
||||
<div className="prose">
|
||||
<h1>Who{"'"}s Using This?</h1>
|
||||
<p>
|
||||
A few of the
|
||||
{" "}
|
||||
<a href="https://www.npmjs.com/browse/depended/prettier">
|
||||
many projects
|
||||
</a>
|
||||
{" "}using Prettier
|
||||
</p>
|
||||
</div>
|
||||
<div className="logos">
|
||||
{showcase}
|
||||
</div>
|
||||
<p>Are you using this project?</p>
|
||||
<a
|
||||
href={`${siteConfig.githubUrl}/edit/master/website/siteConfig.js`}
|
||||
className="button"
|
||||
>
|
||||
Add your company
|
||||
</a>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Users.defaultProps = {
|
||||
language: "en"
|
||||
};
|
||||
|
||||
module.exports = Users;
|
|
@ -5,7 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
||||
<title>Prettier</title>
|
||||
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
@ -14,17 +14,17 @@
|
|||
<meta name="theme-color" content="#1A2B34">
|
||||
<meta name="msapplication-navbutton-color" content="#1A2B34">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<meta name="msapplication-starturl" content="/prettier/">
|
||||
<meta name="msapplication-starturl" content="/">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<link rel="icon" href="icon.png">
|
||||
<link rel="apple-touch-icon" href="icon.png">
|
||||
<link rel="icon" href="/icon.png">
|
||||
<link rel="apple-touch-icon" href="/icon.png">
|
||||
|
||||
<link rel="stylesheet" crossorigin href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.css">
|
||||
<link rel="stylesheet" crossorigin href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/theme/neat.css">
|
||||
|
||||
<script src="lib/prettier-version.js"></script>
|
||||
<script src="playground.js"></script>
|
||||
<script src="/lib/prettier-version.js"></script>
|
||||
<script src="/playground.js"></script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/codemirror.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/mode/javascript/javascript.js"></script>
|
||||
|
@ -60,8 +60,12 @@
|
|||
}
|
||||
|
||||
header {
|
||||
height: 64px;
|
||||
height: 30px;
|
||||
padding: 10px 10px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
position: relative;
|
||||
text-align: left;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #1A2B34;
|
||||
|
@ -74,26 +78,36 @@
|
|||
}
|
||||
}
|
||||
|
||||
header a {
|
||||
height: 34px;
|
||||
display: flex;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header a,
|
||||
header a:visited {
|
||||
color: #e0e0e0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
header a:focus,
|
||||
header a:active,
|
||||
header a:hover {
|
||||
color: #70a0a0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 45px;
|
||||
height: 100%;
|
||||
margin-left: 10px;
|
||||
margin-right: 20px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.tagline {
|
||||
flex: 2;
|
||||
font-weight: 200;
|
||||
header h2 {
|
||||
display: block;
|
||||
font-family: "Helvetica Neue", Arial, sans-serif;
|
||||
font-weight: 400;
|
||||
line-height: 8px;
|
||||
position: relative;
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.links {
|
||||
|
@ -201,10 +215,11 @@
|
|||
|
||||
<body>
|
||||
<header>
|
||||
<a href=".">
|
||||
<img class="logo" src="prettier.png">
|
||||
<a href="/">
|
||||
<img class="logo" src="/icon.png">
|
||||
<h2>Prettier</h2>
|
||||
</a>
|
||||
<h2 class="tagline"><em>Opinionated</em> code formatter</h2>
|
||||
|
||||
<span class="links">
|
||||
<a
|
||||
class="github-button"
|
||||
|
@ -270,7 +285,7 @@
|
|||
</p>
|
||||
</footer>
|
||||
|
||||
<script src="lib/sw-toolbox-companion.js" data-service-worker="service-worker.js"></script>
|
||||
<script src="/install-service-worker.js"></script>
|
||||
|
||||
<script async defer src="https://buttons.github.io/buttons.js"></script>
|
||||
</body>
|
|
@ -0,0 +1,128 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const PACKAGE = require("../package");
|
||||
const GITHUB_URL = `https://github.com/${PACKAGE.repository}`;
|
||||
|
||||
/* List of projects/orgs using your project for the users page */
|
||||
const users = [
|
||||
{
|
||||
caption: "React",
|
||||
image: `${GITHUB_URL}/raw/master/images/react-200x100.png`,
|
||||
infoLink: "https://facebook.github.io/react/",
|
||||
pinned: true
|
||||
},
|
||||
{
|
||||
caption: "Jest",
|
||||
image: `${GITHUB_URL}/raw/master/images/jest-200x100.png`,
|
||||
infoLink: "https://facebook.github.io/jest/",
|
||||
pinned: true
|
||||
},
|
||||
{
|
||||
caption: "Yarn",
|
||||
image: `${GITHUB_URL}/raw/master/images/yarn-200x100.png`,
|
||||
infoLink: "https://yarnpkg.com",
|
||||
pinned: true
|
||||
},
|
||||
{
|
||||
caption: "Babel",
|
||||
image: `${GITHUB_URL}/raw/master/images/babel-200x100.png`,
|
||||
infoLink: "https://babeljs.jo",
|
||||
pinned: true
|
||||
},
|
||||
{
|
||||
caption: "Zeit",
|
||||
image: `${GITHUB_URL}/raw/master/images/zeit-200x100.png`,
|
||||
infoLink: "https://zeit.co/",
|
||||
pinned: true
|
||||
},
|
||||
{
|
||||
caption: "Webpack CLI",
|
||||
image: `${GITHUB_URL}/raw/master/images/webpack-200x100.png`,
|
||||
infoLink: "https://webpack.js.org/api/cli/",
|
||||
pinned: true
|
||||
}
|
||||
];
|
||||
|
||||
const siteConfig = {
|
||||
title: "Prettier",
|
||||
githubUrl: GITHUB_URL,
|
||||
url: PACKAGE.homepage,
|
||||
baseUrl: "/",
|
||||
projectName: PACKAGE.name,
|
||||
repo: PACKAGE.repository,
|
||||
users,
|
||||
/* base url for editing docs, usage example: editUrl + 'en/doc1.md' */
|
||||
editUrl: `${GITHUB_URL}/edit/master/docs/`,
|
||||
/* header links for links on this site, 'LANGUAGE' will be replaced by whatever
|
||||
language the page is for, ex: 'en' */
|
||||
headerLinksInternal: [
|
||||
{
|
||||
section: "docs",
|
||||
href: "/docs/LANGUAGE/why-prettier.html",
|
||||
text: "Docs"
|
||||
},
|
||||
{
|
||||
section: "api",
|
||||
href: "/docs/LANGUAGE/why-prettier.html",
|
||||
text: "API"
|
||||
},
|
||||
{ section: "help", href: "/LANGUAGE/help/", text: "Help" },
|
||||
// {section: 'blog', href: '/test-site/blog', text: 'Blog'},
|
||||
{
|
||||
section: "playground",
|
||||
href: "/playground/",
|
||||
text: "Playground"
|
||||
}
|
||||
],
|
||||
/* header links for links outside the site */
|
||||
headerLinksExternal: [
|
||||
{
|
||||
section: "github",
|
||||
href: GITHUB_URL,
|
||||
text: "GitHub"
|
||||
}
|
||||
],
|
||||
/* path to images for header/footer */
|
||||
headerIcon: "icon.png",
|
||||
footerIcon: "icon.png",
|
||||
favicon: "icon.png",
|
||||
/* default link for docsSidebar */
|
||||
docsSidebarDefaults: {
|
||||
layout: "docs",
|
||||
root: "/docs/en/why-prettier.html",
|
||||
title: "Docs"
|
||||
},
|
||||
/* colors for website */
|
||||
colors: {
|
||||
primaryColor: "#1A2B34",
|
||||
secondaryColor: "#808080",
|
||||
prismColor:
|
||||
"rgba(26, 43, 52, 0.03)" /* primaryColor in rgba form, with 0.03 alpha */
|
||||
},
|
||||
tagline: "Opinonated Code Formatter"
|
||||
};
|
||||
|
||||
let languages;
|
||||
if (fs.existsSync("./languages.js")) {
|
||||
languages = require("./languages.js");
|
||||
siteConfig["en"] = require("./i18n/en.js");
|
||||
} else {
|
||||
languages = [
|
||||
{
|
||||
enabled: true,
|
||||
name: "English",
|
||||
tag: "en"
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
const enabledLanguages = languages.filter(lang => lang.enabled);
|
||||
|
||||
siteConfig.languages = enabledLanguages;
|
||||
|
||||
/* INJECT LOCALIZED FILES BEGIN */
|
||||
/* INJECT LOCALIZED FILES END */
|
||||
|
||||
module.exports = siteConfig;
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
|
@ -0,0 +1,9 @@
|
|||
"use strict";
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker.register("/service-worker.js", {
|
||||
scope: "/playground/"
|
||||
});
|
||||
}
|
|
@ -1292,8 +1292,8 @@ var author = "James Long";
|
|||
var license = "MIT";
|
||||
var main = "./index.js";
|
||||
var dependencies = { "babel-code-frame": "7.0.0-alpha.12", "babylon": "7.0.0-beta.13", "chalk": "1.1.3", "diff": "3.2.0", "esutils": "2.0.2", "flow-parser": "0.47.0", "get-stream": "3.0.0", "glob": "7.1.2", "graphql": "0.10.1", "jest-validate": "20.0.3", "json-to-ast": "2.0.0-alpha1.2", "minimist": "1.2.0", "parse5": "3.0.2", "postcss": "^6.0.1", "postcss-less": "^1.0.0", "postcss-media-query-parser": "0.2.3", "postcss-scss": "1.0.0", "postcss-selector-parser": "2.2.3", "postcss-values-parser": "git://github.com/shellscape/postcss-values-parser.git#5e351360479116f3fe309602cdd15b0a233bc29f", "typescript": "2.5.0-dev.20170617", "typescript-eslint-parser": "git://github.com/eslint/typescript-eslint-parser.git#cfddbfe3ebf550530aef2f1c6c4ea1d9e738d9c1" };
|
||||
var devDependencies = { "babel-cli": "6.24.1", "babel-preset-es2015": "6.24.1", "cross-spawn": "5.1.0", "eslint": "3.19.0", "eslint-friendly-formatter": "3.0.0", "eslint-plugin-prettier": "2.1.1", "jest": "20.0.0", "mkdirp": "^0.5.1", "prettier": "1.4.2", "rimraf": "2.6.1", "rollup": "0.41.1", "rollup-plugin-commonjs": "7.0.0", "rollup-plugin-json": "2.1.0", "rollup-plugin-node-builtins": "2.0.0", "rollup-plugin-node-globals": "1.1.0", "rollup-plugin-node-resolve": "2.0.0", "rollup-plugin-replace": "1.1.1", "sw-toolbox": "3.6.0", "uglify-es": "3.0.15", "webpack": "2.6.1" };
|
||||
var scripts = { "test": "jest", "test-integration": "jest tests_integration", "lint": "EFF_NO_LINK_RULES=true eslint . --format 'node_modules/eslint-friendly-formatter'", "build": "./scripts/build/build.sh" };
|
||||
var devDependencies = { "babel-cli": "6.24.1", "babel-preset-es2015": "6.24.1", "cross-spawn": "5.1.0", "eslint": "4.1.1", "eslint-friendly-formatter": "3.0.0", "eslint-plugin-prettier": "2.1.2", "jest": "20.0.0", "mkdirp": "^0.5.1", "prettier": "1.4.2", "rimraf": "2.6.1", "rollup": "0.41.1", "rollup-plugin-commonjs": "7.0.0", "rollup-plugin-json": "2.1.0", "rollup-plugin-node-builtins": "2.0.0", "rollup-plugin-node-globals": "1.1.0", "rollup-plugin-node-resolve": "2.0.0", "rollup-plugin-replace": "1.1.1", "shelljs": "0.7.8", "sw-toolbox": "3.6.0", "uglify-es": "3.0.15", "webpack": "2.6.1" };
|
||||
var scripts = { "test": "jest", "test-integration": "jest tests_integration", "lint": "EFF_NO_LINK_RULES=true eslint . --format 'node_modules/eslint-friendly-formatter'", "build": "./scripts/build/build.js" };
|
||||
var jest = { "setupFiles": ["<rootDir>/tests_config/run_spec.js"], "snapshotSerializers": ["<rootDir>/tests_config/raw-serializer.js"], "testRegex": "jsfmt\\.spec\\.js$|__tests__/.*\\.js$", "testPathIgnorePatterns": ["tests/new_react", "tests/more_react"] };
|
||||
var _package = {
|
||||
name: name,
|
||||
|
@ -3313,14 +3313,16 @@ function isStyledJsx(path$$1) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Template literal in this context:
|
||||
* Template literal in these contexts:
|
||||
* styled.button`color: red`
|
||||
* or
|
||||
* Foo.extend`color: red`
|
||||
* css`color: red`
|
||||
* keyframes`0% { opacity: 0; }`
|
||||
* injectGlobal`body{ margin:0: }`
|
||||
*/
|
||||
function isStyledComponents(path$$1) {
|
||||
var parent = path$$1.getParentNode();
|
||||
return parent && parent.type === "TaggedTemplateExpression" && parent.tag.type === "MemberExpression" && (parent.tag.object.name === "styled" || /^[A-Z]/.test(parent.tag.object.name) && parent.tag.property.name === "extend");
|
||||
return parent && parent.type === "TaggedTemplateExpression" && (parent.tag.type === "MemberExpression" && (parent.tag.object.name === "styled" || /^[A-Z]/.test(parent.tag.object.name) && parent.tag.property.name === "extend") || parent.tag.type === "Identifier" && parent.tag.name === "css");
|
||||
}
|
||||
|
||||
var multiparser$1 = {
|
||||
|
@ -4150,7 +4152,7 @@ function genericPrintNoParens(path$$1, options, print, args) {
|
|||
{
|
||||
var parent = path$$1.getParentNode();
|
||||
var parentParent = path$$1.getParentNode(1);
|
||||
var isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "DoStatement");
|
||||
var isInsideParenthesis = n !== parent.body && (parent.type === "IfStatement" || parent.type === "WhileStatement" || parent.type === "DoWhileStatement");
|
||||
|
||||
var _parts2 = printBinaryishExpressions(path$$1, print, options,
|
||||
/* isNested */false, isInsideParenthesis);
|
||||
|
@ -4882,7 +4884,7 @@ function genericPrintNoParens(path$$1, options, print, args) {
|
|||
}
|
||||
parts.push("while (");
|
||||
|
||||
parts.push(group$1(concat$2([indent$2(softline$1), path$$1.call(print, "test"), softline$1])), ")", semi);
|
||||
parts.push(group$1(concat$2([indent$2(concat$2([softline$1, path$$1.call(print, "test")])), softline$1])), ")", semi);
|
||||
|
||||
return concat$2(parts);
|
||||
}
|
||||
|
@ -5692,10 +5694,8 @@ function genericPrintNoParens(path$$1, options, print, args) {
|
|||
parts.push(printTypeScriptModifiers(path$$1, options, print));
|
||||
|
||||
// Global declaration looks like this:
|
||||
// declare global { ... }
|
||||
var isGlobalDeclaration = n.name.type === "Identifier" && n.name.name === "global" && n.modifiers && n.modifiers.some(function (modifier) {
|
||||
return modifier.type === "TSDeclareKeyword";
|
||||
});
|
||||
// (declare)? global { ... }
|
||||
var isGlobalDeclaration = n.name.type === "Identifier" && n.name.name === "global" && !/namespace|module/.test(options.originalText.slice(util$4.locStart(n), util$4.locStart(n.name)));
|
||||
|
||||
if (!isGlobalDeclaration) {
|
||||
parts.push(isExternalModule ? "module " : "namespace ");
|
||||
|
@ -10498,10 +10498,13 @@ function normalize(options) {
|
|||
normalized.parser = "parse5";
|
||||
} else if (/\.(ts|tsx)$/.test(filepath)) {
|
||||
normalized.parser = "typescript";
|
||||
} else if (/\.graphql$/.test(filepath)) {
|
||||
} else if (/\.(graphql|gql)$/.test(filepath)) {
|
||||
normalized.parser = "graphql";
|
||||
} else if (/\.json$/.test(filepath)) {
|
||||
normalized.parser = "json";
|
||||
}
|
||||
|
||||
if (normalized.parser === "json") {
|
||||
normalized.trailingComma = "none";
|
||||
}
|
||||
|
||||
|
@ -10863,7 +10866,7 @@ function isSourceElement(opts, node) {
|
|||
if (node == null) {
|
||||
return false;
|
||||
}
|
||||
switch (node.type) {
|
||||
switch (node.type || node.kind) {
|
||||
case "ObjectExpression": // JSON
|
||||
case "ArrayExpression": // JSON
|
||||
case "StringLiteral": // JSON
|
||||
|
@ -10901,8 +10904,24 @@ function isSourceElement(opts, node) {
|
|||
case "InterfaceDeclaration": // Flow, Typescript
|
||||
case "TypeAliasDeclaration": // Typescript
|
||||
case "ExportAssignment": // Typescript
|
||||
case "ExportDeclaration":
|
||||
// Typescript
|
||||
case "ExportDeclaration": // Typescript
|
||||
case "OperationDefinition": // GraphQL
|
||||
case "FragmentDefinition": // GraphQL
|
||||
case "VariableDefinition": // GraphQL
|
||||
case "TypeExtensionDefinition": // GraphQL
|
||||
case "ObjectTypeDefinition": // GraphQL
|
||||
case "FieldDefinition": // GraphQL
|
||||
case "DirectiveDefinition": // GraphQL
|
||||
case "EnumTypeDefinition": // GraphQL
|
||||
case "EnumValueDefinition": // GraphQL
|
||||
case "InputValueDefinition": // GraphQL
|
||||
case "InputObjectTypeDefinition": // GraphQL
|
||||
case "SchemaDefinition": // GraphQL
|
||||
case "OperationTypeDefinition": // GraphQL
|
||||
case "InterfaceTypeDefinition": // GraphQL
|
||||
case "UnionTypeDefinition": // GraphQL
|
||||
case "ScalarTypeDefinition":
|
||||
// GraphQL
|
||||
return true;
|
||||
}
|
||||
return false;
|
|
@ -8,8 +8,7 @@ function createCommonjsModule(fn, module) {
|
|||
}
|
||||
|
||||
var parserPostcss = createCommonjsModule(function (module) {
|
||||
module.exports =
|
||||
/******/ (function(modules) { // webpackBootstrap
|
||||
module.exports = /******/ (function(modules) { // webpackBootstrap
|
||||
/******/ // The module cache
|
||||
/******/ var installedModules = {};
|
||||
/******/
|
||||
|
@ -25140,7 +25139,7 @@ function requireParser(isSCSS) {
|
|||
}
|
||||
|
||||
function parse(text) {
|
||||
const isLikelySCSS = !!text.match(/(\w\s*: [^}:]+|#){|\@import[^\n]+(url|,)/);
|
||||
const isLikelySCSS = !!text.match(/(\w\s*: [^}:]+|#){|@import[^\n]+(url|,)/);
|
||||
try {
|
||||
return parseWithParser(requireParser(isLikelySCSS), text);
|
||||
} catch (e) {
|
|
@ -232,9 +232,9 @@ var process = {
|
|||
uptime: uptime
|
||||
};
|
||||
|
||||
var __dirname = '/Users/vjeux/random/prettier/dist';
|
||||
var __dirname = '/Users/azz/code/prettier/dist';
|
||||
|
||||
var __filename = '/Users/vjeux/random/prettier/dist/parser-typescript.js';
|
||||
var __filename = '/Users/azz/code/prettier/dist/parser-typescript.js';
|
||||
|
||||
var browser$1 = true;
|
||||
|
|
@ -0,0 +1 @@
|
|||
prettierVersion = "1.5.2";
|
|
@ -3,13 +3,13 @@
|
|||
"short_name": "Prettier",
|
||||
"description": "Opinionated code formatter",
|
||||
"lang": "en-US",
|
||||
"start_url": ".",
|
||||
"scope": ".",
|
||||
"start_url": "/",
|
||||
"scope": "/",
|
||||
"display": "browser",
|
||||
"theme_color": "#1A2B34",
|
||||
"icons": [
|
||||
{
|
||||
"src": "icon.png"
|
||||
"src": "/icon.png"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -19,7 +19,7 @@ var state = (function loadState(hash) {
|
|||
}
|
||||
})(decodeURIComponent(location.hash.slice(1)));
|
||||
|
||||
var worker = new Worker("./worker.js");
|
||||
var worker = new Worker("/worker.js");
|
||||
// Warm up the worker (load the current parser while CodeMirror loads)
|
||||
worker.postMessage({ text: "", options: state.options });
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
|
@ -0,0 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
/* eslint-env browser */
|
||||
|
||||
if (location.hash.substring(1).startsWith(encodeURIComponent("{"))) {
|
||||
location.pathname = "/playground/";
|
||||
}
|
|
@ -11,6 +11,7 @@ toolbox.precache([
|
|||
"lib/index.js",
|
||||
"lib/parser-babylon.js",
|
||||
"lib/parser-typescript.js",
|
||||
"lib/parser-postcss.js",
|
||||
"lib/parser-flow.js",
|
||||
"lib/parser-graphql.js",
|
||||
"lib/parser-json.js",
|
||||
|
@ -32,7 +33,12 @@ toolbox.precache([
|
|||
"https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.26.0/keymap/sublime.js",
|
||||
|
||||
// Images
|
||||
"prettier.png"
|
||||
"/prettier.png"
|
||||
]);
|
||||
|
||||
toolbox.router.default = toolbox.fastest;
|
||||
// Default to hit the cache only if there's a network error
|
||||
toolbox.router.default = toolbox.networkFirst;
|
||||
|
||||
// For scripts, stylesheets and images, we can use the "fastest" strategy
|
||||
// This means you need to reload twice to get new changes
|
||||
toolbox.router.get(/\.(js|css|png|svg)$/, toolbox.fastest);
|
File diff suppressed because it is too large
Load Diff
22
yarn.lock
22
yarn.lock
|
@ -1223,6 +1223,14 @@ eslint-plugin-prettier@2.1.2:
|
|||
fast-diff "^1.1.1"
|
||||
jest-docblock "^20.0.1"
|
||||
|
||||
eslint-plugin-react@7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.1.0.tgz#27770acf39f5fd49cd0af4083ce58104eb390d4c"
|
||||
dependencies:
|
||||
doctrine "^2.0.0"
|
||||
has "^1.0.1"
|
||||
jsx-ast-utils "^1.4.1"
|
||||
|
||||
eslint-scope@^3.7.1:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"
|
||||
|
@ -1508,6 +1516,10 @@ fstream@^1.0.0, fstream@^1.0.10, fstream@^1.0.2:
|
|||
mkdirp ">=0.5 0"
|
||||
rimraf "2"
|
||||
|
||||
function-bind@^1.0.2:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.0.tgz#16176714c801798e4e8f2cf7f7529467bb4a5771"
|
||||
|
||||
gauge@~2.7.3:
|
||||
version "2.7.4"
|
||||
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
|
||||
|
@ -1637,6 +1649,12 @@ has-unicode@^2.0.0:
|
|||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9"
|
||||
|
||||
has@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28"
|
||||
dependencies:
|
||||
function-bind "^1.0.2"
|
||||
|
||||
hash-base@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1"
|
||||
|
@ -2310,6 +2328,10 @@ jsprim@^1.2.2:
|
|||
json-schema "0.2.3"
|
||||
verror "1.3.6"
|
||||
|
||||
jsx-ast-utils@^1.4.1:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1"
|
||||
|
||||
kind-of@^3.0.2:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
|
||||
|
|
Loading…
Reference in New Issue