You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DevelopmentWorkflow.md
+70-44Lines changed: 70 additions & 44 deletions
Original file line number
Diff line number
Diff line change
@@ -4,89 +4,115 @@ Development Workflow
4
4
## Project Structure
5
5
6
6
The repository contains several packages and apps:
7
-
-`tns-core-modules` - The core NativeScript TypeScript modules used to develop NativeScript apps
8
-
-`tns-core-modules-widgets` - The native widgets (Java and Objective-C) used by the core NativeScript modules
9
-
-`e2e/ui-tests-app` - UI app used for manual testing and automation
7
+
-`nativescript-core` - The core NativeScript TypeScript modules used to develop NativeScript apps. Produces `@nativescript/core` npm package
8
+
-`tns-core-modules-package` - Base for generating the `tns-core-modules` package (compatibility package for projects that still import code from `tns-core-modules`).
9
+
-`tns-core-modules-widgets` - The native widgets (Java and Objective-C) used by the core NativeScript modules. Produces `tns-core-modules-widgets` npm package
10
+
-`tns-platform-declarations` - TypeScript definitions for Android and iOS native APIs. Produces `tns-platform-declarations` npm package
11
+
-`tests` - Unit tests app for the `@nativescript/core` package. These test are executed as nativescript application on mobile device or emulator.
12
+
-`unit-test` - Node unit tests. These test validate parts of the framework that do not require the nativescript runtime and so can be executed in node environment
10
13
-`e2e` - applications and *e2e* tests
11
-
-`tests` - Unit tests app for the `tns-core-modules`
12
-
-`tns-platform-declarations` - TypeScript definitions for Android and iOS native APIs
14
+
-`e2e/ui-tests-app` - UI app used for manual testing and automation
15
+
-`apps` - legacy apps for testing
16
+
-`build` - scripts used for building and infrastructure
17
+
-`dist` - construction site for packing npm modules
13
18
14
19
Working with the repo is organized with npm scripts,
15
20
go and read through the `scripts` section in the [package.json](./package.json).
16
21
17
22
Managing dependencies:
23
+
-`tns-core-modules-widgets` depends on:
24
+
- no deps
25
+
-`@nativescript/core` depends on:
26
+
-`tns-core-modules-widgets`
27
+
- (devDep)`tns-platform-declarations`
18
28
-`tns-core-modules` depends on:
19
-
-`tns-platform-declarations`
20
-
-`e2e/ui-tests-app` depends on:
21
-
-`tns-platform-declarations`
22
-
-`tns-core-modules`
23
-
-`e2e` depends on:
24
-
-`tns-core-modules`
25
-
-`tests` depends on:
26
-
-`tns-platform-declarations`
27
-
-`tns-core-modules`
28
-
29
-
> NOTE: `tns-core-modules` depends on `tns-core-modules-widgets`,
29
+
-`@nativescript/core`
30
+
- (devDep)`tns-platform-declarations`
30
31
31
32
## Initial Setup
32
33
33
-
Clone (or fork/clone) the repo:
34
+
Clone (or fork/clone) the repo and run setup script:
Link both the `nativescript-core` folders and the generated compatibility package (`dist\tns-core-modules`):
78
+
```bash
79
+
npm i <path-to-nativescript-repo>/nativescript-core --save
80
+
npm i <path-to-nativescript-repo>/dist/tns-core-modules --save
77
81
```
78
-
3. Run the app
79
-
```bash
80
-
tns run ios
81
-
tns run android
82
+
83
+
You can do changes in the app code and `nativescript-core` and rely on HMR to refresh the app.
84
+
85
+
### JavaScript Applications
86
+
Use the same steps as with TS application. However, the configuration of JS application does not include loading and transpiling TS code. You need to transpile the TS code in `nativescript-core` yourself. The following npm script will run tsc in watch mode in `nativescript-core` (run it in a separate terminal so that you can do `tns run` in parallel):
87
+
88
+
```bash
89
+
npm run tsc-core-watch
82
90
```
83
91
84
-
---
85
-
**NOTE**
92
+
### Angular Applications
93
+
Linking `tns-core-modules` and `@nativescript/core` in **Angular applications** does not work at the moment. Check [#7905](https://github.com/NativeScript/NativeScript/issues/7905) for more details on the issue.
86
94
87
-
Linking `tns-core-modules` in Angular app does not work at the moment. Check [#7905](https://github.com/NativeScript/NativeScript/issues/7905) for more details on the issue.
88
95
89
-
---
96
+
## Building `tns-core-modules-widgets`
97
+
You can the following npm script to build and link the `tns-core-modules-widgets` package.
98
+
```bash
99
+
npm run setup-widgets
100
+
```
101
+
102
+
This script will build the `tns-core-modules-widgets` package and link it inside the `nativescript-core` so it will be used for running the tests and e2e apps.
103
+
104
+
>Note: NOTE: do not commit changes in the `tns-core-modules-widgets` dependency in the `nativescript-core/package.json`
105
+
106
+
## Running Node Unit Tests
107
+
Run node unit tests with:
108
+
```
109
+
npm run unit-test
110
+
```
111
+
or run tests in watch mode:
112
+
113
+
```
114
+
npm run unit-test-watch
115
+
```
90
116
91
117
## Platform declarations
92
118
To update the platform declarations (the ios.d.ts-es) you can run:
0 commit comments