|
1 | | -import { getPackageJson } from '../utils'; //getNsConfig |
| 1 | +import { getPackageJson } from '../utils'; |
2 | 2 | import { Tree, SchematicsException } from '@angular-devkit/schematics'; |
| 3 | +import { normalize } from '@angular-devkit/core'; |
3 | 4 | import { extname } from 'path'; |
4 | 5 | import { Schema as ComponentOptions } from './component/schema'; |
5 | 6 | import { Schema as ModuleOptions } from './module/schema'; |
@@ -31,15 +32,7 @@ const isNs = (tree: Tree) => { |
31 | 32 | }; |
32 | 33 |
|
33 | 34 | const isWeb = (tree: Tree) => { |
34 | | - if (!tree.exists('nativescript.config.ts')) { |
35 | | - console.log(`nativescript.config.ts not found. Assuming this is a {N} only project`); |
36 | | - |
37 | | - return false; |
38 | | - } |
39 | | - |
40 | | - // const config = getNsConfig(tree); |
41 | | - |
42 | | - return true;//config.webext != null; |
| 35 | + return tree.exists(normalize('/src/main.tns.ts')); |
43 | 36 | }; |
44 | 37 |
|
45 | 38 | export interface PlatformUse { |
@@ -77,24 +70,16 @@ export const getPlatformUse = (tree: Tree, options: Options): PlatformUse => { |
77 | 70 | }; |
78 | 71 |
|
79 | 72 | export const getExtensions = (tree: Tree, options: Options): Extensions => { |
80 | | - // let ns = options.nsExtension; |
81 | | - // let web = options.webExtension; |
82 | | - |
83 | | - // if (isWeb(tree)) { |
84 | | - // const nsconfig = getNsConfig(tree); |
85 | | - |
86 | | - // ns = ns || nsconfig.nsext; |
87 | | - // web = web || nsconfig.webext; |
88 | | - |
89 | | - // if (ns === web) { |
90 | | - // ns = DEFAULT_SHARED_EXTENSIONS.ns; |
91 | | - // web = DEFAULT_SHARED_EXTENSIONS.web; |
92 | | - // } |
93 | | - // } |
| 73 | + if (isWeb(tree)) { |
| 74 | + return { |
| 75 | + ns: DEFAULT_SHARED_EXTENSIONS.ns, |
| 76 | + web: DEFAULT_SHARED_EXTENSIONS.web, |
| 77 | + }; |
| 78 | + } |
94 | 79 |
|
95 | 80 | return { |
96 | | - ns: DEFAULT_SHARED_EXTENSIONS.ns,// parseExtension(ns || ''), |
97 | | - web: DEFAULT_SHARED_EXTENSIONS.web //parseExtension(web || ''), |
| 81 | + ns: '', |
| 82 | + web: '', |
98 | 83 | }; |
99 | 84 | }; |
100 | 85 |
|
|
0 commit comments