Skip to content

Commit

Permalink
Merge branch 'main' into dunitz/cache-invalidation
Browse files Browse the repository at this point in the history
  • Loading branch information
tihuan authored Sep 30, 2021
2 parents 9dfbd92 + 24d7b63 commit 70e4c55
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 40 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/sastisfaction.yml

This file was deleted.

5 changes: 0 additions & 5 deletions client/__tests__/e2e/screenshot_env.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const PuppeteerEnvironment = require("jest-environment-puppeteer");
require("jest-circus");
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const ENV_DEFAULT = require("../../../environment.default.json");

// @ts-expect-error ts-migrate(2451) FIXME: Cannot redeclare block-scoped variable 'takeScreen... Remove this comment to see the full error message
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const takeScreenshot = require("./takeScreenshot");

class ScreenshotEnvironment extends PuppeteerEnvironment {
Expand Down
7 changes: 7 additions & 0 deletions client/configuration/eslint/eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ module.exports = {
],
},
overrides: [
// Override some TypeScript rules just for .js files
{
files: ["*.js"],
rules: {
"@typescript-eslint/no-var-requires": "off",
},
},
{
files: ["**/*.test.ts"],
env: {
Expand Down
15 changes: 10 additions & 5 deletions client/configuration/webpack/webpack.config.shared.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/* eslint-disable @blueprintjs/classes-constants -- we don't import blueprint here */
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const path = require("path");
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const fs = require("fs");
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const ObsoleteWebpackPlugin = require("obsolete-webpack-plugin");
// eslint-disable-next-line @typescript-eslint/no-var-requires --- FIXME: disabled temporarily on migrate to TS.
const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin");
const webpack = require("webpack");

const src = path.resolve("src");
const nodeModules = path.resolve("node_modules");
Expand All @@ -22,6 +18,8 @@ const rawObsoleteHTMLTemplate = fs.readFileSync(

const obsoleteHTMLTemplate = rawObsoleteHTMLTemplate.replace(/'/g, '"');

const deploymentStage = process.env.DEPLOYMENT_STAGE || "test";

module.exports = {
entry: [
"core-js",
Expand Down Expand Up @@ -78,6 +76,13 @@ module.exports = {
new ScriptExtHtmlWebpackPlugin({
async: "obsolete",
}),
new webpack.DefinePlugin({
PLAUSIBLE_DATA_DOMAIN: JSON.stringify(
deploymentStage === "prod"
? "cellxgene.cziscience.com"
: "cellxgene.staging.single-cell.czi.technology"
),
}),
],
};
/* eslint-enable @blueprintjs/classes-constants -- we don't import blueprint here */
5 changes: 5 additions & 0 deletions client/index_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
box-sizing: border-box;
}
</style>
<script
defer
data-domain="<%= PLAUSIBLE_DATA_DOMAIN %>"
src="https://plausible.io/js/plausible.js"
></script>
</head>
<body>
<script type="text/javascript">
Expand Down
7 changes: 5 additions & 2 deletions server/eb/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ def _before_adding_routes(app, app_config):
# this should print the failing script's hash to console.
# See more here: https://github.com/chanzuckerberg/cellxgene/pull/1745
obsolete_browser_script_hash = ["'sha256-/rmgOi/skq9MpiZxPv6lPb1PNSN+Uf4NaUHO/IjyfwM='"]

PLAUSIBLE_URL = "https://plausible.io"

csp = {
"default-src": ["'self'"],
"connect-src": ["'self'"] + extra_connect_src,
"script-src": ["'self'", "'unsafe-eval'"] + obsolete_browser_script_hash + script_hashes,
"connect-src": ["'self'", PLAUSIBLE_URL] + extra_connect_src,
"script-src": ["'self'", "'unsafe-eval'", PLAUSIBLE_URL] + obsolete_browser_script_hash + script_hashes,
"style-src": ["'self'", "'unsafe-inline'"],
"img-src": ["'self'", "https://cellxgene.cziscience.com", "data:"],
"object-src": ["'none'"],
Expand Down
2 changes: 1 addition & 1 deletion server/tests/unit/eb/test_eb.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def test_config(self):
# test failure mode (flask_secret_key not set)
env = os.environ.copy()
env.pop("CXG_SECRET_KEY", None)
env["PYTHONPATH"] = PROJECT_ROOT
with self.assertRaises(subprocess.CalledProcessError) as exception_context:
subprocess.check_output(command, env=env)
output = str(exception_context.exception.stdout, "utf-8")
Expand All @@ -75,7 +76,6 @@ def test_config(self):
self.assertEqual(exception_context.exception.returncode, 1)

# test passing case
env = os.environ.copy()
env["CXG_SECRET_KEY"] = "secret"
output = subprocess.check_output(command, env=env)
output = str(output, "utf-8")
Expand Down

0 comments on commit 70e4c55

Please sign in to comment.