Centralize prettier configuration to root level (#30501)

* Merge all .prettierignore files into top-level config

* Merge all .prettierrc files into top-level config

* Replace service-specific glob patterns in package.json format scripts with `prettier .`

* Add template files with Jinja2, Go template, envsubst, and Handlebars syntax to .prettierignore

* Ignore GitHub templates

* Ignore PUG templates to format them separately with `format:pug`

* Encourage double quotes for YAML, YML files

* Move prettier for PUG source format script to the root

* Move prettier for styles source format script to the root

* Remove prettier for jenkins files from web

* Remove prettier source format script from all services

* Make .prettierrc more readable

* Update format scripts by file type

* Organise `.prettierignore`

* Add `--cache` flag to prettier scripts for faster runs

* Format all files with prettier

* Format all or format services

* Remove `format`/`format:fix` scripts from services since now it runs from root `package.json`

* Avoid conlficts with yamllint configuration

* Remove `--cache` flag from prettier scripts

* Update all service Makefiles to use root-level prettier configuration

* Update all Jenkinsfile to use root-level prettier configuration

* Ignore auto-generated files by build_scripts

* Update package-lock.json

* Update root Makefile format targets

* Update SP Jenkinsfile format target

* Update E2E Makefile format script

* Udpate `format_js` to work in both local and CI env

* Add docker-mailtrap to .prettierignore

docker-mailtrap is a third-party git-ignored directory used for testing

* Added Docker env detection to prevent nested Docker spawning

* Ignore handlebars templates

* Add cryptographic files and test output to `.prettierignore`

* Add terraform modules to `.gitignore`

* Remove prettier-plugin-groovy

* Use npx directly instead of Docker for local formatting for faster formatting

* Auto-generate Makefiles

* Revert "Remove prettier-plugin-groovy"

This reverts commit 194a33589a2e1e4d2225d10c67e9f025e4222025.

* Mount monorepo root in RUN_LINT_FORMAT for prettier config access

* Prettier ignores all `node_modules` by default regardless of location

* Show only changed files in format output

* Ignore LICENSE files

* Enable prettier on rendered build_scripts outputs

* Ignoring all the template folders by prettier

* Remove the public/minjs entry since it does not exist

* Remove all non-existent paths

* Sync `.prettierignore` with ignored files by `.gitignore` and `.dockerignore` files

* Revert "Auto-generate Makefiles"

This reverts commit c0233e490de1bc95fe437219d65e0b66e0331ec9.

* Revert "Use npx directly instead of Docker for local formatting for faster formatting"

This reverts commit 1d2b2cf1a6c6974c76885852a90dd55e84167e41.

* Ignore dashboard JSON files

* Ignore files generated by bin/update_build_scripts

* Remove unsupported file types from `.prettierignore`

* Ignore test fixture generated files

* Ignore README file types by prettier

* Ignore generate snapshots by prettier

* Allow to format generated bin/update_build_scripts by prettier

* Ensure build script outputs prettier-compatible tsconfig.json

* Fix build script output to match prettier formatting
- Fix Jinja2 whitespace in docker-compose templates
- Change YAML quotes from single to double

* Don't read cryptographic files by prettier

* Ignore google verification files by prettier

* Revert npx prettier formatting

* Ignore domain verification files

* Show only changed files in format output

* Make `.github` prettier

* Allow all files to be formatted in jobs by prettier

* Allow server-ce/server-pro files to be formatted by prettier

* Ignore more folders in clsi, filestory, git-bridge by prettier

* Update build script with `RUN_LINTING_CI_MONOREPO`

* Ignore docker-mailtrap and downloads in server-ce by prettier

* Restore prettier configs and prettierignore for V1 since it has its own prettier (an older version)

* Source format

GitOrigin-RevId: 637adc3cc422d1f20c86d6ebc8ec514d60758287
This commit is contained in:
Rebeka Dekany
2026-02-04 09:08:22 +00:00
committed by Copybot
parent 9b10da6eaf
commit a648015db8
141 changed files with 770 additions and 992 deletions
-40
View File
@@ -1,40 +0,0 @@
# NOTE: changing paths may require updating them in the Makefile too.
data/
scripts/translations/.cache/
node_modules
frontend/js/vendor
modules/**/frontend/js/vendor
public/js
public/minjs
frontend/stylesheets/modules/metrics/nvd3.scss
frontend/js/features/source-editor/lezer-latex/latex.mjs
frontend/js/features/source-editor/lezer-latex/latex.terms.mjs
frontend/js/features/source-editor/lezer-bibtex/bibtex.mjs
frontend/js/features/source-editor/lezer-bibtex/bibtex.terms.mjs
frontend/js/features/source-editor/hunspell/wasm/hunspell.mjs
# complex pages
app/views/project/editor.pug
app/views/project/editor/**
modules/open-in-overleaf/app/views/documentation.pug
modules/references-search/app/views/project/editor/**
modules/rich-text/app/views/toolbar.pug
# loops
app/views/referal/bonus.pug
modules/templates/app/views/tag.pug
# expressions that could not be formatted correctly
app/views/_mixins/faq_search.pug
app/views/external/home/v2.pug
app/views/project/token/access.pug
app/views/user/primaryEmailCheck.pug
app/views/user/restricted.pug
modules/admin-panel/app/views/project/show.pug
modules/templates/app/views/project/editor/_left-menu.pug
modules/two-factor-authentication/app/views/_mixins.pug
# minified files
app/views/_google_analytics.pug
app/views/_customer_io.pug
frontend/js/shared/lottie/**
-23
View File
@@ -1,23 +0,0 @@
{
"arrowParens": "avoid",
"jsxSingleQuote": false,
"pugAttributeSeparator": "as-needed",
"pugBracketSpacing": false,
"pugClassNotation": "as-is",
"pugIdNotation": "as-is",
"pugSortAttributesBeginning": ["name", "data-type"],
"plugins": ["@prettier/plugin-pug", "prettier-plugin-groovy"],
"semi": false,
"singleQuote": true,
"trailingComma": "es5",
"tabWidth": 2,
"useTabs": false,
"overrides": [
{
"files": "*.pug",
"options": {
"useTabs": true
}
}
]
}
+25 -18
View File
@@ -431,9 +431,16 @@ ci:
#
# Lint & format
#
# Run the linting commands in the scope of the monorepo.
# Eslint and prettier (plus some configs) are on the root.
RUN_LINTING_MONOREPO = docker run --rm -v $(MONOREPO):$(MONOREPO) -w $(MONOREPO) {{node_image}}:{{node_version}} npm run --silent
RUN_LINTING_CI_MONOREPO = docker run --rm --volume $(MONOREPO)/.editorconfig:/overleaf/.editorconfig --volume $(MONOREPO)/.eslintignore:/overleaf/.eslintignore --volume $(MONOREPO)/.eslintrc:/overleaf/.eslintrc --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume $(MONOREPO)/tsconfig.backend.json:/overleaf/tsconfig.backend.json --volume $(MONOREPO)/services/web/data/reports:/overleaf/services/web/data/reports -w /overleaf $(IMAGE_CI) npm run --silent
ORG_PATH = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RUN_LINT_FORMAT ?= \
docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume ${PWD}/data/reports:/overleaf/services/web/data/reports ${IMAGE_CI}
docker run --rm --env BRANCH_NAME --env CI --env COMMIT_SHA --env MONOREPO --volume $(MONOREPO)/.prettierignore:/overleaf/.prettierignore --volume $(MONOREPO)/.prettierrc:/overleaf/.prettierrc --volume ${PWD}/data/reports:/overleaf/services/web/data/reports ${IMAGE_CI}
NODE_MODULES_PATH := ${PATH}:${PWD}/node_modules/.bin:/overleaf/services/web/node_modules/.bin
WITH_NODE_MODULES_PATH = \
@@ -505,34 +512,34 @@ lint_in_docker:
format: format_js
format_js:
npm run --silent format
$(RUN_LINTING_MONOREPO) format -- services/web
format: format_styles
format_styles:
npm run --silent format:styles
format: format_pug
format_pug:
npm run --silent format:pug
format: format_jenkins
format_jenkins:
npm run --silent format:jenkins
format_ci:
$(RUN_LINTING_CI_MONOREPO) format -- services/web
format_fix:
npm run --silent format:fix
$(RUN_LINTING_MONOREPO) format:fix -- services/web
format_styles:
$(RUN_LINTING_MONOREPO) format:styles
format_styles_fix:
npm run --silent format:styles:fix
$(RUN_LINTING_MONOREPO) format:styles:fix
format_pug:
$(RUN_LINTING_MONOREPO) format:pug
format_pug_fix:
npm run --silent format:pug:fix
$(RUN_LINTING_MONOREPO) format:pug:fix
format_jenkins:
$(RUN_LINTING_MONOREPO) format:jenkins
format_jenkins_fix:
npm run --silent format:jenkins:fix
$(RUN_LINTING_MONOREPO) format:jenkins:fix
format_in_docker:
$(RUN_LINT_FORMAT) make format -j2 --output-sync
$(RUN_LINT_FORMAT) npm run --prefix /overleaf format -- services/web
SHELLCHECK_OPTS = \
--shell=bash \
+9 -9
View File
@@ -1,12 +1,10 @@
overleaf/web
==============
# overleaf/web
overleaf/web is the front-end web service of the open-source web-based collaborative LaTeX editor,
[Overleaf](https://www.overleaf.com).
It serves all the HTML pages, CSS and javascript to the client. overleaf/web also contains
a lot of logic around creating and editing projects, and account management.
The rest of the Overleaf stack, along with information about contributing can be found in the
[overleaf/overleaf](https://github.com/overleaf/overleaf) repository.
@@ -22,11 +20,13 @@ $ npm run start
### Running Tests
To run all tests run:
```
make test
```
To run both unit and acceptance tests for a module run:
```
make test_module MODULE=saas-authentication
```
@@ -50,11 +50,13 @@ make test_unit MOCHA_GREP='AuthorizationManager'
```
To run only the unit tests for a single module do:
```
make test_unit_module MODULE=saas-authentication
```
Module tests can also use a MOCHA_GREP argument:
```
make test_unit_module MODULE=saas-authentication MOCHA_GREP=SSO
```
@@ -86,23 +88,22 @@ make test_acceptance_run MOCHA_GREP='AuthorizationManager'
```
To run only the acceptance tests for a single module do:
```
make test_acceptance_module MODULE=saas-authentication
```
Module tests can also use a MOCHA_GREP argument:
```
make test_acceptance_module MODULE=saas-authentication MOCHA_GREP=SSO
```
Routes
------
## Routes
Run `bin/routes` to print out all routes in the project.
License and Credits
-------------------
## License and Credits
This project is licensed under the [AGPLv3 license](http://www.gnu.org/licenses/agpl-3.0.html)
@@ -127,4 +128,3 @@ of these icons are used within Overleaf inside the `public/img/silk` and
We gratefully acknowledge [IconShock](http://www.iconshock.com) for use of the icons
in the `public/img/iconshock` directory found via
[findicons.com](http://findicons.com/icon/498089/height?id=526085#)
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
</html>
+11 -12
View File
@@ -2,7 +2,6 @@ volumes:
data:
services:
test_unit:
build:
context: ../..
@@ -49,7 +48,7 @@ services:
OVERLEAF_CONFIG:
REDIS_HOST: redis_test
extra_hosts:
- 'www.overleaf.test:127.0.0.1'
- "www.overleaf.test:127.0.0.1"
volumes:
- ../../bin/shared/wait_for_it:/overleaf/bin/shared/wait_for_it
- ./data/reports:/overleaf/services/web/data/reports
@@ -151,15 +150,15 @@ services:
# REF: https://github.com/moby/moby/issues/8231#issuecomment-63877553
# REF: https://github.com/moby/moby/issues/8231#issuecomment-63871343
command:
- 'bash'
- '-c'
- 'ulimit -n 1024 && exec bash /run.sh'
- "bash"
- "-c"
- "ulimit -n 1024 && exec bash /run.sh"
saml:
image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test
logging:
driver: none
environment:
SAML_BASE_URL_PATH: 'http://saml/simplesaml/'
SAML_TEST_SP_ENTITY_ID: 'overleaf-test-saml'
SAML_TEST_SP_LOCATION: 'http://www.overleaf.test:23000/saml/callback'
image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test
logging:
driver: none
environment:
SAML_BASE_URL_PATH: "http://saml/simplesaml/"
SAML_TEST_SP_ENTITY_ID: "overleaf-test-saml"
SAML_TEST_SP_LOCATION: "http://www.overleaf.test:23000/saml/callback"
+9 -10
View File
@@ -2,7 +2,6 @@ volumes:
data:
services:
test_unit:
image: node:24.13.0
volumes:
@@ -56,7 +55,7 @@ services:
# OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING: 'true'
extra_hosts:
- 'www.overleaf.test:127.0.0.1'
- "www.overleaf.test:127.0.0.1"
depends_on:
- redis_test
- mongo
@@ -143,13 +142,13 @@ services:
# REF: https://github.com/moby/moby/issues/8231#issuecomment-63877553
# REF: https://github.com/moby/moby/issues/8231#issuecomment-63871343
command:
- 'bash'
- '-c'
- 'ulimit -n 1024 && exec bash /run.sh'
- "bash"
- "-c"
- "ulimit -n 1024 && exec bash /run.sh"
saml:
image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test
environment:
SAML_BASE_URL_PATH: 'http://saml/simplesaml/'
SAML_TEST_SP_ENTITY_ID: 'overleaf-test-saml'
SAML_TEST_SP_LOCATION: 'http://www.overleaf.test:23000/saml/callback'
image: us-east1-docker.pkg.dev/overleaf-ops/ol-docker/saml-test
environment:
SAML_BASE_URL_PATH: "http://saml/simplesaml/"
SAML_TEST_SP_ENTITY_ID: "overleaf-test-saml"
SAML_TEST_SP_LOCATION: "http://www.overleaf.test:23000/saml/callback"
+12 -12
View File
@@ -1,14 +1,14 @@
This directory contains fonts used by the Overleaf web application.
* [DM Mono](https://github.com/googlefonts/dm-mono)
* [Font Awesome](https://fontawesome.com/v4/)
* [Inter](https://rsms.me/inter/)
* [Lato](https://www.latofonts.com/)
* [Material Symbols](https://github.com/google/material-design-icons)
* [Merriweather](https://github.com/SorkinType/Merriweather)
* [Noto Sans](https://notofonts.github.io/#latin-greek-cyrillic)
* [Noto Serif](https://notofonts.github.io/#latin-greek-cyrillic)
* [OpenDyslexic Mono](https://github.com/antijingoist/opendyslexic/tree/master)
* [Open Sans](https://github.com/googlefonts/opensans)
* [Source Code Pro](https://github.com/adobe-fonts/source-code-pro)
* [STIX Two Math](https://github.com/stipub/stixfonts/)
- [DM Mono](https://github.com/googlefonts/dm-mono)
- [Font Awesome](https://fontawesome.com/v4/)
- [Inter](https://rsms.me/inter/)
- [Lato](https://www.latofonts.com/)
- [Material Symbols](https://github.com/google/material-design-icons)
- [Merriweather](https://github.com/SorkinType/Merriweather)
- [Noto Sans](https://notofonts.github.io/#latin-greek-cyrillic)
- [Noto Serif](https://notofonts.github.io/#latin-greek-cyrillic)
- [OpenDyslexic Mono](https://github.com/antijingoist/opendyslexic/tree/master)
- [Open Sans](https://github.com/googlefonts/opensans)
- [Source Code Pro](https://github.com/adobe-fonts/source-code-pro)
- [STIX Two Math](https://github.com/stipub/stixfonts/)
@@ -253,4 +253,4 @@ const countries = <const>[
]
export default countries
export type CountryCode = typeof countries[number]['code']
export type CountryCode = (typeof countries)[number]['code']
@@ -2,8 +2,8 @@
The files in this directory are:
* `hunspell.wasm`: [Hunspell](https://github.com/hunspell/hunspell) compiled to WebAssembly using Emscripten, via the [build.sh](../build.sh) script.
* `hunspell.mjs`: a JavaScript wrapper for the WebAssembly module, generated by Emscripten.
* `hunspell.d.ts`: manually-created types for the exports from the JavaScript module.
- `hunspell.wasm`: [Hunspell](https://github.com/hunspell/hunspell) compiled to WebAssembly using Emscripten, via the [build.sh](../build.sh) script.
- `hunspell.mjs`: a JavaScript wrapper for the WebAssembly module, generated by Emscripten.
- `hunspell.d.ts`: manually-created types for the exports from the JavaScript module.
Note: To speed up compilation on ARM architecture (e.g. Apple M1), add `-arm64` to the Docker image tag in `Dockerfile`.
@@ -4,7 +4,6 @@ Lezer-LaTeX is a LaTeX parser implemented with [lezer](https://lezer.codemirror.
The parser is written in a "grammar" file, (and a "tokens" file with custom tokenizer logic) which is then compiled by `@lezer/generator` into a parser module and a "terms" module. The parser module is then loaded by the CodeMirror 6 in the web frontend codebase.
## Important files
- Source files:
@@ -23,7 +22,6 @@ The parser is written in a "grammar" file, (and a "tokens" file with custom toke
- Webpack plugins:
- `web/webpack-plugins/lezer-grammar-compiler.js`: A webpack plugin that calls the generator as part of the webpack build. In dev, it will automatically re-build the parser when the grammar file changes.
## NPM tasks
- `lezer-latex:generate`: Generate the parser files from the grammar
@@ -33,7 +31,6 @@ The parser is written in a "grammar" file, (and a "tokens" file with custom toke
- `lezer-latex:run`: Run the parser against a file
- (Calls `lezer-latex/run.js`)
### Generating the parser
From the monorepo root:
@@ -46,7 +43,6 @@ make install
bin/npm -w services/web run 'lezer-latex:generate'
```
## Tests
Unit tests for the parser live in `web/test/unit/src/LezerLatex`. There are three kinds of test, in three subdirectories:
@@ -57,11 +53,10 @@ Unit tests for the parser live in `web/test/unit/src/LezerLatex`. There are thre
These tests run as part of `test_frontend`. You can run these tests alone by invoking:
``` sh
```sh
make test_unit MOCHA_GREP='lezer-latex'
```
## Trying the parser
While developing the parser, you can run it against a file by calling the `lezer-latex:run` task. There are
@@ -69,13 +64,12 @@ some example files in the test suite, at `web/test/unit/src/LezerLatex/examples/
For example:
``` sh
```sh
bin/npm -w services/web run 'lezer-latex:run' web/test/unit/src/LezerLatex/examples/amsmath.tex
```
If you omit the file path, the default file (`examples/demo.tex`) will be run.
## Integration into web
The web frontend imports the parser (from `latex.mjs`), in `frontend/js/features/source-editor/languages/latex/index.ts`.
@@ -1,20 +1,20 @@
import { PaidSubscription } from "../../../../../types/subscription/dashboard/subscription"
import { PendingPaymentProviderPlan } from "../../../../../types/subscription/plan"
import { PaidSubscription } from '../../../../../types/subscription/dashboard/subscription'
import { PendingPaymentProviderPlan } from '../../../../../types/subscription/plan'
export const AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE = 'assistant'
export const AI_ADD_ON_CODE = 'assistant'
// we dont want translations on plan or add-on names
export const ADD_ON_NAME = "AI Assist"
export const ADD_ON_NAME = 'AI Assist'
export const AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE = 'assistant-annual'
export function isStandaloneAiPlanCode(planCode?: string) {
return planCode === AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE || planCode === AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE
return (
planCode === AI_ASSIST_STANDALONE_MONTHLY_PLAN_CODE ||
planCode === AI_ASSIST_STANDALONE_ANNUAL_PLAN_CODE
)
}
export function hasPendingAiAddonCancellation(subscription: PaidSubscription){
export function hasPendingAiAddonCancellation(subscription: PaidSubscription) {
const pendingPlan = subscription.pendingPlan as PendingPaymentProviderPlan
const hasAiAddon = subscription.addOns?.some(
@@ -22,11 +22,12 @@ export function hasPendingAiAddonCancellation(subscription: PaidSubscription){
)
// cancellation of entire plan counts as removing the add-on
if(hasAiAddon && !pendingPlan){
if (hasAiAddon && !pendingPlan) {
return true
}
return hasAiAddon &&
return (
hasAiAddon &&
!pendingPlan.addOns?.some(addOn => addOn.code === AI_ADD_ON_CODE)
}
)
}
@@ -1,8 +1,7 @@
import { Meta } from '@storybook/blocks';
import { Meta } from '@storybook/blocks'
<Meta title="Storybook Guideline / Storybook builds" />
# Cloud Builds
Storybook builds can be used to share your development work. They can be found at [https://storybook.dev-overleaf.com/](https://storybook.dev-overleaf.com/).
@@ -1,4 +1,4 @@
import { Canvas, Controls, Meta } from '@storybook/blocks';
import { Canvas, Controls, Meta } from '@storybook/blocks'
import * as FormatCurrency from './format-currency.stories'
<Meta title="Storybook Guideline / Feature flags" />
@@ -8,7 +8,7 @@ import * as FormatCurrency from './format-currency.stories'
You can wrap your story with the `withSplitTests` utility to add split test variants to your Storybook stories, so you can toggle feature flags directly in the Storybook UI. See [withSplitTests on GitHub](https://github.com/overleaf/internal/blob/main/services/web/.storybook/utils/with-split-tests.tsx).
1. Define your split test argTypes:
Add your split test configurations to the `splitTestsArgTypes` object.
Add your split test configurations to the `splitTestsArgTypes` object.
```js
export const splitTestsArgTypes = {
@@ -19,6 +19,7 @@ export const splitTestsArgTypes = {
},
}
```
2. Wrap your story with `withSplitTests`.
Import `withSplitTests` and `Meta` from '@storybook/react' in your stories.
@@ -1,19 +1,35 @@
import { Meta, ColorItem, ColorPalette, Title, Typeset } from '@storybook/blocks';
import colors from '../../stylesheets/foundations/tokens/colors.json';
import typography from '../../stylesheets/foundations/tokens/typography.json';
import borderRadius from '../../stylesheets/foundations/tokens/borderRadius.json';
import spacing from '../../stylesheets/foundations/tokens/spacing.json';
import {
Meta,
ColorItem,
ColorPalette,
Title,
Typeset,
} from '@storybook/blocks'
import colors from '../../stylesheets/foundations/tokens/colors.json'
import typography from '../../stylesheets/foundations/tokens/typography.json'
import borderRadius from '../../stylesheets/foundations/tokens/borderRadius.json'
import spacing from '../../stylesheets/foundations/tokens/spacing.json'
<Meta title="Storybook Guideline / Foundations" />
# Foundations
Foundations in UX design are the basic rules and core elements, like colors, fonts, and spacing, that ensure consistency across the design.
<p>
These palettes are generated from our token files. The tokens were exported from Figma and split into separate files to categorise: <a href="https://github.com/overleaf/internal/tree/main/services/web/frontend/stylesheets/bootstrap-5/foundations/tokens" target="_blank" rel="noopener noreferrer">Token files on GitHub</a>
These palettes are generated from our token files. The tokens were exported
from Figma and split into separate files to categorise:{' '}
<a
href="https://github.com/overleaf/internal/tree/main/services/web/frontend/stylesheets/bootstrap-5/foundations/tokens"
target="_blank"
rel="noopener noreferrer"
>
Token files on GitHub
</a>
</p>
**Table of Contents**
- [Primitive colors](#primitive-colors)
- [Background colors](#background-colors)
- [Content colors](#content-colors)
@@ -26,17 +42,14 @@ Foundations in UX design are the basic rules and core elements, like colors, fon
- [Spacing](#spacing)
# Colors
<br/>
<br />
## Primitive colors
<ColorPalette>
{Object.entries(colors.PrimitiveColor).map(([name, color]) => (
<ColorItem
key={name}
title={name}
colors={[color.$value]}
/>
<ColorItem key={name} title={name} colors={[color.$value]} />
))}
</ColorPalette>
@@ -126,12 +139,15 @@ Colors used for specific UI elements like color pickers.
</ColorPalette>
# Typography
<br/>
<br />
## Font weight
<br/>
<br />
{Object.entries(typography.Fontweight).map(([name, typography]) => (
<div key={name}>
<strong>{name}</strong>
<Typeset
@@ -143,30 +159,33 @@ Colors used for specific UI elements like color pickers.
))}
## Font size
<br/>
<br />
{Object.entries(typography['Fontsize']).map(([name, typography]) => {
const mixins = typography.$mixin ? [].concat(typography.$mixin) : [];
const mixins = typography.$mixin ? [].concat(typography.$mixin) : [];
return (
<div key={name} style={{ marginBottom: '2rem' }}>
<strong>
{name}
{mixins.map(mixin => (
<span key={mixin}> / @mixin {mixin}</span>
))}
</strong>
<Typeset
fontSizes={[`${typography.$value}px`]}
fontWeight={500}
sampleText="The quick brown fox jumps over the lazy dog"
/>
</div>
);
return (
<div key={name} style={{ marginBottom: '2rem' }}>
<strong>
{name}
{mixins.map(mixin => (
<span key={mixin}> / @mixin {mixin}</span>
))}
</strong>
<Typeset
fontSizes={[`${typography.$value}px`]}
fontWeight={500}
sampleText="The quick brown fox jumps over the lazy dog"
/>
</div>
);
})}
## Border radius
<br/>
<br />
<table style={{ width: '100%' }}>
<thead>
@@ -177,30 +196,33 @@ Colors used for specific UI elements like color pickers.
</tr>
</thead>
<tbody>
{Object.entries(borderRadius['BorderRadius']).map(([name, borderRadius]) => (
<tr key={name}>
<td>
<strong>{name}</strong>
</td>
<td style={{ textAlign: 'center' }}>{borderRadius.$value}px</td>
<td style={{ textAlign: 'center', padding: '0.5rem' }}>
<div
style={{
width: '80px',
height: '80px',
borderRadius: `${borderRadius.$value}px`,
backgroundColor: '#098842',
display: 'inline-block',
}}
/>
</td>
</tr>
))}
{Object.entries(borderRadius['BorderRadius']).map(
([name, borderRadius]) => (
<tr key={name}>
<td>
<strong>{name}</strong>
</td>
<td style={{ textAlign: 'center' }}>{borderRadius.$value}px</td>
<td style={{ textAlign: 'center', padding: '0.5rem' }}>
<div
style={{
width: '80px',
height: '80px',
borderRadius: `${borderRadius.$value}px`,
backgroundColor: '#098842',
display: 'inline-block',
}}
/>
</td>
</tr>
)
)}
</tbody>
</table>
## Spacing
<br/>
<br />
<table style={{ width: '100%' }}>
<thead>
+1 -2
View File
@@ -1,5 +1,4 @@
Locales
=======
# Locales
These files are not to be edited by hand.
+1 -10
View File
@@ -25,14 +25,6 @@
"webpack": "webpack serve --config webpack.config.dev.js",
"webpack:production": "webpack --config webpack.config.prod.js",
"webpack:profile": "webpack --config webpack.config.prod.js --profile --json > stats.json",
"format": "prettier --list-different $PWD/'**/*.{js,jsx,mjs,ts,tsx,json}'",
"format:fix": "prettier --write $PWD/'**/*.{js,jsx,mjs,ts,tsx,json}'",
"format:styles": "prettier --list-different $PWD/'**/*.{css,scss}'",
"format:styles:fix": "prettier --write $PWD/'**/*.{css,scss}'",
"format:pug": "prettier --list-different $PWD/'**/*.pug'",
"format:pug:fix": "prettier --write $PWD/'**/*.pug'",
"format:jenkins": "prettier --list-different $PWD/'**/Jenkinsfile'",
"format:jenkins:fix": "prettier --write $PWD/'**/Jenkinsfile'",
"lint": "eslint --max-warnings 0 --format unix --ext .js,.jsx,.mjs,.ts,.tsx .",
"lint:fix": "eslint --fix --ext .js,.jsx,.mjs,.ts,.tsx .",
"lint:styles": "stylelint '**/*.scss'",
@@ -200,6 +192,7 @@
"zod-validation-error": "^4.0.1"
},
"devDependencies": {
"5to6-codemod": "^1.8.0",
"@ai-sdk/react": "^3.0.2",
"@babel/core": "^7.28.5",
"@babel/plugin-proposal-decorators": "^7.28.0",
@@ -231,7 +224,6 @@
"@pollyjs/adapter-node-http": "^6.0.6",
"@pollyjs/core": "^6.0.6",
"@pollyjs/persister-fs": "^6.0.6",
"@prettier/plugin-pug": "^3.4.0",
"@replit/codemirror-emacs": "overleaf/codemirror-emacs#4394c03858f27053f8768258e9493866e06e938e",
"@replit/codemirror-indentation-markers": "overleaf/codemirror-indentation-markers#371ce3b56f453a392eb0d3b85ab019c185c68e1f",
"@replit/codemirror-vim": "overleaf/codemirror-vim#1bef138382d948018f3f9b8a4d7a70ab61774e4b",
@@ -285,7 +277,6 @@
"@writefull/core": "^1.27.27",
"@writefull/ui": "^1.27.27",
"@writefull/utils": "^1.27.27",
"5to6-codemod": "^1.8.0",
"abort-controller": "^3.0.0",
"acorn": "^7.1.1",
"acorn-walk": "^7.1.1",
@@ -12,15 +12,19 @@ and copying the files to your local machine.
Run the following doc export command to export all doc ids and their associated
project ids in batches of 10,000,000.
```
mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection docs --fields '_id,project_id' --skip 0 --limit 10000000 --type=csv --out docs.00000000.csv
```
This will produce files like:
```
_id,project_id
ObjectId(5babb6f864c952737a9a4c32),ObjectId(5b98bba5e2f38b7c88f6a625)
ObjectId(4eecaffcbffa66588e000007),ObjectId(4eecaffcbffa66588e00000d)
```
Concatenate these into a single file: `cat docs.*csv > all-docs-doc_id-project_id.csv`
For object ids the script will accept either plain hex strings or the `ObjectId(...)`
@@ -29,35 +33,42 @@ format used by mongoexport.
### Exporting Projects
Export project ids from all `projects` and `deletedProjects`
```
mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection projects --fields '_id' --type=csv --out projects.csv
mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection deletedProjects --fields 'project._id' --type=csv --out deleted-projects.csv
```
Concatenate these: `cat projects.csv deleted-projects.csv > all-projects-project_id.csv`
## Processing Exported Data
### Create a unique sorted list of project ids from docs
```
cut -d, -f 2 all-docs-doc_id-project_id.csv | sort | uniq > all-docs-project_ids.sorted.uniq.csv
```
### Create a unique sorted list of projects ids from projects
```
sort all-projects-project_id.csv | uniq > all-projects-project_id.sorted.uniq.csv
```
### Create list of project ids in docs but not in projects
```
comm --check-order -23 all-docs-project_ids.sorted.uniq.csv all-projects-project_id.sorted.uniq.csv > orphaned-doc-project_ids.csv
```
### Create list of docs ids with project ids not in projects
```
grep -F -f orphaned-doc-project_ids.csv all-docs-doc_id-project_id.csv > orphaned-doc-doc_id-project_id.csv
```
## Run doc deleter
```
node delete-orphaned-docs orphaned-doc-doc_id-project_id.csv
```
@@ -7,10 +7,10 @@ node scripts/learn/checkSanitize/index.mjs https://LEARN_WIKI
## Bulk export
There is a bulk export for media wiki pages, but it produces different
html escaping compared to the regular parse API we use in web.
html escaping compared to the regular parse API we use in web.
The bulk export does not escape all the placeholder HTML-like elements,
like `<project-id` or `<document goes here>`.
like `<project-id` or `<document goes here>`.
## Example output
@@ -14,6 +14,7 @@ Follow the directions in `google-ops/README.md` for exporting data from mongo
and copying the files to your local machine.
Run the following user export command.
```
mongoexport --uri $READ_ONLY_MONGO_CONNECTION_STRING --collection users --fields '_id,email,emails,samlIdentifiers' --query '{"samlIdentifiers.providerId": {"$exists": 1}}' --out user-entitlements.json
```
@@ -26,6 +27,7 @@ is never transferred or stored insecurely and that it is deleted ASAP**
Connect to postgres by running `heroku psql -a electric-leaf-4093`
Run the following v2_user_universities export comand.
```
\copy (select uu.user_id, uu.email, uu.cached_entitlement, ud.university_id from v2_user_universities uu LEFT JOIN university_domains ud ON uu.university_domain_id = ud.id WHERE uu.removed_at IS NULL) to 'cached-entitlements.csv' with csv;
```
+8 -7
View File
@@ -1,12 +1,12 @@
# SmokeTests
For the SmokeTests we implemented a Mini-Framework that is tailored for our
tooling, specifically OError, and does not need a large runner, such as mocha.
tooling, specifically OError, and does not need a large runner, such as mocha.
The SmokeTests are separated into individual `steps`.
Each `step` can have a `run` function and a `cleanup` function.
The former will run in sequence with the other steps, the later in reverse
order from the finish, or the last failure.
order from the finish, or the last failure.
```js
async function run(ctx) {
@@ -19,21 +19,22 @@ module.exports = { cleanup, run }
```
Steps will get called with a context object with common helpers and details:
- `request` a promisified `request` module with defaults for `baseUrl`,
`timeout` and internals for cookie handling.
`timeout` and internals for cookie handling.
- `assertHasStatusCode` a helper for asserting response status codes, pass
a response and desired status code. It will throw with OError context set.
a response and desired status code. It will throw with OError context set.
- `getCsrfTokenFor` a helper for retrieving CSRF tokens, pass an endpoint.
- `processWithTimeout` a helper for awaiting Promises with a timeout, pass
`{ work: Promise.resolve(), timeout: 42, message: 'foo timedout' }`
`{ work: Promise.resolve(), timeout: 42, message: 'foo timedout' }`
- `stats` an object for performance tracking.
- `timeout` the step timeout
Steps should handle timeouts locally to ensure appropriate cleanup of timed out
actions.
actions.
Steps may pass values along to the next steps in returning an object with the
desired fields from the `run` or `cleanup` function.
desired fields from the `run` or `cleanup` function.
The returned values will overwrite existing details in the `ctx`.
Alpha-numeric sorting of step filenames determines the processing sequence.