From fa14d4d4b0c56af01197d05d0ada09dac494a0fa Mon Sep 17 00:00:00 2001 From: Erjan Gavalji Date: Wed, 30 Mar 2016 10:29:49 +0300 Subject: [PATCH] Make declaration package have the version of the main repo package.json Read the version field of the extracted tns-core-modules package and set it to the declarations package.json Remove the redundant run.sh file --- build/platform-declarations/gruntfile.js | 26 ++++++++++++++++++++++-- build/platform-declarations/run.sh | 2 -- 2 files changed, 24 insertions(+), 4 deletions(-) delete mode 100755 build/platform-declarations/run.sh diff --git a/build/platform-declarations/gruntfile.js b/build/platform-declarations/gruntfile.js index e056e6799..8b9cb54b2 100644 --- a/build/platform-declarations/gruntfile.js +++ b/build/platform-declarations/gruntfile.js @@ -2,12 +2,24 @@ module.exports = function(grunt) { var fsModule = require("fs"); - function cleanDeps(content, srcPath) { + var masterPackageVersion = ""; + + function updatePackageJson(content, srcPath) { var contentAsJson = JSON.parse(content); delete contentAsJson.devDependencies; + + contentAsJson.version = masterPackageVersion; + return JSON.stringify(contentAsJson, null, "\t"); } + function readMasterPackageVersion(content, srcPath) { + var contentAsJson = JSON.parse(content); + masterPackageVersion = contentAsJson.version; + + return content; + } + function isDiff(content, srcPath) { var relativePath = srcPath.replace(/actuals\//, ""); var extractedRelativePath = "extracted/package/" + relativePath; @@ -37,7 +49,7 @@ module.exports = function(grunt) { src: "./package.json", dest: "./diffs/", options: { - process: cleanDeps + process: updatePackageJson } }, actualDeclaraions: { @@ -70,6 +82,15 @@ module.exports = function(grunt) { src: "./*.tgz", dest: "./", cwd: "./diffs" + }, + readMasterPackageVersion: { + expand: true, + src: "./package.json", + dest: "./extracted/package/", + cwd: "./extracted/package", + options: { + process: readMasterPackageVersion + } } }, shell: { @@ -126,6 +147,7 @@ module.exports = function(grunt) { "shell:createExtractedDir", "shell:unpackPackage", "clean:package", + "copy:readMasterPackageVersion", "clean:extractedNonDeclarations", "shell:createActualsDir", "copy:actualDeclaraions", diff --git a/build/platform-declarations/run.sh b/build/platform-declarations/run.sh deleted file mode 100755 index 7287811bd..000000000 --- a/build/platform-declarations/run.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -grunt --verbose