Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
8ae12cb
add with-commands fixture
galvez Nov 11, 2018
7fccbbb
add local.exists / local.get
galvez Nov 11, 2018
75014bb
add local.hash()
galvez Nov 11, 2018
27cc1fa
lint
galvez Nov 11, 2018
eccb5ec
changed signatures
galvez Nov 11, 2018
6d17aec
add commands test suite
galvez Nov 11, 2018
ef67e28
lint
galvez Nov 11, 2018
87d7826
lint
galvez Nov 11, 2018
6a95419
test fix
galvez Nov 11, 2018
45c37c0
fix imports
galvez Nov 11, 2018
9973192
fixes
galvez Nov 11, 2018
3405a75
fix fixture
galvez Nov 11, 2018
56b10f3
lint
galvez Nov 12, 2018
10a8589
simplify getLocalCommands
galvez Nov 12, 2018
33dde9b
lint
galvez Nov 12, 2018
660a511
fix
galvez Nov 12, 2018
bf63d7a
test tweak
galvez Nov 12, 2018
7b88c1a
ongoing work on run command
galvez Nov 13, 2018
fabf1cd
ongoing work on run command (2)
galvez Nov 13, 2018
b7690b4
ongoing work on run command (3)
galvez Nov 13, 2018
5db8b64
ongoing work on run command (4)
galvez Nov 13, 2018
97d5f38
ongoing work on run command (5)
galvez Nov 13, 2018
195b10e
ongoing work on run command (6)
galvez Nov 13, 2018
c4a619b
ongoing work on run command (7)
galvez Nov 13, 2018
2c3d432
lint
galvez Nov 13, 2018
ae79ffd
add NuxtCommand.list
galvez Nov 13, 2018
5625ca9
lint
galvez Nov 13, 2018
2472b0c
lint
galvez Nov 13, 2018
92e17a1
lint
galvez Nov 13, 2018
d09baee
tweaks
galvez Nov 13, 2018
19fa70c
lint
galvez Nov 13, 2018
3955785
fix
galvez Nov 13, 2018
29b7ec3
add run export
galvez Nov 13, 2018
57654fd
fix type error
galvez Nov 13, 2018
4e39088
fix ensure()
galvez Nov 13, 2018
0f95838
fix argv
galvez Nov 13, 2018
1037212
lint
galvez Nov 13, 2018
45508bb
simplify ensure()
galvez Nov 13, 2018
b8a23b0
rm unknown-calls-default-method test
galvez Nov 13, 2018
5192d30
test fixes
galvez Nov 13, 2018
11ed63f
move setup back to run
galvez Nov 13, 2018
39ad245
move setup back to run
galvez Nov 14, 2018
95ed08b
fix
galvez Nov 14, 2018
79540e3
fix
galvez Nov 14, 2018
b5992eb
lint
galvez Nov 14, 2018
6c02795
fix env
galvez Nov 14, 2018
84008ec
updated list commands
galvez Nov 14, 2018
022e7bf
updated list commands
galvez Nov 14, 2018
9491021
updated list commands
galvez Nov 14, 2018
4866f1c
don't display custom cmds str if none found
galvez Nov 14, 2018
f6ab7fb
don't display custom cmds str if none found
galvez Nov 14, 2018
829c8ce
lint
galvez Nov 14, 2018
6af3831
Merge branch 'dev' of github.com:nuxt/nuxt.js into feat/custom-commands
galvez Dec 7, 2018
78e436e
fix conflicts
galvez Dec 9, 2018
d96eeec
latest dev
galvez Dec 13, 2018
1d9d287
remove run() cmd
galvez Dec 14, 2018
7312915
check PATH for command in ensure()
galvez Dec 14, 2018
c8beb28
pass subCommand to ensure()
galvez Dec 14, 2018
f3afba0
Split ensure/ensureExternal
galvez Dec 14, 2018
b4528d8
run() tweaks
galvez Dec 14, 2018
f0865bc
remove commands folder check in load()
galvez Dec 14, 2018
c5490bf
linting
galvez Dec 14, 2018
e8067f1
unused subCommand
galvez Dec 14, 2018
07cd422
return if custom
galvez Dec 14, 2018
c97e8b9
linting
galvez Dec 14, 2018
b1a60e6
updated fixture
galvez Dec 14, 2018
6ecab58
lint
galvez Dec 14, 2018
0dc33f1
lint
galvez Dec 14, 2018
03811fb
simplify cmd running
galvez Dec 14, 2018
5ee7ab9
lint
galvez Dec 14, 2018
42edc9a
Merge branch 'dev' of github.com:nuxt/nuxt.js into feat/custom-commands
galvez Dec 15, 2018
2486e4c
Merge branch 'dev' of github.com:nuxt/nuxt.js into feat/custom-commands
galvez Dec 17, 2018
bd74936
add bin field to fixture package.json
galvez Dec 18, 2018
dd72175
updated test cmd package
galvez Dec 18, 2018
87f9ed2
debugging ensureExternal
galvez Dec 18, 2018
ccaa2bf
change to execSync with stdio configured
galvez Dec 18, 2018
3eab37d
debugging ensureExternal (2)
galvez Dec 18, 2018
f592c24
find nuxt command position
galvez Dec 18, 2018
b44c9c9
lint
galvez Dec 18, 2018
7bfc3d8
debugging test
galvez Dec 18, 2018
7686626
lint
galvez Dec 18, 2018
5c90b0b
fix test
galvez Dec 18, 2018
af1f8f0
tweak ensureExternal
galvez Dec 18, 2018
aa8e0a7
prevent early exit
galvez Dec 18, 2018
586064f
fix: return value of cmd.run()
pi0 Dec 18, 2018
fbe5122
feat: add argv utils
pi0 Dec 18, 2018
ff78b62
use execa
pi0 Dec 18, 2018
851de25
export getCommand method for internal commands
pi0 Dec 18, 2018
b811d47
remove external logic from command.js
pi0 Dec 18, 2018
7c78f96
rewrite run.js to support external commands
pi0 Dec 18, 2018
b499bf4
update tests
pi0 Dec 18, 2018
7dda9a2
add --help, --version for help
pi0 Dec 18, 2018
ad8b600
feat: default command
pi0 Dec 18, 2018
63cbcc5
improve command/run integration
pi0 Dec 18, 2018
c6572a6
rm unused import
galvez Dec 18, 2018
32e64a2
fix: return instead of process.exit for showVersion, showHelp
pi0 Dec 19, 2018
ccd5c91
fix: update tets for version and help
pi0 Dec 19, 2018
e78dc9f
refactor argv passing
pi0 Dec 19, 2018
f4abbe1
update command tests
pi0 Dec 19, 2018
415b830
fix test
pi0 Dec 19, 2018
87921d2
fix lint error
pi0 Dec 19, 2018
fc395ac
move process.exit to nuxt bin only
pi0 Dec 19, 2018
2048fa7
revert adding new argv utils
pi0 Dec 19, 2018
c527ab5
revert adding default command
pi0 Dec 19, 2018
059ebe3
update tests
pi0 Dec 19, 2018
051d0fd
reduce usage of process.argv
pi0 Dec 19, 2018
53f96d0
imrpove run.js
pi0 Dec 19, 2018
b285708
fix: clone _argv
pi0 Dec 19, 2018
032c049
fix lint error
pi0 Dec 19, 2018
1979422
don't mutate argv
pi0 Dec 19, 2018
2e0eb4e
update help.js
pi0 Dec 19, 2018
591b268
fix: default value for argv
pi0 Dec 19, 2018
8eef22b
refactor commands
pi0 Dec 19, 2018
ef915b2
remove extra imports
pi0 Dec 19, 2018
7facc75
remove extra process.exit mock restore calls
pi0 Dec 19, 2018
1378643
remove getArgv in flavor of argv getter
pi0 Dec 19, 2018
0da937c
minimist supports aliases!
pi0 Dec 19, 2018
d6a5ac0
:cry
pi0 Dec 19, 2018
fb5821b
Merge branch 'dev' into feat/custom-commands
pi0 Dec 19, 2018
b99db50
test: add cli/run tests
pi0 Dec 20, 2018
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
Prev Previous commit
Next Next commit
add NuxtCommand.list
  • Loading branch information
galvez committed Nov 13, 2018
commit ae79ffdc6b6b182a6bc13d012f44b9b0d7eca72d
9 changes: 9 additions & 0 deletions packages/cli/src/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ export default class NuxtCommand {
}
}

static list(dir = '.') {
const cmdsRoot = resolve(dir, 'commands')
return existsSync(cmdsRoot)
? readdirSync(cmdsRoot)
.filter(c => c.endsWith('.js'))
.map(c => parse(c).name)
: []
}

static ensure(name, dir = null) {
if (typeof name === 'undefined') {
return
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/list.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import chalk from 'chalk'
import NuxtCommand from './command'
import { getLocalCommands, loadLocalCommand } from './local'
import { indent, foldLines, startSpaces, optionSpaces, colorize } from './utils/formatting'

export default async function listCommands() {
const commandsOrder = ['dev', 'build', 'generate', 'start', 'help']
const localCommands = getLocalCommands()
const localCommands = NuxtCommand.list('.')

// Load all commands
const _commands = await Promise.all(
commandsOrder.map(cmd => NuxtCommand.load(cmd))
.concat(localCommands.map(cmd => loadLocalCommand(cmd)))
.concat(localCommands.map(cmd => NuxtCommand.load(cmd, '.')))
)

let maxLength = 0
Expand Down