Skip to content

Commit

Permalink
#216 monorepo move data
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Jul 25, 2023
1 parent d510140 commit d4a0443
Show file tree
Hide file tree
Showing 336 changed files with 35,366 additions and 0 deletions.
113 changes: 113 additions & 0 deletions browser/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// eslint-disable-next-line no-undef
module.exports = {
root: true,
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
"plugin:import/recommended",
"plugin:import/typescript",
'plugin:react/recommended', // Uses the recommended rules from @eslint-plugin-react
'plugin:@typescript-eslint/eslint-recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'plugin:jsx-a11y/recommended',
],
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
env: {
browser: true,
es6: true,
jest: true,
node: true,
},
parserOptions: {
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
ecmaFeatures: {
jsx: true, // Allows for the parsing of JSX
arrowFunctions: true,
},
// Next two lines enable deeper TS type checking
// https://typescript-eslint.io/docs/linting/typed-linting/
tsconfigRootDir: __dirname,
project: [
'lib/tsconfig.json',
'react/tsconfig.json',
'data-browser/tsconfig.json',
],
},
plugins: ['react', '@typescript-eslint', 'prettier', 'react-hooks', 'jsx-a11y'],
settings: {
react: {
version: 'detect', // Tells eslint-plugin-react to automatically detect the version of React to use
},
'import/resolver': {
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
paths: ['./src'],
},
},
},
rules: {
// Existing rules
'comma-dangle': 'off', // https://eslint.org/docs/rules/comma-dangle
'function-paren-newline': 'off', // https://eslint.org/docs/rules/function-paren-newline
'global-require': 'off', // https://eslint.org/docs/rules/global-require
// Turn this on when we have migrated all import paths to use `.js`
// "import/extensions": ["error", "ignorePackages"],
"import/no-unresolved": "off",
'import/no-dynamic-require': 'off', // https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-dynamic-require.md
'no-inner-declarations': 'off', // https://eslint.org/docs/rules/no-inner-declarations// New rules
'class-methods-use-this': 'off',
//Allow underscores https://stackoverflow.com/questions/57802057/eslint-configuring-no-unused-vars-for-typescript
'@typescript-eslint/no-unused-vars': ['error', { 'varsIgnorePattern': '^_', 'argsIgnorePattern': '^_' }],
'react-hooks/exhaustive-deps': 'off',
// 'no-unused-vars': ["error", { "ie": "^_" }],
'import/prefer-default-export': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
"react-hooks/rules-of-hooks": "error", // Checks rules of Hooks
'no-console': ['error', { allow: ['error', 'warn'] }],
"react/prop-types": "off",
"padding-line-between-statements": [
"error",
{
"blankLine": "always",
"next": "return",
"prev": "*"
},
{
"blankLine": "always",
"next": "export",
"prev": "*"
},
{
"blankLine": "always",
"next": "multiline-block-like",
"prev": "*"
},
{
"blankLine": "always",
"next": "*",
"prev": "multiline-block-like"
},
{
"blankLine": "any",
"next": "export",
"prev": "export"
}
],
"@typescript-eslint/explicit-member-accessibility": "error",
"eqeqeq": "error",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTaggedTemplates": true }],
"jsx-a11y/no-autofocus": "off",
// This has a bug, so we use typescripts version
"no-shadow": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-eval": "error",
"no-implied-eval": "error",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/member-ordering": "error",
"react/no-unknown-property": ["error", { "ignore": ["about"] }],
},
};
75 changes: 75 additions & 0 deletions browser/.github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Lint, build, test, deploy
permissions: write-all
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
# This is needed when playwright is used in tests #70
- run: pnpm lint-fix
- run: pnpm build
- run: pnpm typecheck
# Mayb we can do without these?
# - run: npx playwright install-deps
# - run: npx playwright install
- name: Start dev server
run: nohup pnpm start &
- name: Run atomic-server docker image in background (for testing)
run: nohup docker run -p 80:80 -p 443:443 -v atomic-storage:/atomic-storage joepmeneer/atomic-server:develop --initialize &
- run: pnpm playwright-install
- run: SERVER_URL=http://localhost pnpm test
- name: Upload failed e2e test screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-test-screenshots
path: data-browser/test-results
- run: pnpm typedoc
- name: Deploy production 🚀
if: ${{github.ref == 'refs/heads/main'}}
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: data-browser/publish # The folder the action should deploy.
- name: Deploy staging 🚀
if: ${{github.ref != 'refs/heads/main'}}
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: data-browser/publish # The folder the action should deploy.
target-folder: staging
45 changes: 45 additions & 0 deletions browser/.github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: deploy
permissions: write-all
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/[email protected]
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: pnpm install
- run: pnpm lint-fix
- run: pnpm build
- run: pnpm typedoc
- name: Deploy production 🚀
if: ${{github.ref == 'refs/heads/main'}}
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: data-browser/publish # The folder the action should deploy.
25 changes: 25 additions & 0 deletions browser/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
build
node_modules
docs
publish
.env
.husky
.nohup
*/lib
*/dist
*/dev-dist
*/yarn-error.log
test-results
*/nohup.out
*/yarn-error.log
lib/coverage
react/coverage
data-browser/coverage
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.DS_Store
8 changes: 8 additions & 0 deletions browser/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
build
**/node_modules
**/dist
**/package.json
**/yarn.lock
**/package-lock.json
**/.eslintrc.js
**/tsconfig.json
12 changes: 12 additions & 0 deletions browser/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"semi": true,
"printWidth": 80,
"tabWidth": 2,
"singleQuote": true,
"bracketSpacing": true,
"useTabs": false,
"arrowParens": "avoid",
"jsxSingleQuote": true,
"trailingComma": "all",
"jsdocParser": true
}
9 changes: 9 additions & 0 deletions browser/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"sakamoto66.vscode-playwright-test-runner",
"ms-vscode.vscode-typescript-next",
"dbaeumer.vscode-eslint",
"antfu.vite",
"ms-playwright.playwright"
]
}
36 changes: 36 additions & 0 deletions browser/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"editor.rulers": [
80
],
"search.exclude": {
"**/.git": true,
"**/node_modules": true,
"**/build": true,
"**/coverage": true,
"**/dist": true,
},
"editor.formatOnSave": true,
"eslint.validate": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],
"typescript.preferences.importModuleSpecifierEnding": "minimal",
"eslint.alwaysShowStatus": true,
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.packageManager": "pnpm",
"eslint.quiet": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
},
"jest.enableInlineErrorMessages": true,
"jest.showCoverageOnLoad": true,
"jest.runAllTestsFirst": false,
"eslint.workingDirectories": [
"./data-browser",
"./react",
"./lib"
]
}
34 changes: 34 additions & 0 deletions browser/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"problemMatcher": [
"$tsc-watch"
],
"label": "run data-browser dev server (pnpm start)",
"detail": "pnpm workspace @tomic/data-browser start",
"isBackground": true,
"group": "build"
},
{
"type": "npm",
"script": "test",
"problemMatcher": [
"$tsc-watch"
],
"label": "test data-browser",
"detail": "pnpm test",
"isBackground": true,
"group": "test"
},
{
"type": "shell",
"command": "./build_server.sh",
"label": "build server JS assets",
"isBackground": true,
"group": "build"
}
]
}
Loading

0 comments on commit d4a0443

Please sign in to comment.