Commit 9b0f965
authored
Allow require of nativescript-cli as library (#2468)
The entry point of current cli is used only from `bin/tns`. In fact the `main` entry in package.json is used when you want to require the module, but CLI is never required. It's installed globally and spawned from it's bin dir (`bin` key in package.json defines which is the "entry" point when package is installed globally).
So I've changed the entry point to a file, that does not use commandDispatcher - when requiring {N} CLI as library, we'll not execute commands.
In order to allow executing specific device operations (like device detection through events), require the mobile-cli-lib's appbuilder bootstrap in the entry point. This will be fixed with other PR's and finally we'll not have to require this bootstrap.1 parent 68679f2 commit 9b0f965
File tree
5 files changed
+37
-2
lines changed- lib
- test
5 files changed
+37
-2
lines changed- appbuilder/device-emitter.ts+6-12
- definitions/mobile.d.ts+5
- definitions/yok.d.ts+7
- mobile/mobile-core/android-device-discovery.ts-1
- mobile/mobile-core/devices-service.ts+18-5
- test/unit-tests/appbuilder/device-emitter.ts+1-32
- test/unit-tests/mocks/mockClassesWithInitializeMethod.ts-15
- test/unit-tests/mocks/public-api-mocks.ts+9
- test/unit-tests/yok.ts+104-48
- yok.ts+6-12
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
0 commit comments