-
Notifications
You must be signed in to change notification settings - Fork 9
[WIP] Ken frontend #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4011a4b
f46c568
6a05ff7
2a9aad1
f96c4fe
570ba5d
2b2bddc
53e759e
8dab5f7
71895c7
d0b55ea
1e11bc2
3205caa
afb9aea
05bce39
1c31f4a
8f5bd92
201dc8e
251a052
a77da82
6d3a1e9
7462ed4
b2270f6
cf8c8e6
ea4ba7b
db32508
f8060b1
fffd0ed
ea0cd3c
fd3702b
7eb1bea
00f3807
dc76a03
998956a
7ab1d5d
79268df
8e9327c
1855d2e
3d76751
c3f728a
578ed5b
a284edb
114511f
7e7d697
557555b
5691a3c
34da3a4
811cb65
6b27bd3
115faa3
9e63629
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,19 +1,32 @@ | ||||||||||||||||||||||
| # Use the first Dockerfile to set up the build environment | ||||||||||||||||||||||
| FROM base_image:latest AS build_env | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Copy your application source code | ||||||||||||||||||||||
| COPY . /app | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Build the frontend and play app | ||||||||||||||||||||||
| RUN sbt dist | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Start a new stage for the runtime image | ||||||||||||||||||||||
| FROM amazoncorretto:17 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Install python deps | ||||||||||||||||||||||
| COPY requirements.txt . | ||||||||||||||||||||||
| RUN yum install -y python3 | ||||||||||||||||||||||
| COPY docker-init/requirements.txt . | ||||||||||||||||||||||
| RUN yum install -y python3 unzip | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Clean up after After installing packages with Apply the following changes: RUN yum install -y python3 unzip && \
+ yum clean all && \
+ rm -rf /var/cache/yum📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
| RUN pip3 install --upgrade pip; pip3 install -r requirements.txt | ||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Optimize Combining the Apply the following changes: -RUN pip3 install --upgrade pip; pip3 install -r requirements.txt
+RUN pip3 install --upgrade pip && \
+ pip3 install --no-cache-dir -r requirements.txt📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| RUN mkdir -p /app | ||||||||||||||||||||||
|
Comment on lines
+15
to
18
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Combine To optimize the Docker image and reduce the number of layers, consider combining consecutive Apply the following changes: -RUN yum install -y python3 unzip
-RUN pip3 install --upgrade pip && \
- pip3 install --no-cache-dir -r requirements.txt
-RUN mkdir -p /app
+RUN yum install -y python3 unzip && \
+ yum clean all && \
+ rm -rf /var/cache/yum && \
+ pip3 install --upgrade pip && \
+ pip3 install --no-cache-dir -r requirements.txt && \
+ mkdir -p /app📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
| COPY generate_anomalous_data.py /app/ | ||||||||||||||||||||||
| COPY start.sh /start.sh | ||||||||||||||||||||||
| COPY docker-init/generate_anomalous_data.py /app/ | ||||||||||||||||||||||
| COPY docker-init/start.sh /start.sh | ||||||||||||||||||||||
| RUN chmod +x /start.sh | ||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||
|
Comment on lines
+20
to
22
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Set execute permissions when copying the You can set the execute permissions during the Apply the following changes: -COPY docker-init/start.sh /start.sh
-RUN chmod +x /start.sh
+COPY --chmod=+x docker-init/start.sh /start.sh📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ENV DYNAMO_ENDPOINT="http://localhost:8000" | ||||||||||||||||||||||
| ENV AWS_DEFAULT_REGION="fakeregion" | ||||||||||||||||||||||
| ENV AWS_ACCESS_KEY_ID="fakeaccesskey" | ||||||||||||||||||||||
| ENV AWS_SECRET_ACCESS_KEY="fakesecretkey" | ||||||||||||||||||||||
| # Copy frontend + play zipped dist and set up app directory structure | ||||||||||||||||||||||
| COPY --from=build_env /app/hub/target/universal/hub-0.1.0-SNAPSHOT.zip /app | ||||||||||||||||||||||
| RUN unzip hub-0.1.0-SNAPSHOT.zip -d /app/hub && \ | ||||||||||||||||||||||
| cp -r hub/hub-0.1.0-SNAPSHOT/* hub/. && \ | ||||||||||||||||||||||
| rm -rf hub/hub-0.1.0-SNAPSHOT hub-0.1.0-SNAPSHOT.zip | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| EXPOSE 9000 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ENTRYPOINT ["/start.sh"] | ||||||||||||||||||||||
| ENTRYPOINT ["/start.sh"] | ||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| FROM base_image:latest AS build_env | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider using a specific version tag for the base image. Using Consider changing the first line to: -FROM base_image:latest AS build_env
+FROM base_image:<specific-version> AS build_envReplace
|
||
|
|
||
| # Copy the entire project directory into the container | ||
| COPY . /app | ||
|
Comment on lines
+3
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Optimize the COPY command to include only necessary files. Copying the entire project directory might include unnecessary files, increasing the image size and build time. Consider using a Alternatively, you can explicitly copy only the necessary files and directories: -COPY . /app
+COPY package.json package-lock.json /app/
+COPY src/ /app/src/
+COPY public/ /app/public/Adjust the paths according to your project structure.
|
||
|
|
||
| # Install Node.js and npm | ||
| RUN apk add --update nodejs npm | ||
|
|
||
| # Build the frontend using SBT | ||
| RUN sbt "project frontend" buildFrontend | ||
|
|
||
| FROM node:18-alpine | ||
|
|
||
| # Copy the built frontend from the previous stage to the new container | ||
| COPY --from=build_env app/frontend /app/frontend | ||
|
|
||
| # Set the working directory for subsequent commands | ||
| WORKDIR /app/frontend | ||
|
|
||
| # Expose port 3000 for the SvelteKit app | ||
| EXPOSE 3000 | ||
|
|
||
| # Specify the command to run when the container starts | ||
| CMD ["node", "build/index.js"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,4 +3,5 @@ if ! python3 generate_anomalous_data.py; then | |
| echo "Error: Failed to generate anomalous data" >&2 | ||
| exit 1 | ||
| fi | ||
| exec "$@" | ||
|
|
||
| exec "./hub/bin/hub" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider the implications of removing The removal of If maintaining the ability to execute arbitrary commands is important, consider one of these alternatives:
Please clarify if this change in behavior is intentional and aligns with the project's requirements. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,135 @@ | ||
| # create-svelte | ||
| # Chronon Frontend | ||
|
|
||
| Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte). | ||
| The frontend for Chronon. | ||
|
|
||
| ## Creating a project | ||
| ## Getting Started | ||
|
|
||
| If you're seeing this, you've probably already done this step. Congrats! | ||
| ### Prerequisites | ||
|
|
||
| - [Node.js](https://nodejs.org/en/) (LTS version recommended) | ||
| - npm (comes with Node.js) | ||
|
|
||
| ### Installation | ||
|
|
||
| 1. Clone the repository: | ||
|
|
||
| ```bash | ||
| git clone https://github.com/zipline-ai/chronon.git | ||
| cd chronon | ||
| ``` | ||
|
|
||
| 2. Navigate to the frontend directory: | ||
|
|
||
| ```bash | ||
| cd frontend | ||
| ``` | ||
|
|
||
| 3. Install dependencies: | ||
| ```bash | ||
| npm install | ||
| ``` | ||
|
|
||
| ### Development | ||
|
|
||
| To start the development server: | ||
|
|
||
| ```bash | ||
| # create a new project in the current directory | ||
| npm create svelte@latest | ||
| npm run dev | ||
| ``` | ||
|
|
||
| This will start a local server. The app will automatically reload if you make changes to the code. | ||
|
|
||
| # create a new project in my-app | ||
| npm create svelte@latest my-app | ||
| ### Build | ||
|
|
||
| To create an optimized production build: | ||
|
|
||
| ```bash | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## Developing | ||
| This will create an optimized version of your project in the `build` directory. | ||
|
|
||
| ### Preview | ||
|
|
||
| Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: | ||
| To preview the production build locally: | ||
|
|
||
| ```bash | ||
| npm run dev | ||
| npm run preview | ||
| ``` | ||
|
|
||
| # or start the server and open the app in a new browser tab | ||
| npm run dev -- --open | ||
| ### Running Tests | ||
|
|
||
| #### All Tests | ||
|
|
||
| To run both unit and integration tests together: | ||
|
|
||
| ```bash | ||
| npm run test | ||
| ``` | ||
|
|
||
| ## Building | ||
| #### Unit Tests | ||
|
|
||
| To create a production version of your app: | ||
| To run unit tests using Vitest: | ||
|
|
||
| ```bash | ||
| npm run build | ||
| npm run test:unit | ||
| ``` | ||
|
|
||
| To run unit tests once: | ||
|
|
||
| ```bash | ||
| npm run test:unit:once | ||
| ``` | ||
|
|
||
| #### Integration Tests | ||
|
|
||
| To run integration tests using Playwright: | ||
|
|
||
| ```bash | ||
| npm run test:integration | ||
| ``` | ||
|
|
||
| To run integration tests once: | ||
|
|
||
| ```bash | ||
| npm run test:integration:once | ||
| ``` | ||
|
|
||
| For the Playwright UI to explore test results: | ||
|
|
||
| ```bash | ||
| npm run test:integration:ui | ||
| ``` | ||
|
|
||
| ### Linting and Formatting | ||
|
|
||
| To check code formatting and linting issues: | ||
|
|
||
| ```bash | ||
| npm run lint | ||
| ``` | ||
|
|
||
| To format the codebase: | ||
|
|
||
| ```bash | ||
| npm run format | ||
| ``` | ||
|
|
||
| ### Type Checking | ||
|
|
||
| To check the TypeScript types: | ||
|
|
||
| ```bash | ||
| npm run check | ||
| ``` | ||
|
|
||
| To continuously check types while developing: | ||
|
|
||
| ```bash | ||
| npm run check:watch | ||
| ``` | ||
|
|
||
| You can preview the production build with `npm run preview`. | ||
| ## Best Practices | ||
|
|
||
| > To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. | ||
| 1. **Code Style**: This project uses Prettier and ESLint for code formatting and linting. Please run `npm run lint` and `npm run format` before committing changes. | ||
| 2. **Testing**: Ensure all changes are covered with unit and integration tests. Use Vitest for unit tests and Playwright for integration tests. | ||
|
Comment on lines
+132
to
+135
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider expanding the Best Practices section. The current Best Practices section provides a good starting point, but it could be enhanced to provide more comprehensive guidance for contributors. Consider the following improvements:
Example expansion: ## Best Practices
1. **Code Style**: This project uses Prettier and ESLint for code formatting and linting. Please run `npm run lint` and `npm run format` before committing changes.
2. **Testing**: Ensure all changes are covered with unit and integration tests. Use Vitest for unit tests and Playwright for integration tests.
3. **Naming Conventions**: Use PascalCase for component names, camelCase for variables and functions, and UPPER_CASE for constants.
4. **Component Structure**: Follow the Single Responsibility Principle. Keep components small and focused on a single task.
5. **State Management**: Use React hooks for local state and [preferred state management solution] for global state.
6. **Performance**: Optimize renders by using React.memo, useMemo, and useCallback where appropriate.
7. **Documentation**: Update relevant documentation when adding new features or making significant changes.
For more detailed guidelines, please refer to our [Contribution Guidelines](link-to-guidelines). |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "$schema": "https://shadcn-svelte.com/schema.json", | ||
| "style": "new-york", | ||
| "tailwind": { | ||
| "config": "tailwind.config.js", | ||
| "css": "src/app.css", | ||
| "baseColor": "neutral" | ||
| }, | ||
|
Comment on lines
+4
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Missing Tailwind Configuration Files The Tailwind configuration is referencing 🔗 Analysis chainLGTM! Verify the existence of specified Tailwind files. The Tailwind configuration looks good. The base color is set to "neutral", which is a valid Tailwind color. Please run the following script to verify the existence of the specified Tailwind files: Please run the following corrected script to verify the existence of the specified Tailwind files: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the existence of Tailwind configuration files
# Test: Check if tailwind.config.js exists
if [ -f "tailwind.config.js" ]; then
echo "tailwind.config.js exists"
else
echo "tailwind.config.js does not exist"
fi
# Test: Check if src/app.css exists
if [ -f "src/app.css" ]; then
echo "src/app.css exists"
else
echo "src/app.css does not exist"
fi
Length of output: 431 Script: #
#!/bin/bash
# Description: Verify the existence of Tailwind configuration files
# Test: Check if tailwind.config.js exists
if [ -f "tailwind.config.js" ]; then
echo "tailwind.config.js exists"
else
echo "tailwind.config.js does not exist"
fi
# Test: Check if src/app.css exists
if [ -f "src/app.css" ]; then
echo "src/app.css exists"
else
echo "src/app.css does not exist"
fi
Length of output: 196 |
||
| "aliases": { | ||
| "components": "$lib/components", | ||
| "utils": "$lib/utils" | ||
| }, | ||
| "typescript": true | ||
| } | ||
|
Comment on lines
+1
to
+14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider additional configurations for enhanced setup. The overall structure of the configuration file is good and covers the basic setup for a SvelteKit project with shadcn UI and Tailwind CSS. However, you might want to consider adding some additional configurations to enhance your setup:
Here's an example of how these additions might look: {
// ... existing configurations ...
"outDir": "src/lib/components/ui",
"componentPath": "src/lib/components/ui",
"themes": ["light", "dark"]
}These additions can provide more flexibility and control over your project structure and theming. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify a valid base image that includes SBT for the build stage
The placeholder
base_image:latestneeds to be replaced with an actual base image that includes SBT. Without SBT installed, theRUN sbt distcommand on line 8 will fail. Consider using an official SBT image likehseeberger/scala-sbtor another appropriate base image that suits your build requirements.