Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-robots-txt

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-robots-txt - npm Package Compare versions

Comparing version 0.5.0 to 1.0.0

Changelog.md

104

package.json
{
"name": "express-robots-txt",
"version": "0.5.0",
"version": "1.0.0",
"description": "Express middleware to serve and generate robots.txt",
"main": "index.js",
"directories": {
"test": "test"
"type": "commonjs",
"main": "./commonjs/index.js",
"exports": {
".": {
"require": "./commonjs/index.js",
"default": "./esm/index.mjs"
}
},
"module": "./esm/index.mjs",
"files": [
"esm/*",
"commonjs/*"
],
"scripts": {
"test": "jest"
"test:esm": "NODE_OPTIONS=\"--no-warnings --experimental-modules --experimental-vm-modules\" jest -c test/esm/jest.config.mjs",
"test:commonjs": "jest -c test/commonjs/jest.config.js",
"test": "yarn test:esm && yarn test:commonjs",
"lint": "eslint --fix esm/*.mjs test/esm/*.mjs test/commonjs/*.js",
"build:cjs": "babel esm --out-dir commonjs/ --source-maps",
"build": "yarn lint && yarn build:cjs && yarn test"
},

@@ -34,6 +48,17 @@ "repository": {

"devDependencies": {
"@babel/cli": "^7.14.8",
"@babel/core": "^7.15.0",
"@babel/eslint-parser": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"babel-plugin-add-module-exports": "^1.0.4",
"chai": "^4.1.2",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-jest": "^24.4.0",
"express": "^4.12.1",
"jest": "^26.1.0",
"supertest": "^4.0.2"
"jest": "27.0.6",
"jest-config": "^27.0.6",
"supertest": "^6.0.0"
},

@@ -43,10 +68,65 @@ "peerDependencies": {

},
"jest": {
"setupFilesAfterEnv": [
"<rootDir>/test/setup-test-framework-script.js"
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
],
"testMatch": [
"<rootDir>/test/index.js"
"plugins": [
"add-module-exports"
]
},
"eslintConfig": {
"env": {
"browser": false,
"es6": true,
"node": true
},
"extends": [
"airbnb-base"
],
"parser": "@babel/eslint-parser",
"parserOptions": {
"sourceType": "module",
"allowImportExportEverywhere": false,
"ecmaFeatures": {
"globalReturn": false
},
"requireConfigFile": false
},
"plugins": [
"babel"
],
"rules": {
"import/extensions": [
"error",
{
"mjs": "always"
}
],
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"never"
],
"strict": 0,
"no-underscore-dangle": 0
}
}
}
# express-robots-txt [![npm version](https://badge.fury.io/js/express-robots-txt.svg)](https://badge.fury.io/js/express-robots-txt) ![Node.js CI](https://github.com/modosc/express-robots-txt/workflows/Node.js%20CI/badge.svg)
Express middleware for generating a robots.txt or responding with an existing file. Forked from [weo-edu/express-robots](https://github.com/weo-edu/express-robots).
Express middleware for generating a robots.txt or responding with an existing file.
# Usage
```javascript
// es6 usage requires a version of node which supports esm_conditional_exports, see
// https://nodejs.org/api/esm.html#esm_conditional_exports
import express from 'express'
import robots from 'express-robots-txt'
// commonjs
const express = require('express')
const robots = require('express-robots-txt')
const app = express()
const port = 3000
app.use(robots({
UserAgent: '*',
Disallow: '/',
CrawlDelay: '5',
Sitemap: 'https://nowhere.com/sitemap.xml',
}))
app.listen(port)
```
## Using a file

@@ -16,3 +38,6 @@

```javascript
app.use(robots({ UserAgent: '*', Disallow: '/' }))
app.use(robots({
UserAgent: '*',
Disallow: '/'
}))
```

@@ -30,3 +55,7 @@

```javascript
app.use(robots({ UserAgent: '*', Disallow: '/', CrawlDelay: '5' }))
app.use(robots({
UserAgent: '*',
Disallow: '/',
CrawlDelay: '5'
}))
```

@@ -45,3 +74,8 @@

```javascript
app.use(robots({ UserAgent: '*', Disallow: '/', CrawlDelay: '5', Sitemap: 'https://nowhere.com/sitemap.xml' }))
app.use(robots({
UserAgent: '*',
Disallow: '/',
CrawlDelay: '5',
Sitemap: 'https://nowhere.com/sitemap.xml'
}))
```

@@ -60,3 +94,11 @@

```javascript
app.use(robots({ UserAgent: '*', Disallow: '/', CrawlDelay: '5', Sitemap: ['https://nowhere.com/sitemap.xml', 'https://nowhere.com/sitemap2.xml'] }))
app.use(robots({
UserAgent: '*',
Disallow: '/',
CrawlDelay: '5',
Sitemap: [
'https://nowhere.com/sitemap.xml',
'https://nowhere.com/sitemap2.xml'
]
}))
```

@@ -128,3 +170,8 @@

```javascript
app.use(robots({ UserAgent: '*', Disallow: '/', CrawlDelay: '5', Host: 'foobar.com' }))
app.use(robots({
UserAgent: '*',
Disallow: '/',
CrawlDelay: '5',
Host: 'foobar.com'
}))
```

@@ -139,1 +186,4 @@

```
## Thanks
Originally forked from [weo-edu/express-robots](https://github.com/weo-edu/express-robots).
.editorconfig
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc