diff --git a/odd-platform-ui/README.md b/odd-platform-ui/README.md index 58db4b679..8f8d1c168 100644 --- a/odd-platform-ui/README.md +++ b/odd-platform-ui/README.md @@ -1,21 +1,24 @@ ## 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.
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. @@ -23,14 +26,14 @@ Open [http://localhost:3000](http://localhost:3000) to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console. -### `npm test` +### `pnpm 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. ## Create build -### `npm run build` +### `pnpm run build` Builds the app for production to the `build` folder.
It correctly bundles React in production mode and optimizes the build for the best performance. diff --git a/odd-platform-ui/generate.sh b/odd-platform-ui/generate.sh new file mode 100644 index 000000000..0afa2cd3d --- /dev/null +++ b/odd-platform-ui/generate.sh @@ -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 \ No newline at end of file diff --git a/odd-platform-ui/package.json b/odd-platform-ui/package.json index d93c8a2a1..b4b7fbe55 100644 --- a/odd-platform-ui/package.json +++ b/odd-platform-ui/package.json @@ -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": {