Skip to content

Commit

Permalink
fix(odd-platform-ui): fix ui build for windows (#1607)
Browse files Browse the repository at this point in the history
Co-authored-by: ayemets-corcentric <[email protected]>
  • Loading branch information
anatolii-yemets and anatolii-yemets authored Feb 6, 2024
1 parent d32b2a5 commit 6b0a1cf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
13 changes: 8 additions & 5 deletions odd-platform-ui/README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@

## Requirements
- [nvm](https://github.com/nvm-sh/nvm) with installed [Node.js](https://nodejs.org/en/) of expected version (check `.nvmrc`)
- [pnpm](https://pnpm.io/installation) - package manager
- [Docker](https://www.docker.com/) - to run openapi generator.

**Note for Windows users:** You need to set a bash compatible shell, for example: `npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"`

## Initialize application

In the project directory, you can run:

### `npm install`
### `pnpm install`
Installs project dependencies

### `npm run generate`
### `pnpm run generate`
Generates an openApi client in `src/generated-sources` from API specification `prospectlog-specification//openapi.yml`

## Run application in dev mode

### `npm start`
### `pnpm start`

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

The page will reload if you make edits.<br />
You will also see any lint errors in the console.

### `npm test`
### `pnpm test`

Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

## Create build

### `npm run build`
### `pnpm run build`

Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
Expand Down
8 changes: 8 additions & 0 deletions odd-platform-ui/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

GENERATOR_IMAGE="openapitools/openapi-generator-cli:v5.1.1"
CONFIG_PATH="odd-platform-ui/openapi-config.yaml"
WORKDIR="//mnt" # Using double-slash for compatibility with Windows
HOST_DIRECTORY=/$(pwd)/..

docker run -v $HOST_DIRECTORY:$WORKDIR -w $WORKDIR --rm $GENERATOR_IMAGE generate -c $CONFIG_PATH
4 changes: 2 additions & 2 deletions odd-platform-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"build": "pnpm generate && tsc --noEmit && vite build",
"test": "vitest",
"tsc": "tsc",
"generate": "docker run -v `pwd`/..:/mnt -w /mnt --rm openapitools/openapi-generator-cli:v5.1.1 generate -c odd-platform-ui/openapi-config.yaml",
"generate": "chmod u+x ./generate.sh && ./generate.sh",
"lint": "eslint --ext .tsx,.ts src/",
"lint:fix": "eslint --ext .tsx,.ts src/ --fix",
"prepare": "chmod u+x .husky/prepare.sh && .husky/prepare.sh",
"pre-commit": "pnpm tsc --noEmit && lint-staged",
"preinstall": "pnpm install husky && npx only-allow pnpm",
"preinstall": "pnpm install husky",
"i18n:scan": "mkdir -p ./tmp && rm -rf ./tmp && npx tsc --jsx preserve --target esnext --module esnext --noEmit false --outDir ./tmp && npx i18next-scanner"
},
"lint-staged": {
Expand Down

0 comments on commit 6b0a1cf

Please sign in to comment.