newcandies 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -140,10 +140,20 @@ async function main() {
|
|
|
140
140
|
const templateAppPath = path.join(__dirname, "..", "templates", selectedItem.path, "app.json");
|
|
141
141
|
if (await fs.pathExists(templatePkgPath)) {
|
|
142
142
|
const tmplPkg = await fs.readJSON(templatePkgPath);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
const isFullPackageJson = tmplPkg.scripts || tmplPkg.main || tmplPkg.version;
|
|
144
|
+
if (isFullPackageJson) {
|
|
145
|
+
const finalPkg = {
|
|
146
|
+
...tmplPkg,
|
|
147
|
+
dependencies: { ...basePkg.dependencies, ...tmplPkg.dependencies },
|
|
148
|
+
devDependencies: { ...basePkg.devDependencies, ...tmplPkg.devDependencies }
|
|
149
|
+
};
|
|
150
|
+
await fs.writeJSON(path.join(dest, "package.json"), finalPkg, { spaces: 2 });
|
|
151
|
+
} else {
|
|
152
|
+
basePkg.dependencies = { ...basePkg.dependencies, ...tmplPkg.dependencies };
|
|
153
|
+
basePkg.devDependencies = { ...basePkg.devDependencies, ...tmplPkg.devDependencies };
|
|
154
|
+
basePkg.scripts = { ...basePkg.scripts, ...tmplPkg.scripts };
|
|
155
|
+
await fs.writeJSON(path.join(dest, "package.json"), basePkg, { spaces: 2 });
|
|
156
|
+
}
|
|
147
157
|
}
|
|
148
158
|
if (await fs.pathExists(templateAppPath) && baseApp) {
|
|
149
159
|
const tmplApp = await fs.readJSON(templateAppPath);
|