Skip to content

Commit 8202061

Browse files
committed
fix: rebrand to verdaccio-install-counts to avoid npm rejection
1 parent 841a5c6 commit 8202061

File tree

7 files changed

+35
-34
lines changed

7 files changed

+35
-34
lines changed

CHANGELOG.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
### Bug Fixes
55

6-
* **CI:** set semantic_version to v19 for cycjimmy/semantic-release-action@v2 ([424d330](https://github.com/openupm/verdaccio-download-counts/commit/424d330cd1373414fe8a24c1e381bd4d450b894a))
7-
* handle the key not exist error for getPackageDownloadTimeSeriesResults() ([62ebb20](https://github.com/openupm/verdaccio-download-counts/commit/62ebb208ff1114019953da578c1fcd27e045d6bf))
8-
* import-logs scripts ([64de4e6](https://github.com/openupm/verdaccio-download-counts/commit/64de4e6d6e7fb6fe47b1820ab8dd8dba4b23d38a))
9-
* parseVersionFromTarballFilename for tarball name with multiple hyphens ([01330b7](https://github.com/openupm/verdaccio-download-counts/commit/01330b753695f25ca640f8a0c7a6ae35b2687f49))
10-
* repository address of package.json ([58ec568](https://github.com/openupm/verdaccio-download-counts/commit/58ec56833e542af15e89c12aff1517e94ce17845))
11-
* reset-redis.sh will remove pkghit:ver:* ([b133643](https://github.com/openupm/verdaccio-download-counts/commit/b133643da8d070671ecf9b0bcc0f557fd9695fcc))
12-
* set LICENSE ([2bb55ea](https://github.com/openupm/verdaccio-download-counts/commit/2bb55ea9a5b084d22fb2a447a75b2023d00ed365))
13-
* should not increase counter for HTTP HEAD ([4dc8d5e](https://github.com/openupm/verdaccio-download-counts/commit/4dc8d5ec0646cf4255d8943552bc6a796df8d53c))
14-
* update CI npm automation branch ([00aa0d6](https://github.com/openupm/verdaccio-download-counts/commit/00aa0d62dcbd2af5e5837c1ebba5d961f79743c9))
6+
* **CI:** set semantic_version to v19 for cycjimmy/semantic-release-action@v2 ([424d330](https://github.com/openupm/verdaccio-install-counts/commit/424d330cd1373414fe8a24c1e381bd4d450b894a))
7+
* handle the key not exist error for getPackageDownloadTimeSeriesResults() ([62ebb20](https://github.com/openupm/verdaccio-install-counts/commit/62ebb208ff1114019953da578c1fcd27e045d6bf))
8+
* import-logs scripts ([64de4e6](https://github.com/openupm/verdaccio-install-counts/commit/64de4e6d6e7fb6fe47b1820ab8dd8dba4b23d38a))
9+
* parseVersionFromTarballFilename for tarball name with multiple hyphens ([01330b7](https://github.com/openupm/verdaccio-install-counts/commit/01330b753695f25ca640f8a0c7a6ae35b2687f49))
10+
* repository address of package.json ([58ec568](https://github.com/openupm/verdaccio-install-counts/commit/58ec56833e542af15e89c12aff1517e94ce17845))
11+
* reset-redis.sh will remove pkghit:ver:* ([b133643](https://github.com/openupm/verdaccio-install-counts/commit/b133643da8d070671ecf9b0bcc0f557fd9695fcc))
12+
* set LICENSE ([2bb55ea](https://github.com/openupm/verdaccio-install-counts/commit/2bb55ea9a5b084d22fb2a447a75b2023d00ed365))
13+
* should not increase counter for HTTP HEAD ([4dc8d5e](https://github.com/openupm/verdaccio-install-counts/commit/4dc8d5ec0646cf4255d8943552bc6a796df8d53c))
14+
* update CI npm automation branch ([00aa0d6](https://github.com/openupm/verdaccio-install-counts/commit/00aa0d62dcbd2af5e5837c1ebba5d961f79743c9))
1515

1616

1717
### Features
1818

19-
* add npm automation ([61c8645](https://github.com/openupm/verdaccio-download-counts/commit/61c8645c6d6fb51ea48e6c3a162c8e3126b4d255))
20-
* add the middleware skeleton ([75bdcfb](https://github.com/openupm/verdaccio-download-counts/commit/75bdcfb41aae0a0104dd69ae01424f72fab5873a))
21-
* script to import nginx server access log as history data ([14d23a1](https://github.com/openupm/verdaccio-download-counts/commit/14d23a101c29668e7b4c1a86ccce58bbcf045ecb))
19+
* add npm automation ([61c8645](https://github.com/openupm/verdaccio-install-counts/commit/61c8645c6d6fb51ea48e6c3a162c8e3126b4d255))
20+
* add the middleware skeleton ([75bdcfb](https://github.com/openupm/verdaccio-install-counts/commit/75bdcfb41aae0a0104dd69ae01424f72fab5873a))
21+
* script to import nginx server access log as history data ([14d23a1](https://github.com/openupm/verdaccio-install-counts/commit/14d23a101c29668e7b4c1a86ccce58bbcf045ecb))

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# verdaccio-download-counts
1+
# verdaccio-install-counts
22

33
<!-- vscode-markdown-toc -->
44
* [Introduction](#Introduction)
@@ -24,7 +24,7 @@
2424

2525
## <a name='Introduction'></a>Introduction
2626

27-
This package implements API endpoints for download counts similar to [the ones](https://raw.githubusercontent.com/npm/registry/master/docs/download-counts.md) provided by npm, but limited to a specific package.
27+
This package implements API endpoints for package download counts similar to [the ones](https://raw.githubusercontent.com/npm/registry/master/docs/install-counts.md) provided by npm, but limited to a specific package.
2828

2929
The stats data is stored in Redis, using [RedisTimeSeries](https://redis.io/docs/stack/timeseries/). Please refer to the [Redis data structure](#redis-data-structure) section for more information.
3030

@@ -34,13 +34,13 @@ Note that this package does not include a widget for the Verdaccio web UI.
3434

3535
Install the package.
3636
```
37-
npm install verdaccio-download-counts
37+
npm install verdaccio-install-counts
3838
```
3939

4040
Update the `middlewares` seciton of verdaccio's `config.yaml`.
4141
```
4242
middlewares:
43-
download-counts:
43+
install-counts:
4444
enabled: true
4545
redis:
4646
host: 127.0.0.1

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "verdaccio-download-counts",
2+
"name": "verdaccio-install-counts",
33
"version": "1.0.0",
44
"description": "The package provides public api that gives you download counts by package and time range.",
55
"main": "lib/src/index.js",
@@ -34,11 +34,12 @@
3434
"keywords": [
3535
"verdaccio",
3636
"download counts",
37+
"install counts",
3738
"stats",
3839
"statistics"
3940
],
4041
"license": "BSD-3-Clause",
41-
"repository": "openupm/verdaccio-download-counts",
42+
"repository": "openupm/verdaccio-install-counts",
4243
"author": "Favo Yang <https://github.com/favoyang>",
4344
"scripts": {
4445
"build": "tsc",

src/bin/cli-utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function readVerdaccioConfig(): any {
3737
export function createRedisClient(): Redis {
3838
const verdaccioConfig = readVerdaccioConfig();
3939
const middlewares = verdaccioConfig['middlewares']
40-
const downloadCounts = middlewares['download-counts'];
40+
const downloadCounts = middlewares['install-counts'];
4141
let redisOptions = {};
4242
if ('redis' in downloadCounts)
4343
redisOptions = downloadCounts['redis'];

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ export default class VerdaccioMiddlewarePlugin implements IPluginMiddleware<Cust
6060
const { period, package: packageName } = req.params;
6161
try {
6262
const [startDate, endDate] = parsePeriod(period);
63-
// this.logger.debug(`[download-counts] startDate: ${startDate.toISOString()}, endDate: ${endDate.toISOString()}`);
63+
// this.logger.debug(`[install-counts] startDate: ${startDate.toISOString()}, endDate: ${endDate.toISOString()}`);
6464
const metadata = await getPackageAsync(_storage, {
6565
name: packageName,
6666
uplinksLook: true,
6767
req,
6868
abbreviated: false
6969
});
70-
// this.logger.debug(`[download-counts] metadata: ${JSON.stringify(metadata)}`);
70+
// this.logger.debug(`[install-counts] metadata: ${JSON.stringify(metadata)}`);
7171
const results = await getPackageDownloadTimeSeriesResults(self.redisClient, startDate, endDate, packageName);
7272
let totalDownloads = 0;
7373
if (results !== null) {
@@ -100,14 +100,14 @@ export default class VerdaccioMiddlewarePlugin implements IPluginMiddleware<Cust
100100
const { period, package: packageName } = req.params;
101101
try {
102102
const [startDate, endDate] = parsePeriod(period);
103-
// this.logger.debug(`[download-counts] startDate: ${startDate.toISOString()}, endDate: ${endDate.toISOString()}`);
103+
// this.logger.debug(`[install-counts] startDate: ${startDate.toISOString()}, endDate: ${endDate.toISOString()}`);
104104
const metadata = await getPackageAsync(_storage, {
105105
name: packageName,
106106
uplinksLook: true,
107107
req,
108108
abbreviated: false
109109
});
110-
// this.logger.debug(`[download-counts] metadata: ${JSON.stringify(metadata)}`);
110+
// this.logger.debug(`[install-counts] metadata: ${JSON.stringify(metadata)}`);
111111
const results = await getPackageDownloadTimeSeriesResults(self.redisClient, startDate, endDate, packageName);
112112
const downloads: { day: string; downloads: number }[] = [];
113113
if (results !== null) {

src/utils.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,29 @@ export function getVersion(pkg: Package, version: any): Version | void {
6161
export function redisCreateClient(config: string | RedisOptions, logger: Logger): Redis {
6262
const client = new Redis(config as any);
6363
client.on('connect', function () {
64-
logger.warn('[download-counts] connected to redis server');
64+
logger.warn('[install-counts] connected to redis server');
6565
});
6666

6767
client.on("ready", function () {
68-
logger.warn("[download-counts] ready to use");
69-
logger.warn("[download-counts] set enableOfflineQueue to false to make following web requests fail instantly when redis connection is down");
68+
logger.warn("[install-counts] ready to use");
69+
logger.warn("[install-counts] set enableOfflineQueue to false to make following web requests fail instantly when redis connection is down");
7070
client.options.enableOfflineQueue = false;
7171
});
7272

7373
client.on('reconnecting', function (delay) {
74-
logger.warn({ delay }, '[download-counts] reconnecting in @{delay}ms');
74+
logger.warn({ delay }, '[install-counts] reconnecting in @{delay}ms');
7575
});
7676

7777
client.on('end', function () {
78-
logger.warn('[download-counts] redis connection end');
78+
logger.warn('[install-counts] redis connection end');
7979
});
8080

8181
client.on('close', function () {
82-
logger.warn('[download-counts] redis connection close');
82+
logger.warn('[install-counts] redis connection close');
8383
});
8484

8585
client.on('error', function (err) {
86-
logger.error({ err }, '[download-counts] redis error @{err}');
86+
logger.error({ err }, '[install-counts] redis error @{err}');
8787
});
8888

8989
return client;
@@ -226,8 +226,8 @@ export function parsePeriod(period: string): Array<Date> {
226226
// Make sure that startDate is before endDate
227227
if (startDate > endDate)
228228
endDate = startDate;
229-
// self.logger.debug(`[download-counts] startDate: ${startDate.toISOString()}`);
230-
// self.logger.debug(`[download-counts] endDate: ${endDate.toISOString()}`);
229+
// self.logger.debug(`[install-counts] startDate: ${startDate.toISOString()}`);
230+
// self.logger.debug(`[install-counts] endDate: ${endDate.toISOString()}`);
231231
return [startDate, endDate];
232232
}
233233

0 commit comments

Comments
 (0)