Skip to content

Commit fa66f41

Browse files
committed
chore: tooling
1 parent ca53755 commit fa66f41

File tree

6 files changed

+82
-47
lines changed

6 files changed

+82
-47
lines changed

apps/demo-angular/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
"reflect-metadata": "file:../../node_modules/reflect-metadata",
1616
"rxjs": "file:../../node_modules/rxjs",
1717
"zone.js": "file:../../node_modules/zone.js",
18-
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
19-
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
2018
"@nativescript/camera": "file:../../dist/packages/camera",
19+
"@nativescript/appavailability": "file:../../dist/packages/appavailability",
2120
"@nativescript/datetimepicker": "file:../../dist/packages/datetimepicker",
2221
"@nativescript/directions": "file:../../dist/packages/directions",
2322
"@nativescript/email": "file:../../dist/packages/email",
2423
"@nativescript/fingerprint-auth": "file:../../dist/packages/fingerprint-auth",
2524
"@nativescript/geolocation": "file:../../dist/packages/geolocation",
25+
"@nativescript/imagepicker": "file:../../dist/packages/imagepicker",
2626
"@nativescript/iqkeyboardmanager": "file:../../dist/packages/iqkeyboardmanager",
2727
"@nativescript/local-notifications": "file:../../dist/packages/local-notifications",
2828
"@nativescript/shared-notification-delegate": "file:../../dist/packages/shared-notification-delegate",
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1-
import { NgModule } from "@angular/core";
2-
import { Routes } from "@angular/router";
3-
import { NativeScriptRouterModule } from "@nativescript/angular";
1+
import { NgModule } from '@angular/core';
2+
import { Routes } from '@angular/router';
3+
import { NativeScriptRouterModule } from '@nativescript/angular';
44

5-
import { HomeComponent } from "./home.component";
5+
import { HomeComponent } from './home.component';
66

77
const routes: Routes = [
8-
{ path: "", redirectTo: "/home", pathMatch: "full" },
9-
{ path: "home", component: HomeComponent },
10-
{ path: "datetimepicker", loadChildren: () => import('./plugin-demos/datetimepicker.module').then(m => m.DateTimePickerModule) },
11-
{ path: "imagepicker", loadChildren: () => import('./plugin-demos/imagepicker.module').then(m => m.ImagePickerModule) },
12-
{ path: "appavailability", loadChildren: () => import('./plugin-demos/appavailability.module').then(m => m.AppavailabilityModule) }
8+
{ path: '', redirectTo: '/home', pathMatch: 'full' },
9+
{ path: 'home', component: HomeComponent },
10+
{ path: 'appavailability', loadChildren: () => import('./plugin-demos/appavailability.module').then(m => m.AppavailabilityModule) },
11+
{ path: 'camera', loadChildren: () => import('./plugin-demos/camera.module').then(m => m.CameraModule) },
12+
{ path: 'datetimepicker', loadChildren: () => import('./plugin-demos/datetimepicker.module').then(m => m.DatetimepickerModule) },
13+
{ path: 'directions', loadChildren: () => import('./plugin-demos/directions.module').then(m => m.DirectionsModule) },
14+
{ path: 'email', loadChildren: () => import('./plugin-demos/email.module').then(m => m.EmailModule) },
15+
{ path: 'fingerprint-auth', loadChildren: () => import('./plugin-demos/fingerprint-auth.module').then(m => m.FingerprintAuthModule) },
16+
{ path: 'geolocation', loadChildren: () => import('./plugin-demos/geolocation.module').then(m => m.GeolocationModule) },
17+
{ path: 'imagepicker', loadChildren: () => import('./plugin-demos/imagepicker.module').then(m => m.ImagepickerModule) },
18+
{ path: 'iqkeyboardmanager', loadChildren: () => import('./plugin-demos/iqkeyboardmanager.module').then(m => m.IqkeyboardmanagerModule) },
19+
{ path: 'local-notifications', loadChildren: () => import('./plugin-demos/local-notifications.module').then(m => m.LocalNotificationsModule) },
20+
{ path: 'shared-notification-delegate', loadChildren: () => import('./plugin-demos/shared-notification-delegate.module').then(m => m.SharedNotificationDelegateModule) },
21+
{ path: 'zip', loadChildren: () => import('./plugin-demos/zip.module').then(m => m.ZipModule) }
1322
];
1423

1524
@NgModule({
16-
imports: [NativeScriptRouterModule.forRoot(routes)],
17-
exports: [NativeScriptRouterModule]
25+
imports: [NativeScriptRouterModule.forRoot(routes)],
26+
exports: [NativeScriptRouterModule],
1827
})
19-
export class AppRoutingModule { }
28+
export class AppRoutingModule {}

apps/demo-angular/src/home.component.ts

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,41 @@ import { Component } from '@angular/core';
66
})
77
export class HomeComponent {
88
demos = [
9-
{
10-
name: 'datetimepicker',
11-
},
12-
{
13-
name: 'imagepicker',
14-
},
15-
{
16-
name: 'appavailability',
17-
},
18-
];
19-
}
9+
{
10+
name: 'appavailability'
11+
},
12+
{
13+
name: 'camera'
14+
},
15+
{
16+
name: 'datetimepicker'
17+
},
18+
{
19+
name: 'directions'
20+
},
21+
{
22+
name: 'email'
23+
},
24+
{
25+
name: 'fingerprint-auth'
26+
},
27+
{
28+
name: 'geolocation'
29+
},
30+
{
31+
name: 'imagepicker'
32+
},
33+
{
34+
name: 'iqkeyboardmanager'
35+
},
36+
{
37+
name: 'local-notifications'
38+
},
39+
{
40+
name: 'shared-notification-delegate'
41+
},
42+
{
43+
name: 'zip'
44+
}
45+
];
46+
}

apps/demo-vue/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
55
"nativescript-vue": "file:../../node_modules/nativescript-vue",
66
"@nativescript/core": "file:../../node_modules/@nativescript/core",
7-
"@nativescript/imagepicker": "file:../../packages/imagepicker",
8-
"@nativescript/appavailability": "file:../../packages/appavailability",
97
"@nativescript/camera": "file:../../packages/camera",
8+
"@nativescript/appavailability": "file:../../packages/appavailability",
109
"@nativescript/datetimepicker": "file:../../packages/datetimepicker",
1110
"@nativescript/directions": "file:../../packages/directions",
1211
"@nativescript/email": "file:../../packages/email",
1312
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
1413
"@nativescript/geolocation": "file:../../packages/geolocation",
14+
"@nativescript/imagepicker": "file:../../packages/imagepicker",
1515
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
1616
"@nativescript/local-notifications": "file:../../packages/local-notifications",
1717
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",

apps/demo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
"dependencies": {
77
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core",
88
"@nativescript/core": "file:../../node_modules/@nativescript/core",
9-
"@nativescript/imagepicker": "file:../../packages/imagepicker",
10-
"@nativescript/appavailability": "file:../../packages/appavailability",
119
"@nativescript/camera": "file:../../packages/camera",
10+
"@nativescript/appavailability": "file:../../packages/appavailability",
1211
"@nativescript/datetimepicker": "file:../../packages/datetimepicker",
1312
"@nativescript/directions": "file:../../packages/directions",
1413
"@nativescript/email": "file:../../packages/email",
1514
"@nativescript/fingerprint-auth": "file:../../packages/fingerprint-auth",
1615
"@nativescript/geolocation": "file:../../packages/geolocation",
16+
"@nativescript/imagepicker": "file:../../packages/imagepicker",
1717
"@nativescript/iqkeyboardmanager": "file:../../packages/iqkeyboardmanager",
1818
"@nativescript/local-notifications": "file:../../packages/local-notifications",
1919
"@nativescript/shared-notification-delegate": "file:../../packages/shared-notification-delegate",

tools/schematics/utils/index.ts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export function getDemoAppRoot(type: SupportedDemoType) {
127127
}
128128

129129
export function getPluginDemoPath() {
130-
return 'src/plugin-demos';
130+
return 'src/plugin-demos';
131131
}
132132

133133
export function getDemoTypeFromName(name: string): SupportedDemoType {
@@ -191,7 +191,7 @@ export function resetAngularIndex(tree: Tree, packages?: Array<string>) {
191191
angularIndex.substring(0, demosIndex + 1) +
192192
packages
193193
.sort()
194-
.map((p) => `\n{\nname: '${p}'\n}`)
194+
.map((p) => `\n {\n name: '${p}'\n }`)
195195
.join(',') +
196196
'\n];\n}';
197197
tree.overwrite(angularIndexPath, angularIndex);
@@ -200,32 +200,31 @@ export function resetAngularIndex(tree: Tree, packages?: Array<string>) {
200200
export function resetAngularRoutes(tree: Tree, packages?: Array<string>) {
201201
const angularRouteModulePath = `${getDemoAppRoot('angular')}/src/app-routing.module.ts`;
202202
let angularRouteModule = tree.get(angularRouteModulePath).content.toString();
203-
const routeDefIndex = angularRouteModule.indexOf('const routes');
204-
const routeModuleStart = angularRouteModule.substring(0, routeDefIndex);
205-
const routeMoudleDefIndex = angularRouteModule.indexOf('@NgModule');
206-
const routeModuleEnd = angularRouteModule.substring(routeMoudleDefIndex, angularRouteModule.length);
203+
const routeDefIndex = angularRouteModule.indexOf('const routes');
204+
const routeModuleStart = angularRouteModule.substring(0, routeDefIndex);
205+
const routeMoudleDefIndex = angularRouteModule.indexOf('@NgModule');
206+
const routeModuleEnd = angularRouteModule.substring(routeMoudleDefIndex, angularRouteModule.length);
207207

208208
packages = packages && packages.length ? packages : getAllPackages(tree);
209209
const packageRoutes =
210210
packages
211211
.sort()
212-
.map((p) => `{ path: '${p}', loadChildren: () => import('./plugin-demos/${p}.module').then(m => m.${stringUtils.classify(p)}Module) }`)
213-
.join(',\n') +
214-
'\n];\n\n';
215-
const routeStart = `const routes: Routes = [
216-
{ path: '', redirectTo: '/home', pathMatch: 'full' },
217-
{ path: 'home', component: HomeComponent },`;
218-
angularRouteModule = routeModuleStart + routeStart + packageRoutes + routeModuleEnd;
219-
console.log('angularRouteModule:', angularRouteModule)
220-
// tree.overwrite(angularRouteModulePath, angularRouteModule);
212+
.map((p) => ` { path: '${p}', loadChildren: () => import('./plugin-demos/${p}.module').then(m => m.${stringUtils.classify(p)}Module) }`)
213+
.join(',\n') + '\n];\n\n';
214+
const routeStart = `const routes: Routes = [
215+
{ path: '', redirectTo: '/home', pathMatch: 'full' },
216+
{ path: 'home', component: HomeComponent },\n`;
217+
angularRouteModule = routeModuleStart + routeStart + packageRoutes + routeModuleEnd;
218+
// console.log('angularRouteModule:', angularRouteModule);
219+
tree.overwrite(angularRouteModulePath, angularRouteModule);
221220
}
222221

223222
export function resetIndexForDemoType(tree: Tree, demoType: SupportedDemoType) {
224-
const packages = getPackageNamesToUpdate();
223+
const packages = getPackageNamesToUpdate();
225224
switch (demoType) {
226225
case 'angular':
227-
resetAngularIndex(tree, packages);
228-
resetAngularRoutes(tree, packages);
226+
resetAngularIndex(tree, packages);
227+
resetAngularRoutes(tree, packages);
229228
break;
230229
case 'xml':
231230
const demoIndexPath = getDemoIndexPathForType(demoType);

0 commit comments

Comments
 (0)