@@ -17,6 +17,11 @@ const isTypeScript = ({ projectDir, packageJson } = {}) => {
17
17
) || isAngular ( { packageJson } ) ;
18
18
} ;
19
19
20
+ const isShared = ( { projectDir } ) => {
21
+ const nsConfig = getNsConfig ( projectDir ) ;
22
+ return nsConfig && ! ! nsConfig . shared ;
23
+ }
24
+
20
25
const isAngular = ( { projectDir, packageJson } = { } ) => {
21
26
packageJson = packageJson || getPackageJson ( projectDir ) ;
22
27
@@ -39,9 +44,22 @@ const isVue = ({ projectDir, packageJson } = {}) => {
39
44
40
45
const getPackageJson = projectDir => {
41
46
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 => {
42
60
let result ;
43
61
try {
44
- result = JSON . parse ( fs . readFileSync ( packageJsonPath , "utf8" ) ) ;
62
+ result = JSON . parse ( fs . readFileSync ( filePath , "utf8" ) ) ;
45
63
} catch ( e ) {
46
64
result = { } ;
47
65
}
@@ -69,6 +87,7 @@ const getIndentationCharacter = (jsonContent) => {
69
87
const getProjectDir = hook . findProjectDir ;
70
88
71
89
const getPackageJsonPath = projectDir => resolve ( projectDir , "package.json" ) ;
90
+ const getNsConfigPath = projectDir => resolve ( projectDir , "nsconfig.json" ) ;
72
91
73
92
const isAndroid = platform => / a n d r o i d / i. test ( platform ) ;
74
93
const isIos = platform => / i o s / i. test ( platform ) ;
@@ -104,11 +123,13 @@ module.exports = {
104
123
isAndroid,
105
124
isIos,
106
125
isAngular,
126
+ isShared,
107
127
getAngularVersion,
108
128
isVue,
109
129
isTypeScript,
110
130
writePackageJson,
111
131
convertSlashesInPath,
112
132
getIndentationCharacter,
113
133
safeGet,
114
- } ;
134
+ } ;
135
+
0 commit comments