Skip to content

Commit 686135c

Browse files
authored
feat(cli): {N} 7 package scoping, nativescript.config, ns migrate (#5350)
1 parent 037186c commit 686135c

File tree

526 files changed

+57877
-25399
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

526 files changed

+57877
-25399
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.js
44
!/*.js
55
!bin/nativescript.js
6+
!bin/nsc.js
67
!vendor/*.js
78
!resources/**
89
!lib/common/test/resources/**/*

.idea/encodings.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"useTabs": true
3+
}

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
- NATIVESCRIPT_SKIP_POSTINSTALL_TASKS=1
1313
language: node_js
1414
node_js:
15-
- '8'
15+
- '14'
1616
git:
1717
submodules: true
1818
install:

CHANGELOG.md

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
## [7.0.1](https://github.com/NativeScript/nativescript-cli/compare/v6.7.8...v7.0.1) (2020-09-01)
2+
3+
4+
### Bug Fixes
5+
6+
* broken test due to missing dependency ([51a3fb4](https://github.com/NativeScript/nativescript-cli/commit/51a3fb49428c449b5ee01ab9e90052cbbba5c7a0))
7+
* failing tests ([ab9f2a9](https://github.com/NativeScript/nativescript-cli/commit/ab9f2a923bc0bdf1ead995013bd99639037174bc))
8+
* failing tests + config service stub ([d5d62bd](https://github.com/NativeScript/nativescript-cli/commit/d5d62bd967758e0cca5ddfd399c9da3aca9c2ede))
9+
* global Error extension and Function injection ([f46ddb9](https://github.com/NativeScript/nativescript-cli/commit/f46ddb947def168f253f60c7db217fc16b0631d3))
10+
* plugin service tests and config reading ([bc3568e](https://github.com/NativeScript/nativescript-cli/commit/bc3568e820511d946c137af93614f46e61d7e21c))
11+
* properly resolve bundle id ([4ece731](https://github.com/NativeScript/nativescript-cli/commit/4ece731075f146ee9ad10dea992b4bd60ee64c62))
12+
* runtime name/version parse ([e3ee3a4](https://github.com/NativeScript/nativescript-cli/commit/e3ee3a4088a539d90b2c4d48905e24831aec7c48))
13+
* scoped runtimes, project detection, frameworkPath ([9ca68e5](https://github.com/NativeScript/nativescript-cli/commit/9ca68e5c611134947c67440fc224cca651d0d3ca))
14+
* unit-tests ([1076a78](https://github.com/NativeScript/nativescript-cli/commit/1076a785708f6580036f226747337ede918f0837))
15+
* update runtime package.json when config changes ([a460652](https://github.com/NativeScript/nativescript-cli/commit/a460652cf54c5a603172def2f91e6a4a4972af92))
16+
* version format to use v instead of @ ([c7900ad](https://github.com/NativeScript/nativescript-cli/commit/c7900adc62cf2136a584edce14c21b678ac34ac6))
17+
18+
19+
### Features
20+
21+
* config file handling ([1dfdfa4](https://github.com/NativeScript/nativescript-cli/commit/1dfdfa44e623c3c292090eafa8dfed8035fe9fa2))
22+
* config manipulation ([93175f4](https://github.com/NativeScript/nativescript-cli/commit/93175f4cb8a13cb416b24af491b5caac4b86c799))
23+
* passing appPath and appResourcesPath through gradle args ([24e07c0](https://github.com/NativeScript/nativescript-cli/commit/24e07c060cb30941ec905444310416f202e546dd))
24+
* use scoped app templates and fix create project appid ([fd370d3](https://github.com/NativeScript/nativescript-cli/commit/fd370d353b2ccc1cd7803f03978047c9fbfbfade))
25+
* **webpack:** use scoped @nativescript/webpack ([8307d78](https://github.com/NativeScript/nativescript-cli/commit/8307d78a1fe7954709ec9bf1dcfcabd68cc832e5))
26+
27+
28+
129
## [6.7.8](https://github.com/NativeScript/nativescript-cli/compare/v6.7.7...v6.7.8) (2020-06-27)
230

331

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,12 @@ When the patch is reviewed and merged, you can safely delete your branch and pul
9595
Updating the CLI Documentation
9696
===
9797

98-
The CLI documentation is what you see when running the `tns help` command.
98+
The CLI documentation is what you see when running the `ns help` command.
9999
This documentation is distributed as part of the CLI package and is generated from the *.md files that can be found in <a href="https://github.com/NativeScript/nativescript-cli/tree/master/docs/man_pages" target="_blank">man_pages folder</a>
100100
The output of the documentation is html static pages that are generated on post install hook of the CLI installation.
101101
In addition, documentation generation is triggered every time there is no html article for the respective help command that is executed.
102102

103-
In order to see a change applied in your development workspace after editing the *.md files, you can use the `tns dev-generate-help` command.
103+
In order to see a change applied in your development workspace after editing the *.md files, you can use the `ns dev-generate-help` command.
104104
This will trigger regeneration of all html files on your local environment. Mind that you need to run from the /bin folder of the nativescript_cli.
105105

106106
[Back to Top][1]

PublicAPI.md

+17-18
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Public API
44
This document describes all methods that can be invoked when NativeScript CLI is required as library, i.e.
55

66
```JavaScript
7-
const tns = require("nativescript");
7+
const ns = require("nativescript");
88
```
99

1010
# Contents
@@ -221,11 +221,10 @@ Returns an IProjectData object that is initialized with the provided package.jso
221221
/**
222222
* Returns an initialized IProjectData object containing data about the NativeScript project in the provided projectDir
223223
* @param {string} packageJsonContent The content of the project.json file in the root of the project
224-
* @param {string} nsconfigContent The content of the nsconfig.json file in the root of the project
225224
* @param {string} projectDir The path to the project
226225
* @returns {IProjectData} Information about the NativeScript project
227226
*/
228-
getProjectDataFromContent(packageJsonContent: string, nsconfigContent: string, projectDir?: string): IProjectData
227+
getProjectDataFromContent(packageJsonContent: string, projectDir?: string): IProjectData
229228
```
230229
231230
### getNsConfigDefaultContent
@@ -1515,8 +1514,8 @@ setCleanupLogFile(filePath: string): void;
15151514
15161515
* Usage
15171516
```JavaScript
1518-
const tns = require("nativescript");
1519-
tns.cleanupService.setCleanupLogFile("/Users/username/cleanup-logs.txt");
1517+
const ns = require("nativescript");
1518+
ns.cleanupService.setCleanupLogFile("/Users/username/cleanup-logs.txt");
15201519
```
15211520
15221521
## initializeService
@@ -1545,18 +1544,18 @@ interface IInitializeService {
15451544
* Usage
15461545
* Initialization without passing any data - `logger` will be initialized with default CLI settings. Warnings will be printed if there are any.
15471546
```JavaScript
1548-
const tns = require("nativescript");
1549-
tns.initializeService.initialize();
1547+
const ns = require("nativescript");
1548+
ns.initializeService.initialize();
15501549
```
15511550
* Initialize with custom settings service options:
15521551
```JavaScript
1553-
const tns = require("nativescript");
1554-
tns.initializeService.initialize({ settingsServiceOptions: { profileDir: "/Users/username/customDir", userAgentName: "MyApp" } });
1552+
const ns = require("nativescript");
1553+
ns.initializeService.initialize({ settingsServiceOptions: { profileDir: "/Users/username/customDir", userAgentName: "MyApp" } });
15551554
```
15561555
* Initialize with custom extensibility path:
15571556
```JavaScript
1558-
const tns = require("nativescript");
1559-
tns.initializeService.initialize({ extensibilityOptions: { pathToExtensions: "/Users/username/customDir/extensions" } });
1557+
const ns = require("nativescript");
1558+
ns.initializeService.initialize({ extensibilityOptions: { pathToExtensions: "/Users/username/customDir/extensions" } });
15601559
```
15611560
15621561
## logger
@@ -1634,7 +1633,7 @@ The `emit-appender` is used to emit the log events through a passed emitter inst
16341633
16351634
* Usage:
16361635
```JavaScript
1637-
const tns = require("nativescript");
1636+
const ns = require("nativescript");
16381637
const { EventEmitter } = require("events");
16391638
const { EMIT_APPENDER_EVENT_NAME, LoggerAppenders } = tns.constants;
16401639
const emitter = new EventEmitter();
@@ -1647,7 +1646,7 @@ emitter.on(EMIT_APPENDER_EVENT_NAME, (logData) => {
16471646
}
16481647
});
16491648

1650-
const logger = tns.logger;
1649+
const logger = ns.logger;
16511650
logger.initialize({
16521651
appenderOptions: {
16531652
type: LoggerAppenders.emitAppender,
@@ -1656,18 +1655,18 @@ logger.initialize({
16561655
});
16571656
```
16581657
1659-
> NOTE: In several cases CLI passes additional configuration properties in the `context` of the `loggingEvent`. Full list is available in the `tns.constants.LoggerConfigData` object. These properties are used by CLI's layout and appender to change the way the message is printed on the terminal and if it should be on stderr or stdout.
1658+
> NOTE: In several cases CLI passes additional configuration properties in the `context` of the `loggingEvent`. Full list is available in the `ns.constants.LoggerConfigData` object. These properties are used by CLI's layout and appender to change the way the message is printed on the terminal and if it should be on stderr or stdout.
16601659
16611660
#### cli-appender
16621661
`cli-appender` prints messages to stdout or stderr based on the passed options for the message.
16631662
16641663
* Usage
16651664
```JavaScript
1666-
const tns = require("nativescript");
1665+
const ns = require("nativescript");
16671666
const { EventEmitter } = require("events");
1668-
const { EMIT_APPENDER_EVENT_NAME, LoggerAppenders } = tns.constants;
1667+
const { EMIT_APPENDER_EVENT_NAME, LoggerAppenders } = ns.constants;
16691668

1670-
const logger = tns.logger;
1669+
const logger = ns.logger;
16711670
logger.initialize({
16721671
appenderOptions: {
16731672
type: LoggerAppenders.cliAppender,
@@ -1686,7 +1685,7 @@ log4js.addLayout("myCustomLayout", (config) => {
16861685
}
16871686
});
16881687

1689-
tns.logger.initialize({ appenderOptions: { layout: { type: "myCustomLayout" } } });
1688+
ns.logger.initialize({ appenderOptions: { layout: { type: "myCustomLayout" } } });
16901689
```
16911690
16921691
## How to add a new method to Public API

README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Linux | `sudo npm install nativescript -g --unsafe-perm` | `npm install nativesc
106106
To check if your system is configured properly, run the following command.
107107

108108
```Shell
109-
tns doctor
109+
ns doctor
110110
```
111111

112112
## Configure Proxy Settings
@@ -116,7 +116,7 @@ If you are working with the NativeScript CLI behind a web proxy, you need to con
116116
### Set Proxy Settings
117117

118118
```Shell
119-
tns proxy set <Url> <Username> <Password>
119+
ns proxy set <Url> <Username> <Password>
120120
```
121121

122122
#### Attributes
@@ -143,13 +143,13 @@ The <code>--insecure</code> flag allows you to perform insecure SSL connections
143143
### Display Current Proxy Settings
144144

145145
```Shell
146-
tns proxy
146+
ns proxy
147147
```
148148

149149
### Clear Proxy Settings
150150

151151
```Shell
152-
tns proxy clear
152+
ns proxy clear
153153
```
154154

155155
[Back to Top][1]
@@ -165,7 +165,7 @@ Quick Start
165165

166166
## The Commands
167167

168-
Run `tns help` to view all available commands in the browser. Run `tns help <Command>` to view more information about a selected command in the browser. `tns --help` opens console help, where help information is shown in the console.
168+
Run `ns help` to view all available commands in the browser. Run `ns help <Command>` to view more information about a selected command in the browser. `ns --help` opens console help, where help information is shown in the console.
169169

170170
[Back to Top][1]
171171

@@ -174,28 +174,28 @@ Run `tns help` to view all available commands in the browser. Run `tns help <Com
174174
To create a new cross-platform project from the default JavaScript template, run the following command.
175175

176176
```Shell
177-
tns create MyApp --js
177+
ns create MyApp --js
178178
```
179179

180180
To create a new cross-platform project from the default TypeScript, Angular or Vue template, use the `template` option followed by either `typescript`, `angular` or `vue`.
181181

182182
```Shell
183-
tns create MyApp --template typescript
184-
tns create MyApp --template angular
185-
tns create MyApp --template vue
183+
ns create MyApp --template typescript
184+
ns create MyApp --template angular
185+
ns create MyApp --template vue
186186
```
187187

188188
Or you can simply use the shorthand `tsc` and `ng` options.
189189

190190
```Shell
191-
tns create MyApp --tsc
192-
tns create MyApp --ng
191+
ns create MyApp --tsc
192+
ns create MyApp --ng
193193
```
194194
With the `template` option you can also specify a local or a remote path to the template that you want to use to create your project.
195195
For example, if you want to create a React template, run the following command.
196196

197197
```Shell
198-
tns create MyApp --template https://github.com/shirakaba/tns-template-blank-react.git
198+
ns create MyApp --template https://github.com/shirakaba/tns-template-blank-react.git
199199
```
200200

201201
The NativeScript CLI creates a new project and sets the application identifier to `org.nativescript.myapp`.
@@ -258,8 +258,8 @@ You can always override the generated entitlements file, by pointing to your own
258258
You can build it for your target mobile platforms.
259259

260260
```Shell
261-
tns build android
262-
tns build ios
261+
ns build android
262+
ns build ios
263263
```
264264

265265
The NativeScript CLI calls the SDK for the selected target platform and uses it to build your app locally.
@@ -277,16 +277,16 @@ You can test your work in progress on connected Android or iOS devices.
277277
To verify that the NativeScript CLI recognizes your connected devices, run the following command.
278278

279279
```Shell
280-
tns devices
280+
ns devices
281281
```
282282

283283
The NativeScript CLI lists all connected physical devices and running emulators/simulators.
284284

285285
After you have listed the available devices, you can quickly run your app on connected devices by executing:
286286

287287
```Shell
288-
tns run android
289-
tns run ios
288+
ns run android
289+
ns run ios
290290
```
291291

292292
[Back to Top][1]
@@ -296,7 +296,7 @@ Extending the CLI
296296

297297
The NativeScript CLI lets you extend its behavior and customize it to fit your needs by using [hooks](https://en.wikipedia.org/wiki/Hooking).
298298

299-
When you run one of the extendable commands (for example, `tns build`), the CLI checks for hooks and executes them. Plugins can also use hooks to control the compilation of the application package.
299+
When you run one of the extendable commands (for example, `ns build`), the CLI checks for hooks and executes them. Plugins can also use hooks to control the compilation of the application package.
300300

301301
For more information, see the [Extending the CLI document](https://github.com/NativeScript/nativescript-cli/blob/master/extending-cli.md)
302302

@@ -308,7 +308,7 @@ Troubleshooting
308308
If the NativeScript CLI does not behave as expected, you might be facing a configuration issue. For example, a missing `JAVA` path. To check if your system is configured properly for the NativeScript CLI, run the following command.
309309

310310
```bash
311-
tns doctor
311+
ns doctor
312312
```
313313

314314
This command prints warnings about current configuration issues and provides basic information about how to resolve them.
@@ -337,7 +337,7 @@ npm run setup
337337
```
338338

339339
To use the locally built CLI instead `tns` you can call `PATH_TO_CLI_FOLDER/bin/tns`. For example:
340-
`PATH_TO_CLI_FOLDER/bin/tns run ios|android`
340+
`PATH_TO_CLI_FOLDER/bin/ns run ios|android`
341341

342342
[Back to Top][1]
343343

bin/ns

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require("./tns");

bin/nsc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require("./tns");

bin/nsc.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env node
2+
3+
require("./tns");

config/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
"WHOAMI_URL_ENDPOINT": "https://play.nativescript.org/api/whoami",
1111
"PREVIEW_APP_ENVIRONMENT": "live",
1212
"GA_TRACKING_ID": "UA-111455-51"
13-
}
13+
}

docs/man_pages/general/clean.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<% if (isJekyll) { %>---
2+
title: ns clean
3+
position: 24
4+
---<% } %>
5+
6+
# ns clean
7+
8+
### Description
9+
10+
Clean project artifacts.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
General | `$ ns clean`
17+
18+
<% if(isHtml) { %>
19+
20+
### Related Commands
21+
22+
<% } %>

docs/man_pages/general/migrate.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The following dependencies will be updated if needed:
5353
* @angular-devkit/build-angular
5454
* rxjs
5555
* zone.js
56-
* nativescript-unit-test-runner
56+
* @nativescript/unit-test-runner
5757
* karma-webpack
5858
* karma-jasmine
5959
* karma-mocha

docs/man_pages/general/update.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ position: 16
77

88
### Description
99

10-
Updates the project with the latest versions of iOS/Android runtimes, cross-platform modules and "nativescript-dev-webpack".
10+
Updates the project with the latest versions of iOS/Android runtimes, cross-platform modules and "@nativescript/webpack".
1111
In order to get the latest development release instead, pass `next` as argument:
1212
`tns update next`
1313

0 commit comments

Comments
 (0)