Skip to content

feat: Scoped Packages #7911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 60 commits into from
Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
67bf6b4
chore: move tns-core-modules to nativescript-core
Aug 28, 2019
faa240f
chore: preparing compat generate script
Aug 29, 2019
8b6e8e5
chore: add missing definitions
Aug 29, 2019
73887ba
chore: no need for http-request to be private
Aug 29, 2019
73b3bc8
chore: packages chore
Aug 30, 2019
011cefd
test: generate tests for tns-core-modules
Aug 30, 2019
4437b08
chore: add anroid module for consistency
Aug 30, 2019
22caa10
chore: add .npmignore
Aug 30, 2019
48ab584
chore: added privateModulesWhitelist
Aug 30, 2019
23f4729
chore(webpack): added bundle-entry-points
Aug 30, 2019
371809c
chore: scripts
Aug 30, 2019
217782f
chore: tests changed to use @ns/core
Aug 30, 2019
7996702
test: add scoped-packages test project
Sep 9, 2019
b3e0941
test: fix types
Sep 10, 2019
3d9612a
test: update test project
Sep 10, 2019
5a786ef
chore: build scripts
Sep 10, 2019
8bd8f6b
chore: update build script
Sep 11, 2019
7722913
chore: npm scripts cleanup
Sep 11, 2019
6197fd6
chore: make the compat pgk work with old wp config
Sep 11, 2019
7801e22
test: generate diff friendly tests
Sep 11, 2019
4c297b7
chore: create barrel exports
Sep 11, 2019
fc72e8c
chore: move files after rebase
Sep 12, 2019
1d10e85
chore: typedoc config
Sep 19, 2019
4db3250
chore: compat mode
Sep 19, 2019
827cbaf
chore: review of barrels
Sep 19, 2019
09d2029
chore: remove tns-core-modules import after rebase
Sep 27, 2019
ce02b67
chore: dev workflow setup
Oct 1, 2019
935dfa9
chore: update developer-workflow
Oct 2, 2019
108b748
docs: experiment with API extractor
Oct 3, 2019
7443e4f
chore: api-extractor and barrel exports
Oct 4, 2019
7c0f3a8
chore: api-extractor configs
Oct 4, 2019
b518904
chore: generate d.ts rollup with api-extractor
Oct 7, 2019
29fa1f9
refactor: move methods inside Frame
Oct 7, 2019
ba372d4
chore: fic tests to use Frame static methods
Oct 7, 2019
962b8f1
refactor: create Builder class
Oct 7, 2019
8af8d60
refactor: use Builder class in tests
Oct 7, 2019
fb5f5be
refactor: include Style in ui barrel
Oct 7, 2019
d600625
chore: separate compat build script
SvetoslavTsenov Oct 7, 2019
80d23af
chore: update NATIVESCRIPT_CORE_ARGS
SvetoslavTsenov Oct 7, 2019
7b7434b
chore: fix compat pack
SvetoslavTsenov Oct 7, 2019
67b73f1
chore: fix tslint errors
Oct 7, 2019
b632585
chore: fix ui-test-app build with linked modules
Oct 7, 2019
e32c2c3
chore: Application, ApplicationSettings, Connectivity and Http
Oct 8, 2019
5b69c4c
chore: export Trace, Profiling and Utils
Oct 8, 2019
06235a1
refactor: Static create methods for ImageSource
Oct 9, 2019
83a15a0
chore: fix deprecated usages of ImageSource
Oct 9, 2019
ff0a003
chore: move Span and FormattedString to ui
Oct 9, 2019
7a85180
chore: add events-args and ImageSource to index files
Oct 10, 2019
d4059aa
chore: check for CLI >= 6.2 when building for IOS
Oct 11, 2019
cf501d8
chore: update travis build
Oct 11, 2019
0d561f5
chore: copy Pod file to compat package
SvetoslavTsenov Oct 14, 2019
16f05b5
chore: update error msg ui-tests-app
SvetoslavTsenov Oct 14, 2019
3e3314e
refactor: Apply suggestions from code review
Oct 15, 2019
1d413f8
chore: typings and refs
Oct 15, 2019
657aec4
chore: add missing d.ts files for public API
Oct 15, 2019
24fb668
chore: adress code review FB
Oct 16, 2019
1488137
chore: update api-report
Oct 16, 2019
bc4e293
chore: dev-workflow for other apps
Oct 16, 2019
bdb1336
chore: api update
Oct 16, 2019
babb3a7
chore: update api-report
Oct 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 17 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ libs
node_modules
package
platforms
!tns-core-modules/platforms
!nativescript-core/platforms
reports
tags
temp

# Files
package-lock.json
.DS_Store
.nsbuildinfo
tsdoc-metadata.json

# IDEs and editors
/.idea
Expand All @@ -23,6 +25,7 @@ package-lock.json
*.launch
.settings/
.atom
.ctags-exclude

# IDE - VSCode
.vscode/*
Expand Down Expand Up @@ -51,23 +54,20 @@ tscommand*.tmp.txt

# Other
*.js
!tns-core-modules-package/**/*.js
# https://github.com/NativeScript/nativescript-dev-webpack/issues/932
!tns-core-modules/xml/xml.js
!nativescript-core/xml/xml.js
!tests/hooks/**/*.*
!js-libs/**/*.*
!css/**/*.*
!css-value/**/*.*
!fetch/**/*.*
!apps/TelerikNEXT/lib/**/*.*
!build/**/*.*
.vs/

.baseDir.ts
.ctags-exclude
!nativescript-core/js-libs/**/*.*
!nativescript-core/cli-hooks/**/*.*
!nativescript-core/css/**/*.*
nativescript-core/css/parser.js*
nativescript-core/css/system-classes.js*
!nativescript-core/css-value/**/*.*
!nativescript-core/fetch/**/*.*
!nativescript-core/build/**/*.*

TestRunResult.txt
.testsapprun
#generated by api-extractor
nativescript-core/nativescript-core.d.ts

tns-core-modules.base.d.ts
tns-core-modules.d.ts
tns-core-modules.es6.d.ts
.vs/
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ language: node_js
node_js:
- "node"
script:
- npm install
- npm run tslint
- npm run setup
- npm run unit-test

# circular references check
- cd tests && npm i
- node_modules/.bin/webpack --env.android
- node_modules/.bin/webpack --env.ios
# modules transpilation
- cd ../tns-core-modules && npm i && cd ..
- npm install
- npm run tsc
- npm run tslint

114 changes: 70 additions & 44 deletions DevelopmentWorkflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,89 +4,115 @@ Development Workflow
## Project Structure

The repository contains several packages and apps:
- `tns-core-modules` - The core NativeScript TypeScript modules used to develop NativeScript apps
- `tns-core-modules-widgets` - The native widgets (Java and Objective-C) used by the core NativeScript modules
- `e2e/ui-tests-app` - UI app used for manual testing and automation
- `nativescript-core` - The core NativeScript TypeScript modules used to develop NativeScript apps. Produces `@nativescript/core` npm package
- `tns-core-modules-package` - Base for generating the `tns-core-modules` package (compatibility package for projects that still import code from `tns-core-modules`).
- `tns-core-modules-widgets` - The native widgets (Java and Objective-C) used by the core NativeScript modules. Produces `tns-core-modules-widgets` npm package
- `tns-platform-declarations` - TypeScript definitions for Android and iOS native APIs. Produces `tns-platform-declarations` npm package
- `tests` - 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 environment
- `e2e` - applications and *e2e* tests
- `tests` - Unit tests app for the `tns-core-modules`
- `tns-platform-declarations` - TypeScript definitions for Android and iOS native APIs
- `e2e/ui-tests-app` - UI app used for manual testing and automation
- `apps` - legacy apps for testing
- `build` - scripts used for building and infrastructure
- `dist` - 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](./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:
- `tns-platform-declarations`
- `e2e/ui-tests-app` depends on:
- `tns-platform-declarations`
- `tns-core-modules`
- `e2e` depends on:
- `tns-core-modules`
- `tests` depends on:
- `tns-platform-declarations`
- `tns-core-modules`

> NOTE: `tns-core-modules` depends on `tns-core-modules-widgets`,
- `@nativescript/core`
- (devDep)`tns-platform-declarations`

## Initial Setup

Clone (or fork/clone) the repo:
Clone (or fork/clone) the repo and run setup script:

``` bash
git clone https://github.com/NativeScript/NativeScript.git
cd NativeScript
npm run setup
```

Install dependencies:

``` bash
npm install
```

## Running Unit Tests
## Running Unit Tests Application
After the [initial setup](#initial-setup) you can run the tests with:

``` bash
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 UI Test App
## Running the `e2e` Test Apps

The UI test app is an ordinary NativeScript app that logs the test results on the go.
After the [initial setup](#initial-setup) you can run the tests with:
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](#initial-setup) run the e2e apps with:

``` bash
cd e2e/ui-tests-app
cd e2e/<app-name>

# Run the Android app
tns platform add android@next # NOTE: do not commit this change to package.json
tns platform add android@next
tns run android

# Run the iOS app
tns platform add ios@next # NOTE: do not commit this change to package.json
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

1. Open the app, where you will use the module from the repository in the console.
2. Add the `tns-core-modules` in the application via:
```bash
npm install --save <path to tns-core-modules>
# Example: npm install --save ../NativeScript/tns-core-modules
### TypeScript Applications
Link both the `nativescript-core` folders and the generated compatibility package (`dist\tns-core-modules`):
``` bash
npm i <path-to-nativescript-repo>/nativescript-core --save
npm i <path-to-nativescript-repo>/dist/tns-core-modules --save
```
3. Run the app
```bash
tns run ios
tns run android

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):

``` bash
npm run tsc-core-watch
```

---
**NOTE**
### Angular Applications
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.

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.

---
## Building `tns-core-modules-widgets`
You can the following npm script to build and link the `tns-core-modules-widgets` package.
``` bash
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 the `nativescript-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:
Expand Down
Loading