Skip to content

Commit

Permalink
Chore[Vite] (#21)
Browse files Browse the repository at this point in the history
* fix(auth): fix sending username and password as encoded uri

* fix(login): clean codes to match eslint recommendations

* fix(panel-home): go to setup on not initialized

* fix(top-five-checks-card): fix ui

* fix(panel-setup-cloud): fix ui

* fix(dark-mode-switch): fix ui

* fix(event-button): clear codes to match eslint recommendations

* fix(layout): cleanup codes to match with eslint

* fix(shared): cleanup code to match with eslint reccomendations

* fix(utils): cleanup codes to match eslint reccomendation

* chore(vite): replace react-scripts (cra) with vite

* fix(vite-config): remove unnecessary proxy uri for ws

* fix(vite-config): remove unnecessary ws fro m proxy

* fix(vite-config): fix build to suppor public_url

* fix(publish): fix env config names changes

* fix(packages-json): add engines and browserslist in packages.json

* feat(scripts): add storybook and https preview scripts
  • Loading branch information
sijav authored Oct 25, 2023
1 parent 0cf40c9 commit da5a29b
Show file tree
Hide file tree
Showing 47 changed files with 1,656 additions and 6,985 deletions.
15 changes: 5 additions & 10 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
REACT_APP_SERVER=https://app.dev-eu.fixcloud.io
REACT_APP_WS_SERVER=wss://app.dev-eu.fixcloud.io
REACT_APP_USE_PROXY=true
REACT_APP_NETWORK_RETRY_COUNT=5
REACT_APP_WEBSOCKET_RETRY_TIMEOUT=5000
GENERATE_SOURCEMAP=false
VITE_SERVER=https://app.dev-eu.fixcloud.io
VITE_WS_SERVER=wss://app.dev-eu.fixcloud.io
VITE_USE_PROXY=true
VITE_NETWORK_RETRY_COUNT=5
VITE_WEBSOCKET_RETRY_TIMEOUT=5000
HOST=127.0.0.1
PORT=3000
# NOTE: THIS IS DANGEROUS!
# It exposes your machine to attacks from the websites you visit.
# Do NOT put this in the production
DANGEROUSLY_DISABLE_HOST_CHECK=true
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
!.storybook
public/*.min.js
public/*.min.js
src/locales/**/messages.po
31 changes: 31 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react-hooks/recommended',
'plugin:storybook/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['prettier', '@typescript-eslint', 'react-refresh'],
rules: {
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
'prettier/prettier': ['warn'],
'@typescript-eslint/no-unused-vars': [
'warn',
{
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
},
],
'no-console': [
'warn',
{
allow: ['warn', 'error', 'info'],
},
],
},
}
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:

- name: Create .env file
run: |
echo "REACT_APP_NETWORK_RETRY_COUNT=5" > .env
echo "REACT_APP_WEBSOCKET_RETRY_TIMEOUT=5000" >> .env
echo "VITE_NETWORK_RETRY_COUNT=5" > .env
echo "VITE_WEBSOCKET_RETRY_TIMEOUT=5000" >> .env
- name: Create a production build
uses: devcontainers/[email protected]
with:
runCmd: PUBLIC_URL=https://cdn.some.engineering/fix-ui/${{ github.sha }} yarn build
runCmd: PUBLIC_URL=https://cdn.some.engineering/fix-ui/${{ github.sha }}/ yarn build

- name: Move build to target
run: |
Expand Down
37 changes: 28 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage
coverage

# production
/build
/storybook-static
/target
build
storybook-static
target
dist
dist-ssr
*.local
/.pnp
.pnp.js

# misc
.DS_Store
Expand All @@ -21,6 +21,25 @@
.env.production.local
.env

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# dependencies
node_modules

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
16 changes: 6 additions & 10 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import type { StorybookConfig } from '@storybook/react-webpack5'
import type { StorybookConfig } from '@storybook/react-vite'

const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/preset-create-react-app',
'@storybook/addon-onboarding',
'@storybook/addon-interactions',
],
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/addon-onboarding', '@storybook/addon-interactions'],
framework: {
name: '@storybook/react-webpack5',
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
staticDirs: ['..\\public'],
core: {
disableTelemetry: true,
},
}
export default config
2 changes: 1 addition & 1 deletion .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const preview: Preview = {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
date: /Date$/i,
},
},
},
Expand Down
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,22 @@

The frontend for the FIX service

# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `yarn start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
Open [http://localhost:8081](http://localhost:8081) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `yarn test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
See the section about [Getting Started in Vitest](https://vitest.dev/guide/) for more information.

### `yarn build`

Expand All @@ -31,20 +27,4 @@ It correctly bundles React in production mode and optimizes the build for the be
The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `yarn eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
See the section about [deployment](https://vitejs.dev/guide/cli.html#build) for more information.
19 changes: 5 additions & 14 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Fix is an open-source Wiz alternative for cloud infrastructure security. Take control of cloud risks with an asset inventory, compliance scans, and remediation workflows."
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/apple-touch-icon.png" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<style>
body {
margin: 0;
Expand Down Expand Up @@ -90,7 +90,7 @@
}
}
</style>
<script src="%PUBLIC_URL%/particles.min.js"></script>
<script src="/particles.min.js"></script>
<title>Fix by Some Engineering Inc.</title>
</head>
<body>
Expand Down Expand Up @@ -151,15 +151,6 @@
})
</script>
</div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit da5a29b

Please sign in to comment.