Skip to content

Commit aaa11f1

Browse files
committed
initial commit
0 parents  commit aaa11f1

37 files changed

+6712
-0
lines changed

.eslintrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"root": true,
3+
"ignorePatterns": ["**/lib/**"],
4+
"parser": "@typescript-eslint/parser",
5+
"plugins": ["@typescript-eslint"],
6+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
7+
"env": {
8+
"node": true
9+
}
10+
}

.github/workflows/ci.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
merge_group:
11+
types:
12+
- checks_requested
13+
14+
permissions:
15+
contents: read
16+
pull-requests: write
17+
18+
jobs:
19+
build-and-test:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
25+
- name: Use Node.js
26+
uses: actions/setup-node@v3
27+
with:
28+
node-version: '18'
29+
30+
- name: Get yarn cache directory path
31+
id: yarn-cache-dir-path
32+
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
33+
34+
- name: Cache yarn dependencies
35+
uses: actions/cache@v3
36+
id: yarn-cache
37+
with:
38+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
39+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-yarn-
42+
43+
- name: Install dependencies
44+
run: yarn install --frozen-lockfile
45+
46+
- name: Run tests with coverage
47+
run: yarn test
48+
49+
- name: Upload coverage reports to Codecov
50+
uses: codecov/codecov-action@v4
51+
with:
52+
token: ${{ secrets.CODECOV_TOKEN }}
53+
54+
- name: Get coverage percentage
55+
id: coverage
56+
run: |
57+
COVERAGE=$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')
58+
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
59+
60+
- name: Comment PR
61+
uses: actions/github-script@v6
62+
if: github.event_name == 'pull_request'
63+
with:
64+
github-token: ${{secrets.GITHUB_TOKEN}}
65+
script: |
66+
const fs = require('fs');
67+
const coverageData = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
68+
69+
let coverageTable = '| Category | Percentage | Covered | Total |\n';
70+
coverageTable += '|-----------|------------|---------|-------|\n';
71+
72+
for (const [category, data] of Object.entries(coverageData.total)) {
73+
const percentage = data.pct.toFixed(2);
74+
coverageTable += `| ${category} | ${percentage}% | ${data.covered} | ${data.total} |\n`;
75+
}
76+
77+
const comment = `## 📊 Test Coverage Report\n\n${coverageTable}\n\nLast updated: ${new Date().toUTCString()}`;
78+
79+
github.rest.issues.createComment({
80+
issue_number: context.issue.number,
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
body: comment
84+
});

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/node_modules/**
2+
**/lib/**
3+
**/coverage/**
4+
**/.vscode/**

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.15.0

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/coverage/**
2+
**/lib/**
3+
CHANGELOG.md

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 140,
3+
"tabWidth": 2,
4+
"quoteProps": "consistent",
5+
"trailingComma": "all"
6+
}

CHANGELOG.md

Whitespace-only changes.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 MinhOmega
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# 📊 npm-increaser-downloads
2+
3+
A tool designed to simulate package downloads and increase the popularity score of npm packages, inspired by [npm-downloads-increaser](https://github.com/lachiejames/npm-downloads-increaser). This enhanced version allows developers to test and analyze the impact of download counts on package visibility and ranking within the npm ecosystem, with added support for packages not found in npms.io and several new features.
4+
5+
## ✨ Features
6+
7+
- Simulates package downloads from the npm registry
8+
- Supports packages not listed on npms.io
9+
- Configurable download count, concurrency, and timeout settings
10+
- Supports both CLI and programmatic usage
11+
- Real-time progress tracking and statistics
12+
- Handles scoped packages and various network conditions
13+
14+
## ⚠️ Disclaimer
15+
16+
This tool is intended for educational and testing purposes only. Artificially inflating download counts may violate npm's terms of service. Use responsibly and at your own risk.
17+
18+
## 🖥️ Running from the command line
19+
20+
### 📥 Installing
21+
22+
Install `npm-increaser-downloads` globally using npm:
23+
24+
```bash
25+
npm install -g npm-increaser-downloads
26+
```
27+
28+
### 🚀 Running
29+
30+
Setup configuration and run:
31+
32+
```bash
33+
npm-increaser-downloads
34+
```
35+
36+
Once you specify your configuration, this will start spamming downloads for the provided package in the npmjs registry. This will increase the popularity score of the npm package.
37+
38+
NOTE: The npmJS Weekly Downloads are updated **once every 24 hours**, so results will not be instantly visible.
39+
40+
### ⚙️ Configuration options
41+
42+
| Property | Description | Example |
43+
| ---------------------- | ------------------------------------------------------- | --------------------------- |
44+
| packageName | NPM package to increase the downloads of | `"npm-increaser-downloads"` |
45+
| numDownloads | Number of times to download the package | `100000` |
46+
| maxConcurrentDownloads | Amount of downloads to run in parallel at once | `300` |
47+
| downloadTimeout | Max time (in ms) to wait for for a download to complete | `3000` |
48+
49+
**NOTE: slower** networks may perform better with a **lower** `maxConcurrentDownloads` and a **higher** `downloadTimeout`
50+
51+
## 🛠️ Running in TypeScript
52+
53+
### 📥 Installing
54+
55+
Install the project using:
56+
57+
```bash
58+
git clone https://github.com/lachiejames/npm-increaser-downloads.git
59+
```
60+
61+
### 🔧 Setting up your configuration
62+
63+
Open `npm-increaser-downloads.config.js` from the root directory, and populate the configuration options as shown in the table above.
64+
65+
### 💻 Running locally
66+
67+
Installing dependencies:
68+
69+
```bash
70+
npm install
71+
```
72+
73+
Running in development mode:
74+
75+
```bash
76+
npm run dev
77+
```
78+
79+
Running the CLI in development mode:
80+
81+
```bash
82+
npm run dev:cli
83+
```
84+
85+
Compiling to JavaScript:
86+
87+
```bash
88+
npm run build
89+
```
90+
91+
Running with Node:
92+
93+
```bash
94+
npm start
95+
```
96+
97+
Running tests:
98+
99+
```bash
100+
npm test
101+
```
102+
103+
Formatting code:
104+
105+
```bash
106+
npm run format
107+
```

npm-increaser-downloads.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Config } from './src/models/config.model';
2+
3+
const config: Config = {
4+
// NPM package to increase the download count for
5+
packageName: "",
6+
7+
// Number of downloads to add to the package
8+
numDownloads: 1000,
9+
10+
// Amount of downloads you can run in parallel at once.
11+
// Slower networks may perform better with a lower maxConcurrentDownloads
12+
maxConcurrentDownloads: 300,
13+
14+
// Max time to wait for for a download to complete
15+
// Slower networks may perform better with a higher downloadTimeout
16+
downloadTimeout: 3000,
17+
};
18+
19+
export default config;

0 commit comments

Comments
 (0)