oclif 1.18.2-dev.2 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.oclif.manifest.json +1 -1
- package/CHANGELOG.md +71 -10
- package/README.md +223 -96
- package/bin/dev +19 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +5 -2
- package/lib/aws.d.ts +5 -5
- package/lib/aws.js +5 -5
- package/lib/command-base.d.ts +1 -1
- package/lib/command-base.js +3 -3
- package/lib/commands/generate.d.ts +11 -0
- package/lib/commands/generate.js +19 -0
- package/lib/commands/manifest.d.ts +1 -2
- package/lib/commands/manifest.js +4 -7
- package/lib/commands/pack/deb.d.ts +3 -3
- package/lib/commands/pack/deb.js +7 -8
- package/lib/commands/pack/macos.d.ts +4 -4
- package/lib/commands/pack/macos.js +16 -17
- package/lib/commands/pack/tarballs.d.ts +4 -5
- package/lib/commands/pack/tarballs.js +6 -7
- package/lib/commands/pack/win.d.ts +4 -4
- package/lib/commands/pack/win.js +26 -20
- package/lib/commands/promote.d.ts +12 -13
- package/lib/commands/promote.js +27 -28
- package/lib/commands/readme.d.ts +11 -12
- package/lib/commands/readme.js +27 -28
- package/lib/commands/upload/deb.d.ts +2 -3
- package/lib/commands/upload/deb.js +7 -8
- package/lib/commands/upload/macos.d.ts +2 -3
- package/lib/commands/upload/macos.js +7 -8
- package/lib/commands/upload/tarballs.d.ts +5 -5
- package/lib/commands/upload/tarballs.js +15 -18
- package/lib/commands/upload/win.d.ts +2 -3
- package/lib/commands/upload/win.js +8 -9
- package/lib/generators/{app.d.ts → cli.d.ts} +1 -21
- package/lib/generators/cli.js +183 -0
- package/lib/help-compatibility.d.ts +4 -5
- package/lib/help-compatibility.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -2
- package/lib/log.js +2 -1
- package/lib/tarballs/bin.d.ts +2 -2
- package/lib/tarballs/bin.js +1 -0
- package/lib/tarballs/build.js +13 -12
- package/lib/tarballs/config.d.ts +6 -6
- package/lib/tarballs/config.js +6 -5
- package/lib/tarballs/index.js +4 -4
- package/lib/tarballs/node.js +5 -4
- package/lib/upload-util.d.ts +3 -3
- package/lib/upload-util.js +1 -0
- package/lib/util.js +5 -2
- package/lib/version-indexes.d.ts +2 -4
- package/lib/version-indexes.js +3 -1
- package/package.json +5 -7
- package/lib/app-command.d.ts +0 -16
- package/lib/app-command.js +0 -26
- package/lib/commands/base.d.ts +0 -5
- package/lib/commands/base.js +0 -11
- package/lib/commands/command.d.ts +0 -19
- package/lib/commands/command.js +0 -23
- package/lib/commands/hook.d.ts +0 -22
- package/lib/commands/hook.js +0 -25
- package/lib/commands/multi.d.ts +0 -5
- package/lib/commands/multi.js +0 -11
- package/lib/commands/plugin.d.ts +0 -5
- package/lib/commands/plugin.js +0 -11
- package/lib/commands/single.d.ts +0 -5
- package/lib/commands/single.js +0 -11
- package/lib/generators/app.js +0 -470
- package/lib/generators/command.d.ts +0 -15
- package/lib/generators/command.js +0 -51
- package/lib/generators/hook.d.ts +0 -14
- package/lib/generators/hook.js +0 -51
- package/templates/LICENSE.mit +0 -21
- package/templates/README.md.ejs +0 -21
- package/templates/appveyor.yml.ejs +0 -33
- package/templates/base/src/index.js +0 -1
- package/templates/base/src/index.ts +0 -1
- package/templates/base/test/index.test.js +0 -8
- package/templates/base/test/index.test.ts +0 -9
- package/templates/bin/run +0 -5
- package/templates/bin/run.cmd +0 -3
- package/templates/circle.yml.ejs +0 -65
- package/templates/editorconfig +0 -11
- package/templates/eslintrc +0 -3
- package/templates/eslintrc.typescript +0 -12
- package/templates/multi/src/index.js +0 -1
- package/templates/multi/src/index.ts +0 -1
- package/templates/plugin/bin/run +0 -4
- package/templates/plugin/src/index.ts +0 -1
- package/templates/scripts/setup_git +0 -12
- package/templates/single/bin/run.js +0 -4
- package/templates/single/bin/run.ts +0 -13
- package/templates/src/command.js.ejs +0 -27
- package/templates/src/command.ts.ejs +0 -46
- package/templates/src/hook.js.ejs +0 -3
- package/templates/src/hook.ts.ejs +0 -7
- package/templates/test/command.test.js.ejs +0 -28
- package/templates/test/command.test.ts.ejs +0 -29
- package/templates/test/hook.test.js.ejs +0 -9
- package/templates/test/hook.test.ts.ejs +0 -9
- package/templates/test/mocha.opts +0 -4
- package/templates/test/tsconfig.json +0 -9
- package/templates/travis.yml.ejs +0 -14
- package/templates/tsconfig.json +0 -14
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as Generator from 'yeoman-generator';
|
|
2
|
-
import { Options } from '../commands/command';
|
|
3
|
-
declare class CommandGenerator extends Generator {
|
|
4
|
-
options: Options;
|
|
5
|
-
pjson: any;
|
|
6
|
-
get _path(): string;
|
|
7
|
-
get _ts(): any;
|
|
8
|
-
get _ext(): "ts" | "js";
|
|
9
|
-
get _mocha(): any;
|
|
10
|
-
constructor(args: any, options: Options);
|
|
11
|
-
prompting(): Promise<void>;
|
|
12
|
-
writing(): void;
|
|
13
|
-
end(): void;
|
|
14
|
-
}
|
|
15
|
-
export = CommandGenerator;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const _ = require("lodash");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const Generator = require("yeoman-generator");
|
|
5
|
-
const yosay = require("yosay");
|
|
6
|
-
const { version } = require('../../package.json');
|
|
7
|
-
class CommandGenerator extends Generator {
|
|
8
|
-
constructor(args, options) {
|
|
9
|
-
super(args, options);
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
get _path() {
|
|
13
|
-
return this.options.name.split(':').join('/');
|
|
14
|
-
}
|
|
15
|
-
get _ts() {
|
|
16
|
-
return this.pjson.devDependencies.typescript;
|
|
17
|
-
}
|
|
18
|
-
get _ext() {
|
|
19
|
-
return this._ts ? 'ts' : 'js';
|
|
20
|
-
}
|
|
21
|
-
get _mocha() {
|
|
22
|
-
return this.pjson.devDependencies.mocha;
|
|
23
|
-
}
|
|
24
|
-
async prompting() {
|
|
25
|
-
this.pjson = this.fs.readJSON('package.json');
|
|
26
|
-
if (!this.pjson)
|
|
27
|
-
throw new Error('not in a project directory');
|
|
28
|
-
this.pjson.oclif = this.pjson.oclif || {};
|
|
29
|
-
this.log(yosay(`Adding a command to ${this.pjson.name} Version: ${version}`));
|
|
30
|
-
}
|
|
31
|
-
writing() {
|
|
32
|
-
this.sourceRoot(path.join(__dirname, '../../templates'));
|
|
33
|
-
let bin = this.pjson.oclif.bin || this.pjson.oclif.dirname || this.pjson.name;
|
|
34
|
-
if (bin.includes('/'))
|
|
35
|
-
bin = bin.split('/').pop();
|
|
36
|
-
const cmd = `${bin} ${this.options.name}`;
|
|
37
|
-
const commandPath = this.destinationPath(`src/commands/${this._path}.${this._ext}`);
|
|
38
|
-
const opts = Object.assign(Object.assign({}, this.options), { bin, cmd, _, type: 'command', path: commandPath });
|
|
39
|
-
this.fs.copyTpl(this.templatePath(`src/command.${this._ext}.ejs`), commandPath, opts);
|
|
40
|
-
// this.fs.copyTpl(this.templatePath(`plugin/src/hooks/init.${this._ext}`), this.destinationPath(`src/hooks/init.${this._ext}`), this)
|
|
41
|
-
if (this._mocha) {
|
|
42
|
-
// this.fs.copyTpl(this.templatePath(`plugin/test/hooks/init.test.${this._ext}`), this.destinationPath(`test/hooks/init.test.${this._ext}`), this)
|
|
43
|
-
this.fs.copyTpl(this.templatePath(`test/command.test.${this._ext}.ejs`), this.destinationPath(`test/commands/${this._path}.test.${this._ext}`), opts);
|
|
44
|
-
}
|
|
45
|
-
// this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson)
|
|
46
|
-
}
|
|
47
|
-
end() {
|
|
48
|
-
this.spawnCommandSync(path.join('.', 'node_modules/.bin/oclif-dev'), ['readme']);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
module.exports = CommandGenerator;
|
package/lib/generators/hook.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as Generator from 'yeoman-generator';
|
|
2
|
-
import { Options } from '../commands/hook';
|
|
3
|
-
declare class HookGenerator extends Generator {
|
|
4
|
-
options: Options;
|
|
5
|
-
pjson: any;
|
|
6
|
-
get _path(): string;
|
|
7
|
-
get _ts(): any;
|
|
8
|
-
get _ext(): "ts" | "js";
|
|
9
|
-
get _mocha(): any;
|
|
10
|
-
constructor(args: any, options: Options);
|
|
11
|
-
prompting(): Promise<void>;
|
|
12
|
-
writing(): void;
|
|
13
|
-
}
|
|
14
|
-
export = HookGenerator;
|
package/lib/generators/hook.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const _ = require("lodash");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
const Generator = require("yeoman-generator");
|
|
5
|
-
const yosay = require("yosay");
|
|
6
|
-
const { version } = require('../../package.json');
|
|
7
|
-
class HookGenerator extends Generator {
|
|
8
|
-
constructor(args, options) {
|
|
9
|
-
super(args, options);
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
get _path() {
|
|
13
|
-
return this.options.name.split(':').join('/');
|
|
14
|
-
}
|
|
15
|
-
get _ts() {
|
|
16
|
-
return this.pjson.devDependencies.typescript;
|
|
17
|
-
}
|
|
18
|
-
get _ext() {
|
|
19
|
-
return this._ts ? 'ts' : 'js';
|
|
20
|
-
}
|
|
21
|
-
get _mocha() {
|
|
22
|
-
return this.pjson.devDependencies.mocha;
|
|
23
|
-
}
|
|
24
|
-
async prompting() {
|
|
25
|
-
this.pjson = this.fs.readJSON('package.json');
|
|
26
|
-
this.pjson.oclif = this.pjson.oclif || {};
|
|
27
|
-
if (!this.pjson)
|
|
28
|
-
throw new Error('not in a project directory');
|
|
29
|
-
this.log(yosay(`Adding a ${this.options.event} hook to ${this.pjson.name} Version: ${version}`));
|
|
30
|
-
}
|
|
31
|
-
writing() {
|
|
32
|
-
this.sourceRoot(path.join(__dirname, '../../templates'));
|
|
33
|
-
this.fs.copyTpl(this.templatePath(`src/hook.${this._ext}.ejs`), this.destinationPath(`src/hooks/${this.options.event}/${this.options.name}.${this._ext}`), this);
|
|
34
|
-
if (this._mocha) {
|
|
35
|
-
this.fs.copyTpl(this.templatePath(`test/hook.test.${this._ext}.ejs`), this.destinationPath(`test/commands/${this._path}.test.${this._ext}`), this);
|
|
36
|
-
}
|
|
37
|
-
this.pjson.oclif = this.pjson.oclif || {};
|
|
38
|
-
this.pjson.oclif.hooks = this.pjson.oclif.hooks || {};
|
|
39
|
-
const hooks = this.pjson.oclif.hooks;
|
|
40
|
-
const p = `./${this._ts ? 'lib' : 'src'}/hooks/${this.options.event}/${this.options.name}`;
|
|
41
|
-
if (hooks[this.options.event]) {
|
|
42
|
-
hooks[this.options.event] = _.castArray(hooks[this.options.event]);
|
|
43
|
-
hooks[this.options.event].push(p);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.pjson.oclif.hooks[this.options.event] = p;
|
|
47
|
-
}
|
|
48
|
-
this.fs.writeJSON(this.destinationPath('./package.json'), this.pjson);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
module.exports = HookGenerator;
|
package/templates/LICENSE.mit
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 <%- pjson.author %>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/templates/README.md.ejs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<%= pjson.name %>
|
|
2
|
-
<%= '='.repeat(pjson.name.length) %>
|
|
3
|
-
|
|
4
|
-
<%= pjson.description %>
|
|
5
|
-
|
|
6
|
-
[](https://oclif.io)
|
|
7
|
-
[](https://npmjs.org/package/<%= pjson.name %>)
|
|
8
|
-
<%_ if (circleci) { _%>
|
|
9
|
-
[](https://circleci.com/gh/<%= repository %>/tree/master)
|
|
10
|
-
<%_ } _%>
|
|
11
|
-
<%_ if (appveyor) { _%>
|
|
12
|
-
[](https://ci.appveyor.com/project/<%= repository %>/branch/master)
|
|
13
|
-
<%_ } _%>
|
|
14
|
-
[](https://npmjs.org/package/<%= pjson.name %>)
|
|
15
|
-
[](https://github.com/<%= repository %>/blob/master/package.json)
|
|
16
|
-
|
|
17
|
-
<!-- toc -->
|
|
18
|
-
# Usage
|
|
19
|
-
<!-- usage -->
|
|
20
|
-
# Commands
|
|
21
|
-
<!-- commands -->
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
environment:
|
|
2
|
-
nodejs_version: "10"
|
|
3
|
-
cache:
|
|
4
|
-
<%_ if (yarn) { _%>
|
|
5
|
-
- '%LOCALAPPDATA%\Yarn -> appveyor.yml'
|
|
6
|
-
- node_modules -> yarn.lock
|
|
7
|
-
<%_ } else { _%>
|
|
8
|
-
- '%AppData%\npm-cache -> appveyor.yml'
|
|
9
|
-
- node_modules -> package-lock.json
|
|
10
|
-
<%_ } _%>
|
|
11
|
-
|
|
12
|
-
install:
|
|
13
|
-
- ps: Install-Product node $env:nodejs_version x64
|
|
14
|
-
<%_ if (yarn) { _%>
|
|
15
|
-
- yarn
|
|
16
|
-
<%_ } else { _%>
|
|
17
|
-
- npm install
|
|
18
|
-
<%_ } _%>
|
|
19
|
-
test_script:
|
|
20
|
-
<%_ if (type === 'single' || type === 'multi') { _%>
|
|
21
|
-
- .\bin\run --version
|
|
22
|
-
- .\bin\run --help
|
|
23
|
-
<%_ } else if (type === 'plugin') { _%>
|
|
24
|
-
- .\bin\run --help
|
|
25
|
-
<%_ } _%>
|
|
26
|
-
- <%- yarn ? 'yarn' : 'npm' %> test
|
|
27
|
-
<% if (mocha) { %>
|
|
28
|
-
after_test:
|
|
29
|
-
- .\node_modules\.bin\nyc report --reporter text-lcov > coverage.lcov
|
|
30
|
-
<% } %>
|
|
31
|
-
|
|
32
|
-
build: off
|
|
33
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
exports.add = (a, b) => a + b
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const add = (a: number, b: number) => a + b
|
package/templates/bin/run
DELETED
package/templates/bin/run.cmd
DELETED
package/templates/circle.yml.ejs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
version: 2
|
|
3
|
-
jobs:
|
|
4
|
-
node-latest: &test
|
|
5
|
-
docker:
|
|
6
|
-
- image: node:latest
|
|
7
|
-
working_directory: ~/cli
|
|
8
|
-
steps:
|
|
9
|
-
- checkout
|
|
10
|
-
- restore_cache: &restore_cache
|
|
11
|
-
keys:
|
|
12
|
-
- v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'package-lock.json' %>"}}
|
|
13
|
-
- v1-npm-{{checksum ".circleci/config.yml"}}
|
|
14
|
-
- run:
|
|
15
|
-
name: Install dependencies
|
|
16
|
-
command: <%- yarn ? 'yarn' : 'npm ci' %>
|
|
17
|
-
<%_ if (['single', 'multi'].includes(type)) { _%>
|
|
18
|
-
- run: ./bin/run --version
|
|
19
|
-
<%_ } _%>
|
|
20
|
-
<%_ if (['single', 'multi', 'plugin'].includes(type)) { _%>
|
|
21
|
-
- run: ./bin/run --help
|
|
22
|
-
<%_ } _%>
|
|
23
|
-
- run:
|
|
24
|
-
name: Testing
|
|
25
|
-
command: <%- yarn ? 'yarn' : 'npm' %> test
|
|
26
|
-
node-12:
|
|
27
|
-
<<: *test
|
|
28
|
-
docker:
|
|
29
|
-
- image: node:12
|
|
30
|
-
node-10:
|
|
31
|
-
<<: *test
|
|
32
|
-
docker:
|
|
33
|
-
- image: node:10
|
|
34
|
-
cache:
|
|
35
|
-
<<: *test
|
|
36
|
-
steps:
|
|
37
|
-
- checkout
|
|
38
|
-
- run:
|
|
39
|
-
name: Install dependencies
|
|
40
|
-
command: <%- yarn ? 'yarn' : 'npm ci' %>
|
|
41
|
-
- save_cache:
|
|
42
|
-
key: v1-npm-{{checksum ".circleci/config.yml"}}-{{checksum "<%- yarn ? 'yarn.lock' : 'package-lock.json' %>"}}
|
|
43
|
-
paths:
|
|
44
|
-
- ~/cli/node_modules
|
|
45
|
-
<%_ if (yarn) { _%>
|
|
46
|
-
- /usr/local/share/.cache/yarn
|
|
47
|
-
- /usr/local/share/.config/yarn
|
|
48
|
-
<%_ } else { _%>
|
|
49
|
-
- ~/.npm
|
|
50
|
-
- /usr/local/lib/node_modules
|
|
51
|
-
<%_ } _%>
|
|
52
|
-
|
|
53
|
-
workflows:
|
|
54
|
-
version: 2
|
|
55
|
-
"<%= pjson.name %>":
|
|
56
|
-
jobs:
|
|
57
|
-
- node-latest
|
|
58
|
-
- node-12
|
|
59
|
-
- node-10
|
|
60
|
-
- cache:
|
|
61
|
-
filters:
|
|
62
|
-
tags:
|
|
63
|
-
only: /^v.*/
|
|
64
|
-
branches:
|
|
65
|
-
ignore: /.*/
|
package/templates/editorconfig
DELETED
package/templates/eslintrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@oclif/command')
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {run} from '@oclif/command'
|
package/templates/plugin/bin/run
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default {}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -ex
|
|
4
|
-
|
|
5
|
-
if [[ ! -z "$GIT_EMAIL" ]] & [[ ! -z "$GIT_USERNAME" ]]; then
|
|
6
|
-
git config --global push.default simple
|
|
7
|
-
git config --global user.email "$GIT_EMAIL"
|
|
8
|
-
git config --global user.name "$GIT_USERNAME"
|
|
9
|
-
fi
|
|
10
|
-
|
|
11
|
-
git submodule sync
|
|
12
|
-
git submodule update --init --recursive
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const fs = require('fs')
|
|
4
|
-
const path = require('path')
|
|
5
|
-
const project = path.join(__dirname, '../tsconfig.json')
|
|
6
|
-
const dev = fs.existsSync(project)
|
|
7
|
-
|
|
8
|
-
if (dev) {
|
|
9
|
-
require('ts-node').register({project})
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
require(`../${dev ? 'src' : 'lib'}`).run()
|
|
13
|
-
.catch(require('@oclif/errors/handle'))
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const {Command, flags} = require('@oclif/command')
|
|
2
|
-
<%_ const klass = _.upperFirst(_.camelCase(name.split(':').slice(-1).join(':') + ':command')) _%>
|
|
3
|
-
|
|
4
|
-
class <%- klass %> extends Command {
|
|
5
|
-
async run() {
|
|
6
|
-
const {flags} = this.parse(<%- klass %>)
|
|
7
|
-
const name = flags.name || 'world'
|
|
8
|
-
this.log(`hello ${name} from <%- path.replace(/\\/g, '\\\\') %>`)
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
<%- klass %>.description = `Describe the command here
|
|
13
|
-
...
|
|
14
|
-
Extra documentation goes here
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
<%- klass %>.flags = {
|
|
18
|
-
<%_ if (type === 'single') { _%>
|
|
19
|
-
// add --version flag to show CLI version
|
|
20
|
-
version: flags.version({char: 'v'}),
|
|
21
|
-
// add --help flag to show CLI version
|
|
22
|
-
help: flags.help({char: 'h'}),
|
|
23
|
-
<%_ } _%>
|
|
24
|
-
name: flags.string({char: 'n', description: 'name to print'}),
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
module.exports = <%- klass %>
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import {Command, flags} from '@oclif/command'
|
|
2
|
-
<%_ const klass = _.upperFirst(_.camelCase(name)) _%>
|
|
3
|
-
|
|
4
|
-
<%_ if (type === 'single') { _%>
|
|
5
|
-
class <%- klass %> extends Command {
|
|
6
|
-
<%_ } else { _%>
|
|
7
|
-
export default class <%- klass %> extends Command {
|
|
8
|
-
<%_ } _%>
|
|
9
|
-
static description = 'describe the command here'
|
|
10
|
-
|
|
11
|
-
<%_ if (name === 'hello') { _%>
|
|
12
|
-
static examples = [
|
|
13
|
-
`$ <%- cmd %>
|
|
14
|
-
hello world from ./src/<%- name %>.ts!
|
|
15
|
-
`,
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
<%_ } _%>
|
|
19
|
-
static flags = {
|
|
20
|
-
<%_ if (type === 'single') { _%>
|
|
21
|
-
// add --version flag to show CLI version
|
|
22
|
-
version: flags.version({char: 'v'}),
|
|
23
|
-
<%_ } _%>
|
|
24
|
-
help: flags.help({char: 'h'}),
|
|
25
|
-
// flag with a value (-n, --name=VALUE)
|
|
26
|
-
name: flags.string({char: 'n', description: 'name to print'}),
|
|
27
|
-
// flag with no value (-f, --force)
|
|
28
|
-
force: flags.boolean({char: 'f'}),
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
static args = [{name: 'file'}]
|
|
32
|
-
|
|
33
|
-
async run() {
|
|
34
|
-
const {args, flags} = this.parse(<%- klass %>)
|
|
35
|
-
|
|
36
|
-
const name = flags.name ?? 'world'
|
|
37
|
-
this.log(`hello ${name} from <%- path.replace(/\\/g, '\\\\') %>`)
|
|
38
|
-
if (args.file && flags.force) {
|
|
39
|
-
this.log(`you input --force and --file: ${args.file}`)
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
<%_ if (type === 'single') { _%>
|
|
44
|
-
|
|
45
|
-
export = <%- klass %>
|
|
46
|
-
<%_ } _%>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const {expect, test} = require('@oclif/test')
|
|
2
|
-
<%_ if (type === 'single') { _%>
|
|
3
|
-
const cmd = require('..')
|
|
4
|
-
<%_ } _%>
|
|
5
|
-
|
|
6
|
-
describe('<%- name %>', () => {
|
|
7
|
-
test
|
|
8
|
-
.stdout()
|
|
9
|
-
<%_ if (type === 'single') { _%>
|
|
10
|
-
.do(() => cmd.run([]))
|
|
11
|
-
<%_ } else { _%>
|
|
12
|
-
.command(['<%- name %>'])
|
|
13
|
-
<%_ } _%>
|
|
14
|
-
.it('runs hello', ctx => {
|
|
15
|
-
expect(ctx.stdout).to.contain('hello world')
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test
|
|
19
|
-
.stdout()
|
|
20
|
-
<%_ if (type === 'single') { _%>
|
|
21
|
-
.do(() => cmd.run(['--name', 'jeff']))
|
|
22
|
-
<%_ } else { _%>
|
|
23
|
-
.command(['<%- name %>', '--name', 'jeff'])
|
|
24
|
-
<%_ } _%>
|
|
25
|
-
.it('runs hello --name jeff', ctx => {
|
|
26
|
-
expect(ctx.stdout).to.contain('hello jeff')
|
|
27
|
-
})
|
|
28
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {expect, test} from '@oclif/test'
|
|
2
|
-
<%_ if (type === 'single') { _%>
|
|
3
|
-
|
|
4
|
-
import cmd = require('../src')
|
|
5
|
-
<%_ } _%>
|
|
6
|
-
|
|
7
|
-
describe('<%- name %>', () => {
|
|
8
|
-
test
|
|
9
|
-
.stdout()
|
|
10
|
-
<%_ if (type === 'single') { _%>
|
|
11
|
-
.do(() => cmd.run([]))
|
|
12
|
-
<%_ } else { _%>
|
|
13
|
-
.command(['<%- name %>'])
|
|
14
|
-
<%_ } _%>
|
|
15
|
-
.it('runs hello', ctx => {
|
|
16
|
-
expect(ctx.stdout).to.contain('hello world')
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
test
|
|
20
|
-
.stdout()
|
|
21
|
-
<%_ if (type === 'single') { _%>
|
|
22
|
-
.do(() => cmd.run(['--name', 'jeff']))
|
|
23
|
-
<%_ } else { _%>
|
|
24
|
-
.command(['<%- name %>', '--name', 'jeff'])
|
|
25
|
-
<%_ } _%>
|
|
26
|
-
.it('runs hello --name jeff', ctx => {
|
|
27
|
-
expect(ctx.stdout).to.contain('hello jeff')
|
|
28
|
-
})
|
|
29
|
-
})
|
package/templates/travis.yml.ejs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
language: node_js
|
|
2
|
-
node_js:
|
|
3
|
-
- node
|
|
4
|
-
|
|
5
|
-
cache: <%- yarn ? 'yarn' : 'npm' %>
|
|
6
|
-
|
|
7
|
-
script:
|
|
8
|
-
<%_ if (type === 'single' || type === 'multi') { _%>
|
|
9
|
-
- ./bin/run --version
|
|
10
|
-
- ./bin/run --help
|
|
11
|
-
<%_ } else if (type === 'plugin') { _%>
|
|
12
|
-
- ./bin/run --help
|
|
13
|
-
<%_ } _%>
|
|
14
|
-
- <%- yarn ? 'yarn' : 'npm' %> run test
|
package/templates/tsconfig.json
DELETED