From 215405cb8f0540baef43859110bab6334c673bed Mon Sep 17 00:00:00 2001 From: Andy Marks Date: Sat, 9 Oct 2021 11:56:06 +1100 Subject: [PATCH] Bumped deps. --- README.md | 14 +-- package.json | 160 +++++++++++++++++----------------- rollup-default.config.js | 50 +++++------ src/run.ts | 181 +++++++++++++++++++++++++++------------ 4 files changed, 240 insertions(+), 165 deletions(-) diff --git a/README.md b/README.md index 2159890..ea7c699 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,7 @@ Let's start simple. In order to get values from your `package.json` file injecte ```json { "name": "@appnest/readme", - "version": "1.2.5" + "version": "1.2.7" } ``` @@ -129,7 +129,7 @@ Welcome to {{ pkg.name }}. This is version {{ pkg.version }}! When running `node_modules/.bin/readme generate` the file `README.md` will be generated with the following contents: ```markdown -Welcome to @appnest/readme. This is version 1.2.5. +Welcome to @appnest/readme. This is version 1.2.7. ``` ### Usage @@ -550,14 +550,14 @@ If you have a variable from your `blueprint.json` file you want to stamp to your Objects are formatted as a list with the keys being bold. If you for example want to stamp the `dependencies` field from your `package.json` file you write `{{ pkg.dependencies }}` and the dependencies will be stamped in a nice formatted way like this. -* **@types/glob**: ^7.1.1 +* **@types/glob**: ^7.1.4 * **check-links**: ^1.1.8 * **colors**: ^1.4.0 -* **commander**: ^5.0.0 -* **fs-extra**: ^9.0.0 -* **glob**: ^7.1.6 +* **commander**: ^8.2.0 +* **fs-extra**: ^10.0.0 +* **glob**: ^7.2.0 * **path**: ^0.12.7 -* **web-component-analyzer**: 1.0.3 +* **web-component-analyzer**: 1.1.6 #### 1D Arrays diff --git a/package.json b/package.json index 1789d4b..6dcaf1d 100644 --- a/package.json +++ b/package.json @@ -1,82 +1,82 @@ { - "name": "@appnest/readme", - "version": "1.2.7", - "description": "Automatically generate a beautiful best-practice README file based on the contents of your repository", - "license": "MIT", - "module": "index.esm.js", - "main": "index.cjs.js", - "types": "index.d.ts", - "author": "Appnest", - "scripts": { - "prebuild": "node prebuild.js", - "b:lib": "rollup -c && rollup -c=rollup-cli.config.js", - "b:lib:prebuild": "npm run prebuild && npm run b:lib", - "readme": "npm run b:lib && npm run generate:readme", - "generate:readme": "node dist/cli.cjs.js generate", - "publish": "cd dist && npm publish --access=public && cd ..", - "git:add:commit:push": "git add . && git commit --no-edit --amend --no-verify && git push", - "bump:patch": "npm version patch && npm run git:add:commit:push", - "bump:minor": "npm version minor && npm run git:add:commit:push", - "bump:major": "npm version major && npm run git:add:commit:push", - "publish:patch": "npm run bump:patch && npm run b:lib:prebuild && npm run publish", - "publish:minor": "npm run bump:minor && npm run b:lib:prebuild && npm run publish", - "publish:major": "npm run bump:major && npm run b:lib:prebuild && npm run publish", - "push:readme": "npm run readme && git add . && git commit -m 'New readme' && git push", - "ncu": "ncu -u -a && npm update && npm install" - }, - "bugs": { - "url": "https://github.com/andreasbm/readme/issues" - }, - "homepage": "https://github.com/andreasbm/readme#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/andreasbm/readme.git" - }, - "keywords": [ - "opensource", - "project", - "readme", - "template", - "boilerplate", - "nodejs", - "maintaining", - "generator" - ], - "contributors": [ - { - "name": "Andreas Mehlsen", - "url": "https://twitter.com/andreasmehlsen", - "img": "https://avatars1.githubusercontent.com/u/6267397?s=460&v=4", - "info": [ - "🔥" - ] - }, - { - "name": "You?", - "img": "https://joeschmoe.io/api/v1/random", - "url": "https://github.com/andreasbm/readme/blob/master/CONTRIBUTING.md" - } - ], - "bin": { - "readme": "cli.cjs.js" - }, - "dependencies": { - "@types/glob": "^7.1.1", - "check-links": "^1.1.8", - "colors": "^1.4.0", - "commander": "^5.0.0", - "fs-extra": "^9.0.0", - "glob": "^7.1.6", - "path": "^0.12.7", - "web-component-analyzer": "1.0.3" - }, - "devDependencies": { - "@types/fs-extra": "^8.1.0", - "@wessberg/rollup-plugin-ts": "^1.2.21", - "rimraf": "^3.0.2", - "rollup": "^2.1.0", - "rollup-plugin-commonjs": "^10.1.0", - "rollup-plugin-json": "^4.0.0", - "rollup-plugin-node-resolve": "^5.2.0" - } + "name": "@appnest/readme", + "version": "1.2.7", + "description": "Automatically generate a beautiful best-practice README file based on the contents of your repository", + "license": "MIT", + "module": "index.esm.js", + "main": "index.cjs.js", + "types": "index.d.ts", + "author": "Appnest", + "scripts": { + "prebuild": "node prebuild.js", + "b:lib": "rollup -c && rollup -c=rollup-cli.config.js", + "b:lib:prebuild": "npm run prebuild && npm run b:lib", + "readme": "npm run b:lib && npm run generate:readme", + "generate:readme": "node dist/cli.cjs.js generate", + "publish": "cd dist && npm publish --access=public && cd ..", + "git:add:commit:push": "git add . && git commit --no-edit --amend --no-verify && git push", + "bump:patch": "npm version patch && npm run git:add:commit:push", + "bump:minor": "npm version minor && npm run git:add:commit:push", + "bump:major": "npm version major && npm run git:add:commit:push", + "publish:patch": "npm run bump:patch && npm run b:lib:prebuild && npm run publish", + "publish:minor": "npm run bump:minor && npm run b:lib:prebuild && npm run publish", + "publish:major": "npm run bump:major && npm run b:lib:prebuild && npm run publish", + "push:readme": "npm run readme && git add . && git commit -m 'New readme' && git push", + "ncu": "ncu -u -a && npm update && npm install" + }, + "bugs": { + "url": "https://github.com/andreasbm/readme/issues" + }, + "homepage": "https://github.com/andreasbm/readme#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/andreasbm/readme.git" + }, + "keywords": [ + "opensource", + "project", + "readme", + "template", + "boilerplate", + "nodejs", + "maintaining", + "generator" + ], + "contributors": [ + { + "name": "Andreas Mehlsen", + "url": "https://twitter.com/andreasmehlsen", + "img": "https://avatars1.githubusercontent.com/u/6267397?s=460&v=4", + "info": [ + "🔥" + ] + }, + { + "name": "You?", + "img": "https://joeschmoe.io/api/v1/random", + "url": "https://github.com/andreasbm/readme/blob/master/CONTRIBUTING.md" + } + ], + "bin": { + "readme": "cli.cjs.js" + }, + "dependencies": { + "@types/glob": "^7.1.4", + "check-links": "^1.1.8", + "colors": "^1.4.0", + "commander": "^8.2.0", + "fs-extra": "^10.0.0", + "glob": "^7.2.0", + "path": "^0.12.7", + "web-component-analyzer": "1.1.6" + }, + "devDependencies": { + "@types/fs-extra": "^8.1.0", + "rollup-plugin-ts": "^1.4.7", + "rimraf": "^3.0.2", + "rollup": "^2.58.0", + "@rollup/plugin-commonjs": "^21.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.0.5" + } } diff --git a/rollup-default.config.js b/rollup-default.config.js index 741b1ff..3eabd3c 100644 --- a/rollup-default.config.js +++ b/rollup-default.config.js @@ -1,32 +1,32 @@ -import ts from "@wessberg/rollup-plugin-ts"; -import commonjs from "rollup-plugin-commonjs"; -import resolve from "rollup-plugin-node-resolve"; +import ts from "rollup-plugin-ts"; +import commonjs from "@rollup/plugin-commonjs"; +import resolve from "@rollup/plugin-node-resolve"; import pkg from "./package.json"; -import json from "rollup-plugin-json"; +import json from "@rollup/plugin-json"; export const distPath = "dist"; export const srcPath = "src"; export const config = { - plugins: [ - resolve({ - module: true, - browser: true, - jsnext: true, - main: false, - modulesOnly: false - }), - json(), - ts({ - transpiler: "babel" - }), - commonjs({ - include: "**/node_modules/**" - }) - ], - external: [ - ...Object.keys(pkg.dependencies || {}), - ...Object.keys(pkg.devDependencies || {}), - ], - treeshake: false + plugins: [ + resolve({ + module: true, + browser: true, + jsnext: true, + main: false, + modulesOnly: false, + }), + json(), + ts({ + transpiler: "babel", + }), + commonjs({ + include: "**/node_modules/**", + }), + ], + external: [ + ...Object.keys(pkg.dependencies || {}), + ...Object.keys(pkg.devDependencies || {}), + ], + treeshake: false, }; diff --git a/src/run.ts b/src/run.ts index 1143392..481d740 100644 --- a/src/run.ts +++ b/src/run.ts @@ -1,67 +1,142 @@ -import * as program from "commander"; +const program = require("commander"); import pkg from "./../package.json"; import { checkLinksCommand } from "./check-links/check-links"; -import { defaultConfig, defaultConfigName, defaultDocumentationConfig } from "./config"; +import { + defaultConfig, + defaultConfigName, + defaultDocumentationConfig, +} from "./config"; import { generateCommand } from "./generate/generate"; +import { Options } from "./model"; /** * Runs the cli. * @param argv */ -export async function run (argv: string[]) { - program - .version(pkg.version); +export async function run(argv: string[]) { + program.version(pkg.version); - program - .command(`check-links`) - .description(`Checks all links for aliveness.`) - .option(`--i, --input `, `Path of the file that needs to be checked. Defaults to '${defaultConfig.output}'`, defaultConfig.output) - .action( cmd => { - checkLinksCommand(cmd.opts()).then(); - }); + program + .command(`check-links`) + .description(`Checks all links for aliveness.`) + .option( + `--i, --input `, + `Path of the file that needs to be checked. Defaults to '${defaultConfig.output}'`, + defaultConfig.output + ) + .action((_: any, options: Options) => { + checkLinksCommand(options).then(); + }); - program - .command(`generate`) - .description(`Generates a README file.`) - .option(`-c --config `, `Path of the configuration file. Defaults to '${defaultConfigName}'.`) - .option(`-p --package `, `Path of the package file. Defaults to '${defaultConfig.package}'.`) - .option(`-o --output `, `Path of the generated README file. Defaults to '${defaultConfig.output}'.`) - .option(`-i --input `, `Path of the blueprint. Defaults to '${defaultConfig.input}'.`) - .option(`-e --extend `, `Path to another configuration object that should be extended.`) - .option(`-d --dry`, `Whether the command should run as dry. If dry, the output file is not generated but outputted to the console instead.`) - .option(`--badges `, `Badges. Used for the 'badges' template.`) - .option(`--text `, `Text describing your project. Used for the 'description' template.`) - .option(`--demo `, `Demo url for your project. Used for the 'description' template.`) - .option(`--lineBreak `, `The linebreak used in the generation of the README file. Defaults to '\\r\\n'`) - .option(`--tab `, `The tab used in the generation of the README file. Defaults to '\\t'`) - .option(`--placeholder `, `The placeholder syntax used when looking for templates in the blueprint. Defaults to '\["\{\{", "\}\}"\]`) - .option(`--line `, `The line style of the titles. Can also be an URL. Defaults to 'colored'.`) - .option(`--templates `, `User created templates.`) - .option(`--silent`, `Whether the console output from the command should be silent.`) - .option(`--headingPrefix `, `The prefix of the header tags. Defaults to '\{1: "➤ ", 2: "➤ "\}'`) - .option(`--logo `, `The logo information. Used for the 'logo' template.`) - .option(`--contributorsPerRow `, `The amount of contributors pr row when using the 'contributors' template. Defaults to '${defaultConfig.contributorsPerRow}'`) - .option(`--documentationConfig `, `Configuration object for automatic documentation template.`) - .option(`--checkLinks`, `Checks all links for aliveness after the README file has been generated.`) - .option(`--pkg.name `, `Contributors of the project. Used for the 'contributors' template.`) - .option(`--pkg.contributors `, `Contributors of the project. Used for the 'contributors' template.`) - .option(`--pkg.license `, `License kind. Used for the 'license' template.`) - .action( cmd => { - generateCommand(cmd.opts()).then(); - }); + program + .command(`generate`) + .description(`Generates a README file.`) + .option( + `-c --config `, + `Path of the configuration file. Defaults to '${defaultConfigName}'.` + ) + .option( + `-p --package `, + `Path of the package file. Defaults to '${defaultConfig.package}'.` + ) + .option( + `-o --output `, + `Path of the generated README file. Defaults to '${defaultConfig.output}'.` + ) + .option( + `-i --input `, + `Path of the blueprint. Defaults to '${defaultConfig.input}'.` + ) + .option( + `-e --extend `, + `Path to another configuration object that should be extended.` + ) + .option( + `-d --dry`, + `Whether the command should run as dry. If dry, the output file is not generated but outputted to the console instead.` + ) + .option(`--badges `, `Badges. Used for the 'badges' template.`) + .option( + `--text `, + `Text describing your project. Used for the 'description' template.` + ) + .option( + `--demo `, + `Demo url for your project. Used for the 'description' template.` + ) + .option( + `--lineBreak `, + `The linebreak used in the generation of the README file. Defaults to '\\r\\n'` + ) + .option( + `--tab `, + `The tab used in the generation of the README file. Defaults to '\\t'` + ) + .option( + `--placeholder `, + `The placeholder syntax used when looking for templates in the blueprint. Defaults to '\["\{\{", "\}\}"\]` + ) + .option( + `--line `, + `The line style of the titles. Can also be an URL. Defaults to 'colored'.` + ) + .option(`--templates `, `User created templates.`) + .option( + `--silent`, + `Whether the console output from the command should be silent.` + ) + .option( + `--headingPrefix `, + `The prefix of the header tags. Defaults to '\{1: "➤ ", 2: "➤ "\}'` + ) + .option( + `--logo `, + `The logo information. Used for the 'logo' template.` + ) + .option( + `--contributorsPerRow `, + `The amount of contributors pr row when using the 'contributors' template. Defaults to '${defaultConfig.contributorsPerRow}'` + ) + .option( + `--documentationConfig `, + `Configuration object for automatic documentation template.` + ) + .option( + `--checkLinks`, + `Checks all links for aliveness after the README file has been generated.` + ) + .option( + `--pkg.name `, + `Contributors of the project. Used for the 'contributors' template.` + ) + .option( + `--pkg.contributors `, + `Contributors of the project. Used for the 'contributors' template.` + ) + .option( + `--pkg.license `, + `License kind. Used for the 'license' template.` + ) + .action((_: any, options: Options) => { + generateCommand(options).then(); + }); - // Do some error handling - const userArgs = argv.slice(2); - if (userArgs.length === 0) { - program.help(); - } + // Do some error handling + const userArgs = argv.slice(2); + if (userArgs.length === 0) { + program.help(); + } - // Handle unknown commands - program.on("command:*", () => { - console.error(`Invalid command: ${userArgs.join(" ")}\nSee --help for a list of available commands.`); - process.exit(1); - }); + // Handle unknown commands + program.on("command:*", () => { + console.error( + `Invalid command: ${userArgs.join( + " " + )}\nSee --help for a list of available commands.` + ); + process.exit(1); + }); - // Parse the input - program.parse(argv); + // Parse the input + program.parse(argv); }