oclif 1.18.2-dev.3 → 2.0.0-dev.1

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.
Files changed (105) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/CHANGELOG.md +59 -11
  3. package/README.md +223 -96
  4. package/bin/dev +19 -0
  5. package/bin/dev.cmd +3 -0
  6. package/bin/run +5 -2
  7. package/lib/aws.d.ts +5 -5
  8. package/lib/aws.js +5 -5
  9. package/lib/command-base.d.ts +1 -1
  10. package/lib/command-base.js +3 -3
  11. package/lib/commands/generate.d.ts +11 -0
  12. package/lib/commands/generate.js +19 -0
  13. package/lib/commands/manifest.d.ts +1 -2
  14. package/lib/commands/manifest.js +4 -7
  15. package/lib/commands/pack/deb.d.ts +3 -3
  16. package/lib/commands/pack/deb.js +7 -8
  17. package/lib/commands/pack/macos.d.ts +4 -4
  18. package/lib/commands/pack/macos.js +17 -18
  19. package/lib/commands/pack/tarballs.d.ts +4 -5
  20. package/lib/commands/pack/tarballs.js +6 -7
  21. package/lib/commands/pack/win.d.ts +4 -4
  22. package/lib/commands/pack/win.js +26 -20
  23. package/lib/commands/promote.d.ts +12 -13
  24. package/lib/commands/promote.js +27 -28
  25. package/lib/commands/readme.d.ts +11 -12
  26. package/lib/commands/readme.js +27 -28
  27. package/lib/commands/upload/deb.d.ts +2 -3
  28. package/lib/commands/upload/deb.js +7 -8
  29. package/lib/commands/upload/macos.d.ts +2 -3
  30. package/lib/commands/upload/macos.js +8 -9
  31. package/lib/commands/upload/tarballs.d.ts +5 -5
  32. package/lib/commands/upload/tarballs.js +15 -18
  33. package/lib/commands/upload/win.d.ts +2 -3
  34. package/lib/commands/upload/win.js +9 -10
  35. package/lib/generators/{app.d.ts → cli.d.ts} +1 -21
  36. package/lib/generators/cli.js +183 -0
  37. package/lib/help-compatibility.d.ts +4 -5
  38. package/lib/help-compatibility.js +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.js +3 -2
  41. package/lib/log.js +2 -1
  42. package/lib/tarballs/bin.d.ts +2 -2
  43. package/lib/tarballs/bin.js +1 -0
  44. package/lib/tarballs/build.js +15 -14
  45. package/lib/tarballs/config.d.ts +6 -7
  46. package/lib/tarballs/config.js +6 -7
  47. package/lib/tarballs/index.js +4 -4
  48. package/lib/tarballs/node.js +5 -4
  49. package/lib/upload-util.d.ts +3 -3
  50. package/lib/upload-util.js +2 -1
  51. package/lib/util.js +5 -2
  52. package/lib/version-indexes.d.ts +2 -4
  53. package/lib/version-indexes.js +3 -1
  54. package/package.json +6 -8
  55. package/lib/app-command.d.ts +0 -16
  56. package/lib/app-command.js +0 -26
  57. package/lib/commands/base.d.ts +0 -5
  58. package/lib/commands/base.js +0 -11
  59. package/lib/commands/command.d.ts +0 -19
  60. package/lib/commands/command.js +0 -23
  61. package/lib/commands/hook.d.ts +0 -22
  62. package/lib/commands/hook.js +0 -25
  63. package/lib/commands/multi.d.ts +0 -5
  64. package/lib/commands/multi.js +0 -11
  65. package/lib/commands/plugin.d.ts +0 -5
  66. package/lib/commands/plugin.js +0 -11
  67. package/lib/commands/single.d.ts +0 -5
  68. package/lib/commands/single.js +0 -11
  69. package/lib/generators/app.js +0 -470
  70. package/lib/generators/command.d.ts +0 -15
  71. package/lib/generators/command.js +0 -51
  72. package/lib/generators/hook.d.ts +0 -14
  73. package/lib/generators/hook.js +0 -51
  74. package/templates/LICENSE.mit +0 -21
  75. package/templates/README.md.ejs +0 -21
  76. package/templates/appveyor.yml.ejs +0 -33
  77. package/templates/base/src/index.js +0 -1
  78. package/templates/base/src/index.ts +0 -1
  79. package/templates/base/test/index.test.js +0 -8
  80. package/templates/base/test/index.test.ts +0 -9
  81. package/templates/bin/run +0 -5
  82. package/templates/bin/run.cmd +0 -3
  83. package/templates/circle.yml.ejs +0 -65
  84. package/templates/editorconfig +0 -11
  85. package/templates/eslintrc +0 -3
  86. package/templates/eslintrc.typescript +0 -12
  87. package/templates/multi/src/index.js +0 -1
  88. package/templates/multi/src/index.ts +0 -1
  89. package/templates/plugin/bin/run +0 -4
  90. package/templates/plugin/src/index.ts +0 -1
  91. package/templates/scripts/setup_git +0 -12
  92. package/templates/single/bin/run.js +0 -4
  93. package/templates/single/bin/run.ts +0 -13
  94. package/templates/src/command.js.ejs +0 -27
  95. package/templates/src/command.ts.ejs +0 -46
  96. package/templates/src/hook.js.ejs +0 -3
  97. package/templates/src/hook.ts.ejs +0 -7
  98. package/templates/test/command.test.js.ejs +0 -28
  99. package/templates/test/command.test.ts.ejs +0 -29
  100. package/templates/test/hook.test.js.ejs +0 -9
  101. package/templates/test/hook.test.ts.ejs +0 -9
  102. package/templates/test/mocha.opts +0 -4
  103. package/templates/test/tsconfig.json +0 -9
  104. package/templates/travis.yml.ejs +0 -14
  105. package/templates/tsconfig.json +0 -14
@@ -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
@@ -1,8 +0,0 @@
1
- const {expect} = require('chai')
2
- const {add} = require('../src')
3
-
4
- describe('add', () => {
5
- it('1+2=3', () => {
6
- expect(add(1, 2)).to.equal(3)
7
- })
8
- })
@@ -1,9 +0,0 @@
1
- import {expect} from 'chai'
2
-
3
- import {add} from '../src'
4
-
5
- describe('add', () => {
6
- it('1+2=3', () => {
7
- expect(add(1, 2)).to.equal(3)
8
- })
9
- })
package/templates/bin/run DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('@oclif/command').run()
4
- .then(require('@oclif/command/flush'))
5
- .catch(require('@oclif/errors/handle'))
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
@@ -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: /.*/
@@ -1,11 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- charset = utf-8
7
- trim_trailing_whitespace = true
8
- insert_final_newline = true
9
-
10
- [*.md]
11
- trim_trailing_whitespace = false
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "oclif"
3
- }
@@ -1,12 +0,0 @@
1
- {
2
- "extends": [
3
- "oclif",
4
- "oclif-typescript"
5
- ],
6
- "settings": {
7
- "node": {
8
- "tryExtensions": [".js", ".ts"]
9
- }
10
- },
11
- "root": true
12
- }
@@ -1 +0,0 @@
1
- module.exports = require('@oclif/command')
@@ -1 +0,0 @@
1
- export {run} from '@oclif/command'
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('@oclif/command').run()
4
- .catch(require('@oclif/errors/handle'))
@@ -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,4 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require('..').run()
4
- .catch(require('@oclif/errors/handle'))
@@ -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,3 +0,0 @@
1
- module.exports = async function (opts) {
2
- process.stdout.write(`example hook running ${opts.id}\n`)
3
- }
@@ -1,7 +0,0 @@
1
- import {Hook} from '@oclif/config'
2
-
3
- const hook: Hook<'<%- options.event %>'> = async function (opts) {
4
- process.stdout.write(`example hook running ${opts.id}\n`)
5
- }
6
-
7
- export default hook
@@ -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
- })
@@ -1,9 +0,0 @@
1
- const {expect, test} = require('@oclif/test')
2
-
3
- describe('hooks', () => {
4
- test
5
- .stdout()
6
- .hook('init', {id: 'mycommand'})
7
- .do(output => expect(output.stdout).to.contain('example hook running mycommand'))
8
- .it('shows a message')
9
- })
@@ -1,9 +0,0 @@
1
- import {expect, test} from '@oclif/test'
2
-
3
- describe('hooks', () => {
4
- test
5
- .stdout()
6
- .hook('init', {id: 'mycommand'})
7
- .do(output => expect(output.stdout).to.contain('example hook running mycommand'))
8
- .it('shows a message')
9
- })
@@ -1,4 +0,0 @@
1
- <%= ts ? '--require ts-node/register\n--watch-extensions ts\n' : '' _%>
2
- --recursive
3
- --reporter spec
4
- --timeout 5000
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../tsconfig",
3
- "compilerOptions": {
4
- "noEmit": true
5
- },
6
- "references": [
7
- {"path": ".."}
8
- ]
9
- }
@@ -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
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "declaration": true,
4
- "importHelpers": true,
5
- "module": "commonjs",
6
- "outDir": "lib",
7
- "rootDir": "src",
8
- "strict": true,
9
- "target": "es2017"
10
- },
11
- "include": [
12
- "src/**/*"
13
- ]
14
- }