Closed agubler closed 4 years ago
Interesting. When calling dojo init
using a globally installed @dojo/cli
it includes globally installed packages as well.
loadExternalCommands()
returns
C:\Users\a\src\dojo\test2>dojo init
Map {
'build' => Map {
'app' => {
name: 'app',
group: 'build',
alias: undefined,
description: 'create a build of your application',
register: [Function: register],
installed: true,
global: false,
run: [Function: run],
path: 'C:/Users/a/src/dojo/test2/node_modules/@dojo/cli-build-app',
eject: [Function: eject],
validate: undefined,
default: true
}
},
'test' => Map {
'intern' => {
name: 'intern',
group: 'test',
alias: undefined,
description: 'run unit and/or functional tests for your application',
register: [Function: register],
installed: true,
global: false,
run: [Function: run],
path: 'C:/Users/a/src/dojo/test2/node_modules/@dojo/cli-test-intern',
eject: [Function: eject],
validate: undefined,
default: true
}
},
'create' => Map {
'app' => {
name: 'app',
group: 'create',
alias: undefined,
description: 'scaffolds a new app',
register: [Function: default_1],
installed: true,
global: true,
run: [Function: default_1],
path: 'C:/Users/a/AppData/Roaming/npm/node_modules/@dojo/cli-create-app',
eject: undefined,
validate: undefined,
default: true
},
'widget' => {
name: 'widget',
group: 'create',
alias: undefined,
description: 'scaffolds a new widget',
register: [Function: default_1],
installed: true,
global: false,
run: [Function: default_1],
path: 'C:/Users/a/AppData/Roaming/npm/node_modules/@dojo/cli-create-widget',
eject: undefined,
validate: undefined
}
}
}
It's interesting that it says @dojo/cli-create-widget
isn't global
even though it comes from my global node_modules
directory.
When using npx it looks for installed packages in the temporary npx
folder.
npx -p file://./cli/dist/dojo-cli-7.0.0-pre.tgz -p @dojo/cli-create-app dojo create app --name test4
Results in a rootDir
of "C:\Users\a\src\dojo\test4" and groupMap
of:
Map {
'create' => Map {
'app' => {
name: 'app',
group: 'create',
alias: undefined,
description: 'scaffolds a new app',
register: [Function: default_1],
installed: true,
global: true,
run: [Function: default_1],
path: 'C:/Users/a/AppData/Roaming/npm-cache/_npx/20704/node_modules/@dojo/cli-create-app',
eject: undefined,
validate: undefined,
default: true
}
}
}
It's interesting that it says @dojo/cli-create-widget isn't global even though it comes from my global node_modules directory.
It's not that interesting, the global
flag is just a config setting from the command to indicate whether a command can be used globally or not.
see here: https://github.com/dojo/cli/blob/17eddd3cfdd79a7376ee2aa9ffd6ee256c8384ea/src/command.ts#L40 https://github.com/dojo/cli/blob/17eddd3cfdd79a7376ee2aa9ffd6ee256c8384ea/src/command.ts#L51
Bug
When using the cli-create-app command to create a new project the
.dojorc
isn't being correctly initialised for all the installed commands. It should create initial the dojorc for both thecli-build-app
andcli-test-intern
command but only outputs a section forcli-create-app
.