diff --git a/.github/workflows/install.yml b/.github/workflows/install.yml index 70de3e6..6815e08 100644 --- a/.github/workflows/install.yml +++ b/.github/workflows/install.yml @@ -14,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ ubuntu-latest, windows-latest, macos-latest ] + os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-latest, macos-latest ] node-version: [18, 20, 22] fail-fast: false @@ -28,10 +28,10 @@ jobs: node-version: ${{ matrix.node-version }} - name: Generate package.json file - run: npm init -y + run: cd html && npm init -y - - name: Install ndc package - run: npm install @remotemerge/nepali-date-converter + - name: Install Nepali Date Converter + run: cd html && npm install @remotemerge/nepali-date-converter - name: List installed packages - run: npm list --depth=0 + run: cd html && npm list --depth=0 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8f0c69f..21c0492 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -23,12 +23,15 @@ jobs: registry-url: 'https://registry.npmjs.org' - name: Install dependencies - run: npm install + run: cd html && npm install - name: Build project - run: npm run build + run: cd html && npm run build + + - name: Copy Documentation and License + run: cp README.md LICENSE html/dist - name: Publish the package to npm - run: npm publish ./dist --access public + run: cd html && npm publish ./dist --access public env: NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6a50534..44003c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,7 +1,7 @@ name: Test # Trigger the workflow on pull requests -on: [pull_request] +on: [ pull_request ] jobs: test: @@ -9,8 +9,8 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [18, 20, 22] + os: [ ubuntu-24.04, windows-latest, macos-latest ] + node-version: [ 18, 20, 22 ] fail-fast: false steps: @@ -23,13 +23,13 @@ jobs: node-version: ${{ matrix.node-version }} - name: Install dependencies - run: npm install + run: cd html && npm install - name: Build project - run: npm run build + run: cd html && npm run build - name: Create data file - run: npx shx cp __tests__/data.dist.json __tests__/data.json + run: cd html && npx shx cp __tests__/data.dist.json __tests__/data.json - name: Run Tests - run: npm run test + run: cd html && npm run test diff --git a/.gitignore b/.gitignore index 3461baa..41b0c9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,12 @@ ### Vendor directories -/.yarn/ -/node_modules/ -/vendor/ +/html/.yarn/ +/html/node_modules/ +/html/vendor/ ### Build directories -/build/ -/bundle/ -/dist/ +/html/build/ +/html/bundle/ +/html/dist/ ### JetBrains /.idea/* @@ -56,4 +56,4 @@ pnpm-lock.yaml yarn.lock ## Data Files -/__tests__/data.json +/html/__tests__/data.json diff --git a/README.md b/README.md index 59e26a1..71e2f15 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Package](https://img.shields.io/npm/v/@remotemerge/nepali-date-converter?logo=npm)](https://www.npmjs.com/package/@remotemerge/nepali-date-converter) ![Build](https://img.shields.io/github/actions/workflow/status/remotemerge/nepali-date-converter/publish.yml?logo=github) -![Tests](https://img.shields.io/github/actions/workflow/status/remotemerge/nepali-date-converter/test.yml?style=flat&logo=counterstrike&label=test) +![Tests](https://img.shields.io/github/actions/workflow/status/remotemerge/nepali-date-converter/test.yml?&logo=jest&label=test) ![Downloads](https://img.shields.io/npm/dt/@remotemerge/nepali-date-converter?logo=spreadshirt) [![Size](https://img.shields.io/bundlephobia/minzip/@remotemerge/nepali-date-converter?logo=ipfs&label=size)](https://bundlephobia.com/result?p=@remotemerge/nepali-date-converter) ![License](https://img.shields.io/github/license/remotemerge/nepali-date-converter?logo=opensourceinitiative) diff --git a/app-cli.sh b/app-cli.sh new file mode 100644 index 0000000..6490335 --- /dev/null +++ b/app-cli.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +# Login to the app container +docker compose --file ducker-compose.yml exec --user node npm-dev-server bash diff --git a/ducker-compose.yml b/ducker-compose.yml new file mode 100644 index 0000000..e8ee387 --- /dev/null +++ b/ducker-compose.yml @@ -0,0 +1,30 @@ +# Docker Compose configuration for NPM package deployment +# If you read this file, start docker compose with the following command: +# bash start-docker.sh + +# Define network +networks: + npm-dev-network: + name: npm-dev-network + driver: bridge + external: false + +# Define services +services: + npm-dev-server: + image: node:22 + user: node + working_dir: /app + volumes: + - ./html/:/app + ports: + - "3000:3000" + networks: + - npm-dev-network + entrypoint: [ "/bin/bash", "/app/entrypoint.sh" ] + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:3000" ] + interval: 30s + timeout: 10s + retries: 3 + restart: unless-stopped diff --git a/.npmrc b/html/.npmrc similarity index 100% rename from .npmrc rename to html/.npmrc diff --git a/__tests__/ad.spec.ts b/html/__tests__/ad.spec.ts similarity index 92% rename from __tests__/ad.spec.ts rename to html/__tests__/ad.spec.ts index f15ec9c..516a06b 100644 --- a/__tests__/ad.spec.ts +++ b/html/__tests__/ad.spec.ts @@ -1,4 +1,4 @@ -import DateConverter from '../src/index'; +import DateConverter from '../src'; import records from './data.json'; diff --git a/__tests__/bs.spec.ts b/html/__tests__/bs.spec.ts similarity index 92% rename from __tests__/bs.spec.ts rename to html/__tests__/bs.spec.ts index d588c43..62bac60 100644 --- a/__tests__/bs.spec.ts +++ b/html/__tests__/bs.spec.ts @@ -1,4 +1,4 @@ -import DateConverter from '../src/index'; +import DateConverter from '../src'; import records from './data.json'; diff --git a/__tests__/data.dist.json b/html/__tests__/data.dist.json similarity index 100% rename from __tests__/data.dist.json rename to html/__tests__/data.dist.json diff --git a/html/entrypoint.sh b/html/entrypoint.sh new file mode 100644 index 0000000..53393d7 --- /dev/null +++ b/html/entrypoint.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Exit on error +set -e + +# Change to the app directory +cd /app + +# Install dependencies +npm install + +# Start the app +npm run dev diff --git a/eslint.config.js b/html/eslint.config.js similarity index 100% rename from eslint.config.js rename to html/eslint.config.js diff --git a/index.html b/html/index.html similarity index 72% rename from index.html rename to html/index.html index 7f28fdb..5efd41d 100644 --- a/index.html +++ b/html/index.html @@ -1,4 +1,4 @@ - +
@@ -6,6 +6,6 @@