Skip to content

Commit

Permalink
fix: resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
VK-RED committed Jun 29, 2024
2 parents c5f2701 + 18eeb3f commit 6140b77
Show file tree
Hide file tree
Showing 223 changed files with 40,993 additions and 14,142 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
.git
.gitignore
.env.example
.env
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ BOT_TOKEN = "123"
GUILD_ID = "123"
LOCAL_CMS_PROVIDER = true
CACHE_EXPIRE_S = 10

ADMINS = "Random,[email protected]"
NEXT_PUBLIC_DISABLE_FEATURES = "featurea,featureb,featurec"
REDIS_URL=
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/cms?schema=public"

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

*storybook.log
5 changes: 4 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
"trailingComma": "all",
"plugins": [
"prettier-plugin-tailwindcss"
]
}
24 changes: 24 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { StorybookConfig } from '@storybook/nextjs';

const config: StorybookConfig = {
stories: [
'../storybook/**/*.mdx',
'../storybook/**/*.stories.@(js|jsx|mjs|ts|tsx)',
'../storybook/stories/components/**/*.stories.@(js|jsx|mjs|ts|tsx)',
],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {},
},
docs: {
autodocs: 'tag',
},
staticDirs: ['../public'],
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from '@storybook/react';
import '../src/styles/tailwind.css';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
14 changes: 14 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:20-alpine
ARG DATABASE_URL

WORKDIR /usr/src/app

COPY . .

RUN npm install
RUN DATABASE_URL=$DATABASE_URL npx prisma generate
RUN DATABASE_URL=$DATABASE_URL npm run build

EXPOSE 3000

CMD ["npm", "run", "start"]
110 changes: 86 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,96 @@
<h1 align='center'>CMS</h1>

## Setup Procedure
## Table of contents

* Docker

OR
1. Clone the repository:
```bash
git clone https://github.com/code100x/cms.git
```
2. Navigate to the project directory:
```bash
cd cms
```
3. Run the following command to start the application:
```bash
docker create volume postgres-data # (optional) run this command if you face any mount volume / volume not exist error
docker-compose up
```

* Copy .env.example to .env
* Get a postgres db from https://neon.tech/ (or any other provider)
* Replace the DATABASE_URL in .env
* Run ```npx prisma migrate dev``` to setup schema
## Steps to run locally
With Docker
### Without Docker

* ```docker compose up```
1. clone the repository:
```bash
git clone https://github.com/code100x/cms.git
```
2. Navigate to the project directory:
```bash
cd cms
```
3. (optional) Start a PostgreSQL database using Docker:
```bash
docker run -d \
--name cms-db \
-e POSTGRES_USER=myuser \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_DB=mydatabase \
-p 5432:5432 \
postgres
```
based on this command the connection url will be
```
DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase?schema=public
```
4. Create a `.env` file based on the `.env.example` file and configure the `DATABASE_URL` with your postgreSQL connection string.
5. Install dependencies:
```bash
npm install
```
6. Run database migrations:
```bash
npm run prisma:migrate
```
7. Seed the database:
```bash
npm run db:seed
```
8. Start the development server:
```bash
npm run dev
```

Without Docker
* ```npm install```
* ```npm run db:seed``` to seed the database
* ```npm run dev```
* Login using any userid and password 123456
* You should be able to see some test courses
## Usage

Make sure to lint and format your code before creating a PR
* ```npm run lint:check``` to check for lint errors
* ```npm run lint:fix``` to fix lint errors
* ```npm run format:check``` to format the code
* ```npm run format:fix``` to fix the formatting
* If the code is not formatted properly, the CI will fail
1. Access the aplication in your browser at `http://localhost:3000`
2. Login using any provided user credentials
- (email: `[email protected]`, password: `123456`)
- (email: `[email protected]`, password: `123456`)

---
## Contributing

Read [contributing guidelines](./CONTRIBUTING.md) to start making contributions
We welcome contributions from the community! To contribute to CMS, follow these steps:

1. Fork the repository.
2. Create a new branch (`git checkout -b feature/fooBar`).
3. Make your changes and commit them (`git commit -am 'Add some fooBar'`).
> Make sure to lint and format your code before commiting
>
> - `npm run lint:check` to check for lint errors
> - `npm run lint:fix` to fix lint errors
> - `npm run format:check` to format the code
> - `npm run format:fix` to fix the formatting
4. Push to the branch (`git push origin feature/fooBar`).
5. Create a new Pull Request.

For major changes, please open an issue first to discuss what you would like to change.

Read our [contribution guidelines](./CONTRIBUTING.md) for more details.

## Contributors

<a href="https://github.com/code100x/cms/graphs/contributors">
<img src="https://contrib.rocks/image?repo=code100x/cms&max=400&columns=20" />
</a>

## Issues on mac Silicon
brew install pkg-config cairo pango libpng jpeg giflib librsvg
Binary file added certificate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions chromatic.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"projectId": "Project:66234a5ec2e12ce0e1adf381",
"zip": true
}
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ services:
container_name: cms-docker
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/cms?schema=public
- NEXT_WEBPACK_USEPOLLING=1
ports:
- '3000:3000'
- '5555:5555'
Expand All @@ -26,9 +27,12 @@ services:
ports:
- 5432:5432
volumes:
- ./postgres-data:/var/lib/postgresql/data
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: [ 'CMD-SHELL', 'pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}' ]
interval: 10s
timeout: 5s
retries: 5

volumes:
postgres-data:
14 changes: 13 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
experimental: {
serverActions: {
allowedOrigins: ['localhost:3000', 'app.100xdevs.com', 'app2.100xdevs.com']
}
}
},
swcMinify: true,
webpack: (config) => {
// Enable polling based on env variable being set
if (process.env.NEXT_WEBPACK_USEPOLLING) {
config.watchOptions = {
poll: 500,
aggregateTimeout: 300
};
}
return config;
},
};

module.exports = nextConfig;
Loading

0 comments on commit 6140b77

Please sign in to comment.