Comparing version 0.0.6 to 0.1.0
@@ -127,3 +127,3 @@ "use strict"; | ||
} | ||
return out; | ||
return out.replace(/^ /, ''); | ||
}; | ||
@@ -143,3 +143,3 @@ GenBadges.prototype.addBadge = function (_badge, CONFIG) { | ||
var params = split[2]; | ||
var baseLink = ' https://img.shields.io'; | ||
var baseLink = 'https://img.shields.io'; | ||
switch (type) { | ||
@@ -146,0 +146,0 @@ case 'install': |
@@ -47,19 +47,20 @@ #!/usr/bin/env node | ||
var license_1 = require("./license"); | ||
var logger_1 = require("./logger"); | ||
(function () { return __awaiter(void 0, void 0, void 0, function () { | ||
var args, Package, config, STATE, _a, err_1; | ||
var ARGS, Package, config, STATE, _a, err_1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
args = utility_1.getArgs(); | ||
ARGS = utility_1.getArgs(); | ||
return [4 /*yield*/, utility_1.getPackageJson()]; | ||
case 1: | ||
Package = _b.sent(); | ||
return [4 /*yield*/, config_1.getConfig(args, Package)]; | ||
return [4 /*yield*/, config_1.getConfig(Package)]; | ||
case 2: | ||
config = _b.sent(); | ||
STATE = new state_1.State(Package, config, args); | ||
STATE = new state_1.State(Package, config); | ||
_b.label = 3; | ||
case 3: | ||
_b.trys.push([3, 14, , 15]); | ||
_a = args[0]; | ||
_b.trys.push([3, 15, , 16]); | ||
_a = ARGS[0] ? ARGS[0].replace(/^--?/, '') : ARGS[0]; | ||
switch (_a) { | ||
@@ -76,29 +77,34 @@ case 'a': return [3 /*break*/, 4]; | ||
case 'license': return [3 /*break*/, 10]; | ||
case 'h': return [3 /*break*/, 12]; | ||
case 'help': return [3 /*break*/, 12]; | ||
} | ||
return [3 /*break*/, 12]; | ||
return [3 /*break*/, 13]; | ||
case 4: return [4 /*yield*/, CallAll(STATE)]; | ||
case 5: | ||
_b.sent(); | ||
return [3 /*break*/, 13]; | ||
return [3 /*break*/, 14]; | ||
case 6: return [4 /*yield*/, new badges_1.GenBadges(STATE).res()]; | ||
case 7: | ||
_b.sent(); | ||
return [3 /*break*/, 13]; | ||
return [3 /*break*/, 14]; | ||
case 8: return [4 /*yield*/, new tsDoc_1.TsDoc(STATE).res()]; | ||
case 9: | ||
_b.sent(); | ||
return [3 /*break*/, 13]; | ||
return [3 /*break*/, 14]; | ||
case 10: return [4 /*yield*/, new license_1.License(STATE).res()]; | ||
case 11: | ||
_b.sent(); | ||
return [3 /*break*/, 13]; | ||
return [3 /*break*/, 14]; | ||
case 12: | ||
logger_1.logger.Log('help'); | ||
return [3 /*break*/, 14]; | ||
case 13: | ||
new default_1.Default(STATE); | ||
return [3 /*break*/, 13]; | ||
case 13: return [3 /*break*/, 15]; | ||
case 14: | ||
return [3 /*break*/, 14]; | ||
case 14: return [3 /*break*/, 16]; | ||
case 15: | ||
err_1 = _b.sent(); | ||
console.error(err_1); | ||
return [3 /*break*/, 15]; | ||
case 15: return [2 /*return*/]; | ||
return [3 /*break*/, 16]; | ||
case 16: return [2 /*return*/]; | ||
} | ||
@@ -105,0 +111,0 @@ }); |
@@ -66,3 +66,3 @@ "use strict"; | ||
var CONFIG_PATH = './suf.config.json'; | ||
function getConfig(args, Package) { | ||
function getConfig(Package) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -78,3 +78,3 @@ var _this = this; | ||
hasConfig = _e.sent(); | ||
if (!(!hasConfig || args[0] === '-fc')) return [3 /*break*/, 6]; | ||
if (!!hasConfig) return [3 /*break*/, 6]; | ||
logger_1.logger.Log('info', 'No config Found, do you want to create one? ', '[Y/n]'); | ||
@@ -128,5 +128,4 @@ return [4 /*yield*/, suf_node_1.getYNAnswer()]; | ||
case 2: | ||
/**this function should only be called without the type parameter, | ||
when there is no config. */ | ||
config = __assign({}, CONFIG); | ||
/**this will only be executed when there is no config. */ | ||
config = {}; | ||
updateOrCreate = 'Create'; | ||
@@ -147,3 +146,3 @@ _c = []; | ||
if (!_j.sent()) return [3 /*break*/, 6]; | ||
_e = [__assign({}, CONFIG)]; | ||
_e = [__assign({}, config)]; | ||
_h = {}; | ||
@@ -150,0 +149,0 @@ _f = key; |
@@ -24,4 +24,4 @@ "use strict"; | ||
], | ||
preset: new log_1.PresetNodeHelp("--out: OUTPUT_FILE:Relative path to the output file with extension.\n--dir: DIR: Relative path to the input dir.\n--name: NAME: Header name.\n--exclude: FILES: Comma separated list of files to exclude, cannot be used with --include\n--include: FILES: Comma separated list of files to include, cannot be used with --exclude\n-h: : Displays this Message.", ':', 11, 90) | ||
preset: new log_1.PresetNodeHelp("INFO: All arguments can start with - or --, but i would recommend to just use letters.\na | all: Calls all modules.\nb | badges: Calls the badges module.\nt | ts | d.ts | docs: Calls the tsDoc module.\nl | licence: Calls the license module.\nh | help: Displays this Message.", ':', 25, 90) | ||
} | ||
}); |
@@ -42,6 +42,5 @@ "use strict"; | ||
var State = /** @class */ (function () { | ||
function State(PACKAGE, _CONFIG, ARGS) { | ||
function State(PACKAGE, _CONFIG) { | ||
this.PACKAGE = PACKAGE; | ||
this._CONFIG = _CONFIG; | ||
this.ARGS = ARGS; | ||
} | ||
@@ -48,0 +47,0 @@ Object.defineProperty(State.prototype, "CONFIG", { |
@@ -111,3 +111,3 @@ "use strict"; | ||
} | ||
return [4 /*yield*/, fs_1.promises.writeFile(CONFIG.out, input.replace(utility_marker_1.insertionMarker.regex, utility_marker_1.getGenerated("# " + CONFIG.title + "\n" + this.createNav(navLinks) + rawText, 'tsDoc')))]; | ||
return [4 /*yield*/, fs_1.promises.writeFile(CONFIG.out, input.replace(utility_marker_1.insertionMarker.regex, utility_marker_1.getGenerated("\n# " + CONFIG.title + "\n" + this.createNav(navLinks) + rawText, 'tsDoc')))]; | ||
case 3: | ||
@@ -114,0 +114,0 @@ _a.sent(); |
@@ -18,4 +18,4 @@ "use strict"; | ||
license: { | ||
regex: /<span id="LICENSE_GENERATION_MARKER_0">[\S\s]*<\/span>/, | ||
marker: '<span id="LICENSE_GENERATION_MARKER_0">\n__INSERT_GENERATED__\n</span>' | ||
regex: /<span id="LICENSE_GENERATION_MARKER_0"><\/span>[\S\s]*<span id="LICENSE_GENERATION_MARKER_1"><\/span>/, | ||
marker: '<span id="LICENSE_GENERATION_MARKER_0"></span>\n__INSERT_GENERATED__\n<span id="LICENSE_GENERATION_MARKER_1"></span>' | ||
} | ||
@@ -22,0 +22,0 @@ }; |
{ | ||
"name": "suf-cli", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "Utility Cli", | ||
"main": "./dist/cli.js", | ||
"scripts": { | ||
"prepack": "del ./dist && tsc -b && node ./dist/cli.js" | ||
"prepack": "del ./dist && del ./types && tsc -b && node ./dist/cli.js" | ||
}, | ||
@@ -23,3 +23,2 @@ "author": "Syler", | ||
"@sorg/log": "^1.0.2", | ||
"del-cli": "^3.0.0", | ||
"node-fetch": "^2.6.0", | ||
@@ -33,2 +32,3 @@ "suf-node": "^1.1.0", | ||
"@types/node-fetch": "^2.5.4", | ||
"del-cli": "^3.0.0", | ||
"package-json-type": "^1.0.3", | ||
@@ -35,0 +35,0 @@ "tslib": "^1.10.0" |
191
README.md
## suf-cli | ||
<span id="BADGE_GENERATION_MARKER_0"></span> | ||
[![npmV]( https://img.shields.io/npm/v/suf-cli)](https://www.npmjs.com/package/suf-cli) [![min]( https://img.shields.io/bundlephobia/min/suf-cli)](https://bundlephobia.com/result?p=suf-cli) [![install](https://badgen.net/packagephobia/install/suf-cli)](https://packagephobia.now.sh/result?p=suf-cli) [![githubLastCommit]( https://img.shields.io/github/last-commit/TheRealSyler/suf-cli)](https://github.com/TheRealSyler/suf-cli) | ||
[![npmV](https://img.shields.io/npm/v/suf-cli)](https://www.npmjs.com/package/suf-cli) [![min](https://img.shields.io/bundlephobia/min/suf-cli)](https://bundlephobia.com/result?p=suf-cli) [![install](https://badgen.net/packagephobia/install/suf-cli)](https://packagephobia.now.sh/result?p=suf-cli) [![githubLastCommit](https://img.shields.io/github/last-commit/TheRealSyler/suf-cli)](https://github.com/TheRealSyler/suf-cli) | ||
<span id="BADGE_GENERATION_MARKER_1"></span> | ||
suf-cli is a utility cli for automating readme stuff, like adding a license(also adds a license file). | ||
suf-cli is a utility cli for automating readme stuff, like adding a license, most of the stuff below and above has been generated with this cli. | ||
## TODO | ||
## Usage | ||
- add help command | ||
- add readme | ||
```bash | ||
suf | ||
``` | ||
<span id="LICENSE_GENERATION_MARKER_0"> | ||
this cli works by reading the `suf.config.json` file, every cli module has its section in the config file, if you call the cli without any arguments it will ask you to create a config or it executes all modules present in the config, to add a module just execute the command for that module. | ||
> INFO: All arguments can start with - or --, but i would recommend to just use letters. | ||
| Command | | | ||
| ------------------------------- | ------------------------- | | ||
| `a` \| `all` | Calls all modules. | | ||
| `b` \| `badges` | Calls the badges module. | | ||
| `t` \| `ts` \| `d.ts` \| `docs` | Calls the tsDoc module. | | ||
| `l` \| `licence` | Calls the license module. | | ||
| `h` \| `help` | Displays this Message. | | ||
<span id="DOC_GENERATION_MARKER_0"></span> | ||
# Docs | ||
- **[Modules](#modules)** | ||
- [BadgesModuleConfig](#badgesmoduleconfig) | ||
- [TsDocModuleConfig](#tsdocmoduleconfig) | ||
- [LicenseModuleConfig](#licensemoduleconfig) | ||
- [ConfigFile](#configfile) | ||
- **[badgeTypes](#badgetypes)** | ||
- [Badges](#badges) | ||
- [Links](#links) | ||
### Modules | ||
##### BadgesModuleConfig | ||
```typescript | ||
interface BadgesModuleConfig { | ||
/**package name */ | ||
name: string; | ||
/**github username */ | ||
github: string; | ||
/**vscode publisher.packageName */ | ||
vscode?: string; | ||
/**github repo name */ | ||
repo: string; | ||
/**path to readme or other target file */ | ||
out: string; | ||
/**Array of badges */ | ||
badges: string[]; | ||
/**link to external config,(not sure if this still works) */ | ||
externalConfig?: string; | ||
} | ||
``` | ||
##### TsDocModuleConfig | ||
```typescript | ||
interface TsDocModuleConfig { | ||
/**title displayed at the top of the generated text */ | ||
title: string; | ||
/**path to the d.ts files */ | ||
dir: string; | ||
/**path to readme or other target file */ | ||
out: string; | ||
/**include all files in array, include and exclude cannot be used at the same time */ | ||
include?: string[]; | ||
/**exclude all files in array, include and exclude cannot be used at the same time */ | ||
exclude?: string[]; | ||
} | ||
``` | ||
##### LicenseModuleConfig | ||
```typescript | ||
interface LicenseModuleConfig { | ||
/**license type */ | ||
type: string; | ||
/**license year */ | ||
year: string; | ||
/**full name of the copyright holder */ | ||
name: string; | ||
/**path to readme or other target file */ | ||
out: string; | ||
/**path/name of the LICENSE file */ | ||
file: string; | ||
} | ||
``` | ||
##### ConfigFile | ||
```typescript | ||
interface ConfigFile { | ||
badges?: BadgesModuleConfig; | ||
tsDoc?: TsDocModuleConfig; | ||
license?: LicenseModuleConfig; | ||
} | ||
``` | ||
### badgeTypes | ||
##### Badges | ||
```typescript | ||
interface Badges { | ||
/** circleCi build. */ | ||
circleci: '/circleci/build/github/<GITHUB>/<REPO>'; | ||
/** Vscode Extension Version. */ | ||
vscV: '/visual-studio-marketplace/v/<VSCODE>'; | ||
/** Vscode Extension downloads. */ | ||
vscD: '/visual-studio-marketplace/d/<VSCODE>'; | ||
/** Vscode Extension installs. */ | ||
vscI: '/visual-studio-marketplace/i/<VSCODE>'; | ||
/** Vscode Extension ratings. */ | ||
vscR: '/visual-studio-marketplace/r/<VSCODE>'; | ||
/** Bundlephobia Min. */ | ||
min: '/bundlephobia/min/<NAME>'; | ||
/** Bundlephobia Minzip. */ | ||
minzip: '/bundlephobia/minzip/<NAME>'; | ||
/** Packagephobia Install. */ | ||
install: '/packagephobia/install/<NAME>'; | ||
/** Packagephobia Publish. */ | ||
publish: '/packagephobia/publish/<NAME>'; | ||
/** Npm Version. */ | ||
npmV: '/npm/v/<NAME>'; | ||
/** Npm Weekly Downloads. */ | ||
npmDW: '/npm/dw/<NAME>'; | ||
/** Npm Monthly Downloads. */ | ||
npmDM: '/npm/dm/<NAME>'; | ||
/** Npm Yearly Downloads. */ | ||
npmDY: '/npm/dy/<NAME>'; | ||
/** Npm Total Downloads. */ | ||
npmDT: '/npm/dt/<NAME>'; | ||
/** Npm Types. */ | ||
npmTypes: '/npm/types/<NAME>'; | ||
/** Npm License. */ | ||
npmLicense: '/npm/license/<NAME>'; | ||
/** Npm Node. */ | ||
npmNode: '/npm/node/<NAME>'; | ||
/** Npm Dependents. */ | ||
npmDep: '/npm/dependents/<NAME>'; | ||
/** GitHub Followers. */ | ||
githubFollowers: '/github/followers/<GITHUB>'; | ||
/** GitHub Forks. */ | ||
githubForks: '/github/forks/<GITHUB>/<REPO>'; | ||
/** GitHub Starts. */ | ||
githubStars: '/github/stars/<GITHUB>/<REPO>'; | ||
/** GitHub Issues. */ | ||
githubIssues: '/github/issues/<GITHUB>/<REPO>'; | ||
/** GitHub Last Commit. */ | ||
githubLastCommit: '/github/last-commit/<GITHUB>/<REPO>'; | ||
/** Custom, usage example: badge=https://img.shields.io/badge/custom%2C-Badge-brightgreen. */ | ||
badge: '<CUSTOM>'; | ||
} | ||
``` | ||
##### Links | ||
```typescript | ||
interface Links { | ||
/** Npm package. */ | ||
npm: 'https://www.npmjs.com/package/<NAME>'; | ||
/** Github Repo. */ | ||
github: 'https://github.com/<GITHUB>/<REPO>'; | ||
/** circleCi Repo Pipelines. */ | ||
circleci: 'https://app.circleci.com/github/<GITHUB>/<REPO>/pipelines'; | ||
/** Visual Studio marketplace. */ | ||
vscode: 'https://marketplace.visualstudio.com/items?itemName=<VSCODE>'; | ||
/** Bundlephobia Link. */ | ||
bundle: 'https://bundlephobia.com/result?p=<NAME>'; | ||
/** Packagephobia Link. */ | ||
package: 'https://packagephobia.now.sh/result?p=<NAME>'; | ||
/** Custom, usage example: link=https://example.com. */ | ||
link: '<CUSTOM>'; | ||
} | ||
``` | ||
_Generated with_ **[suf-cli](https://www.npmjs.com/package/suf-cli)** | ||
<span id="DOC_GENERATION_MARKER_1"></span> | ||
<span id="LICENSE_GENERATION_MARKER_0"></span> | ||
Copyright (c) 2019 Leonard Grosoli Licensed under the MIT license. | ||
</span> | ||
<span id="LICENSE_GENERATION_MARKER_1"></span> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70756
5
16
1256
194
5
- Removeddel-cli@^3.0.0
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@nodelib/fs.scandir@2.1.5(transitive)
- Removed@nodelib/fs.stat@2.0.5(transitive)
- Removed@nodelib/fs.walk@1.2.8(transitive)
- Removed@types/glob@7.2.0(transitive)
- Removed@types/minimatch@5.1.2(transitive)
- Removed@types/minimist@1.2.5(transitive)
- Removed@types/node@22.9.0(transitive)
- Removed@types/normalize-package-data@2.4.4(transitive)
- Removedaggregate-error@3.1.0(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedarrify@1.0.1(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbraces@3.0.3(transitive)
- Removedcamelcase@5.3.1(transitive)
- Removedcamelcase-keys@6.2.2(transitive)
- Removedclean-stack@2.2.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removeddecamelize-keys@1.1.1(transitive)
- Removeddel@5.1.0(transitive)
- Removeddel-cli@3.0.1(transitive)
- Removeddir-glob@3.0.1(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfast-glob@3.3.2(transitive)
- Removedfastq@1.17.1(transitive)
- Removedfill-range@7.1.1(transitive)
- Removedfind-up@4.1.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedglob@7.2.3(transitive)
- Removedglob-parent@5.1.2(transitive)
- Removedglobby@10.0.2(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhard-rejection@2.1.0(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedignore@5.3.2(transitive)
- Removedindent-string@4.0.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-extglob@2.1.1(transitive)
- Removedis-glob@4.0.3(transitive)
- Removedis-number@7.0.0(transitive)
- Removedis-path-cwd@2.2.0(transitive)
- Removedis-path-inside@3.0.3(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjson-parse-even-better-errors@2.3.1(transitive)
- Removedkind-of@6.0.3(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedlocate-path@5.0.0(transitive)
- Removedmap-obj@1.0.14.3.0(transitive)
- Removedmeow@6.1.1(transitive)
- Removedmerge2@1.4.1(transitive)
- Removedmicromatch@4.0.8(transitive)
- Removedmin-indent@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist-options@4.1.0(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-limit@2.3.0(transitive)
- Removedp-locate@4.1.0(transitive)
- Removedp-map@3.0.0(transitive)
- Removedp-try@2.2.0(transitive)
- Removedparse-json@5.2.0(transitive)
- Removedpath-exists@4.0.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpicomatch@2.3.1(transitive)
- Removedqueue-microtask@1.2.3(transitive)
- Removedquick-lru@4.0.1(transitive)
- Removedread-pkg@5.2.0(transitive)
- Removedread-pkg-up@7.0.1(transitive)
- Removedredent@3.0.0(transitive)
- Removedresolve@1.22.8(transitive)
- Removedreusify@1.0.4(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedrun-parallel@1.2.0(transitive)
- Removedsemver@5.7.2(transitive)
- Removedslash@3.0.0(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstrip-indent@3.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedto-regex-range@5.0.1(transitive)
- Removedtrim-newlines@3.0.1(transitive)
- Removedtype-fest@0.13.10.6.00.8.1(transitive)
- Removedundici-types@6.19.8(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyargs-parser@18.1.3(transitive)