Skip to content

Commit

Permalink
feat: add front-end code and modify build.gradle. add deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Rim-2 committed Feb 26, 2024
1 parent 755e9a8 commit afc54ff
Show file tree
Hide file tree
Showing 299 changed files with 48,388 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This is a basic workflow to help you get started with Actions

name: Deploy

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

- name: Deploy to Heroku
uses: AkhileshNS/[email protected]
with:
# This will be used for authentication. You can find it in your heroku homepage account settings
heroku_api_key: ${{ sns_secrets.HEROKU_DEPLOY_KEY }}
# Email that you use with heroku
heroku_email: [email protected]
# The appname to use for deploying/updating
heroku_app_name: my-sns-service
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,7 @@ gradle-app.setting
# Java heap dump
*.hprof

# End of https://www.toptal.com/developers/gitignore/api/intellij,intellij+all,intellij+iml,gradle,java
# End of https://www.toptal.com/developers/gitignore/api/intellij,intellij+all,intellij+iml,gradle,java

**/front-end/node_modules/**
**/front-end/static/**
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/sns-0.0.1-SNAPSHOT.jar
28 changes: 27 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'java'
id 'org.springframework.boot' version '2.6.7'
id 'io.spring.dependency-management' version '1.1.4'
id "com.github.node-gradle.node" version "3.3.0"
}

group = 'com.fastcampus'
Expand All @@ -23,7 +24,7 @@ repositories {

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-security'
// implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'org.postgresql:postgresql'
Expand All @@ -35,3 +36,28 @@ dependencies {
tasks.named('test') {
useJUnitPlatform()
}

node {
nodeModulesDir = file("$projectDir/front-end")
version = '18.3.0'
download = true
}

task npmBuild(type: NpmTask) {
args = ['run', "build"]
}

task copyFrontEnd(type: Copy) {
from "$projectDir/front-end/static"
into 'build/resources/main/static/.'
}

task cleanFrontEnd(type: Delete) {
delete "$projectDir/front-end/static", "$projectDir/front-end/node_modules"
}

npmBuild.dependsOn npmInstall
copyFrontEnd.dependsOn npmBuild
compileJava.dependsOn copyFrontEnd

clean.dependsOn cleanFrontEnd
2 changes: 2 additions & 0 deletions front-end/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .env
BUILD_PATH='./static'
5 changes: 5 additions & 0 deletions front-end/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
singleQuote: true,
trailingComma: 'all',
printWidth: 100,
};
70 changes: 70 additions & 0 deletions front-end/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

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

The page will reload when you make changes.\
You may also see any lint errors in the console.

### `npm 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.

### `npm 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.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can't go back!**

If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)

### Analyzing the Bundle Size

This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)

### Making a Progressive Web App

This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)

### Advanced Configuration

This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)

### Deployment

This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)

### `npm run build` fails to minify

This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
8 changes: 8 additions & 0 deletions front-end/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"baseUrl": "src",
"paths": {
"*": ["public/src/*"]
}
}
}
Loading

0 comments on commit afc54ff

Please sign in to comment.