-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added base structure for ui/web folder for 3.0 (#4028)
* feat: added base structure for web folder Signed-off-by: Sahil <sahil@harness.io> * feat: added config and models for API types Signed-off-by: Sahil <sahil@harness.io> * feat: added APIs for consumption Signed-off-by: Sahil <sahil@harness.io> * feat: added string util for easy translations Signed-off-by: Sahil <sahil@harness.io> * chore: code cleanup Signed-off-by: Sahil <sahil@harness.io> * fix: removed unused code Signed-off-by: Sahil <sahil@harness.io> --------- Signed-off-by: Sahil <sahil@harness.io>
- Loading branch information
Showing
117 changed files
with
30,596 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
jest.config.js | ||
scripts/ | ||
node_modules | ||
dist | ||
*.js | ||
_mocks/ | ||
config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
--- | ||
parser: '@typescript-eslint/parser' | ||
root: true | ||
parserOptions: | ||
ecmaVersion: 2020 | ||
sourceType: module | ||
ecmaFeatures: | ||
jsx: true | ||
impliedStrict: true | ||
project: ./tsconfig.json | ||
plugins: | ||
- react | ||
- '@typescript-eslint/eslint-plugin' | ||
- react-hooks | ||
- jest | ||
- import | ||
env: | ||
browser: true | ||
node: true | ||
shared-node-browser: true | ||
es6: true | ||
jest: true | ||
globals: | ||
__DEV__: readonly | ||
extends: | ||
- eslint:recommended | ||
- plugin:react/recommended | ||
- plugin:@typescript-eslint/recommended | ||
- plugin:import/errors | ||
- plugin:import/typescript | ||
- prettier | ||
settings: | ||
react: | ||
version: detect | ||
import/resolver: | ||
typescript: | ||
alwaysTryTypes: true | ||
|
||
rules: | ||
# built-in | ||
no-console: 2 | ||
semi: 0 | ||
no-await-in-loop: 2 | ||
no-shadow: 0 | ||
|
||
# react hooks | ||
react-hooks/rules-of-hooks: 2 | ||
react-hooks/exhaustive-deps: 1 | ||
|
||
# react | ||
react/prop-types: 0 | ||
react/display-name: 1 | ||
|
||
#typescript | ||
'@typescript-eslint/no-use-before-define': 0 | ||
'@typescript-eslint/explicit-function-return-type': | ||
- 1 | ||
- allowExpressions: true | ||
no-unused-vars: 0 | ||
'@typescript-eslint/no-unused-vars': | ||
- 2 | ||
- vars: all | ||
args: after-used | ||
ignoreRestSiblings: true | ||
argsIgnorePattern: ^_ | ||
'@typescript-eslint/member-delimiter-style': 0 | ||
'@typescript-eslint/no-shadow': 2 | ||
'@typescript-eslint/no-extra-semi': 0 | ||
'@typescript-eslint/no-duplicate-imports': 2 | ||
|
||
#import | ||
import/order: | ||
- error | ||
- groups: | ||
- builtin | ||
- external | ||
- internal | ||
- - parent | ||
- sibling | ||
pathGroups: | ||
- pattern: '*.scss' | ||
group: index | ||
position: after | ||
patternOptions: | ||
matchBase: true | ||
import/no-useless-path-segments: 2 | ||
|
||
import/no-cycle: | ||
- error | ||
|
||
no-restricted-imports: | ||
- warn | ||
- patterns: | ||
- lodash.* | ||
- microfrontends/* | ||
- '!microfrontends/ChildAppMounter' | ||
- _mocks/* | ||
paths: | ||
- lodash | ||
- name: yaml | ||
importNames: | ||
- stringify | ||
message: 'Please use yamlStringify from @utils instead of this' | ||
- name: react-router | ||
message: 'import from "react-router-dom" instead' | ||
- name: microfrontends | ||
message: Import from 'microfrontends' is only allowed in child apps | ||
- name: '@harness/uicore' | ||
importNames: | ||
- Color | ||
- FontVariation | ||
- Intent | ||
- Spacing | ||
message: import from "@harness/design-system" instead | ||
no-restricted-syntax: | ||
- error | ||
- selector: "CallExpression[callee.name='useContext'][arguments.0.name='PipelineContext']" | ||
message: 'Please use usePipelineContext instead' | ||
- selector: "CallExpression[callee.object.name='React'][callee.property.name='useContext'][arguments.0.name='PipelineContext']" | ||
message: 'Please use usePipelineContext instead' | ||
|
||
overrides: | ||
- files: | ||
- '**/*.test.ts' | ||
- '**/*.test.tsx' | ||
rules: | ||
'@typescript-eslint/no-magic-numbers': 0 | ||
'@typescript-eslint/no-non-null-assertion': 0 | ||
'@typescript-eslint/no-non-null-asserted-optional-chain': 0 | ||
'@typescript-eslint/no-explicit-any': 0 | ||
no-await-in-loop: 0 | ||
jest/consistent-test-it: | ||
- 2 | ||
- fn: test | ||
withinDescribe: test | ||
jest/expect-expect: 2 | ||
jest/no-disabled-tests: 2 | ||
jest/no-commented-out-tests: 2 | ||
- files: | ||
- services.tsx | ||
rules: | ||
'@typescript-eslint/explicit-function-return-type': 0 | ||
'@typescript-eslint/no-explicit-any': 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
node_modules | ||
coverage | ||
.nyc_output | ||
reports | ||
cypress-coverage | ||
merged-coverage | ||
.DS_Store | ||
tsconfig.tmp | ||
.idea | ||
yarn-error.log | ||
temp | ||
dist/* | ||
.yalc/ | ||
yalc.lock | ||
.env | ||
junit.xml | ||
cypress/videos/ | ||
certificates | ||
.npmrc | ||
tasks.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
declare MATCH_PATH='chaoscenter/web/' | ||
|
||
declare BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
if [[ "$BRANCH" == "main" ]]; then | ||
echo "\033[0;31;1mYou can't commit directly to main branch\033[0m" | ||
exit 1 | ||
fi | ||
|
||
if [[ "$BRANCH" =~ ^release\/.* ]]; then | ||
echo "\033[0;31;1mYou cannot commit directly to release branch\033[0m" | ||
exit 1 | ||
fi | ||
|
||
declare LITMUS_UI_FILE_CHANGES=$(git diff --name-only --cached | grep $MATCH_PATH -c) | ||
|
||
echo "\033[0;93mLITMUS_UI_FILE_CHANGES\033[0m ⟶ $LITMUS_UI_FILE_CHANGES" | ||
|
||
if [[ $LITMUS_UI_FILE_CHANGES -gt 0 ]] | ||
then | ||
cd ./chaoscenter/web && yarn lint-staged | ||
else | ||
echo "\033[0;93mSkipping husky pre-commit hook in $MATCH_PATH folder\033[0m" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
declare MATCH_PATH='chaoscenter/web/' | ||
|
||
declare BRANCH=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
echo "ON_BRANCH ⟶ $BRANCH" | ||
|
||
declare REMOTE_EXISTS=$(git ls-remote --heads origin $BRANCH | wc -l) | ||
|
||
declare CHECK_AGAINST_COMMIT | ||
|
||
if [[ $REMOTE_EXISTS -gt 0 ]] | ||
then | ||
# remote exists, compare changes from last pushed commit | ||
declare LAST_PUSHED_COMMIT_ID=$(git rev-parse --short @{push}) | ||
echo "LAST_PUSHED_COMMIT ⟶ $LAST_PUSHED_COMMIT_ID" | ||
CHECK_AGAINST_COMMIT=$LAST_PUSHED_COMMIT_ID | ||
else | ||
# remote doesn't exists, compare changes from branched off commit | ||
declare BRANCHED_COMMIT_ID=$(git rev-parse --short $(git merge-base main $BRANCH)) | ||
echo "BRANCHED_COMMIT_ID ⟶ $BRANCHED_COMMIT_ID" | ||
CHECK_AGAINST_COMMIT=$BRANCHED_COMMIT_ID | ||
fi | ||
|
||
declare CHAOS_UI_FILE_CHANGES=$(git diff --name-only -r --stat --oneline $CHECK_AGAINST_COMMIT HEAD | grep $MATCH_PATH -c) | ||
|
||
echo "CHAOS_UI_FILE_CHANGES ⟶ $CHAOS_UI_FILE_CHANGES" | ||
|
||
if [[ $CHAOS_UI_FILE_CHANGES -gt 0 ]] | ||
then | ||
cd ./chaoscenter/web && yarn test:silent --changedSince=$CHECK_AGAINST_COMMIT | ||
else | ||
echo "Skipping husky pre-push hook in $MATCH_PATH folder" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/strings/types.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
printWidth: 120 | ||
tabWidth: 2 | ||
useTabs: false | ||
semi: true | ||
singleQuote: true | ||
trailingComma: none | ||
bracketSpacing: true | ||
bracketSameLine: false | ||
arrowParens: avoid | ||
endOfLine: lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const packageJSON = require('../package.json'); | ||
const { pick, mapValues } = require('lodash'); | ||
|
||
/** | ||
* These packages must be stricly shared with exact versions | ||
*/ | ||
const ExactSharedPackages = [ | ||
'react-dom', | ||
'react', | ||
'@blueprintjs/core', | ||
'@blueprintjs/select', | ||
'@blueprintjs/datetime', | ||
'react-router-dom', | ||
'restful-react', | ||
'lodash-es' | ||
]; | ||
|
||
/** | ||
* @type {import('webpack').ModuleFederationPluginOptions} | ||
*/ | ||
module.exports = { | ||
name: 'chaos', | ||
filename: 'remoteEntry.js', | ||
exposes: { | ||
'./MicroFrontendApp': './src/app/App' | ||
}, | ||
shared: { | ||
formik: packageJSON.dependencies['formik'], | ||
...mapValues(pick(packageJSON.dependencies, ExactSharedPackages), version => ({ | ||
singleton: true, | ||
requiredVersion: version | ||
})) | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
[ req ] | ||
distinguished_name = req_distinguished_name | ||
x509_extensions = v3_req | ||
prompt = no | ||
|
||
[v3_req] | ||
keyUsage = critical, digitalSignature, keyAgreement | ||
extendedKeyUsage = serverAuth | ||
subjectAltName = @alt_names | ||
|
||
[alt_names] | ||
DNS.1 = localhost |
Oops, something went wrong.