Skip to content

Commit

Permalink
feat: Set up CI/CD workflow and npm publishing configuration
Browse files Browse the repository at this point in the history
- Updated GitHub Actions workflow with test, integration test, and publish jobs
- Configured package.json for npm publishing
- Added proper metadata and dependencies
  • Loading branch information
xanaawakens committed Dec 29, 2024
1 parent 9846468 commit 4f4c542
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 45 deletions.
54 changes: 44 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: CI
name: CI/CD

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [created]

jobs:
build:
test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
Expand All @@ -35,24 +36,57 @@ jobs:
- name: Build
run: npm run build

bundle-size:
test-integration:
needs: test
runs-on: ubuntu-latest
needs: build

strategy:
matrix:
test-project: [webpack-test, rollup-test, vite-test]

steps:
- uses: actions/checkout@v3

- name: Use Node.js
- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'
node-version: '18'
cache: 'npm'

- name: Install package dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Install test project dependencies
working-directory: test-projects/${{ matrix.test-project }}
run: npm ci

- name: Build test project
working-directory: test-projects/${{ matrix.test-project }}
run: npm run build

publish:
needs: [test, test-integration]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'

steps:
- uses: actions/checkout@v3

- name: Use Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Check bundle size
run: node dist/cli.js --max-size 500 --output json --dir ./dist
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
76 changes: 41 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
{
"name": "bundle-size-tracker",
"name": "@avixiii/bundle-size-tracker",
"version": "1.0.0",
"description": "Track and analyze bundle sizes for JavaScript/TypeScript projects",
"description": "A powerful and flexible tool to track and analyze JavaScript bundle sizes across different build tools",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"type": "module",
"bin": {
"bundle-size-tracker": "./dist/cli.js"
"bundle-size-tracker": "dist/cli.js"
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"scripts": {
"build": "tsc",
"test": "jest",
"lint": "eslint src --ext .ts",
"lint": "eslint . --ext .ts",
"prepublishOnly": "npm run build",
"prepare": "npm run build"
},
"keywords": [
Expand All @@ -21,45 +27,45 @@
"webpack",
"rollup",
"vite",
"analysis",
"performance"
],
"author": "",
"author": "avixiii-dev",
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"@types/webpack": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"eslint": "^8.0.0",
"jest": "^29.0.0",
"ts-jest": "^29.0.0",
"typescript": "^5.0.0",
"webpack": "^5.0.0",
"rollup": "^3.0.0",
"vite": "^4.0.0"
"repository": {
"type": "git",
"url": "git+https://github.com/avixiii-dev/bundle-size-tracker.git"
},
"bugs": {
"url": "https://github.com/avixiii-dev/bundle-size-tracker/issues"
},
"homepage": "https://github.com/avixiii-dev/bundle-size-tracker#readme",
"peerDependencies": {
"rollup": "^4.0.0",
"vite": "^5.0.0",
"webpack": "^5.0.0"
},
"dependencies": {
"commander": "^11.1.0",
"filesize": "^10.1.0",
"@types/glob": "^8.0.0",
"chalk": "^4.1.2",
"commander": "^11.0.0",
"filesize": "^10.0.0",
"glob": "^10.0.0"
},
"peerDependencies": {
"webpack": ">=5.0.0",
"rollup": ">=3.0.0",
"vite": ">=4.0.0"
"devDependencies": {
"@types/jest": "^29.5.11",
"@types/node": "^20.10.6",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"eslint": "^8.56.0",
"jest": "^29.7.0",
"rollup": "^4.9.1",
"ts-jest": "^29.1.1",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"webpack": "^5.89.0"
},
"peerDependenciesMeta": {
"webpack": {
"optional": true
},
"rollup": {
"optional": true
},
"vite": {
"optional": true
}
"engines": {
"node": ">=16.0.0"
}
}

0 comments on commit 4f4c542

Please sign in to comment.