Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
maafaishal committed Mar 9, 2024
0 parents commit c22bc48
Show file tree
Hide file tree
Showing 17 changed files with 4,188 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
39 changes: 39 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PR Checker

on: [push, pull_request]

jobs:
test:
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-latest'
node_version:
- '20'
- '18'
- '16'
- '14'
name: Node.js ${{ matrix.node_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}

- name: Update NPM
run: npm install --global pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint
if: matrix.node_version == '20'
run: pnpm run lint

# - name: Run Tests
# run: npm run test-coverage
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4

- name: Update NPM
run: npm install --global pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --branches=main --debug
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,ts,tsx}": ["eslint --fix"],
"**/*/package.json": ["sort-package-json"]
}
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Clean Up node_modules

[![Build Status][github_actions_badge]][github_actions_link]
[![NPM Version][package_version_badge]][package_link]

[package_version_badge]: https://img.shields.io/npm/v/clear-node-modules.svg
[package_link]: https://www.npmjs.com/package/clear-node-modules
[github_actions_badge]: https://img.shields.io/github/actions/workflow/status/keithamus/clear-node-modules/pr.yml
[github_actions_link]: https://github.com/keithamus/clear-node-modules/actions?query=workflow%3ACI+branch%3Amain

Find and delete `node_modules` folders (recursively) in your directory.

## CLI

### Run via npx

```bash
npx clear-node-modules
```

### Install

```bash
npm install --global clear-node-modules
```

### Usage

```console
$ npx clear-node-modules
"node_modules" is deleted! ✅
```

CLI also supports a particular path, not only your current directory, so you don't need to change the directory.

```console
$ npx clear-node-modules src
```

## Options

#### `-r`,`--recursive` flag

When you want to also delete all nested `node_modules` directory, you can run CLI with the `--recursive` flag (or `-r`).

```console
$ npx clear-node-modules -r
```
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "clear-node-modules",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"main": "dist/index.js",
"bin": "./dist/cli.mjs",
"scripts": {
"build": "tsup-node",
"dev": "tsup-node --watch",
"lint": "eslint src",
"semantic-release": "semantic-release",
"prepare": "husky"
},
"dependencies": {
"globby": "^14.0.1",
"tsup": "^8.0.2"
},
"devDependencies": {
"@commitlint/cli": "^19.0.3",
"@commitlint/config-conventional": "^19.0.3",
"@modern-js/tsconfig": "^2.48.0",
"@types/node": "20",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"semantic-release": "^23.0.2",
"sort-package-json": "^2.8.0",
"typescript": "^5.3.3"
},
"tsup": {
"entry": [
"src"
],
"format": "esm",
"splitting": false,
"sourcemap": true,
"target": "node18",
"clean": true
}
}

0 comments on commit c22bc48

Please sign in to comment.