@@ -17,6 +17,11 @@ const isTypeScript = ({ projectDir, packageJson } = {}) => {
1717 ) || isAngular ( { packageJson } ) ;
1818} ;
1919
20+ const isShared = ( { projectDir } ) => {
21+ const nsConfig = getNsConfig ( projectDir ) ;
22+ return nsConfig && ! ! nsConfig . shared ;
23+ }
24+
2025const isAngular = ( { projectDir, packageJson } = { } ) => {
2126 packageJson = packageJson || getPackageJson ( projectDir ) ;
2227
@@ -39,9 +44,22 @@ const isVue = ({ projectDir, packageJson } = {}) => {
3944
4045const getPackageJson = projectDir => {
4146 const packageJsonPath = getPackageJsonPath ( projectDir ) ;
47+ const result = readJsonFile ( packageJsonPath ) ;
48+
49+ return result ;
50+ } ;
51+
52+ const getNsConfig = projectDir => {
53+ const nsConfigPath = getNsConfigPath ( projectDir ) ;
54+ const result = readJsonFile ( nsConfigPath ) ;
55+
56+ return result ;
57+ } ;
58+
59+ const readJsonFile = filePath => {
4260 let result ;
4361 try {
44- result = JSON . parse ( fs . readFileSync ( packageJsonPath , "utf8" ) ) ;
62+ result = JSON . parse ( fs . readFileSync ( filePath , "utf8" ) ) ;
4563 } catch ( e ) {
4664 result = { } ;
4765 }
@@ -69,6 +87,7 @@ const getIndentationCharacter = (jsonContent) => {
6987const getProjectDir = hook . findProjectDir ;
7088
7189const getPackageJsonPath = projectDir => resolve ( projectDir , "package.json" ) ;
90+ const getNsConfigPath = projectDir => resolve ( projectDir , "nsconfig.json" ) ;
7291
7392const isAndroid = platform => / a n d r o i d / i. test ( platform ) ;
7493const isIos = platform => / i o s / i. test ( platform ) ;
@@ -104,11 +123,13 @@ module.exports = {
104123 isAndroid,
105124 isIos,
106125 isAngular,
126+ isShared,
107127 getAngularVersion,
108128 isVue,
109129 isTypeScript,
110130 writePackageJson,
111131 convertSlashesInPath,
112132 getIndentationCharacter,
113133 safeGet,
114- } ;
134+ } ;
135+
0 commit comments