Skip to content

Commit 27d3f91

Browse files
committed
Merge from master and resolve conflicts
2 parents 234fd07 + 55ae9ec commit 27d3f91

25 files changed

Lines changed: 810 additions & 200 deletions

.githooks/pre-commit

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh
2+
3+
# Setup for the check for filenames with non-ASCII characters
4+
if git rev-parse --verify HEAD >/dev/null 2>&1
5+
then
6+
against=HEAD
7+
else
8+
# Initial commit: diff against an empty tree object
9+
against=$(git hash-object -t tree /dev/null)
10+
fi
11+
12+
# If you want to allow non-ASCII filenames set this variable to true.
13+
allownonascii=$(git config --type=bool hooks.allownonascii)
14+
15+
# Redirect output to stderr.
16+
exec 1>&2
17+
18+
# Cross platform projects tend to avoid non-ASCII filenames; prevent
19+
# them from being added to the repository. We exploit the fact that the
20+
# printable range starts at the space character and ends with tilde.
21+
if [ "$allownonascii" != "true" ] &&
22+
# Note that the use of brackets around a tr range is ok here, (it's
23+
# even required, for portability to Solaris 10's /usr/bin/tr), since
24+
# the square bracket bytes happen to fall in the designated range.
25+
test $(git diff-index --cached --name-only --diff-filter=A -z $against |
26+
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
27+
then
28+
cat <<\EOF
29+
Error: Attempt to add a non-ASCII file name.
30+
This can cause problems if you want to work with people on other platforms.
31+
To be portable it is advisable to rename the file.
32+
If you know what you are doing you can disable this check using:
33+
git config hooks.allownonascii true
34+
EOF
35+
exit 1
36+
fi
37+
38+
# lints changed JavaScript and TypeScript
39+
changed_js=$(git diff-index --cached --name-only $against | grep -E "(.*\.(js|mjs|ts|mts)|scripts/.*\.(js|mjs|ts|mts)|src/.*\.(js|mjs|ts|mts)|test/.*\.(js|mjs|ts|mts)|admin/.*\.(js|mjs|ts|mts)|admin/src/.*\.(js|mjs|ts|mts))$")
40+
# /dev/null prevents eslint from checking everything
41+
./node_modules/.bin/eslint ${changed_js:-/dev/null}
42+
LINT_STATUS=$?
43+
if [ "$LINT_STATUS" != "0" ]; then
44+
echo 'Fix the errors above, then use `git add` to restage all fixed files'
45+
exit $LINT_STATUS
46+
fi
47+
48+
# lints changed HTML
49+
changed_html=$(git diff-index --cached --name-only $against | grep -E "^src/.*\.html$")
50+
# src/tokens.html prevents htmlhint from checking everything
51+
node_modules/.bin/htmlhint ${changed_html:-src/tokens.html}
52+
LINT_STATUS=$?
53+
if [ "$LINT_STATUS" != "0" ]; then
54+
echo 'Fix the errors above, then use `git add` to restage all fixed files'
55+
exit $LINT_STATUS
56+
fi
57+
58+
# runs all automated tests
59+
npm run test:unit
60+
61+
# If there are whitespace errors, print the offending file names and fail.
62+
exec git diff-index --check --cached $against --

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ jspm_packages/
5757
# Ignore dist folder with webpack build output
5858
dist/
5959
dist-types/
60+
# local storybook files
6061
storybook-static/
62+
admin/storybook-static/
6163
webpack-stats.json
6264
spritesheet.json
6365
spritesheet.png
@@ -66,6 +68,13 @@ spritesheet.png
6668
# Generated type declarations from local builds (source types live under /types)
6769
src/**/*.d.ts
6870

71+
# Admin
72+
admin/node_modules/
73+
admin/dist/
74+
admin/build_output.log
75+
76+
# Reticulum
77+
reticulum/
6978
.DS_Store
7079

7180
certs/

.vscode/settings.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@
1717
},
1818
"[html]": {
1919
"editor.defaultFormatter": "vscode.html-language-features" // Set to esbenp.prettier-vscode when we are ready to reformat all HTML files
20-
},
21-
"i18n-ally.localesPaths": ["src/assets/locales"],
22-
"i18n-ally.keystyle": "nested"
20+
}
2321
}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ Read our [contributor guide](./CONTRIBUTING.md) to learn how you can submit bug
4545

4646
We're also looking for help with localization. The Hubs redesign has a lot of new text and we need help from people like you to translate it. Follow the [localization docs](./src/assets/locales/README.md) to get started.
4747

48+
A Git hook will run before each commit, to lint and test the code.
49+
Fix the issues it complains about, then the hook will allow your commit.
50+
The checks are also run in Continuous Integration, so you'll be requested to fix a Pull Request that fails these checks — the Git hook just gives you faster feedback.
51+
In unusual situations, you can suppress the checks by adding the flag `-n` to your commit command.
52+
53+
To run the checks *before* you commit, run `npm run test`.
54+
4855
Contributors are expected to abide by the project's [Code of Conduct](./CODE_OF_CONDUCT.md) and to be respectful of the project and people working on it.
4956

5057
## Additional Resources

admin/.storybook/preview.js

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,10 @@
11
import React from "react";
22
import { IntlProvider } from "react-intl";
3-
import { createTheme, ThemeProvider } from "@material-ui/core/styles";
3+
import { ThemeProvider } from "@material-ui/core/styles";
44
import { Provider } from "react-redux";
55
import mockStore from "./mocks/store.js";
66
import "../src/styles/globals.scss";
7-
8-
// Admin theme matching the one in admin.js
9-
const adminTheme = createTheme({
10-
components: {
11-
MuiDrawer: {
12-
styleOverrides: {
13-
paper: {
14-
backgroundColor: "#222222",
15-
minHeight: "100vh",
16-
position: "sticky",
17-
top: 0,
18-
overflowX: "hidden"
19-
}
20-
}
21-
},
22-
MuiAppBar: {
23-
styleOverrides: {
24-
root: {
25-
position: "sticky",
26-
top: 0,
27-
zIndex: 1100
28-
}
29-
}
30-
}
31-
},
32-
palette: {
33-
primary: {
34-
main: "#1700c7"
35-
},
36-
secondary: {
37-
main: "#000000"
38-
}
39-
},
40-
typography: {
41-
fontFamily: "Inter,Arial"
42-
}
43-
});
7+
import { adminTheme } from "../src/admin-theme";
448

459
// Simple messages for preview
4610
const messages = {
@@ -57,8 +21,8 @@ const AdminLayout = ({ children }) => {
5721
<Provider store={mockStore}>
5822
<IntlProvider locale="en" messages={messages}>
5923
<ThemeProvider theme={adminTheme}>
60-
<div style={{ fontFamily: "Inter,Arial", margin: 0, padding: 0 }}>
61-
{children}
24+
<div className="global_background" style={{ fontFamily: "Inter,Arial", margin: 0, padding: 0 }}>
25+
<main style={{ minHeight: "100vh" }}>{children}</main>
6226
</div>
6327
</ThemeProvider>
6428
</IntlProvider>

0 commit comments

Comments
 (0)