Skip to content

Commit 9f8b327

Browse files
committed
feat: use fs promise
1 parent 928e4ae commit 9f8b327

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

README.md

+20-14
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ module.exports = {
3131

3232
## Options
3333

34-
This plugin uses [`generate-robotstxt`](https://github.com/itgalaxy/generate-robotstxt#usage) to generate content of `robots.txt` and it has the following options:
34+
This plugin uses [`generate-robotstxt`](https://github.com/itgalaxy/generate-robotstxt#usage) to generate content
35+
of `robots.txt` and it has the following options:
3536

3637
| Name | Type | Default | Description |
3738
| :----------: | :--------: | :-----------------------------------: | :----------------------------------------------------------------------------: |
@@ -51,7 +52,7 @@ module.exports = {
5152
options: {
5253
host: 'https://www.example.com',
5354
sitemap: 'https://www.example.com/sitemap.xml',
54-
policy: [{ userAgent: '*', allow: '/' }]
55+
policy: [{userAgent: '*', allow: '/'}]
5556
}
5657
}
5758
]
@@ -60,7 +61,6 @@ module.exports = {
6061

6162
### `env`-option
6263

63-
6464
`gatsby-config.js`
6565

6666
```js
@@ -73,10 +73,10 @@ module.exports = {
7373
sitemap: 'https://www.example.com/sitemap.xml',
7474
env: {
7575
development: {
76-
policy: [{ userAgent: '*', disallow: ['/'] }]
76+
policy: [{userAgent: '*', disallow: ['/']}]
7777
},
7878
production: {
79-
policy: [{ userAgent: '*', allow: '/' }]
79+
policy: [{userAgent: '*', allow: '/'}]
8080
}
8181
}
8282
}
@@ -85,7 +85,9 @@ module.exports = {
8585
};
8686
```
8787

88-
The `env` key will be taken from `process.env.GATSBY_ACTIVE_ENV` first (see [Gatsby Environment Variables](https://www.gatsbyjs.org/docs/environment-variables/) for more information on this variable), falling back to `process.env.NODE_ENV`. When this is not available then it defaults to `development`.
88+
The `env` key will be taken from `process.env.GATSBY_ACTIVE_ENV` first (
89+
see [Gatsby Environment Variables](https://www.gatsbyjs.org/docs/environment-variables/) for more information on this
90+
variable), falling back to `process.env.NODE_ENV`. When this is not available then it defaults to `development`.
8991

9092
You can resolve the `env` key by using `resolveEnv` function:
9193

@@ -102,10 +104,10 @@ module.exports = {
102104
resolveEnv: () => process.env.GATSBY_ENV,
103105
env: {
104106
development: {
105-
policy: [{ userAgent: '*', disallow: ['/'] }]
107+
policy: [{userAgent: '*', disallow: ['/']}]
106108
},
107109
production: {
108-
policy: [{ userAgent: '*', allow: '/' }]
110+
policy: [{userAgent: '*', allow: '/'}]
109111
}
110112
}
111113
}
@@ -139,13 +141,15 @@ module.exports = {
139141
module.exports = {
140142
host: 'https://www.example.com',
141143
sitemap: 'https://www.example.com/sitemap.xml',
142-
policy: [{ userAgent: '*' }]
144+
policy: [{userAgent: '*'}]
143145
};
144146
```
145147

146148
#### Netlify
147149

148-
If you would like to disable crawlers for [deploy-previews](https://www.netlify.com/blog/2016/07/20/introducing-deploy-previews-in-netlify/) you can use the following snippet:
150+
If you would like to disable crawlers
151+
for [deploy-previews](https://www.netlify.com/blog/2016/07/20/introducing-deploy-previews-in-netlify/) you can use the
152+
following snippet:
149153

150154
`gatsby-config.js`
151155

@@ -170,15 +174,15 @@ module.exports = {
170174
resolveEnv: () => NETLIFY_ENV,
171175
env: {
172176
production: {
173-
policy: [{ userAgent: '*' }]
177+
policy: [{userAgent: '*'}]
174178
},
175179
'branch-deploy': {
176-
policy: [{ userAgent: '*', disallow: ['/'] }],
180+
policy: [{userAgent: '*', disallow: ['/']}],
177181
sitemap: null,
178182
host: null
179183
},
180184
'deploy-preview': {
181-
policy: [{ userAgent: '*', disallow: ['/'] }],
185+
policy: [{userAgent: '*', disallow: ['/']}],
182186
sitemap: null,
183187
host: null
184188
}
@@ -191,7 +195,9 @@ module.exports = {
191195

192196
### `query`-option
193197

194-
By default the site URL will come from the Gatsby node `site.siteMeta.siteUrl`. Like in [Gatsby's sitemap plugin](https://www.gatsbyjs.org/packages/gatsby-plugin-sitemap/) an optional GraphQL query can be used to provide a different value from another data source as long as it returns the same shape:
198+
By default the site URL will come from the Gatsby node `site.siteMeta.siteUrl`. Like
199+
in [Gatsby's sitemap plugin](https://www.gatsbyjs.org/packages/gatsby-plugin-sitemap/) an optional GraphQL query can be
200+
used to provide a different value from another data source as long as it returns the same shape:
195201

196202
`gatsby-config.js`
197203

0 commit comments

Comments
 (0)