Skip to content

Commit

Permalink
Move to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
dipiash committed Oct 23, 2024
1 parent 4512854 commit 22420b6
Show file tree
Hide file tree
Showing 15 changed files with 39,417 additions and 21,162 deletions.
70 changes: 37 additions & 33 deletions .github/workflows/CheckPullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,36 @@ jobs:
cache-and-install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache data for pnpm and node_modules
uses: actions/cache@v3
with:
path: |
~/.pnpm-store
**/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: pnpm/action-setup@v4

- uses: actions/setup-node@v4
with:
version: 8
run_install: true
node-version: 20.16.0
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Install dependencies
run: npm ci --prefer-offline

type-check:
runs-on: ubuntu-latest
needs:
- cache-and-install
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v10
- run: npm ci --prefer-offline
- uses: nrwl/nx-set-shas@v4

- name: type-check PR
if: github.ref != 'refs/heads/main'
Expand All @@ -61,15 +56,18 @@ jobs:
needs:
- cache-and-install
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v10
- run: npm ci --prefer-offline
- uses: nrwl/nx-set-shas@v4

- name: lint PR
if: github.ref != 'refs/heads/main'
Expand All @@ -83,15 +81,18 @@ jobs:
needs:
- cache-and-install
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v10
- run: npm ci --prefer-offline
- uses: nrwl/nx-set-shas@v4

- name: stylelint PR
if: github.ref != 'refs/heads/main'
Expand All @@ -105,15 +106,18 @@ jobs:
needs:
- cache-and-install
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v10
- run: npm ci --prefer-offline
- uses: nrwl/nx-set-shas@v4

- name: test PR
if: github.ref != 'refs/heads/main'
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/Deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3

- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: '**/package-lock.json'

- name: Reusable Action for PNPM and NX
uses: dipiash/pnpm-nx-reusable-action@v10
- run: npm ci --prefer-offline

- name: Install and Build 🔧
run: npx nx build main
Expand Down
47 changes: 0 additions & 47 deletions .github/workflows/codeql.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm dlx nx affected --target=type-check --uncommitted=true && node_modules/.bin/lint-staged
npx nx affected --target=type-check --uncommitted=true && node_modules/.bin/lint-staged
4 changes: 2 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm dlx nx affected --target=lint
pnpm dlx nx affected --target=type-check
npx nx affected --target=lint
npx nx affected --target=type-check
9 changes: 9 additions & 0 deletions .huskyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This loads nvm.sh, sets the correct PATH before running hook, and ensures the project version of Node
export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# If you have an .nvmrc file, we use the relevant node version
if [ -f ".nvmrc" ]; then
nvm use
fi
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save-exact=true
legacy-peer-deps=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.16.0
1 change: 1 addition & 0 deletions .nxignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vercel
15 changes: 10 additions & 5 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Add files here to ignore them from prettier formatting

/dist
/coverage
.assets
.nx
.idea
.vscode
.husky
dist
build
coverage
node_modules
.vercel

/.nx/cache
/.nx/workspace-data
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Welcome to our project! We're thrilled that you're considering contributing. Her

1. Fork the repository to your GitHub account.
2. Clone the forked repository to your local machine.
3. Run `pnpm install` to install the project dependencies.
3. Run `npm install` to install the project dependencies.
4. Familiarize yourself with the project's structure and codebase.

## Branching
Expand All @@ -20,8 +20,8 @@ Welcome to our project! We're thrilled that you're considering contributing. Her
2. To configure environment variables:
- Copy `cp ./packages/graphql/env.example ./packages/graphql/.env.local` and add your GitHub token as indicated in step 1.
- Copy `cp ./apps/main/env.example ./apps/main/.env.local` and add your GitHub token in the same way.
3. If needed, you can generate code from the GraphQL schema using: `pnpm codegen:graphql`
4. To start the application: `pnpm dev`
3. If needed, you can generate code from the GraphQL schema using: `npm run codegen:graphql`
4. To start the application: `npm run dev`
5. Open your browser and navigate to http://localhost:3000 to view the app.

## Committing
Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@

### Prerequisites

```sh
# Install pnpm
npx pnpm add -g pnpm
```

```sh
# Install NX
npm install -g nx

# Init project
pnpm run init-project
npm run init-project
```

### Development
Expand All @@ -39,11 +34,11 @@ pnpm run init-project
and add your GitHub token (see step 1)
5. _[Optional step]_ Generate code from GraphQL schema
```sh
pnpm codegen:graphql
npm run codegen:graphql
```
6. Start the app
```sh
pnpm dev
npm run dev
```
and open the page http://localhost:3000/

Expand Down
Loading

0 comments on commit 22420b6

Please sign in to comment.