Skip to content

Commit 58f7e25

Browse files
Merge pull request #1281 from NativeScript/vladimirov/revert-package-json-delete
Do not delete app's package.json
2 parents cb0b668 + 165b462 commit 58f7e25

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/services/project-service.ts

-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ export class ProjectService implements IProjectService {
7777
//update dependencies and devDependencies of newly created project with data from template
7878
this.mergeProjectAndTemplateProperties(projectDir, appPath).wait();
7979
this.updateAppResourcesDir(appDirectory).wait();
80-
// Delete app/package.json file, its just causing confusion.
81-
// Also its dependencies and devDependencies are already merged in project's package.json.
82-
this.$fs.deleteFile(path.join(projectDir, constants.APP_FOLDER_NAME, constants.PACKAGE_JSON_FILE_NAME)).wait();
8380
this.$npm.install(projectDir, projectDir, { "ignore-scripts": this.$options.ignoreScripts }).wait();
8481
} catch (err) {
8582
this.$fs.deleteDirectory(projectDir).wait();

test/project-service.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ class ProjectIntegrationTest {
9090

9191
let expectedFiles = fs.enumerateFilesInDirectorySync(sourceDir);
9292
let actualFiles = fs.enumerateFilesInDirectorySync(appDirectoryPath);
93-
assert.isTrue(actualFiles.length >= (expectedFiles.length - 1), "Files in created project must be at least as files in app dir (without package.json).");
93+
assert.isTrue(actualFiles.length >= expectedFiles.length, "Files in created project must be at least as files in app dir.");
9494
_.each(expectedFiles, file => {
9595
let relativeToProjectDir = helpers.getRelativeToRootPath(sourceDir, file);
96-
if(path.basename(file) === "package.json") {
97-
assert.isFalse(fs.exists(path.join(appDirectoryPath, relativeToProjectDir)).wait());
98-
} else {
99-
assert.isTrue(fs.exists(path.join(appDirectoryPath, relativeToProjectDir)).wait());
100-
}
96+
let filePathInApp = path.join(appDirectoryPath, relativeToProjectDir);
97+
assert.isTrue(fs.exists(filePathInApp).wait(), `File ${filePathInApp} does not exist.`);
10198
});
10299

103100
// assert dependencies and devDependencies are copied from template to real project

0 commit comments

Comments
 (0)