Skip to content

Commit 2b2779f

Browse files
author
Christopher J. Brody
committed
Updated generated dependencies - now more flexible
resolves #7 - update for React Native 0.59
1 parent b0475a5 commit 2b2779f

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

templates/general.js

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,28 @@ ${name};
7373
}, {
7474
name: () => 'package.json',
7575
content: ({ moduleName, platforms, githubAccount, authorName, authorEmail, license }) => {
76-
const dependenciesFirstPart = `{
77-
"react": "^16.6.3",
78-
"react-native": "^0.58.6"`;
79-
const dependenciesPartial = (platforms.indexOf('windows') >= 0)
80-
? dependenciesFirstPart + `,
81-
"react-native-windows": "^0.57.0"`
82-
: dependenciesFirstPart;
83-
const externalDependencies = dependenciesPartial + `
76+
const withWindows = platforms.indexOf('windows') >= 0;
77+
78+
const peerDependencies =
79+
`{
80+
"react": "^16.5.0",
81+
"react-native": ">=0.57.0-rc.0 <1.0.x"` +
82+
(withWindows
83+
? `,
84+
"react-native-windows": ">=0.57.0-rc.0 <1.0.x"`
85+
: ``) + `
8486
}`;
87+
88+
const devDependencies =
89+
`{
90+
"react": "^16.5.0",
91+
"react-native": "0.59.3"` +
92+
(withWindows
93+
? `,
94+
"react-native-windows": "^0.57.1"`
95+
: ``) + `
96+
}`;
97+
8598
return `{
8699
"name": "${moduleName}",
87100
"title": "${moduleName.split('-').map(word => word[0].toUpperCase() + word.substr(1)).join(' ')}",
@@ -106,8 +119,8 @@ ${name};
106119
"license": "${license}",
107120
"licenseFilename": "LICENSE",
108121
"readmeFilename": "README.md",
109-
"peerDependencies": ${externalDependencies},
110-
"devDependencies": ${externalDependencies}
122+
"peerDependencies": ${peerDependencies},
123+
"devDependencies": ${devDependencies}
111124
}
112125
`;
113126
},

0 commit comments

Comments
 (0)