.gitignore000066400000000000000000000003301516220712300130410ustar00rootroot00000000000000/build /node_modules /*.log .idea/workspace.xml .idea/tasks.xml .idea/profiles_settings.xml .idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/profiles_settings.xml node_modules/.yarn-integrity .npmignore000066400000000000000000000002221516220712300130500ustar00rootroot00000000000000/.idea /artifacts /build /test /node_modules /*.iml /*.ipr /*.iws /.travis.yml /.scrutinizer.yml /Gruntfile.js /*.lock *.log /corifeus-boot.json .travis.yml000066400000000000000000000014301516220712300131640ustar00rootroot00000000000000language: node_js node_js: - node before_script: - npm install -g grunt-cli npm env: global: secure: YcRSWYkwc69CxiZ00bQzEbkj2KzYvxxVRovL0tlYiKiK2bffoy25W69wsvGTFhyo3EsBe6RNuKuV9Aq4G3W2G9dAJ3xjB5KDJ/qHdmu/BFqricyo2uKPjO9ug99HwCW9D2eYS9gr5k+Bqq5GJqc17bIoopSK7T9f0AmIWHMgIP0y/8KZnlO0uu+Cg8mmGz9YNQAN4+UYspYyNSQP69/cokp/IvGgLHTo5ulqBHh0DTH5jSzlwlLterFjWAl43meSwHVp8HpBs1D+1Zq8fx2v5C/aGJ/HnN7kcA9Ma/Ct/AnT17vMZOr3G3vc2ypts8VRuKu65XqLTRQXXIy7uM62xNx3e7f8bCr5vavrZKPPuxDO0/EISu7Bmy1EudoizfTxMH9n/Lid8FmxQ48FkD5QKVT/jkXBk55b99L7KWnmRSQK1bRm0ip17bbSPxzUj6roXiWwITCDniSssnMONZjbBEQAPHRw7NsEEPMX8wxRkV4Brda4ce+xz9Knf700RCfB0HhCucFv/2erWrMSLUF+v/Qdznud8r8eEVbsynz5iMiOuOWwh7iHwOZ5qSeOaHh9XDcpgcIq1GmJyzjB2VDkfkPsfJEnlnApgKxpCNIJ8xtvPHkiABwqgsUrsnb5a/ZyxswZSr2+MwCjWXsNT0venzEPze5gp8eFHbamvnueeEc= Gruntfile.js000066400000000000000000000004541516220712300133550ustar00rootroot00000000000000module.exports = (grunt) => { const builder = require(`corifeus-builder`); const loader = new builder.loader(grunt); loader.js({ replacer: { type: 'p3x', npmio: true, }, }); grunt.registerTask('default', builder.config.task.build.js); };LICENSE000066400000000000000000000023001516220712300120550ustar00rootroot00000000000000 @license p3x-verdaccio-cli v2019.1.23-19 🍶 Verdaccio CLI https://pages.corifeus.com/verdaccio-cli Copyright (c) 2019 Patrik Laszlo / P3X / Corifeus and contributors. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md000066400000000000000000000110321516220712300123310ustar00rootroot00000000000000[//]: #@corifeus-header [![NPM](https://nodei.co/npm/p3x-verdaccio-cli.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/p3x-verdaccio-cli/) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Build Status](https://api.travis-ci.com/patrikx3/verdaccio-cli.svg?branch=master)](https://travis-ci.com/patrikx3/verdaccio-cli) [![Uptime Robot ratio (30 days)](https://img.shields.io/uptimerobot/ratio/m780749701-41bcade28c1ea8154eda7cca.svg)](https://uptimerobot.patrikx3.com/) # 🍶 Verdaccio CLI v2019.1.23-19 🙏 This is an open-source project. Star this repository, if you like it, or even donate to maintain the servers and the development. Thank you so much! I run my own server with dynamic IP address, so, it may happen, that the server can not be reachable for about max 15 minutes, due to nature of the dynamic DNS. The server may also be unreachable, when I backup the SSD with Clonzilla (very rarely) or an electrical issue (but this should not happen again). When the server is down, please hang on for 15-30 minutes and the server will be back up. All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://corifeus.com)) could have errors, since I am developing in my free time. However, it is usually stable. **Bugs are evident™ - MATRIX️** ### Node Version Requirement ``` >=10.13.0 ``` ### Built on Node ``` v11.7.0 ``` The ```async``` and ```await``` keywords are required. Install NodeJs: https://nodejs.org/en/download/package-manager/ # Description [//]: #@corifeus-header:end It is that first `p3x-verdaccio-cli` version that is working with the [Verdaccio](https://github.com/verdaccio). What is good about this, that when I checked my cache count is 1981, after clean my cache and reinstall my all repos is down to 881. ## Features ⚠️ **This is only working with the original Sinopia file system storage driver!!!** ### Show the help ```bash p3x-verdaccio-cli ``` ### Info ```text p3x-verdaccio-cli --config /var/npm/config.yml cache info ``` ###### Output ```text root@server:/var/npm# npm i -g p3x-verdaccio-cli /usr/bin/p3x-verdaccio-cli -> /usr/lib/node_modules/p3x-verdaccio-cli/bin/p3x-verdaccio-cli.js + p3x-verdaccio-cli@2019.1.23-16 updated 1 package in 0.953s root@server:/var/npm# p3x-verdaccio-cli --config=/var/npm/config.yaml cache info (node:23539) ExperimentalWarning: The fs.promises API is experimental Own packages: corifeus-utils, corifeus-builder, corifeus-builder-angular, corifeus-web, corifeus-web-material, p3x-aes-folder, p3x-angular-compile, p3x-docker-registry-client, p3x-html-pdf, p3x-onenote, p3x-ramdisk, p3x-systemd-manager, p3x-tools, p3x-freenom, grunt-p3x-express, corifeus-server, p3x-redis-ui-server, p3x-redis-ui-material, p3x-redis-ui, grunt-injector, p3x-verdaccio-cli Own packages count: 21 Total of package count without own packages: 771 ``` ### Clean cache Of course, with an option eg. `--storage=azure` it could be enabled. ```bash # first you can try a dry run and give some output info p3x-verdaccio-cli --config /var/npm/config.yml --dry cache clean # actually clean the cache p3x-verdaccio-cli --config /var/npm/config.yml cache clean ``` [//]: #@corifeus-footer --- [**P3X-VERDACCIO-CLI**](https://pages.corifeus.com/verdaccio-cli) Build v2019.1.23-19 [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) ## P3X Sponsors [IntelliJ - The most intelligent Java IDE](https://www.jetbrains.com/?from=patrikx3) [![JetBrains](https://cdn.corifeus.com/assets/svg/jetbrains-logo.svg)](https://www.jetbrains.com/?from=patrikx3) [![NoSQLBooster](https://cdn.corifeus.com/assets/png/nosqlbooster-70x70.png)](https://www.nosqlbooster.com/) [The Smartest IDE for MongoDB](https://www.nosqlbooster.com) [//]: #@corifeus-footer:endbin/000077500000000000000000000000001516220712300116255ustar00rootroot00000000000000bin/p3x-verdaccio-cli.js000077500000000000000000000003471516220712300154060ustar00rootroot00000000000000#!/usr/bin/env node if (!require('fs').existsSync(`${__dirname}/../node_modules`)) { require('child_process').execSync(`cd ${__dirname}/.. && npm install --only=prod`, { stdio: 'inherit' }); } require('../src/cli')package.json000066400000000000000000000022571516220712300133510ustar00rootroot00000000000000{ "name": "p3x-verdaccio-cli", "version": "2019.1.23-19", "corifeus": { "prefix": "p3x-", "publish": true, "type": "p3x", "code": "Sake", "nodejs": "v11.7.0", "opencollective": false, "reponame": "verdaccio-cli", "build": true }, "bin": { "p3x-verdaccio-cli": "bin/p3x-verdaccio-cli.js" }, "license": "MIT", "description": "🍶 Verdaccio CLI", "main": "src/index.js", "directories": { "test": "test" }, "scripts": { "test": "grunt" }, "repository": { "type": "git", "url": "git+https://github.com/patrikx3/verdaccio-cli.git" }, "keywords": [ "verdaccio", "cli" ], "author": "Patrik Laszlo ", "bugs": { "url": "https://github.com/patrikx3/verdaccio-cli/issues" }, "homepage": "https://pages.corifeus.com/verdaccio-cli", "devDependencies": { "corifeus-builder": "^2019.1.23-10" }, "dependencies": { "commander": "^2.19.0", "fs-extra": "^7.0.1", "js-yaml": "^3.12.1" }, "engines": { "node": ">=10.13.0" } }src/000077500000000000000000000000001516220712300116445ustar00rootroot00000000000000src/cli/000077500000000000000000000000001516220712300124135ustar00rootroot00000000000000src/cli/index.js000066400000000000000000000074131516220712300140650ustar00rootroot00000000000000const verdaccioCli = require('../') const program = require('commander') const pkg = verdaccioCli.pkg; const fs = require('fs').promises const path = require('path') const fsExtra = require('fs-extra') const parseConfig = async (opts) => { const yaml = require('js-yaml') //console.warn(opts) const yamlString = (await fs.readFile(opts.config)).toString() const yamlConfig = yaml.load(yamlString) //console.warn(yamlConfig) return yamlConfig } const availableCacheRoutine = [ 'clean', 'info', ] const start = async() => { program .version(pkg.version) .option('-c, --config ', 'This is required to provide the Verdaccio configuration.') .option('-d, --dry', 'Do not actually clean the cache, just print some info.') program .command('cache ') .description(`Help to manage the Verdaccio cache.`) .action(async (routine, options) => { try { if (!availableCacheRoutine.includes(routine)) { return console.error(`The cache is not available '${routine}', the available routines are ${availableCacheRoutine.join(', ')}.`) } //console.warn(options) const configPath = path.dirname(program.config) const config = await parseConfig({ config: program.config }) const storagePath = path.resolve(configPath, config.storage) const db = require(path.resolve(storagePath, '.sinopia-db.json')) const packageFolders = await fs.readdir(storagePath) //console.warn(packageFolders) const packageFoldersWithoutOwn = [] const packageFolderPathStatAwaitable = [] for(let packageFolderPath of packageFolders) { packageFolderPathStatAwaitable.push( fs.stat(path.resolve(storagePath, packageFolderPath)) ) } const packageFolderPathStatAwaitableResult = await Promise.all(packageFolderPathStatAwaitable) for(let statIndex in packageFolderPathStatAwaitableResult) { const stat = packageFolderPathStatAwaitableResult[statIndex] //console.warn(stat) const packagePath = packageFolders[statIndex] if (stat.isDirectory() && !db.list.includes(packagePath)) { packageFoldersWithoutOwn.push(packagePath) } } if (program.dry === true || routine === 'info') { console.info(` Own packages: ${db.list.join(', ')} Own packages count: ${db.list.length} Total of package count without own packages: ${packageFoldersWithoutOwn.length} `) return } const removablePathAwaitable = [] for(let packagePath of packageFoldersWithoutOwn) { removablePathAwaitable.push( fsExtra.remove(path.resolve(storagePath, packagePath)) ) } await Promise.all(removablePathAwaitable) console.info('Removed all cached packages and kept all own packages.') //console.warn(packageFoldersWithoutOwn.length, packageFolders.length) } catch(e) { console.error(e) } }) program.parse(process.argv); if (!process.argv.slice(2).length) { program.outputHelp(); } else if (program.config === undefined) { return console.error(`The ${pkg.name} program's first argument should be like '--config=/verdaccio/path/config.yaml' and should present.`) } } start();src/index.js000066400000000000000000000001201516220712300133020ustar00rootroot00000000000000module.exports.pkg = require('../package') module.exports.cli = require('./cli')test/000077500000000000000000000000001516220712300120345ustar00rootroot00000000000000test/cli/000077500000000000000000000000001516220712300126035ustar00rootroot00000000000000test/cli/cache-clean000077500000000000000000000001651516220712300146560ustar00rootroot00000000000000#!/usr/bin/env bash ./bin/p3x-verdaccio-cli.js --config=/home/patrikx3/Desktop/Downloads/npm/config.yaml cache clean test/cli/cache-clean-dry000077500000000000000000000001711516220712300154470ustar00rootroot00000000000000#!/usr/bin/env bash ./bin/p3x-verdaccio-cli.js --config=/home/patrikx3/Desktop/Downloads/npm/config.yaml -d cache clean verdaccio-cli.iml000066400000000000000000000005171516220712300142670ustar00rootroot00000000000000