Skip to content

chore: add scoped package #2014

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 25 commits into from
Oct 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ed16c12
initial commit
tbozhikov Oct 7, 2019
2ca7acd
save progress
tbozhikov Oct 7, 2019
55da9f3
chore: make most of e2e apps work with the revamped older package
tbozhikov Oct 8, 2019
1d640af
fix: single-page test app
tbozhikov Oct 8, 2019
1090095
fix: revert changes to modal navigation e2e
tbozhikov Oct 9, 2019
10b9253
chore: reorganise exports
tbozhikov Oct 9, 2019
f519624
chore: remove comment
tbozhikov Oct 10, 2019
f725a6e
fix: unit tests after refactoring
tbozhikov Oct 10, 2019
fdad1c9
chore: first bits of a pack script for non-scoped dependency
tbozhikov Oct 10, 2019
1cb22db
chore: pack script for compat package
tbozhikov Oct 11, 2019
d975201
chore: rename out tgz file to nativescript-angular-compat.tgz
tbozhikov Oct 11, 2019
1ca8279
fix: comments
tbozhikov Oct 11, 2019
398fbe0
chore: remove unused npm script
tbozhikov Oct 14, 2019
2595456
chore: add pack script in scoped pckg
tbozhikov Oct 14, 2019
5c7f25f
fix: ensure dist
tbozhikov Oct 14, 2019
a492023
chore: build scoped package through nodejs script
tbozhikov Oct 14, 2019
e9e9327
chore: update build scripts, fix jenkins build
tbozhikov Oct 15, 2019
63872d8
fix: try to fix error in jenkins
tbozhikov Oct 15, 2019
faede8a
fix: remove bin prop from compat so that npm flattens scoped deps in …
tbozhikov Oct 17, 2019
ddefe0e
cleanup: wrongly committed files
tbozhikov Oct 17, 2019
8174558
fix: revert tns-ios and tns-android versions in package jsons
tbozhikov Oct 17, 2019
0a25c40
chore: export most types from root scope of the scoped package
tbozhikov Oct 17, 2019
916bc85
chore: add platform common exports in compat, clean ups
tbozhikov Oct 17, 2019
cb0292f
fix: update compat build script to work correctly with save-exact
tbozhikov Oct 21, 2019
f82e9aa
fix: potential breaking change
tbozhikov Oct 21, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ node_modules
platforms
hooks
tags
dist
**/*.js.map
**/*.metadata.json

Expand All @@ -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
Expand Down Expand Up @@ -46,3 +56,4 @@ tsconfig.tns.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

45 changes: 45 additions & 0 deletions build/pack-scripts/pack-compat.ts
Original file line number Diff line number Diff line change
@@ -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}`);
31 changes: 31 additions & 0 deletions build/pack-scripts/pack-scoped.ts
Original file line number Diff line number Diff line change
@@ -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}`);
18 changes: 18 additions & 0 deletions build/pack-scripts/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
25 changes: 25 additions & 0 deletions build/pack-scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
2 changes: 1 addition & 1 deletion e2e/animation-examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/animation-examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/modal-navigation-ng/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/modal-navigation-ng/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/nested-router-tab-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/nested-router-tab-view/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/renderer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/routable-animations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/routable-animations/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions e2e/router-tab-view/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 1 addition & 2 deletions e2e/router-tab-view/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion e2e/router-tab-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/router-tab-view/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/router/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion e2e/single-page/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions e2e/single-page/app/first/first.component.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion e2e/single-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions e2e/single-page/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions nativescript-angular-package/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.tgz

*.ts
!*.d.ts

*.js.map

tsconfig.json
global.d.ts
.npmignore
gulpfile.js
tslint.json
Loading