Skip to content

Commit

Permalink
update postlink script
Browse files Browse the repository at this point in the history
  • Loading branch information
iVanPan committed Jul 2, 2017
1 parent be1cda8 commit 458848b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 16 additions & 1 deletion scripts/postlink/postlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function addURLTypesForTencentSDK() {
plistContents = plist.build(parsedInfoPlist);
fs.writeFileSync(plistPath, plistContents);
}).then(function(){
addAppIdToGradle()
addAppIdToPackageJson()
});
}
}
Expand Down Expand Up @@ -199,3 +199,18 @@ function addSearchPaths(project, frameworkSearchPath) {
});
};

function addAppIdToPackageJson() {
var packagePath =path.join(__dirname,'../../../','../','./package.json');
var packageFile = fs.readFileSync(packagePath, "utf8");
inquirer.prompt([{
type: "input",
name: "AppID",
message: "What is your Tencent SDK AppID for Android (hit <ENTER> to ignore)"
}]).then(function(answer) {
var key = answer.AppID || "app-id-here";
package.qq_app_id=key
fs.writeFileSync(packagePath, JSON.stringify(package,null, 2));
});
}


8 changes: 7 additions & 1 deletion scripts/postunlink/postunlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ removeLinkFunction();
removeAppID();
removeQueriesSchemes();
removeFrameworkAndSearchPath();

removeAppIdFromPackageJson();

function removeRCTLinkManagerHeader() {
var linkHeaderImportStatement = `#import <React/RCTLinkingManager.h>`;
Expand Down Expand Up @@ -145,3 +145,9 @@ function removeSearchPaths(project, frameworkSearchPath) {
}
});
}
function removeAppIdFromPackageJson() {
var packagePath =path.join(__dirname,'../../../','../','./package.json');
var packageFile = fs.readFileSync(packagePath, "utf8");
delete package.qq_app_id
fs.writeFileSync(packagePath, JSON.stringify(package, null, 2));
}

0 comments on commit 458848b

Please sign in to comment.