/
xplat.ts
36 lines (34 loc) · 1.18 KB
/
xplat.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { Tree, SchematicContext } from '@angular-devkit/schematics';
import { updateFile, XplatHelpers, IXplatSettings } from '@nstudio/xplat';
import { nsNgVersion, nsNgFonticonVersion, nodeSassVersion, nsCoreVersion } from './versions';
export namespace XplatNativeScriptAngularHelpers {
export function updateRootDeps(options: XplatHelpers.Schema) {
return (tree: Tree, context: SchematicContext) => {
return XplatHelpers.updatePackageForXplat(options, {
dependencies: {
'nativescript-angular': nsNgVersion,
'nativescript-ngx-fonticon': nsNgFonticonVersion,
'tns-core-modules': nsCoreVersion
},
devDependencies: {
'node-sass': nodeSassVersion
}
})(tree, context);
};
}
export function addReferences() {
return (tree: Tree) => {
const filename = 'references.d.ts';
if (!tree.exists(filename)) {
// add references.d.ts
tree.create(
filename,
`/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
`
);
}
return tree;
};
}
}