-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2361 from botpress/patch/12-1-4
Patch 12.1.4
- Loading branch information
Showing
384 changed files
with
11,127 additions
and
2,872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
events { | ||
} | ||
|
||
http { | ||
|
||
include mime.types; | ||
|
||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import scrapy | ||
|
||
|
||
class BrokenLinksSpider(scrapy.Spider): | ||
""" | ||
Finds broken links on your website | ||
Source: https://gist.github.com/mdamien/7b71ef06f49de1189fb75f8fed91ae82 | ||
""" | ||
name = 'brokenlink-checker' | ||
|
||
|
||
def __init__(self, site, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
self.start_urls = [site] | ||
self.DOMAIN = site.split('//')[1] | ||
|
||
|
||
def parse(self, response): | ||
if response.status in (404, 500): | ||
item = {} | ||
item['url'] = response.url | ||
item['prev_page'] = response.meta['prev_url'] | ||
item['prev_link_url'] = response.meta['prev_href'] | ||
item['prev_link_text'] = response.meta['prev_link_text'] | ||
item['status'] = response.status | ||
|
||
yield item | ||
|
||
if self.DOMAIN in response.url: | ||
for link in response.css('a'): | ||
href = link.xpath('@href').extract() | ||
text = link.xpath('text()').extract() | ||
if href: | ||
yield response.follow(link, self.parse, meta={ | ||
'prev_link_text': text, | ||
'prev_href': href, | ||
'prev_url': response.url, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Codestyle | ||
on: [push] | ||
jobs: | ||
run_prettier: | ||
name: Run Prettier on codebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
- name: Install Dependencies | ||
run: | | ||
yarn | ||
- name: Run Prettier | ||
run: | | ||
./node_modules/prettier/bin-prettier.js --check '{src,modules}/**/*.ts' '!**/*.d.ts' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Validate documentation | ||
on: [push] | ||
jobs: | ||
check_404s: | ||
name: Check for 404 errors in docs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
- name: Install NGINX | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install nginx | ||
mkdir -p /etc/nginx | ||
sudo cp .github/workflows/code/validate-docs/nginx.conf /etc/nginx/ | ||
- name: Build docs | ||
working-directory: docs/guide/website | ||
run: | | ||
yarn | ||
yarn build | ||
sudo cp -a build/botpress-docs/. /usr/share/nginx/html/ | ||
- name: Start NGINX | ||
run: | | ||
sudo service nginx restart | ||
- name: Install python3 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.x' | ||
architecture: 'x64' | ||
- name: Scrape docs for 404s | ||
run: | | ||
pip install scrapy | ||
scrapy runspider -o errors.csv -a site="http://localhost" .github/workflows/code/validate-docs/spider.py -s HTTPERROR_ALLOW_ALL=True -s LOG_LEVEL=INFO | ||
- name: Check scrape results | ||
run: | | ||
ERRORS_COUNT=$(cat errors.csv | wc -l) | ||
echo "Found $ERRORS_COUNT errors" | ||
cat errors.csv | ||
if [ "$ERRORS_COUNT" != "0" ]; then | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env TS_NODE_COMPILER_OPTIONS={"downlevelIteration":true} ts-node | ||
|
||
import chalk from 'chalk' | ||
import * as cp from 'child_process' | ||
import * as fs from 'fs' | ||
import * as fse from 'fs-extra' | ||
import * as glob from 'glob' | ||
import * as path from 'path' | ||
|
||
const IS_DRY_RUN = !process.argv.includes('--apply') | ||
const files = glob.sync('**/package.json', { ignore: ['**/node_modules/**', 'examples/**'] }) | ||
|
||
function* amendFiles(yarnInstall: boolean) { | ||
let count = 0 | ||
for (const file of files) { | ||
const content = fse.readJsonSync(file) | ||
if (content && content.author && content.author.toLowerCase().includes('botpress')) { | ||
let save = false | ||
const saveFn = () => (save = true) | ||
yield [content, file, saveFn] | ||
if (!save) { | ||
console.log(chalk.grey(`Skipping ${file} (no changes)`)) | ||
continue | ||
} | ||
|
||
count++ | ||
|
||
if (IS_DRY_RUN) { | ||
console.log(chalk.bold(`==> File ${chalk.bold(file)} has changes (DRY RUN)`)) | ||
} else { | ||
console.log(chalk.bold(`==> Applying changes to ${chalk.bold(file)}`)) | ||
fse.writeJsonSync(file, content, { spaces: 2 }) | ||
} | ||
|
||
if (!IS_DRY_RUN && yarnInstall) { | ||
console.log(chalk.grey(`==> yarn install --force`)) | ||
try { | ||
cp.execSync('yarn install --force', { | ||
env: process.env, | ||
cwd: path.dirname(file), | ||
stdio: [ | ||
0, // Use parent's stdin for child. | ||
'ignore', // Pipe child's stdout to parent. | ||
fs.openSync('err.out', 'w') // Direct child's stderr to a file. | ||
] | ||
}) | ||
console.log(chalk.green(` success`)) | ||
} catch (err) { | ||
console.error(chalk.red(`==> ERROR running yarn install (see err.out)`)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
console.log(chalk.bold(`Done processing ${files.length} files`)) | ||
|
||
if (count > 0) { | ||
console.log(chalk.green(`Changed ${chalk.bold(count.toString())} files successfully`)) | ||
if (IS_DRY_RUN) { | ||
console.log(chalk.red.bold(`THIS WAS A DRY RUN, SO NO FILE WAS ACTUALLY CHANGED`)) | ||
console.log(chalk.red(`Run this again with ${chalk.bold('--apply')} to execute the changes`)) | ||
} | ||
} else { | ||
console.log(chalk.green('There are no changes')) | ||
} | ||
} | ||
|
||
/** | ||
* Content : package.json content | ||
* file: file name | ||
* save: function to be called if you want to apply changes | ||
* | ||
* Amend the content to of the package.json as you please and call save if necessary | ||
*/ | ||
for (const [content, file, save] of amendFiles(true)) { | ||
// fstream vulnerability CVE-2019-13173 | ||
if (!content.resolutions || !content.resolutions.fstream) { | ||
content.resolutions = Object.assign({}, content.resolutions, { | ||
fstream: '>=1.0.12' | ||
}) | ||
save() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,8 @@ | |
}, | ||
"dependencies": { | ||
"artillery": "^1.6.0-25" | ||
}, | ||
"resolutions": { | ||
"fstream": ">=1.0.12" | ||
} | ||
} |
Oops, something went wrong.