diff --git a/packages/plugins/README.md b/packages/plugins/README.md index f851eb93bb..e3317ea33c 100644 --- a/packages/plugins/README.md +++ b/packages/plugins/README.md @@ -9,7 +9,35 @@ plugins [![License](https://img.shields.io/npm/l/plugins.svg)](https://github.com//plugins/blob/master/package.json) +* [Usage](#usage) +* [Commands](#commands) + # Usage +```sh-session +$ npm install -g @contentstack/cli-plugins-plugin +$ csdx COMMAND +running command... +$ csdx (-v|--version|version) +@contentstack/cli-plugins-plugin/0.0.0 linux-x64 node-v12.18.4 +$ csdx --help [COMMAND] +USAGE + $ csdx COMMAND +... +``` + # Commands +* [`csdx plugins:create`](#csdx-pluginscreate) + +## `csdx plugins:create` + +Generate plugin starter code + +``` +USAGE + $ csdx plugins:create +``` + +_See code: [src/commands/plugins/create.js](https://github.com/contentstack/cli/blob/v0.0.0/src/commands/plugins/create.js)_ + diff --git a/packages/plugins/package.json b/packages/plugins/package.json index b1c777f736..3e653ccf75 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -3,7 +3,7 @@ "description": "plugins", "version": "0.0.0", "author": "contentstack", - "bugs": "https://github.com//plugins/issues", + "bugs": "https://github.com/contentstack/cli/issues", "dependencies": { "@oclif/command": "^1.8.0", "@oclif/config": "^1.17.0", @@ -36,7 +36,7 @@ "/src", "/yarn.lock" ], - "homepage": "https://github.com//plugins", + "homepage": "https://github.com/contentstack/cli", "keywords": [ "oclif-plugin" ], @@ -48,7 +48,7 @@ "@oclif/plugin-help" ] }, - "repository": "/plugins", + "repository": "contentstack/cli", "scripts": { "postpack": "rm -f oclif.manifest.json", "posttest": "eslint .", diff --git a/packages/plugins/src/generators/plugin.js b/packages/plugins/src/generators/plugin.js index 8109c64825..8e5827ee25 100644 --- a/packages/plugins/src/generators/plugin.js +++ b/packages/plugins/src/generators/plugin.js @@ -280,7 +280,7 @@ module.exports = class extends Generator { this.fs.write(this.destinationPath('.gitignore'), this._gitignore()) this._writePlugin() } - + install() { const dependencies = [] const devDependencies = [] @@ -289,7 +289,7 @@ module.exports = class extends Generator { const save = {save: true} dependencies.push( - '@contentstack/cli-command', + '@contentstack/cli-command@^0', '@oclif/config@^1', '@oclif/command@^1', ) @@ -301,7 +301,7 @@ module.exports = class extends Generator { ) devDependencies.push( - 'mocha@^5', + 'mocha@^8.3.1', 'nyc@^14', 'chai@^4', '@oclif/test@^1', @@ -309,7 +309,7 @@ module.exports = class extends Generator { if (this.mocha) { devDependencies.push( - 'mocha@^5', + 'mocha@^8.3.1', 'nyc@^14', 'chai@^4', ) diff --git a/packages/plugins/src/templates/eslintrc.typescript b/packages/plugins/src/templates/eslintrc.typescript index 7b846193cc..bed79fc4fe 100644 --- a/packages/plugins/src/templates/eslintrc.typescript +++ b/packages/plugins/src/templates/eslintrc.typescript @@ -2,5 +2,8 @@ "extends": [ "oclif", "oclif-typescript" - ] + ], + rules: { + "@typescript-eslint/no-unused-vars": "off" + } } diff --git a/packages/plugins/src/templates/src/command.ts.ejs b/packages/plugins/src/templates/src/command.ts.ejs index 83483dc35e..296c5351fa 100644 --- a/packages/plugins/src/templates/src/command.ts.ejs +++ b/packages/plugins/src/templates/src/command.ts.ejs @@ -1,11 +1,9 @@ // note that we are using @contentstack/cli-command instead of @oclif/command const {Command, flags} = require('@contentstack/cli-command') - <%_ const klass = _.upperFirst(_.camelCase(name)) _%> - export default class <%- klass %> extends Command { - static description = 'Executes demo command from <%- path.replace(/\\/g, '\\\\') %>' + name = flags.name || 'world' <%_ if (name === 'hello') { _%>