Skip to content
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
1 change: 0 additions & 1 deletion .github/workflows/build-and-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
uses: actions/checkout@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
uses: actions/checkout@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
Comment thread
sg-gs marked this conversation as resolved.
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build-and-publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
uses: actions/checkout@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

- name: Get lines changed
run: |
LINES=$(git diff --shortstat origin/${{ github.base_ref }}...HEAD -- . ':!*.spec*' ':!package.json' ':!yarn.lock' | awk '{print $4 + $6}')
LINES=$(git diff --shortstat origin/${{ github.base_ref }}...HEAD -- . ':!*.spec*' ':!package.json' ':!package-lock.json' | awk '{print $4 + $6}')
echo "Lines changed: $LINES"
echo "LINES_CHANGED=$LINES" >> $GITHUB_ENV

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
registry-url: 'https://npm.pkg.github.com'
- name: Create .npmrc file
run: |
echo "registry=https://registry.yarnpkg.com/" > .npmrc
echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/deploy-pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
uses: actions/checkout@v2
with:
registry-url: 'https://npm.pkg.github.com'
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/pre-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ jobs:
uses: actions/checkout@v2
- name: Setup npm
run: |
echo "registry=https://registry.yarnpkg.com/" > .npmrc
echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> .npmrc
echo "always-auth=true" >> .npmrc
env:
NPM_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Install dependencies
run: yarn install
run: npm ci --ignore-scripts
- name: Build
run: yarn build
run: npm run build
5 changes: 2 additions & 3 deletions .github/workflows/run-ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ jobs:
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
echo "registry=https://registry.yarnpkg.com/" > .npmrc
echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
echo "//npm.pkg.github.com/:_authToken=${PERSONAL_ACCESS_TOKEN}" >> .npmrc
echo "always-auth=true" >> .npmrc
Expand All @@ -44,7 +43,7 @@ jobs:
compose-file: './infrastructure/docker-compose.yml'

- name: Install dependencies
run: yarn
run: npm ci --ignore-scripts

- name: Run e2e tests
run: yarn migrate:test && yarn run db:seed:test:all && yarn run test:e2e
run: npm run migrate:test && npm run db:seed:test:all && npm run test:e2e
5 changes: 2 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
registry-url: 'https://npm.pkg.github.com'

# We should see why permissions field is not doing the job. This should be removed
- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand All @@ -41,7 +40,7 @@ jobs:
- run: echo "always-auth=true" >> .npmrc

- name: Install dependencies
run: yarn
run: npm ci --ignore-scripts

- name: Run unit tests
run: yarn test
run: npm run test
5 changes: 2 additions & 3 deletions .github/workflows/sonar-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'

- run: echo "registry=https://registry.yarnpkg.com/" > .npmrc
- run: echo "@internxt:registry=https://npm.pkg.github.com" >> .npmrc
# You cannot read packages from other private repos with GITHUB_TOKEN
# You have to use a PAT instead https://github.com/actions/setup-node/issues/49
Expand All @@ -34,10 +33,10 @@ jobs:
- run: echo "always-auth=true" >> .npmrc

- name: Install dependencies
run: yarn
run: npm ci --ignore-scripts

- name: Test and coverage
run: yarn test:cov
run: npm run test:cov

- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
Expand Down
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
npm run lint-staged
2 changes: 0 additions & 2 deletions .npmrc.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
registry=https://registry.yarnpkg.com/

@internxt:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=TOKEN
always-auth=true
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ LABEL author="internxt"
WORKDIR /usr/app

COPY package.json ./
COPY yarn.lock ./
COPY package-lock.json ./
COPY .npmrc ./
RUN yarn --ignore-scripts
RUN npm ci --ignore-scripts

COPY tsconfig.json ./
COPY tsconfig.build.json ./
COPY nest-cli.json ./
COPY .sequelizerc ./
COPY --chmod=755 src ./src
COPY --chmod=755 migrations ./migrations
RUN yarn build && chmod -R 755 dist/
RUN npm run build && chmod -R 755 dist/

FROM node:22.17.0
LABEL author="internxt"

WORKDIR /usr/app

COPY package.json ./
COPY yarn.lock ./
COPY package-lock.json ./
COPY .npmrc ./
RUN yarn --ignore-scripts --production
RUN npm ci --ignore-scripts --production

COPY --from=builder /usr/app/dist ./dist
COPY --from=builder /usr/app/migrations ./migrations
COPY --from=builder /usr/app/.sequelizerc ./

USER node

CMD ["yarn", "start:prod"]
CMD ["npm", "run", "start:prod"]
17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,17 @@ Drive server WIP is the new API to Drive based on NestJS and following Clean Arc
- [Libs](#libs)
- [API Documentation](#api-documentation)

## Quick Setup

- Yarn

`npm i -g yarn`

## How to Install

- Create a `.npmrc` file from the `.npmrc.template` example provided in the repo.
- Replace `TOKEN` with your own [Github Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) with `read:packages` permission **ONLY**
- Use `yarn` to install project dependencies.

- Use `npm ci` to install project dependencies.

## Start app

Run `yarn start` to start server in production mode.
Run `npm run start` to start server in production mode.

Run `yarn start:dev` to start with nodemon and development environment.
Run `npm run start:dev` to start with nodemon and development environment.

### Running in docker:

Expand All @@ -69,15 +62,15 @@ docker-compose up
You can run unit tests with:

```bash
yarn run test
npm run test
```

### End to End Testing

Running e2e test requires creating a database first (check .env.test file), and having a mariadb instance running.

```bash
yarn run test:e2e
npm run test:e2e
```

## Guideline Nest.js
Expand Down
8 changes: 4 additions & 4 deletions development.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ FROM node:22.17.0
WORKDIR /usr/app

COPY package.json ./
COPY yarn.lock ./
COPY package-lock.json ./
COPY .npmrc ./
RUN yarn --ignore-scripts
RUN npm ci --ignore-scripts

COPY tsconfig.json ./
COPY tsconfig.build.json ./
COPY nest-cli.json ./
COPY .sequelizerc ./
COPY --chmod=755 src ./src
COPY --chmod=755 migrations ./migrations
RUN yarn build && chmod -R 755 dist/
RUN npm run build && chmod -R 755 dist/

USER node

CMD ["sh", "-c", "yarn migrate && yarn start:dev"]
CMD ["sh", "-c", "npm run migrate && npm run start:dev"]
8 changes: 4 additions & 4 deletions infrastructure/development.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ FROM node:22.17.0
WORKDIR /usr/app

COPY package.json ./
COPY yarn.lock ./
COPY package-lock.json ./
COPY .npmrc ./
RUN yarn --ignore-scripts
RUN npm ci --ignore-scripts

COPY tsconfig.json ./
COPY tsconfig.build.json ./
COPY nest-cli.json ./
COPY .sequelizerc ./
COPY --chmod=755 src ./src
COPY --chmod=755 migrations ./migrations
RUN yarn build && chmod -R 755 dist/
RUN npm run build && chmod -R 755 dist/

USER node

CMD ["sh", "-c", "yarn migrate && yarn start:dev"]
CMD ["sh", "-c", "npm run migrate && npm run start:dev"]
8 changes: 4 additions & 4 deletions infrastructure/preview.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM node:22.17.0
WORKDIR /usr/app

COPY package.json ./
COPY yarn.lock ./
COPY package-lock.json ./
COPY .npmrc ./
RUN yarn --ignore-scripts
RUN npm ci --ignore-scripts

COPY tsconfig.json ./
COPY tsconfig.build.json ./
Expand All @@ -14,8 +14,8 @@ COPY .sequelizerc ./
COPY --chmod=755 src ./src
COPY --chmod=755 migrations ./migrations
COPY --chmod=755 seeders ./seeders
RUN yarn build && chmod -R 755 dist/
RUN npm run build && chmod -R 755 dist/

USER node

CMD ["sh", "-c", "yarn migrate && yarn db:seed:test:all && yarn start:dev"]
CMD ["sh", "-c", "npm run migrate && npm run db:seed:test:all && npm run start:dev"]
Loading
Loading