Skip to content

Commit

Permalink
chore: tsconfigs
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina committed Dec 22, 2022
1 parent 6b9861d commit 29aa9ec
Show file tree
Hide file tree
Showing 70 changed files with 5,411 additions and 10,450 deletions.
44 changes: 37 additions & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
# nmHoistingLimits: dependencies
############################################################################################
############################################################################################
############################################################################################
############# To see current config and options: ###########################################
############# % yarn config -v ###########################################
############################################################################################
############################################################################################
############################################################################################

nodeLinker: node-modules

npmRegistries:
"https://registry.npmjs.org/":
npmAuthToken: NPM_AUTH_TOKEN
yarnPath: .yarn/releases/yarn-3.2.1.cjs

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.2.1.cjs
# nmHoistingLimits: workspaces

nodeLinker: node-modules
nmSelfReferences: false
nmMode: hardlinks-global

# lanuage
defaultLanguageName: "node"

pnpEnableInlining: true

# changeset
changesetBaseRefs:
- "master"
- "origin/master"
- "upstream/master"
changesetIgnorePatterns:
- "**/*.test.{js,ts}"

enableTransparentWorkspaces: false

# ui
enableColors: true
enableMessageNames: true

npmRegistries:
"https://registry.npmjs.org/":
npmAuthToken: NPM_AUTH_TOKEN
83 changes: 44 additions & 39 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ After new package is generated, you will need to update some values to be able t
For example in case if package plan to be used in `console` app

Ensure to add proper webpack alias path resolutions into:
* ./storybook/main.js - as `'@flyteoss/flyte-api': path.resolve(__dirname, '../packages/flyte-api/src’),`
* packages/zapp/console/webpack.common.config.ts to alias section - as `'@flyteoss/flyte-api': path.resolve(__dirname, '../packages/flyte-api/src’),`

- ./storybook/main.js - as `'@flyteoss/flyte-api': path.resolve(__dirname, '../packages/flyte-api/src’),`
- packages/zapp/console/webpack.common.config.ts to alias section - as `'@flyteoss/flyte-api': path.resolve(__dirname, '../packages/flyte-api/src’),`

To add child package usage to other package, in parent package ->
* Add `{ "path": “../${package-name}" }` to tsconfig.json
* Add `{ "path": “../${package-name}/tsconfig.build.json" }` to tsconfig.build.json (if exists)
- Then you can import your changes as `import { getLoginUrl } from '@flyteoss/flyte-api’;`

- Add `{ "path": “../${package-name}" }` to tsconfig.json
- Add `{ "path": “../${package-name}/tsconfig.json" }` to tsconfig.json (if exists)

* Then you can import your changes as `import { getLoginUrl } from '@flyteoss/flyte-api’;`

> If you see `yarn lint` package not defined issues update `.\eslintrc.js` by adding your package to
'import/core-modules': ['@clients/locale', '@clients/primitives', '@clients/theme'],
'import/core-modules': ['@clients/locale', '@clients/primitives', '@clients/theme'],

## Storybook

Expand All @@ -59,8 +62,8 @@ You can run storybook with `yarn run storybook`, and view the stories at http://
We are using our internal feature flag solution to allow continuos integration,
while features are in development. There are two types of flags:

- **FeatureFlag**: boolean flags which indicate if feature is enabled.
- **AdminFlag**: the minimal version of flyteadmin in which feature supported.
- **FeatureFlag**: boolean flags which indicate if feature is enabled.
- **AdminFlag**: the minimal version of flyteadmin in which feature supported.

All flags currently available could be found in [/FeatureFlags/defaultConfig.ts](./src/basics/FeatureFlags/defaultConfig.ts)
file. Most of them under active development, which means we don't guarantee it will work as you expect.
Expand Down Expand Up @@ -127,82 +130,84 @@ Running flyteconsole locally requires [NodeJS](https://nodejs.org) and
[yarn](https://yarnpkg.com). We recommend for you to use **asdf** to manage NodeJS version.
You can find currently used versions in `.tool-versions` file.

- Install asdf through homebrew
- Install asdf through homebrew

```bash
brew install asdf
```

- (Optional) If you are using **M1 MacBook**, you will need to install `vips` for proper build experience
- (Optional) If you are using **M1 MacBook**, you will need to install `vips` for proper build experience

```bash
brew install vips
```

- Add Yarn and NodeJs plugins to asdf, to manage versions
- Add Yarn and NodeJs plugins to asdf, to manage versions

```bash
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf plugin-add yarn https://github.com/twuni/asdf-yarn.git
brew install gpg
```

- From flyteconsole directory - install proper NodeJS and yarn versions:
- From flyteconsole directory - install proper NodeJS and yarn versions:

```bash
asdf install
```

- Install nodepackages
- Install nodepackages

```bash
yarn install
```

1. Set `ADMIN_API_URL` and `ADMIN_API_USE_SSL`

```
export ADMIN_API_URL=https://different.admin.service.com
export ADMIN_API_USE_SSL="https"
export LOCAL_DEV_HOST=localhost.different.admin.service.com
```
```
export ADMIN_API_URL=https://different.admin.service.com
export ADMIN_API_USE_SSL="https"
export LOCAL_DEV_HOST=localhost.different.admin.service.com
```

_NOTE:_ Add these to your local profile (e.g., `./profile`) to prevent having to do this step each time
_NOTE:_ Add these to your local profile (e.g., `./profile`) to prevent having to do this step each time

2. Generate SSL certificate

Run the following command from your `flyteconsole` directory
Run the following command from your `flyteconsole` directory

```bash
make generate_ssl
```
```bash
make generate_ssl
```

3. Add new record to hosts file

```bash
sudo vim /etc/hosts
```
```bash
sudo vim /etc/hosts
```

Add the following record
Add the following record

```
127.0.0.1 localhost.different.admin.service.com
```
```
127.0.0.1 localhost.different.admin.service.com
```

4. Install Chrome plugin: [Moesif Origin & CORS Changer](https://chrome.google.com/webstore/detail/moesif-origin-cors-change/digfbfaphojjndkpccljibejjbppifbc)

> _NOTE:_
> 1. Activate plugin (toggle to "on")
> 1. Open 'Advanced Settings':
> - set `Access-Control-Allow-Credentials`: `true`
> - set `Domain List`: `your.localhost.com`
> _NOTE:_
>
> 1. Activate plugin (toggle to "on")
> 1. Open 'Advanced Settings':
>
> - set `Access-Control-Allow-Credentials`: `true`
> - set `Domain List`: `your.localhost.com`
5. Start `flyteconsole`

```bash
yarn start
```
```bash
yarn start
```

Your new localhost is [localhost.different.admin.service.com](http://localhost.different.admin.service.com)
Your new localhost is [localhost.different.admin.service.com](http://localhost.different.admin.service.com)

> Ensure you don't have `ADMIN_API_URL` or `DISABLE_AUTH` set (e.g., in your `/.profile`.)
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ COPY . /my-project/
RUN : \
--mount=type=cache,target=/root/.yarn \
# install production dependencies
&& yarn workspaces focus flyteconsole @flyteconsole/client-app --production \
# TODO: figure out how to get around this
&& rm -rf node_modules/@flyteconsole node_modules/@flyteoss \
&& yarn workspaces focus @flyteconsole/client-app --production \
# move the production dependencies to the /app folder
&& mkdir /app \
&& cp -R node_modules /app
Expand All @@ -20,7 +18,7 @@ WORKDIR /my-project/
RUN : \
--mount=type=cache,target=/root/.yarn \
# install all dependencies so we can build
&& yarn workspaces focus --all --production \
&& yarn workspaces focus @flyteconsole/client-app flyteconsole --production \
&& BASE_URL=/console yarn run build:prod \
&& cp -R ./website/dist/* /app

Expand Down
20 changes: 9 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"scripts": {
"postinstall": "husky install",
"build:pack": "yarn workspaces foreach -vit --include '{@flyteoss/flyteidl,@flyteoss/ui-atoms,@flyteoss/common,@flyteoss/locale,@flyteoss/flyte-api,@flyteoss/components,@flyteoss/console}' run build",
"build:pack": "yarn workspaces foreach -vit --include '{@flyteoss/flyteidl,@flyteoss/flyte-api,@flyteoss/ui-atoms,@flyteoss/common,@flyteoss/locale,@flyteoss/flyte-api,@flyteoss/components,@flyteoss/console}' run build",
"clean": "yarn workspace @flyteconsole/client-app clean",
"start": "yarn workspace @flyteconsole/client-app start",
"gen:ssl": "make generate_ssl",
"start:prod": "yarn workspace @flyteconsole/client-app start:prod",
"build:prod": "yarn build:pack && yarn workspace @flyteconsole/client-app build:prod",
"build:prod": "yarn workspace @flyteconsole/client-app build:prod",
"build:storybook": "build-storybook",
"generate:package": "yarn workspace @flyteconsole/generator start",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
Expand Down Expand Up @@ -49,31 +49,28 @@
]
},
"dependencies": {
"@types/morgan": "^1.9.3",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.7",
"babel-loader": "^8.2.5",
"babel-polyfill": "^6.26.0",
"chalk": "^2.0.1",
"compression-webpack-plugin": "^9.2.0",
"cookie-parser": "^1.4.3",
"copy-webpack-plugin": "^11.0.0",
"dotenv": "^5.0.1",
"express": "^4.14.0",
"express-static-gzip": "^0.3.2",
"fork-ts-checker-webpack-plugin": "^7.2.1",
"html-webpack-plugin": "^5.5.0",
"husky": "^8.0.2",
"morgan": "^1.8.2",
"morgan": "^1.10.0",
"node-polyfill-webpack-plugin": "^2.0.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-hot-loader": "^4.1.2",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"ts-loader": "^9.2.6",
"ts-node": "^8.0.2",
"tsc-alias": "^1.7.0",
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"use-react-router": "^1.0.7",
"wait-on": "^6.0.1",
"webpack": "^5.68.0",
"webpack-cli": "^4.9.2",
Expand All @@ -87,7 +84,6 @@
"@babel/preset-env": "~7.16.11",
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@flyteorg/flyteidl": "^1.3.0",
"@material-ui/core": "^4.2.0",
"@material-ui/icons": "^4.2.1",
"@semantic-release/changelog": "^5.0.1",
Expand All @@ -109,6 +105,7 @@
"@testing-library/react-hooks": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"babel-loader": "^8.2.5",
"eslint": "^8.11.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -134,7 +131,8 @@
"@babel/preset-env": "~7.16.11",
"@babel/preset-react": "~7.16.7",
"@babel/preset-typescript": "~7.16.7",
"minimist": "1.2.6"
"minimist": "1.2.6",
"@types/react": "16.14.34"
},
"packageManager": "[email protected]"
}
9 changes: 3 additions & 6 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyteoss/common",
"version": "0.0.1",
"version": "0.0.8",
"description": "Flyteconsole common utilities",
"main": "./dist/index.js",
"module": "./lib/index.js",
Expand All @@ -27,14 +27,11 @@
"clean": "rm -rf dist && rm -rf lib && rm -rf node_modules && rm -rf tsconfig.build.tsbuildinfo",
"clean:all": "rm -rf node_modules && yarn clean",
"build": "yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --outDir lib --project ./tsconfig.build.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.prod.es.json && run -T tsc-alias -p ./tsconfig.prod.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.prod.json && run -T tsc-alias -p ./tsconfig.prod.json",
"test": "NODE_ENV=test jest"
},
"installConfig": {
"hoistingLimits": "workspaces"
},
"peerDependencies": {
"@types/node": "^18.11.9"
}
}
14 changes: 13 additions & 1 deletion packages/common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,17 @@
"outDir": "./dist",
"composite": true
},
"include": ["src/**/*"]
"include": ["src/**/*"],
"exclude": [
// files excluded from the build, we can not put it inro default tsconfig
// as it will interfere with VSCode IntelliSence
"**/test",
"**/mocks",
"**/__mocks__",
"**/__stories__",
"**/*.spec.*",
"**/*.test.*",
"**/*.mock.*",
"**/*.stories.*"
]
}
9 changes: 9 additions & 0 deletions packages/common/tsconfig.prod.es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"paths": {}
},
// reset references, we are using npmjs published packages in prod.
"references": []
}
9 changes: 9 additions & 0 deletions packages/common/tsconfig.prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "lib",
"paths": {}
},
// reset references, we are using npmjs published packages in prod.
"references": []
}
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/components/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
globals: {
'ts-jest': {
isolatedModules: true,
tsconfig: '<rootDir>/tsconfig.dev.json',
tsconfig: '<rootDir>/tsconfig.test.json',
},
},
};
6 changes: 3 additions & 3 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@flyteoss/components",
"version": "0.0.11",
"version": "0.0.12",
"description": "Flyteconsole Components module, which is published as npm package and can be consumed by 3rd parties",
"main": "./dist/index.js",
"module": "./lib/index.js",
Expand All @@ -25,8 +25,8 @@
"clean": "rm -rf dist && rm -rf lib && rm -rf node_modules && rm -rf tsconfig.build.tsbuildinfo",
"clean:all": "rm -rf node_modules && yarn clean",
"build": "yarn build:esm && yarn build:cjs",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.es.build.json && run -T tsc-alias -p ./tsconfig.es.build.json",
"build:cjs": "run -T tsc --project ./tsconfig.build.json && run -T tsc-alias -p ./tsconfig.build.json",
"build:esm": "run -T tsc --module esnext --project ./tsconfig.prod.es.json && run -T tsc-alias -p ./tsconfig.prod.es.json",
"build:cjs": "run -T tsc --project ./tsconfig.prod.json && run -T tsc-alias -p ./tsconfig.prod.json",
"test": "NODE_ENV=test jest"
},
"dependencies": {
Expand Down
Loading

0 comments on commit 29aa9ec

Please sign in to comment.