Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins #27

Merged
merged 4 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions packages/plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,35 @@ plugins
[![License](https://img.shields.io/npm/l/plugins.svg)](https://github.com//plugins/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- 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
...
```
<!-- usagestop -->
# Commands
<!-- 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)_
<!-- commandsstop -->
6 changes: 3 additions & 3 deletions packages/plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -36,7 +36,7 @@
"/src",
"/yarn.lock"
],
"homepage": "https://github.com//plugins",
"homepage": "https://github.com/contentstack/cli",
"keywords": [
"oclif-plugin"
],
Expand All @@ -48,7 +48,7 @@
"@oclif/plugin-help"
]
},
"repository": "/plugins",
"repository": "contentstack/cli",
"scripts": {
"postpack": "rm -f oclif.manifest.json",
"posttest": "eslint .",
Expand Down
8 changes: 4 additions & 4 deletions packages/plugins/src/generators/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ module.exports = class extends Generator {
this.fs.write(this.destinationPath('.gitignore'), this._gitignore())
this._writePlugin()
}

install() {
const dependencies = []
const devDependencies = []
Expand All @@ -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',
)
Expand All @@ -301,15 +301,15 @@ module.exports = class extends Generator {
)

devDependencies.push(
'mocha@^5',
'mocha@^8.3.1',
'nyc@^14',
'chai@^4',
'@oclif/test@^1',
)

if (this.mocha) {
devDependencies.push(
'mocha@^5',
'mocha@^8.3.1',
'nyc@^14',
'chai@^4',
)
Expand Down
5 changes: 4 additions & 1 deletion packages/plugins/src/templates/eslintrc.typescript
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"extends": [
"oclif",
"oclif-typescript"
]
],
rules: {
"@typescript-eslint/no-unused-vars": "off"
}
}
4 changes: 1 addition & 3 deletions packages/plugins/src/templates/src/command.ts.ejs
Original file line number Diff line number Diff line change
@@ -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') { _%>
Expand Down