Skip to content

Commit

Permalink
Update readme (#6)
Browse files Browse the repository at this point in the history
* update(readme): tidy up some information

* fix(readme): commit updated readme

* update(readme): added links to `periodum`

* update(commands): updated desktop building commands
  • Loading branch information
GervinFung authored Mar 25, 2024
1 parent 0e2653a commit c22b71d
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 46 deletions.
87 changes: 56 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,64 +1,89 @@
# The Periodic Table

Credit to [Evrim Ağacı](https://github.com/evrimagaci) as most of the data is scraped from it
Major credit to [Evrim Ağacı](https://github.com/evrimagaci) as most of the data is scraped from [periodum](https://github.com/evrimagaci/periodum)

## Preview
# Structure

#### Home Page
This project use monorepo with pnpm workspace, the web app and desktop app are in `apps` respectively

![Home](test/snapshot/snapshot-images/pc/home.png 'Home')
# Preview

#### Compounds Page
Home Page

![Compounds](test/snapshot/snapshot-images/pc/compounds.png 'Compounds')
![Home](apps/web/test/snapshot/snapshot-images/pc/home.png 'Home')

#### Element Page (too long to show full page)
Compounds Page

![Element](docs/element.png 'Element')
![Compounds](apps/web/test/snapshot/snapshot-images/pc/compounds.png 'Compounds')

#### Error Page
Element Page (too long to show full page)

![error](test/snapshot/snapshot-images/pc/error.png 'Error')
![Element](apps/web/docs/element.png 'Element')

## Tech Used
Error Page

![error](apps/web/test/snapshot/snapshot-images/pc/error.png 'Error')

# Tech Used

| Aspect | Name |
| ---------------------- | -------------- |
| Development Language | TypeScipt |
| Scripting Language | TypeScipt |
| Testing | Vitest |
| Styling | Joy UI |
| Styling | Mui Joy |
| Framework | NextJS |
| Build Automation Tool | Make |
| Dependency Management | Pnpm |
| Continuous Integration | GitHub Actions |
| Desktop Application | Tauri |

## How to build this app?
# How to build this app?

_*Make sure you have `pnpm` and `make` available in your system*_

### Environment Variables
You can install pnpm with `npm i -g pnpm`, if you have npm in your pc, otherwise, install npm [here](https://nodejs.org/en/download/current)

For Mac and Linux, make is available, but for Windows, you can install make with `choco install make`

#### Development and Testing
Environment Variables

Run the following command
`apps/web/config/.env.production` does not exists as it's not committed, so any `make` commands related to production will not, including but are not limited to `make build-production`, `make copy-env-production`, `make build-executable-production`

`make copy-env-[development/testing]`
Rest assured that you can still build an optimised & minimised version of this application without production configuration provided

#### Make Commands
Make Commands

_*Below are the listed commands that you can use to build/develop/test this app*_

| Command | Usage |
| ------------------------------------------------- | ------------------------------------------------- |
| make start | Start the bundled app |
| make generate | Generate the file needed |
| make start-(development OR staging OR production) | Start development |
| make build-(development OR staging OR production) | Bundle and build the app |
| make deploy-(staging OR production) | Bundle, build and deploy the app |
| make install | Install all dependencies |
| make test | Run all test code |
| make typecheck | Run typechecking for source code |
| make lint | Run linter for source and test code |
| make format-check | Run prettier to check source and test code format |
| make format | Run prettier to format source and test code |
2. Web in `apps/web`

| Command | Usage |
| ---------------------------------------------------- | ------------------------------------------------- |
| make start | Start the bundled app |
| make generate | Generate the file needed |
| make start-(development OR testing OR production) | Start development |
| make build-(development OR testing OR production) | Bundle and build the app |
| make copy-env-(development OR testing OR production) | Copy environment variables to `.env` |
| make install | Install all dependencies |
| make test | Run all test code |
| make typecheck | Run typechecking for source code |
| make lint | Run linter for source and test code |
| make format-check | Run prettier to check source and test code format |
| make format-write | Run prettier to format source and test code |

3. Desktop in `apps/desktop`

| Command | Usage |
| --------------------- | ------------------------------------------------- |
| make build-production | Bundle and build the app |
| make format-check | Run prettier to check source and test code format |
| make format-write | Run prettier to format source and test code |

_*You can run the app without setting up the app for demo purpose, the execution (windows/mac/linux) is in `apps/desktop/src-tauri/target/release/periotable(.exe?)`*_

But if you want to properly install the app, you must run the setup file as shown in terminal after building it

# Generated files

The data for periodic tables are not committed, if you need it, you let me know. For now you can just raise an issue if you need it
14 changes: 11 additions & 3 deletions apps/desktop/Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
.PHONY: build test
MAKEFLAGS += --silent

# build
build-production:
pnpm tauri build

# build
build-desktop:
build-development: build-executable-development

build-executable:
rm -rf build &&\
cd ../web &&\
make build-desktop &&\
make build-$(environment) &&\
mv desktop ../desktop/build

build-executable-development:
make build-executable environment=development

build-executable-production:
make build-executable environment=production

# format
format:
pnpm prettier --$(type) .
Expand Down
17 changes: 8 additions & 9 deletions apps/desktop/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[package]
name = "nextauri"
name = "periotable"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.57"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
description = "A UI/UX friendly desktop application to learn more about Modern Periodic Table of Elements"
authors = ["PoolOfDeath20 <[email protected]>"]
description ="The CLI Application of Gitignored. Provide A Faster Way to Generate .gitignore File via Caching"
repository = "https://github.com/GervinFung/periotable"
readme = "README.md"
homepage = "https://periotable.vercel.app"
license-file = "LICENSE"

[build-dependencies]
tauri-build = { version = "1.5", features = [] }
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"build": {
"beforeBuildCommand": "make build-desktop",
"beforeBuildCommand": "make build-executable-production",
"distDir": "../build"
},
"package": {
Expand Down
8 changes: 6 additions & 2 deletions apps/web/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ generate-schema:
pre-deploy-production: copy-env-production build-production

# next config
generate-web-stuffs:
generate-web-stuffs: generate-schema
cp next/web.mjs next.config.mjs &&\
pnpm vite-node script/pages/web.ts

Expand All @@ -48,6 +48,8 @@ copy-env-testing:
clear-cache:
rm -rf .next

# development

start-development: copy-env-development generate-web-stuffs clear-cache dev

start-testing: copy-env-testing generate-web-stuffs clear-cache dev
Expand All @@ -61,7 +63,9 @@ build-production: clear-cache copy-env-production generate-web-stuffs build gene

build-testing: clear-cache copy-env-testing generate-web-stuffs build

build-desktop: clear-cache copy-env-production generate-desktop-stuffs build
build-development-desktop: clear-cache copy-env-development generate-desktop-stuffs build

build-production-desktop: clear-cache copy-env-production generate-desktop-stuffs build

build:
pnpm next build
Expand Down

0 comments on commit c22b71d

Please sign in to comment.