-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
14,396 additions
and
1 deletion.
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
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 @@ | ||
((nil . ((create-lockfiles . nil)))) |
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 @@ | ||
.#* |
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,128 @@ | ||
load("@bazel_skylib//rules:write_file.bzl", "write_file") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "copy_to_bin", "nodejs_test") | ||
load("@npm//react-scripts:index.bzl", "react_scripts", "react_scripts_test") | ||
|
||
# Filename conventions described at | ||
# https://create-react-app.dev/docs/running-tests#filename-conventions | ||
_TESTS = [ | ||
"src/**/*.test.js*", | ||
"src/**/*.test.ts*", | ||
"src/**/*.spec.js*", | ||
"src/**/*.spec.ts*", | ||
"src/**/__tests__/**/*.js*", | ||
"src/**/__tests__/**/*.ts*", | ||
] | ||
|
||
# We don't want to teach react-scripts to include from multiple directories | ||
# So we copy everything it wants to read to the output "bin" directory | ||
copy_to_bin( | ||
name = "copy_static_files", | ||
srcs = glob( | ||
[ | ||
"public/*", | ||
"src/**/*", | ||
], | ||
exclude = _TESTS, | ||
) + [ | ||
"package.json", | ||
"tsconfig.json", | ||
], | ||
) | ||
|
||
# react-scripts can only work if the working directory is the root of the application. | ||
# So we'll need to chdir before it runs. | ||
write_file( | ||
name = "write_chdir_script", | ||
out = "chdir.js", | ||
content = ["process.chdir(__dirname)"], | ||
) | ||
|
||
_RUNTIME_DEPS = [ | ||
"chdir.js", | ||
"copy_static_files", | ||
"@npm//react", | ||
"@npm//react-dom", | ||
] | ||
|
||
react_scripts( | ||
# Note: If you want to change the name make sure you update BUILD_PATH below accordingly | ||
# https://create-react-app.dev/docs/advanced-configuration/ | ||
name = "build", | ||
args = [ | ||
"--node_options=--require=../$(location chdir.js)", | ||
"build", | ||
], | ||
data = _RUNTIME_DEPS + [ | ||
"@npm//@types", | ||
"@npm//react-redux", | ||
"@npm//@reduxjs/toolkit", | ||
"@npm//bootstrap", | ||
"@npm//javascript-time-ago", | ||
"@npm//prop-types-exact", | ||
"@npm//prismjs", | ||
"@npm//reactstrap", | ||
], | ||
env = { | ||
"BUILD_PATH": "./build", | ||
}, | ||
output_dir = True, | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
nodejs_test( | ||
name = "build_smoke_test", | ||
data = [ | ||
"build", | ||
"@npm//@bazel/runfiles", | ||
], | ||
entry_point = "build_smoke_test.js", | ||
) | ||
|
||
copy_to_bin( | ||
name = "copy_test_files", | ||
srcs = glob(_TESTS), | ||
) | ||
|
||
react_scripts_test( | ||
name = "test", | ||
args = [ | ||
"--node_options=--require=$(rootpath chdir.js)", | ||
"test", | ||
# ibazel is the watch mode for Bazel when running tests | ||
# Because Bazel is really a CI system that runs locally | ||
"--watchAll=false", | ||
"--no-cache", | ||
"--no-watchman", | ||
"--ci", | ||
], | ||
data = _RUNTIME_DEPS + [ | ||
"copy_test_files", | ||
"@npm//@testing-library/jest-dom", | ||
"@npm//@testing-library/react", | ||
"@npm//@testing-library/user-event", | ||
], | ||
# Need to set the pwd to avoid jest needing a runfiles helper | ||
# Windows users with permissions can use --enable_runfiles | ||
# to make this test work | ||
tags = ["no-bazelci-windows"], | ||
) | ||
|
||
|
||
react_scripts( | ||
name = "start", | ||
args = [ | ||
"--node_options=--require=../$(location chdir.js)", | ||
"start", | ||
], | ||
data = _RUNTIME_DEPS, | ||
tags = [ | ||
# This tag instructs ibazel to pipe into stdin a event describing actions. | ||
# ibazel send EOF to stdin by default and `react-scripts start` will stop when getting EOF in stdin. | ||
# So use this to prevent EOF. | ||
"ibazel_notify_changes", | ||
], | ||
env = { | ||
"HOST": "0.0.0.0", | ||
"REACT_APP_HOST": "0.0.0.0", | ||
}, | ||
) |
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,7 @@ | ||
const assert = require('assert'); | ||
const fs = require('fs'); | ||
const {runfiles} = require('@bazel/runfiles'); | ||
|
||
// Make sure there's a file like build/static/js/main.12345678.chunk.js | ||
const jsDir = runfiles.resolvePackageRelative('build/static/js'); | ||
assert.ok(fs.readdirSync(jsDir).some(f => /main\.[0-9a-f]{8}\.chunk\.js/.test(f))); |
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 @@ | ||
process.chdir(__dirname) |
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,80 @@ | ||
{ | ||
"name": "site", | ||
"version": "0.1.0", | ||
"private": true, | ||
"dependencies": { | ||
"@babel/helper-regex": "^7.10.5", | ||
"@octokit/rest": "^18.0.12", | ||
"@reduxjs/toolkit": "^1.4.0", | ||
"bootstrap": "^4.5.3", | ||
"javascript-time-ago": "^2.3.8", | ||
"js-yaml": "^3.14.0", | ||
"js-yaml-loader": "^1.2.2", | ||
"parse-github-event": "^1.1.3", | ||
"prismjs": "^1.24.1", | ||
"prop-types-exact": "^1.2.0", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"react-markdown": "^5.0.3", | ||
"react-redux": "^7.2.4", | ||
"react-scripts": "4.0.1", | ||
"reactstrap": "^8.7.1", | ||
"typescript": "^4.3.5", | ||
"web-vitals": "^2.1.0", | ||
"yarn": "^1.22.10" | ||
}, | ||
"devDependencies": { | ||
"@bazel/ibazel": "^0.15.10", | ||
"@bazel/runfiles": "^3.7.0", | ||
"@testing-library/jest-dom": "^5.11.6", | ||
"@testing-library/react": "^11.2.2", | ||
"@testing-library/user-event": "^12.3.0", | ||
"@wojtekmaj/enzyme-adapter-react-17": "^0.3.2", | ||
"enzyme": "^3.11.0", | ||
"patch-package": "^6.2.2" | ||
}, | ||
"scripts": { | ||
"start": "ibazel run //:start", | ||
"build": "bazel build //:build", | ||
"test": "ibazel test //:test", | ||
"postinstall": "patch-package", | ||
"lint": "./node_modules/.bin/eslint --max-warnings 0 src" | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"react-app", | ||
"react-app/jest" | ||
] | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 1 chrome version", | ||
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"jest": { | ||
"coverageReporters": [ | ||
"lcov", | ||
"text" | ||
], | ||
"coveragePathIgnorePatterns": [ | ||
"node_modules" | ||
], | ||
"collectCoverageFrom": [ | ||
"**/*.{js,jsx}", | ||
"!**/*.eslintrc.js", | ||
"!**/coverage/**", | ||
"!**/dist/**", | ||
"!**/node_modules/**" | ||
], | ||
"testMatch": [ | ||
"**/tests/**/*.js?(x)" | ||
] | ||
} | ||
} |
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,21 @@ | ||
diff --git a/node_modules/jest-haste-map/build/crawlers/node.js b/node_modules/jest-haste-map/build/crawlers/node.js | ||
index 1e7372c..3d3d5f7 100644 | ||
--- a/node_modules/jest-haste-map/build/crawlers/node.js | ||
+++ b/node_modules/jest-haste-map/build/crawlers/node.js | ||
@@ -217,7 +217,16 @@ function find(roots, extensions, ignore, callback) { | ||
|
||
function findNative(roots, extensions, ignore, callback) { | ||
const args = Array.from(roots); | ||
+ // In bazel's execution environment, all source/test files are symlinked | ||
+ // into a sandboxed directory rather than copied over directly. | ||
+ // Jest's crawler is currently set up to use find's type flag to filter only for files. | ||
+ // This excludes symlinked files. | ||
+ // https://github.com/facebook/jest/pull/9351#issuecomment-780637294 | ||
+ args.push('('); | ||
args.push('-type', 'f'); | ||
+ args.push('-o'); | ||
+ args.push('-type', 'l'); | ||
+ args.push(')'); | ||
|
||
if (extensions.length) { | ||
args.push('('); |
Binary file not shown.
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,20 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="theme-color" content="#000000" /> | ||
<meta | ||
name="description" | ||
content="Experiment with envoy configurations and containers" | ||
/> | ||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> | ||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" /> | ||
<title>Envoy playground</title> | ||
</head> | ||
<body> | ||
<noscript>You need to enable JavaScript to run this app.</noscript> | ||
<div id="root"></div> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,25 @@ | ||
{ | ||
"short_name": "Envoy playground", | ||
"name": "Envoy proxy, services and networking playground", | ||
"icons": [ | ||
{ | ||
"src": "favicon.ico", | ||
"sizes": "64x64 32x32 24x24 16x16", | ||
"type": "image/x-icon" | ||
}, | ||
{ | ||
"src": "logo192.png", | ||
"type": "image/png", | ||
"sizes": "192x192" | ||
}, | ||
{ | ||
"src": "logo512.png", | ||
"type": "image/png", | ||
"sizes": "512x512" | ||
} | ||
], | ||
"start_url": ".", | ||
"display": "standalone", | ||
"theme_color": "#000000", | ||
"background_color": "#ffffff" | ||
} |
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,3 @@ | ||
# https://www.robotstxt.org/robotstxt.html | ||
User-agent: * | ||
Disallow: |
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,39 @@ | ||
|
||
import React from 'react'; | ||
|
||
import {Provider} from 'react-redux'; | ||
|
||
import 'bootstrap/dist/css/bootstrap.min.css'; | ||
import './css/playground-site.css'; | ||
|
||
import {EnvoyDistroPage} from '../layout'; | ||
import {EnvoyDistroSiteContext} from "./context"; | ||
import EnvoyDistroSite from './site'; | ||
|
||
import store from "./store"; | ||
|
||
|
||
export default class EnvoyDistroSiteApp extends React.PureComponent { | ||
|
||
state = {site: null} | ||
|
||
async componentDidMount () { | ||
const site = new EnvoyDistroSite(store); | ||
await site.load(); | ||
this.setState({site}); | ||
} | ||
|
||
render () { | ||
const {site} = this.state; | ||
if (!site) { | ||
return ''; | ||
} | ||
return ( | ||
<Provider store={store}> | ||
<EnvoyDistroSiteContext.Provider value={site}> | ||
<EnvoyDistroPage /> | ||
</EnvoyDistroSiteContext.Provider> | ||
</Provider> | ||
); | ||
} | ||
} |
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,7 @@ | ||
|
||
import React from 'react'; | ||
|
||
const EnvoyDistroSiteContext = React.createContext(); | ||
|
||
|
||
export {EnvoyDistroSiteContext}; |
Oops, something went wrong.