Skip to content
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

chore: Switch to npm #595

Merged
merged 21 commits into from
Sep 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/cd.deploy.stg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,30 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Bundle info"
shell: bash
run: |
yarn generate:bundle-info $DEPLOY_VERSION stage
npm run generate:bundle-info $DEPLOY_VERSION stage

- name: "Build"
shell: bash
run: |
yarn build
yarn --cwd=web bundle:alone
npm run build
npx lerna run bundle:alone --scope @dzcode.io/web

- name: "Sentry Release"
shell: bash
run: |
yarn generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }}
npm run generate:sentry-release $DEPLOY_VERSION stage ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: "Deploy"
shell: bash
run: |
yarn deploy:stg
npm run deploy:stg
18 changes: 9 additions & 9 deletions .github/workflows/cd.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,36 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Version"
shell: bash
run: |
yarn version:apply $DEPLOY_VERSION
yarn version:push $DEPLOY_VERSION
npm run version:apply $DEPLOY_VERSION
npm run version:push $DEPLOY_VERSION

- name: "Bundle info"
shell: bash
run: |
yarn generate:bundle-info $DEPLOY_VERSION production
npm run generate:bundle-info $DEPLOY_VERSION production

- name: "Build"
shell: bash
run: |
yarn build
yarn --cwd=web bundle:alone
npm run build
npx lerna run bundle:alone --scope @dzcode.io/web

- name: "Sentry Release"
shell: bash
run: |
yarn generate:sentry-release $DEPLOY_VERSION production ${{ secrets.SENTRY_AUTH_TOKEN }}
npm run generate:sentry-release $DEPLOY_VERSION production ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: "Deploy"
shell: bash
run: |
yarn deploy
npm run deploy
16 changes: 8 additions & 8 deletions .github/workflows/ci.main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,27 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Build"
shell: bash
run: |
yarn build
npm run build

- name: "Lint"
shell: bash
run: |
yarn lint:alone
npm run lint:alone

- name: "Test"
shell: bash
run: |
yarn test:alone -- -- --coverage
npm run test:alone -- -- --coverage

- uses: codecov/codecov-action@v3
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down Expand Up @@ -85,9 +85,9 @@ jobs:
- name: "Misc"
shell: bash
run: |
yarn lerna run bundle:alone --scope @dzcode.io/web
yarn lerna run generate:sitemap --scope @dzcode.io/web
yarn lerna run generate:htmls --scope @dzcode.io/web
npx lerna run bundle:alone --scope @dzcode.io/web
npx lerna run generate:sitemap --scope @dzcode.io/web
npx lerna run generate:htmls --scope @dzcode.io/web

env:
CI: true
6 changes: 3 additions & 3 deletions .github/workflows/ci.pr.e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Cypress"
uses: cypress-io/[email protected]
with:
start: yarn dev:web
start: npm run dev:web
wait-on: "http://localhost:8080"
wait-on-timeout: 120
browser: ${{ matrix.browser }}
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/ci.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Build"
shell: bash
run: |
yarn build --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents
npm run build -- --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents

- name: "Lint"
shell: bash
run: |
yarn lint:alone --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents
npm run lint:alone -- --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents

- name: "Test"
shell: bash
run: |
yarn test:alone -- --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents -- --coverage
npm run test:alone -- --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents -- --coverage

- name: "Misc"
shell: bash
run: |
yarn lerna run bundle:alone --scope @dzcode.io/web --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents
yarn lerna run generate:sitemap --scope @dzcode.io/web --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents
npx lerna run bundle:alone --scope @dzcode.io/web --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents
npx lerna run generate:sitemap --scope @dzcode.io/web --since refs/remotes/origin/${{ github.event.pull_request.base.ref }} --include-dependencies --include-dependents

env:
CI: true
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache: "npm"

- name: "Install"
shell: bash
run: |
yarn --frozen-lockfile --network-timeout 1000000
npm ci

- name: "Build"
run: |
yarn build
npm run build

# Initializes the CodeQL tools for scanning.
- name: "CodeQL"
Expand Down
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ node_modules
.vscode

*.tsbuildinfo
yarn-error.log

.idea/
.env
Expand All @@ -22,11 +21,15 @@ api/sqlite_db
api/nodemon.json

# web
web/bundle
web/build
web/src/_e2e-test/downloads
web/src/_e2e-test/videos
web/src/_e2e-test/screenshots
bundle
build
src/_e2e-test/downloads
src/_e2e-test/videos
src/_e2e-test/screenshots

# Project
firebase/public
firebase/data

# mobile
mobile/.expo
Expand Down
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,15 @@ The code for [dzcode.io](https://dzcode.io), a website for Algerian open-source

You can find more about each folder by clicking on the folder name

| **Apps** | **Coverage** | **Production URL** | **Staging URL** | **Local URL** |
| :-------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------- | -----------------------------------------------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | ------------------------------------------------: |
| [api](./api) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=api)](https://codecov.io/gh/dzcode-io/dzcode.io) | [api.dzcode.io/docs](https://api.dzcode.io/docs) | [api-stage.dzcode.io/docs](https://api-stage.dzcode.io/docs) | [localhost:7070/docs](http://localhost:7070/docs) |
| [web](./web) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=web)](https://codecov.io/gh/dzcode-io/dzcode.io) | [dzcode.io](https://dzcode.io) | [stage.dzcode.io](https://stage.dzcode.io) | [localhost:8080](http://localhost:8080) |
| [mobile](./mobile) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=mobile)](https://codecov.io/gh/dzcode-io/dzcode.io) | | [Android](https://play.google.com/store/apps/details?id=io.dzcode.mobile) \| [iOS](https://testflight.apple.com/join/XDcfIqdJ) \| [Expo](https://expo.dev/@zakman.dev/dzcode?release-channel=stage) | run `yarn --cwd=mobile start:expo` |
| [data](./data) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=data)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| **Packages** | | | | |
| [models](./packages/models) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=models)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| [utils](./packages/utils) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=utils)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| [ui](./packages/ui) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=ui)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| [tooling](./packages/tooling) | | | | |
| [ui-mobile](./packages/ui-mobile) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=ui-mobile)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| **Apps** | **Coverage** | **Production URL** | **Staging URL** | **Local URL** |
| :---------------------------- | :----------------------------------------------------------------------------------------------------------------------------- | -----------------------------------------------: | -----------------------------------------------------------: | ------------------------------------------------: |
| [api](./api) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=api)](https://codecov.io/gh/dzcode-io/dzcode.io) | [api.dzcode.io/docs](https://api.dzcode.io/docs) | [api-stage.dzcode.io/docs](https://api-stage.dzcode.io/docs) | [localhost:7070/docs](http://localhost:7070/docs) |
| [web](./web) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=web)](https://codecov.io/gh/dzcode-io/dzcode.io) | [dzcode.io](https://dzcode.io) | [stage.dzcode.io](https://stage.dzcode.io) | [localhost:8080](http://localhost:8080) |
| [data](./data) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=data)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| **Packages** | | | | |
| [models](./packages/models) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=models)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| [utils](./packages/utils) | [![codecov](https://codecov.io/gh/dzcode-io/dzcode.io/graph/badge.svg?flag=utils)](https://codecov.io/gh/dzcode-io/dzcode.io) | | | |
| [tooling](./packages/tooling) | | | | |

## Get Started

Expand All @@ -29,7 +26,6 @@ Make sure you have:

- [Git](https://git-scm.com/)
- [Nodejs](https://nodejs.org/) version 18 or higher (we recommend using [nvm](https://github.com/nvm-sh/nvm))
- [Yarn](https://yarnpkg.com/) version 1.4.2 or higher

### Run it locally

Expand All @@ -48,26 +44,25 @@ Make sure you have:
- Install dependencies:

```sh
yarn
npm install
```

- Run it locally by either:

```sh
yarn dev:web
npm run dev:web
```

```sh
yarn dev:mobile
npm run dev:api
```

```sh
yarn dev:all
npm run dev:all
```

- For api server go to <http://localhost:7070/docs>
- For web server go to <http://localhost:8080>
- For mobile run `yarn --cwd=mobile start:expo` and scan QR code with your phone

**Note**

Expand All @@ -84,7 +79,7 @@ Make **sure** you are in the project **root**, then:
- run web e2e tests by:

```sh
yarn e2e:web
cd web && npm run e2e:dev
```

## Contributing
Expand All @@ -110,7 +105,7 @@ If you use VSCode, please make sure to have a `.vscode/settings.json` file with
### Before You Create a Pull Request

- If you already forked the repository, please make sure your fork is up-to-date, following [this simple steps](https://www.dzcode.io/Learn/Git_Basics/Syncing_An_Old_Forked_Repository_With_Upstream).
- Please make sure your code follows the style guideline defined in this repo, for that simply run `yarn lint:fix` to ensure the conformity. This process should happen automatically whenever you commit your changes, but you can always do it manually when your Pull Request checks are failing due to linting errors.
- Please make sure your code follows the style guideline defined in this repo, for that simply run `npm run lint:fix` to ensure the conformity. This process should happen automatically whenever you commit your changes, but you can always do it manually when your Pull Request checks are failing due to linting errors.

### List Your Project or Add/Edit Article

Expand Down
4 changes: 2 additions & 2 deletions api/oracle-cloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ RUN pwd
RUN ls

# Install app dependencies
RUN yarn --production --frozen-lockfile
RUN npm install --frozen-lockfile

# export server port
ENV PORT=7070
EXPOSE ${PORT}

# Run the app
WORKDIR /usr/src/repo/api
CMD [ "yarn", "start" ]
CMD [ "npm", "run", "start" ]
4 changes: 2 additions & 2 deletions api/oracle-cloud/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// can be ran locally from ./api:
// SSH_ADDRESS_STG="[email protected]" SSH_PATH="path/to/private/ssh/key" yarn deploy:stg
// SSH_ADDRESS_STG="[email protected]" SSH_PATH="path/to/private/ssh/key" npm run deploy:stg

import { execSync } from "child_process";
import { copySync, existsSync } from "fs-extra";
Expand Down Expand Up @@ -30,7 +30,7 @@ fromToRecords.push(
{ from: "./oracle-cloud/docker-compose.yml", to: "./oracle-cloud/build/docker-compose.yml" },
{ from: "./oracle-cloud/Dockerfile", to: "./oracle-cloud/build/Dockerfile" },
{ from: join(workspaceRoot, "package.json"), to: "./oracle-cloud/build/package.json" },
{ from: join(workspaceRoot, "yarn.lock"), to: "./oracle-cloud/build/yarn.lock" },
{ from: join(workspaceRoot, "package-lock.json"), to: "./oracle-cloud/build/package-lock.json" },
);

fromToRecords.forEach(({ from, to }) => {
Expand Down
Loading
Loading