
* chore: move tns-core-modules to nativescript-core * chore: preparing compat generate script * chore: add missing definitions * chore: no need for http-request to be private * chore: packages chore * test: generate tests for tns-core-modules * chore: add anroid module for consistency * chore: add .npmignore * chore: added privateModulesWhitelist * chore(webpack): added bundle-entry-points * chore: scripts * chore: tests changed to use @ns/core * test: add scoped-packages test project * test: fix types * test: update test project * chore: build scripts * chore: update build script * chore: npm scripts cleanup * chore: make the compat pgk work with old wp config * test: generate diff friendly tests * chore: create barrel exports * chore: move files after rebase * chore: typedoc config * chore: compat mode * chore: review of barrels * chore: remove tns-core-modules import after rebase * chore: dev workflow setup * chore: update developer-workflow * docs: experiment with API extractor * chore: api-extractor and barrel exports * chore: api-extractor configs * chore: generate d.ts rollup with api-extractor * refactor: move methods inside Frame * chore: fic tests to use Frame static methods * refactor: create Builder class * refactor: use Builder class in tests * refactor: include Style in ui barrel * chore: separate compat build script * chore: fix tslint errors * chore: update NATIVESCRIPT_CORE_ARGS * chore: fix compat pack * chore: fix ui-test-app build with linked modules * chore: Application, ApplicationSettings, Connectivity and Http * chore: export Trace, Profiling and Utils * refactor: Static create methods for ImageSource * chore: fix deprecated usages of ImageSource * chore: move Span and FormattedString to ui * chore: add events-args and ImageSource to index files * chore: check for CLI >= 6.2 when building for IOS * chore: update travis build * chore: copy Pod file to compat package * chore: update error msg ui-tests-app * refactor: Apply suggestions from code review Co-Authored-By: Martin Yankov <m.i.yankov@gmail.com> * chore: typings and refs * chore: add missing d.ts files for public API * chore: adress code review FB * chore: update api-report * chore: dev-workflow for other apps * chore: api update * chore: update api-report
4.9 KiB
Development Workflow
Project Structure
The repository contains several packages and apps:
nativescript-core
- The core NativeScript TypeScript modules used to develop NativeScript apps. Produces@nativescript/core
npm packagetns-core-modules-package
- Base for generating thetns-core-modules
package (compatibility package for projects that still import code fromtns-core-modules
).tns-core-modules-widgets
- The native widgets (Java and Objective-C) used by the core NativeScript modules. Producestns-core-modules-widgets
npm packagetns-platform-declarations
- TypeScript definitions for Android and iOS native APIs. Producestns-platform-declarations
npm packagetests
- Unit tests app for the@nativescript/core
package. These test are executed as nativescript application on mobile device or emulator.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 environmente2e
- applications and e2e testse2e/ui-tests-app
- UI app used for manual testing and automationapps
- legacy apps for testingbuild
- scripts used for building and infrastructuredist
- construction site for packing npm modules
Working with the repo is organized with npm scripts,
go and read through the scripts
section in the package.json.
Managing dependencies:
tns-core-modules-widgets
depends on:- no deps
@nativescript/core
depends on:tns-core-modules-widgets
- (devDep)
tns-platform-declarations
tns-core-modules
depends on:@nativescript/core
- (devDep)
tns-platform-declarations
Initial Setup
Clone (or fork/clone) the repo and run setup script:
git clone https://github.com/NativeScript/NativeScript.git
cd NativeScript
npm run setup
Running Unit Tests Application
After the initial setup you can run the tests with:
cd tests
tns run android | ios
You can do changes in the test app and nativescript-core
and rely on HMR to re-run tests.
Running the e2e
Test Apps
There are couple of application used for development and testing.
The ui-test-app
is the more frequently used for development and validation. It is an ordinary NativeScript app that logs the test results on the go.
After the initial setup run the e2e apps with:
cd e2e/<app-name>
# Run the Android app
tns platform add android@next
tns run android
# Run the iOS app
tns platform add ios@next
tns run ios
Note: NOTE: do not commit changes in the runtime versions to
e2e/<app-name>/package.json
Running Another App
TypeScript Applications
Link both the nativescript-core
folders and the generated compatibility package (dist\tns-core-modules
):
npm i <path-to-nativescript-repo>/nativescript-core --save
npm i <path-to-nativescript-repo>/dist/tns-core-modules --save
You can do changes in the app code and nativescript-core
and rely on HMR to refresh the app.
JavaScript Applications
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):
npm run tsc-core-watch
Angular Applications
Linking tns-core-modules
and @nativescript/core
in Angular applications does not work at the moment. Check #7905 for more details on the issue.
Building tns-core-modules-widgets
You can the following npm script to build and link the tns-core-modules-widgets
package.
npm run setup-widgets
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.
Note: NOTE: do not commit changes in the
tns-core-modules-widgets
dependency in thenativescript-core/package.json
Running Node Unit Tests
Run node unit tests with:
npm run unit-test
or run tests in watch mode:
npm run unit-test-watch
Platform declarations
To update the platform declarations (the ios.d.ts-es) you can run:
npm install
npm run dev-declarations
This script will update the iOS declarations. Android tools are not integrated yet. The declarations are generated from the test app and will include the native code from tns-core-modules-widgets.
Documentation API reference
The following will build the API reference pages in bin/dist/apiref
:
npm run typedoc
If you want to improve on the documentation you can also build and start up dev web server:
npm run dev-typedoc
The terminal will point the address you can open in your web browser.