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
2 changes: 1 addition & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
docker:
patterns:
- "*"
- package-ecosystem: npm
- package-ecosystem: pnpm
directory: "/"
schedule:
interval: "monthly"
Expand Down
27 changes: 15 additions & 12 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,37 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Use Node.js 18

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false

- name: Use Node.js 22
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
node-version: '22'
cache: 'pnpm'
cache-dependency-path: 'pnpm-lock.yaml'

- name: Install Dependencies
run: npm ci
run: pnpm install --frozen-lockfile

- name: Run lint
run: npm run lint
run: pnpm run lint

- name: Run test with coverage
run: npm run test:cov
run: pnpm run test:cov

- name: Run Build
run: npm run build
run: pnpm run build

docker:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Build docker image
run: docker build -t typescript-project .
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
FROM node:24-alpine AS builder

# Install pnpm
RUN npm install -g pnpm

WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
RUN pnpm install
RUN pnpm run build

FROM node:24-alpine AS production

# Install pnpm
RUN npm install -g pnpm

ARG NODE_ENV=production
RUN addgroup -S docker && adduser -S user -G docker

WORKDIR /app

COPY --from=builder --chown=user:docker /app/package*.json ./
COPY --from=builder --chown=user:docker /app/package.json ./
COPY --from=builder --chown=user:docker /app/pnpm-lock.yaml ./
COPY --from=builder --chown=user:docker /app/dist ./dist
RUN npm ci --omit=dev && npm cache clean --force
RUN pnpm install --frozen-lockfile --prod && pnpm store prune

USER user

Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,50 @@
Seed project for typescript.
Use this repository as a template for your typescript projects.

## Prerequisites

This project uses pnpm as the package manager. If you don't have pnpm installed, you can install it using one of the following methods:

### Install pnpm globally via npm

```bash
npm install -g pnpm
```

For other installation methods, visit: https://pnpm.io/installation

## Getting Started

Install the dependencies:

```bash
npm install
pnpm install
```

Build the project:

```bash
npm run build
pnpm run build
```

Run the project:

```bash
npm start
pnpm start
```

Test the project using *Jest*:

```bash
npm test
pnpm test
# To test and display the coverage
npm test:cov
pnpm test:cov
```

Lint the project using *ESLint*:

```bash
npm run lint
pnpm run lint
# To fix the linting errors
npm run lint:fix
pnpm run lint:fix
```
4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type {Config} from '@jest/types';
import type {Config} from 'jest';

const config: Config.InitialOptions = {
const config: Config = {
preset: "ts-jest",
testRegex: "\\.(test|e2e)\\.ts$",
moduleFileExtensions: ["ts", "js", "json"],
Expand Down
Loading