diff --git a/.gitignore b/.gitignore index 9399b9cd3..ca4ea8626 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ node_modules platforms hooks tags +dist **/*.js.map **/*.metadata.json @@ -14,6 +15,15 @@ tags !/nativescript-angular/gulpfile.js !/nativescript-angular/zone-js/dist/*.js +/nativescript-angular-package/**/*.d.ts +/nativescript-angular-package/**/*.js + +!/nativescript-angular-package/global.d.ts +!/nativescript-angular-package/postinstall.js +!/nativescript-angular-package/hooks/**/*.js +!/nativescript-angular-package/gulpfile.js +!/nativescript-angular-package/zone-js/dist/*.js + .tscache .nvm .vscode @@ -46,3 +56,4 @@ tsconfig.tns.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json + diff --git a/build/pack-scripts/pack-compat.ts b/build/pack-scripts/pack-compat.ts new file mode 100644 index 000000000..0667e0e05 --- /dev/null +++ b/build/pack-scripts/pack-compat.ts @@ -0,0 +1,45 @@ +import * as path from "path"; +import * as fs from "fs-extra"; +import { execSync } from "child_process"; + +// var myArgs = process.argv.slice(2); +var scopedVersion = process.argv[2]; +console.log(`Packing nativescript-angular package with @nativescript/angular: ${scopedVersion}`); + +const distFolderPath = path.resolve("../../dist"); +const tempFolderPath = path.resolve("./temp-compat"); +const outFileName = "nativescript-angular-compat.tgz"; + +const nsAngularPackagePath = path.resolve("../../nativescript-angular-package"); +const packageJsonPath = path.resolve(`${nsAngularPackagePath}/package.json`); +console.log("Getting package.json from", packageJsonPath); + +let npmInstallParams = ""; +if (scopedVersion.indexOf(".tgz") > 0) { + // rewrite dependency in package.json + const packageJsonObject = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: "utf8" })); + packageJsonObject.dependencies["@nativescript/angular"] = scopedVersion; + fs.writeFileSync(packageJsonPath, JSON.stringify(packageJsonObject, null, 4)); +} else { + npmInstallParams = `@nativescript/angular@${scopedVersion}`; +} + +execSync(`npm install --save-exact ${npmInstallParams}`, { + cwd: nsAngularPackagePath +}); + +// ensure empty temp and existing dist folders +fs.emptyDirSync(tempFolderPath); +fs.ensureDirSync(distFolderPath); + +// create .tgz in temp folder +execSync(`npm pack ${nsAngularPackagePath}`, { + cwd: tempFolderPath +}); + +// assume we have a single file built in temp folder, take its name +const currentFileName = fs.readdirSync(tempFolderPath)[0]; + +// move built file and remove temp folder +fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true }); +fs.removeSync(`${tempFolderPath}`); diff --git a/build/pack-scripts/pack-scoped.ts b/build/pack-scripts/pack-scoped.ts new file mode 100644 index 000000000..fe72a16a4 --- /dev/null +++ b/build/pack-scripts/pack-scoped.ts @@ -0,0 +1,31 @@ +import * as path from "path"; +import * as fs from "fs-extra"; +import { execSync } from "child_process"; + +console.log(`Packing @nativescript/angular package`); + +const distFolderPath = path.resolve("../../dist"); +const tempFolderPath = path.resolve("./temp-scoped"); +const outFileName = "nativescript-angular-scoped.tgz"; + +const nsAngularPackagePath = path.resolve("../../nativescript-angular"); + +execSync(`npm install --save-exact`, { + cwd: nsAngularPackagePath +}); + +// ensure empty temp and dist folders +fs.emptyDirSync(tempFolderPath); +fs.ensureDirSync(distFolderPath); + +// create .tgz in temp folder +execSync(`npm pack ${nsAngularPackagePath}`, { + cwd: tempFolderPath +}); + +// assume we have a single file built in temp folder, take its name +const currentFileName = fs.readdirSync(tempFolderPath)[0]; + +// move built file and remove temp folder +fs.moveSync(`${tempFolderPath}/${currentFileName}`, `${distFolderPath}/${outFileName}`, { overwrite: true }); +fs.removeSync(`${tempFolderPath}`); diff --git a/build/pack-scripts/package.json b/build/pack-scripts/package.json new file mode 100644 index 000000000..93c081421 --- /dev/null +++ b/build/pack-scripts/package.json @@ -0,0 +1,18 @@ +{ + "name": "build", + "version": "1.0.0", + "description": "", + "main": "prepublish-next.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "@types/node": "^12.7.12", + "fs-extra": "^8.1.0", + "rimraf": "^3.0.0", + "ts-node": "^8.4.1", + "typescript": "^3.6.4" + } +} diff --git a/build/pack-scripts/tsconfig.json b/build/pack-scripts/tsconfig.json new file mode 100644 index 000000000..a250c1c15 --- /dev/null +++ b/build/pack-scripts/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "noEmitHelpers": true, + "noEmitOnError": true, + "lib": [ + "es6", + "dom", + "es2015.iterable" + ], + "types": [ + "node" + ], + "typeRoots": [ "./node_modules/@types" ] + }, + "include": [ + "./**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index 1cece5d65..126f35fa3 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/animation-examples/tsconfig.json b/e2e/animation-examples/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/animation-examples/tsconfig.json +++ b/e2e/animation-examples/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json index 2454a4121..5bd81ea31 100644 --- a/e2e/modal-navigation-ng/package.json +++ b/e2e/modal-navigation-ng/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/modal-navigation-ng/tsconfig.json b/e2e/modal-navigation-ng/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/modal-navigation-ng/tsconfig.json +++ b/e2e/modal-navigation-ng/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json index caef1096f..6e78669c1 100644 --- a/e2e/nested-router-tab-view/package.json +++ b/e2e/nested-router-tab-view/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/nested-router-tab-view/tsconfig.json b/e2e/nested-router-tab-view/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/nested-router-tab-view/tsconfig.json +++ b/e2e/nested-router-tab-view/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json index 16b90f954..4b03e0682 100644 --- a/e2e/renderer/package.json +++ b/e2e/renderer/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/renderer/tsconfig.json b/e2e/renderer/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/renderer/tsconfig.json +++ b/e2e/renderer/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/routable-animations/package.json b/e2e/routable-animations/package.json index 98cd54e14..381f54d74 100644 --- a/e2e/routable-animations/package.json +++ b/e2e/routable-animations/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "next", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/routable-animations/tsconfig.json b/e2e/routable-animations/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/routable-animations/tsconfig.json +++ b/e2e/routable-animations/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/router-tab-view/app/app.component.ts b/e2e/router-tab-view/app/app.component.ts index 7c18980d7..20ccd80c4 100644 --- a/e2e/router-tab-view/app/app.component.ts +++ b/e2e/router-tab-view/app/app.component.ts @@ -1,9 +1,8 @@ -import { Component, OnInit, AfterViewInit, AfterContentInit, ViewChild } from "@angular/core"; +import { Component, ViewChild } from "@angular/core"; import { TabViewDirective } from "nativescript-angular/directives"; import { Router, NavigationEnd } from "@angular/router"; import { NSLocationStrategy } from "nativescript-angular/router/ns-location-strategy"; - @Component({ selector: "ns-app", templateUrl: "app.component.html", diff --git a/e2e/router-tab-view/app/app.module.ts b/e2e/router-tab-view/app/app.module.ts index 7f98a48a2..532eb125e 100644 --- a/e2e/router-tab-view/app/app.module.ts +++ b/e2e/router-tab-view/app/app.module.ts @@ -5,8 +5,7 @@ import { AppComponent } from "./app.component"; import { DataService } from "./data.service"; -import { enable as traceEnable, addCategories } from "tns-core-modules/trace"; -import { routerTraceCategory } from "nativescript-angular/trace"; +import { enable as traceEnable } from "tns-core-modules/trace"; // addCategories(routerTraceCategory); traceEnable(); diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json index 4637596b4..fc1120b74 100644 --- a/e2e/router-tab-view/package.json +++ b/e2e/router-tab-view/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/router-tab-view/tsconfig.json b/e2e/router-tab-view/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/router-tab-view/tsconfig.json +++ b/e2e/router-tab-view/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/router/package.json b/e2e/router/package.json index 65d8c663c..e4e5126aa 100644 --- a/e2e/router/package.json +++ b/e2e/router/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/router/tsconfig.json b/e2e/router/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/router/tsconfig.json +++ b/e2e/router/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/e2e/single-page/app/app.module.ts b/e2e/single-page/app/app.module.ts index d2187c691..4a13ad7fe 100644 --- a/e2e/single-page/app/app.module.ts +++ b/e2e/single-page/app/app.module.ts @@ -1,6 +1,7 @@ import { NgModule, NgModuleFactoryLoader, NO_ERRORS_SCHEMA } from "@angular/core"; import { NativeScriptModule } from "nativescript-angular/nativescript.module"; import { NSModuleFactoryLoader } from "nativescript-angular/router"; + import { isNavigationButton } from "nativescript-angular/directives/action-bar"; import { AppRoutingModule, @@ -9,7 +10,7 @@ import { import { AppComponent } from "./app.component"; -import { rendererTraceCategory, viewUtilCategory, routeReuseStrategyTraceCategory, routerTraceCategory } from "nativescript-angular/trace"; +import { routeReuseStrategyTraceCategory, routerTraceCategory } from "nativescript-angular/trace"; import { setCategories, enable } from "tns-core-modules/trace"; import { ModalComponent } from "./second/modal/modal.component"; setCategories(routerTraceCategory + "," + routeReuseStrategyTraceCategory); diff --git a/e2e/single-page/app/first/first.component.ts b/e2e/single-page/app/first/first.component.ts index 58956ec8f..aaef09a8d 100644 --- a/e2e/single-page/app/first/first.component.ts +++ b/e2e/single-page/app/first/first.component.ts @@ -1,10 +1,6 @@ -import { Component, OnInit, OnDestroy, OnChanges } from "@angular/core"; -import { ActivatedRoute, Router, Route } from "@angular/router"; -import { Location } from "@angular/common"; +import { Component, OnInit, OnDestroy } from "@angular/core"; import { Page } from "tns-core-modules/ui/page"; -import { Observable } from "rxjs"; -import { FrameService } from "nativescript-angular/platform-providers"; @Component({ selector: "first", diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json index 001d8b0a6..a1de11d9a 100644 --- a/e2e/single-page/package.json +++ b/e2e/single-page/package.json @@ -15,7 +15,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../../nativescript-angular", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", diff --git a/e2e/single-page/tsconfig.json b/e2e/single-page/tsconfig.json index d93d819b4..65295d0f2 100644 --- a/e2e/single-page/tsconfig.json +++ b/e2e/single-page/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../../nativescript-angular-package", "../../nativescript-angular", "**/*" ], "exclude": [ + "../../nativescript-angular-package/node_modules", + "../../nativescript-angular-package/**/*.d.ts", "../../nativescript-angular/node_modules", "../../nativescript-angular/**/*.d.ts", "node_modules", diff --git a/nativescript-angular-package/.npmignore b/nativescript-angular-package/.npmignore new file mode 100644 index 000000000..cfeb641a3 --- /dev/null +++ b/nativescript-angular-package/.npmignore @@ -0,0 +1,12 @@ +*.tgz + +*.ts +!*.d.ts + +*.js.map + +tsconfig.json +global.d.ts +.npmignore +gulpfile.js +tslint.json diff --git a/nativescript-angular-package/animations/index.ts b/nativescript-angular-package/animations/index.ts new file mode 100644 index 000000000..3add12158 --- /dev/null +++ b/nativescript-angular-package/animations/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/animations"; \ No newline at end of file diff --git a/nativescript-angular-package/common/index.ts b/nativescript-angular-package/common/index.ts new file mode 100644 index 000000000..c78d3aac7 --- /dev/null +++ b/nativescript-angular-package/common/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/common"; diff --git a/nativescript-angular-package/directives/action-bar.ts b/nativescript-angular-package/directives/action-bar.ts new file mode 100644 index 000000000..5337b967b --- /dev/null +++ b/nativescript-angular-package/directives/action-bar.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/directives/action-bar"; \ No newline at end of file diff --git a/nativescript-angular-package/directives/dialogs.ts b/nativescript-angular-package/directives/dialogs.ts new file mode 100644 index 000000000..f7aa4b95b --- /dev/null +++ b/nativescript-angular-package/directives/dialogs.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/directives/dialogs"; \ No newline at end of file diff --git a/nativescript-angular-package/directives/index.ts b/nativescript-angular-package/directives/index.ts new file mode 100644 index 000000000..d32d1c9a8 --- /dev/null +++ b/nativescript-angular-package/directives/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/directives"; \ No newline at end of file diff --git a/nativescript-angular-package/element-registry.ts b/nativescript-angular-package/element-registry.ts new file mode 100644 index 000000000..46a37d420 --- /dev/null +++ b/nativescript-angular-package/element-registry.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/element-registry"; \ No newline at end of file diff --git a/nativescript-angular-package/file-system/ns-file-system.ts b/nativescript-angular-package/file-system/ns-file-system.ts new file mode 100644 index 000000000..e7b0b52dd --- /dev/null +++ b/nativescript-angular-package/file-system/ns-file-system.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/file-system/ns-file-system"; \ No newline at end of file diff --git a/nativescript-angular-package/forms/index.ts b/nativescript-angular-package/forms/index.ts new file mode 100644 index 000000000..4c8c3c933 --- /dev/null +++ b/nativescript-angular-package/forms/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/forms" \ No newline at end of file diff --git a/nativescript-angular-package/forms/value-accessors/index.ts b/nativescript-angular-package/forms/value-accessors/index.ts new file mode 100644 index 000000000..37a248724 --- /dev/null +++ b/nativescript-angular-package/forms/value-accessors/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/forms/value-accessors"; \ No newline at end of file diff --git a/nativescript-angular-package/http-client/index.ts b/nativescript-angular-package/http-client/index.ts new file mode 100644 index 000000000..939d93e6d --- /dev/null +++ b/nativescript-angular-package/http-client/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/http-client" \ No newline at end of file diff --git a/nativescript-angular-package/index.ts b/nativescript-angular-package/index.ts new file mode 100644 index 000000000..03145e814 --- /dev/null +++ b/nativescript-angular-package/index.ts @@ -0,0 +1,9 @@ +export * from "@nativescript/angular"; +export * from "@nativescript/angular/forms"; +export * from "@nativescript/angular/router"; +export * from "@nativescript/angular/file-system/ns-file-system"; +export * from "@nativescript/angular/modal-dialog"; +export * from "@nativescript/angular/forms/value-accessors/base-value-accessor"; +export * from "@nativescript/angular/trace"; +export * from "@nativescript/angular/renderer"; +export * from "@nativescript/angular/view-util"; diff --git a/nativescript-angular-package/modal-dialog.ts b/nativescript-angular-package/modal-dialog.ts new file mode 100644 index 000000000..9dad19c5e --- /dev/null +++ b/nativescript-angular-package/modal-dialog.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/modal-dialog" \ No newline at end of file diff --git a/nativescript-angular-package/nativescript.module.ts b/nativescript-angular-package/nativescript.module.ts new file mode 100644 index 000000000..fc5956f1c --- /dev/null +++ b/nativescript-angular-package/nativescript.module.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/nativescript.module"; \ No newline at end of file diff --git a/nativescript-angular-package/package.json b/nativescript-angular-package/package.json new file mode 100644 index 000000000..55e8139d2 --- /dev/null +++ b/nativescript-angular-package/package.json @@ -0,0 +1,51 @@ +{ + "name": "nativescript-angular", + "version": "8.3.0", + "description": "An Angular renderer that lets you build mobile apps with NativeScript.", + "homepage": "https://www.nativescript.org/", + "bugs": "https://github.com/NativeScript/nativescript-angular/issues", + "author": { + "name": "NativeScript Team" + }, + "contributors": [ + "Hristo Deshev ", + "Alexander Vakrilov ", + "Stanimira Vlaeva " + ], + "nativescript": { + "platforms": { + "android": "6.0.0", + "ios": "6.0.0" + } + }, + "keywords": [ + "NativeScript", + "Angular" + ], + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "https://github.com/NativeScript/nativescript-angular.git" + }, + "dependencies": { + "@nativescript/angular": "file:../nativescript-angular" + }, + "devDependencies": { + "@angular/animations": "~8.2.0", + "@angular/common": "~8.2.0", + "@angular/compiler": "~8.2.0", + "@angular/compiler-cli": "~8.2.0", + "@angular/core": "~8.2.0", + "@angular/forms": "~8.2.0", + "@angular/platform-browser": "~8.2.0", + "@angular/platform-browser-dynamic": "~8.2.0", + "@angular/router": "~8.2.0", + "rxjs": "^6.4.0", + "tns-core-modules": "next", + "typescript": "~3.5.3" + }, + "scripts": { + "ngc": "ngc -p tsconfig.json", + "pack-with-scoped-version": "npm i && tsc && npm run ngc && cd ../build/pack-scripts && npm i && npx ts-node pack-compat.ts" + } +} diff --git a/nativescript-angular-package/platform-common.ts b/nativescript-angular-package/platform-common.ts new file mode 100644 index 000000000..6d8ac7743 --- /dev/null +++ b/nativescript-angular-package/platform-common.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/platform-common"; \ No newline at end of file diff --git a/nativescript-angular-package/platform-providers.ts b/nativescript-angular-package/platform-providers.ts new file mode 100644 index 000000000..dcc447e8d --- /dev/null +++ b/nativescript-angular-package/platform-providers.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/platform-providers"; \ No newline at end of file diff --git a/nativescript-angular-package/platform-static.ts b/nativescript-angular-package/platform-static.ts new file mode 100644 index 000000000..e63c475ec --- /dev/null +++ b/nativescript-angular-package/platform-static.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/platform-static"; \ No newline at end of file diff --git a/nativescript-angular-package/platform.ts b/nativescript-angular-package/platform.ts new file mode 100644 index 000000000..7e8e49eee --- /dev/null +++ b/nativescript-angular-package/platform.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/platform"; \ No newline at end of file diff --git a/nativescript-angular-package/renderer.ts b/nativescript-angular-package/renderer.ts new file mode 100644 index 000000000..6dd053d7a --- /dev/null +++ b/nativescript-angular-package/renderer.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/renderer"; \ No newline at end of file diff --git a/nativescript-angular-package/resource-loader.ts b/nativescript-angular-package/resource-loader.ts new file mode 100644 index 000000000..e9e2794a8 --- /dev/null +++ b/nativescript-angular-package/resource-loader.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/resource-loader"; \ No newline at end of file diff --git a/nativescript-angular-package/router/index.ts b/nativescript-angular-package/router/index.ts new file mode 100644 index 000000000..0959f3730 --- /dev/null +++ b/nativescript-angular-package/router/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/router"; \ No newline at end of file diff --git a/nativescript-angular-package/router/ns-location-strategy.ts b/nativescript-angular-package/router/ns-location-strategy.ts new file mode 100644 index 000000000..3d94eb407 --- /dev/null +++ b/nativescript-angular-package/router/ns-location-strategy.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/router/ns-location-strategy"; \ No newline at end of file diff --git a/nativescript-angular-package/router/ns-route-reuse-strategy.ts b/nativescript-angular-package/router/ns-route-reuse-strategy.ts new file mode 100644 index 000000000..fa6306cfc --- /dev/null +++ b/nativescript-angular-package/router/ns-route-reuse-strategy.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/router/ns-route-reuse-strategy"; \ No newline at end of file diff --git a/nativescript-angular-package/router/ns-router-link.ts b/nativescript-angular-package/router/ns-router-link.ts new file mode 100644 index 000000000..fa87694d9 --- /dev/null +++ b/nativescript-angular-package/router/ns-router-link.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/router/ns-router-link"; \ No newline at end of file diff --git a/nativescript-angular-package/router/page-router-outlet.ts b/nativescript-angular-package/router/page-router-outlet.ts new file mode 100644 index 000000000..f181cf615 --- /dev/null +++ b/nativescript-angular-package/router/page-router-outlet.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/router/page-router-outlet"; \ No newline at end of file diff --git a/nativescript-angular-package/router/router.module.ts b/nativescript-angular-package/router/router.module.ts new file mode 100644 index 000000000..1c7b8ed2b --- /dev/null +++ b/nativescript-angular-package/router/router.module.ts @@ -0,0 +1,2 @@ +export { LocationState } from "@nativescript/angular/router/ns-location-strategy"; +export * from "@nativescript/angular/router/router.module"; \ No newline at end of file diff --git a/nativescript-angular-package/testing/index.ts b/nativescript-angular-package/testing/index.ts new file mode 100644 index 000000000..3939f9dd3 --- /dev/null +++ b/nativescript-angular-package/testing/index.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/testing" \ No newline at end of file diff --git a/nativescript-angular-package/testing/src/nativescript_test_component_renderer.ts b/nativescript-angular-package/testing/src/nativescript_test_component_renderer.ts new file mode 100644 index 000000000..f06c592a4 --- /dev/null +++ b/nativescript-angular-package/testing/src/nativescript_test_component_renderer.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/testing/src/nativescript_test_component_renderer"; \ No newline at end of file diff --git a/nativescript-angular-package/testing/src/util.ts b/nativescript-angular-package/testing/src/util.ts new file mode 100644 index 000000000..42234d6e5 --- /dev/null +++ b/nativescript-angular-package/testing/src/util.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/testing/src/util"; diff --git a/nativescript-angular-package/trace.ts b/nativescript-angular-package/trace.ts new file mode 100644 index 000000000..87044475c --- /dev/null +++ b/nativescript-angular-package/trace.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/trace"; \ No newline at end of file diff --git a/nativescript-angular-package/tsconfig.json b/nativescript-angular-package/tsconfig.json new file mode 100644 index 000000000..b128b871a --- /dev/null +++ b/nativescript-angular-package/tsconfig.json @@ -0,0 +1,34 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "noImplicitUseStrict": true, + "noEmitHelpers": true, + "declaration": true, + "removeComments": false, + "noEmitOnError": true, + "noImplicitAny": false, + "lib": [ + "dom", + "es6", + "es2015.iterable" + ], + "baseUrl": "." + }, + "angularCompilerOptions": { + "genDir": ".", + "skipMetadataEmit": false, + "skipTemplateCodegen": true, + "strictMetadataEmit": true + }, + "include": [ + "**/*.ts" + ], + "exclude":[ + "node_modules/*" + ] +} diff --git a/nativescript-angular-package/value-accessors/base-value-accessor.ts b/nativescript-angular-package/value-accessors/base-value-accessor.ts new file mode 100644 index 000000000..7c5fd2186 --- /dev/null +++ b/nativescript-angular-package/value-accessors/base-value-accessor.ts @@ -0,0 +1,3 @@ +// This file is only for compatibility with pre 4.4.0 releases. +// Please use "nativescript-angular/forms/value-accessors/base-value-accessor" +export * from "@nativescript/angular/forms/value-accessors/base-value-accessor"; diff --git a/nativescript-angular-package/view-util.ts b/nativescript-angular-package/view-util.ts new file mode 100644 index 000000000..53ecbb10e --- /dev/null +++ b/nativescript-angular-package/view-util.ts @@ -0,0 +1 @@ +export * from "@nativescript/angular/view-util"; \ No newline at end of file diff --git a/nativescript-angular/zone-js/README.md b/nativescript-angular-package/zone-js/README.md similarity index 100% rename from nativescript-angular/zone-js/README.md rename to nativescript-angular-package/zone-js/README.md diff --git a/nativescript-angular-package/zone-js/testing.jasmine.ts b/nativescript-angular-package/zone-js/testing.jasmine.ts new file mode 100644 index 000000000..0d852527d --- /dev/null +++ b/nativescript-angular-package/zone-js/testing.jasmine.ts @@ -0,0 +1,3 @@ +// Bootstrap helper module for jasmine spec tests +import "@nativescript/angular/platform"; +import "@nativescript/angular/dist/zone-nativescript.jasmine.js"; diff --git a/nativescript-angular-package/zone-js/testing.mocha.ts b/nativescript-angular-package/zone-js/testing.mocha.ts new file mode 100644 index 000000000..f8ec59c8a --- /dev/null +++ b/nativescript-angular-package/zone-js/testing.mocha.ts @@ -0,0 +1,2 @@ +import "@nativescript/angular/platform"; +import "@nativescript/angular/zone-js/dist/zone-nativescript.mocha.js"; diff --git a/nativescript-angular/animations/index.ts b/nativescript-angular/animations/index.ts index d5754740b..2b54a81e9 100644 --- a/nativescript-angular/animations/index.ts +++ b/nativescript-angular/animations/index.ts @@ -1 +1,4 @@ export * from "./animations.module"; +export * from "./animation-player"; +export * from "./animation-driver"; +export * from "./utils"; diff --git a/nativescript-angular/common.ts b/nativescript-angular/common.ts index c6b119eef..f148d787e 100644 --- a/nativescript-angular/common.ts +++ b/nativescript-angular/common.ts @@ -38,3 +38,5 @@ import { NS_DIRECTIVES } from "./directives"; }) export class NativeScriptCommonModule { } + +export * from "./directives"; diff --git a/nativescript-angular/directives/index.ts b/nativescript-angular/directives/index.ts index 6b68054e3..57efac10f 100644 --- a/nativescript-angular/directives/index.ts +++ b/nativescript-angular/directives/index.ts @@ -1,5 +1,5 @@ import { ListViewComponent } from "./list-view-comp"; -import { TemplateKeyDirective } from "./templated-items-comp"; +import { TemplateKeyDirective, SetupItemViewArgs } from "./templated-items-comp"; import { TabViewDirective, TabViewItemDirective } from "./tab-view"; import { ActionBarComponent, @@ -8,22 +8,25 @@ import { NavigationButtonDirective } from "./action-bar"; import { AndroidFilterComponent, IosFilterComponent } from "./platform-filters"; +import { ModalDialogHost, ModalDialogOptions, ModalDialogParams, ModalDialogService } from "./dialogs"; -export { ListViewComponent } from "./list-view-comp"; -export { SetupItemViewArgs, TemplateKeyDirective } from "./templated-items-comp"; - -export { TabViewDirective, TabViewItemDirective } from "./tab-view"; -export { +export const NS_DIRECTIVES = [ + ListViewComponent, + TemplateKeyDirective, + TabViewDirective, + TabViewItemDirective, ActionBarComponent, ActionBarScope, ActionItemDirective, - NavigationButtonDirective -} from "./action-bar"; -export { AndroidFilterComponent, IosFilterComponent } from "./platform-filters"; + NavigationButtonDirective, + AndroidFilterComponent, + IosFilterComponent, +]; -export const NS_DIRECTIVES = [ +export { ListViewComponent, TemplateKeyDirective, + SetupItemViewArgs, TabViewDirective, TabViewItemDirective, ActionBarComponent, @@ -32,4 +35,8 @@ export const NS_DIRECTIVES = [ NavigationButtonDirective, AndroidFilterComponent, IosFilterComponent, -]; + ModalDialogHost, + ModalDialogOptions, + ModalDialogParams, + ModalDialogService +}; diff --git a/nativescript-angular/file-system/index.ts b/nativescript-angular/file-system/index.ts new file mode 100644 index 000000000..e0e3dc687 --- /dev/null +++ b/nativescript-angular/file-system/index.ts @@ -0,0 +1 @@ +export * from "./ns-file-system"; diff --git a/nativescript-angular/forms/forms.module.ts b/nativescript-angular/forms/forms.module.ts index 814b08727..50511eafc 100644 --- a/nativescript-angular/forms/forms.module.ts +++ b/nativescript-angular/forms/forms.module.ts @@ -18,6 +18,15 @@ export const FORMS_DIRECTIVES = [ NumberValueAccessor, ]; +export { + TextValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + SelectedIndexValueAccessor, + NumberValueAccessor +}; + @NgModule({ declarations: FORMS_DIRECTIVES, providers: [ diff --git a/nativescript-angular/hooks/before-livesync.js b/nativescript-angular/hooks/before-livesync.js deleted file mode 100644 index 9642f1c12..000000000 --- a/nativescript-angular/hooks/before-livesync.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function ($usbLiveSyncService) { - $usbLiveSyncService.forceExecuteFullSync = false; -}; diff --git a/nativescript-angular/hooks/hook-helper.js b/nativescript-angular/hooks/hook-helper.js deleted file mode 100644 index 3a23ae688..000000000 --- a/nativescript-angular/hooks/hook-helper.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -var fs = require("fs"); -var path = require("path"); - -exports.findProjectDir = function findProjectDir() { - var candidateDir = path.join(__dirname, ".."); - while (true) { - var oldCandidateDir = candidateDir; - candidateDir = path.dirname(candidateDir); - if (path.basename(candidateDir) === 'node_modules') { - continue; - } - var packageJsonFile = path.join(candidateDir, 'package.json'); - if (fs.existsSync(packageJsonFile)) { - return candidateDir; - } - if (oldCandidateDir === candidateDir) { - return; - } - } -}; - -exports.getHooksDir = function getHooksDir() { - return path.join(exports.findProjectDir(), 'hooks'); -}; - -exports.getBeforeLivesyncHookDir = function getBeforeLivesyncHookDir() { - return path.join(exports.getHooksDir(), "before-livesync"); -}; - -exports.getHookFilePath = function getHookFilePath() { - return path.join(exports.getBeforeLivesyncHookDir(), "nativescript-angular-sync.js"); -}; diff --git a/nativescript-angular/http-client/http-client.module.ts b/nativescript-angular/http-client/http-client.module.ts index ea6623d5b..59d55a05a 100644 --- a/nativescript-angular/http-client/http-client.module.ts +++ b/nativescript-angular/http-client/http-client.module.ts @@ -1,10 +1,6 @@ import { NgModule } from "@angular/core"; -// IMPORTant: Importing "@angular/common/http" for the first time overwrites the -// global.__extends function. -const cachedExtends = global.__extends; import { HttpClientModule, HttpBackend } from "@angular/common/http"; -global.__extends = cachedExtends; import { NSFileSystem } from "../file-system/ns-file-system"; import { NsHttpBackEnd } from "./ns-http-backend"; diff --git a/nativescript-angular/index.ts b/nativescript-angular/index.ts index db3cb4279..a9b23ecfd 100644 --- a/nativescript-angular/index.ts +++ b/nativescript-angular/index.ts @@ -3,18 +3,17 @@ import "tns-core-modules/application"; export * from "./platform-common"; export * from "./platform"; export * from "./platform-static"; -export * from "./router"; -export * from "./forms"; -export * from "./directives"; -export * from "./common/detached-loader"; -export * from "./trace"; export * from "./platform-providers"; -export * from "./file-system/ns-file-system"; -export * from "./modal-dialog"; -export * from "./renderer"; -export * from "./view-util"; export * from "./resource-loader"; +export * from "./nativescript.module"; +export * from "./common"; + +export * from "./router"; +export * from "./file-system"; +export * from "./http-client"; +export * from "./forms"; + export { ViewClass, ViewClassMeta, @@ -24,5 +23,3 @@ export { isKnownView, registerElement, } from "./element-registry"; - -export * from "./forms/value-accessors/base-value-accessor"; diff --git a/nativescript-angular/nativescript.module.ts b/nativescript-angular/nativescript.module.ts index 439c20b9d..8a4da1ef6 100644 --- a/nativescript-angular/nativescript.module.ts +++ b/nativescript-angular/nativescript.module.ts @@ -33,6 +33,8 @@ export function errorHandlerFactory() { return new ErrorHandler(); } +export { DetachedLoader }; + @NgModule({ declarations: [ DetachedLoader, diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index bd93bb37c..ccbec7234 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,5 +1,5 @@ { - "name": "nativescript-angular", + "name": "@nativescript/angular", "version": "8.3.0", "description": "An Angular renderer that lets you build mobile apps with NativeScript.", "homepage": "https://www.nativescript.org/", @@ -29,11 +29,11 @@ }, "scripts": { "tslint": "tslint --project tsconfig.json --config tslint.json", - "postinstall": "node postinstall.js", "tsc": "tsc -p tsconfig.json", "tsc-w": "tsc -p tsconfig.json -w", "ngc": "ngc -p tsconfig.json", "prepare": "npm run ngc", + "pack": "npm i && tsc && cd ../build/pack-scripts && npm i && npx ts-node pack-scoped.ts", "version": "rm -rf package-lock.json && conventional-changelog -p angular -i ../CHANGELOG.md -s && git add ../CHANGELOG.md", "typedoc": "typedoc --tsconfig \"./tsconfig.typedoc.json\" --out ./bin/dist/ng-api-reference --includeDeclarations --name \"NativeScript Angular\" --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module|declarations).d.ts\"" }, diff --git a/nativescript-angular/postinstall.js b/nativescript-angular/postinstall.js deleted file mode 100644 index c0eb367da..000000000 --- a/nativescript-angular/postinstall.js +++ /dev/null @@ -1,17 +0,0 @@ -var fs = require("fs"); -var os = require("os"); -var hookHelper = require("./hooks/hook-helper"); -var projectDir = hookHelper.findProjectDir(); - -if (projectDir) { - var hooksDir = hookHelper.getHooksDir(), - beforeLivesyncHookDir = hookHelper.getBeforeLivesyncHookDir(), - content = 'module.exports = require("nativescript-angular/hooks/before-livesync");'; - if (!fs.existsSync(hooksDir)) { - fs.mkdirSync(hooksDir); - } - if (!fs.existsSync(beforeLivesyncHookDir)) { - fs.mkdirSync(beforeLivesyncHookDir); - } - fs.writeFileSync(hookHelper.getHookFilePath(), content + os.EOL); -} diff --git a/nativescript-angular/router/router.module.ts b/nativescript-angular/router/router.module.ts index 5246eeea0..1c8095c09 100644 --- a/nativescript-angular/router/router.module.ts +++ b/nativescript-angular/router/router.module.ts @@ -4,7 +4,7 @@ import { LocationStrategy, PlatformLocation } from "@angular/common"; import { NSRouterLink } from "./ns-router-link"; import { NSRouterLinkActive } from "./ns-router-link-active"; import { PageRouterOutlet } from "./page-router-outlet"; -import { NSLocationStrategy, LocationState } from "./ns-location-strategy"; +import { NSLocationStrategy } from "./ns-location-strategy"; import { NativescriptPlatformLocation } from "./ns-platform-location"; import { NSRouteReuseStrategy } from "./ns-route-reuse-strategy"; import { RouterExtensions } from "./router-extensions"; @@ -15,9 +15,8 @@ import { NSEmptyOutletComponent } from "./ns-empty-outlet.component"; export { PageRoute } from "./page-router-outlet"; export { RouterExtensions } from "./router-extensions"; export { NSModuleFactoryLoader } from "./ns-module-factory-loader"; -export { NSEmptyOutletComponent } from "./ns-empty-outlet.component"; -export type LocationState = LocationState; +export { NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent, NSLocationStrategy }; const ROUTER_DIRECTIVES = [NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent]; diff --git a/nativescript-angular/tsconfig.json b/nativescript-angular/tsconfig.json index e8a09f283..79e3addf9 100644 --- a/nativescript-angular/tsconfig.json +++ b/nativescript-angular/tsconfig.json @@ -13,15 +13,19 @@ "noEmitOnError": true, "noImplicitAny": false, "lib": [ - "dom", - "es6", - "es2015.iterable" - ] + "dom", + "es6", + "es2015.iterable" + ], + "baseUrl": "." }, "angularCompilerOptions": { "genDir": ".", "skipMetadataEmit": false, "skipTemplateCodegen": true, "strictMetadataEmit": true - } -} + }, + "include": [ + "**/*.ts" + ] +} \ No newline at end of file diff --git a/ng-sample/package.json b/ng-sample/package.json index 8dbf3d5ae..1b0326ecc 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -34,7 +34,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "file:../nativescript-angular", + "nativescript-angular": "file:../nativescript-angular-package", "rxjs": "^6.4.0", "tns-core-modules": "next", "tns-platform-declarations": "next", diff --git a/ng-sample/tsconfig.json b/ng-sample/tsconfig.json index b73d56d49..4f7b6304b 100644 --- a/ng-sample/tsconfig.json +++ b/ng-sample/tsconfig.json @@ -28,10 +28,13 @@ }, "include": [ "../nativescript-angular", + "../nativescript-angular-package", "**/*" ], "exclude": [ + "../nativescript-angular-package/node_modules", "../nativescript-angular/node_modules", + "../nativescript-angular-package/**/*.d.ts", "../nativescript-angular/**/*.d.ts", "node_modules", "platforms" diff --git a/tests/app/tests/renderer-tests.ts b/tests/app/tests/renderer-tests.ts index 49c59ff2a..2f74a07a5 100644 --- a/tests/app/tests/renderer-tests.ts +++ b/tests/app/tests/renderer-tests.ts @@ -82,7 +82,7 @@ export class StyledLabelCmp { styles: [ `Label { color: red; }`, ` - StackLayout { color: brick; } + StackLayout { color: brown; } TextField { color: red; background-color: lime; } `, ], diff --git a/tests/package.json b/tests/package.json index 55bd35ee1..38882a76f 100644 --- a/tests/package.json +++ b/tests/package.json @@ -27,7 +27,7 @@ "@angular/platform-browser": "~8.2.0", "@angular/platform-browser-dynamic": "~8.2.0", "@angular/router": "~8.2.0", - "nativescript-angular": "../nativescript-angular", + "nativescript-angular": "../nativescript-angular-package", "nativescript-unit-test-runner": "0.7.0", "rxjs": "^6.4.0", "tns-core-modules": "next", diff --git a/tests/tsconfig.json b/tests/tsconfig.json index d24fffdf3..730d1b343 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -23,10 +23,13 @@ } }, "include": [ + "../nativescript-angular-package", "../nativescript-angular", "**/*" ], "exclude": [ + "../nativescript-angular-package/node_modules", + "../nativescript-angular-package/**/*.d.ts", "../nativescript-angular/node_modules", "../nativescript-angular/**/*.d.ts", "node_modules",