Skip to content

Commit

Permalink
fix(scripts): update dep version
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Apr 4, 2018
1 parent bb46b5f commit 974b949
Show file tree
Hide file tree
Showing 4 changed files with 2,860 additions and 3 deletions.
14 changes: 13 additions & 1 deletion .scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@ const packages = [
];

function readPkg(package) {
const packageJsonPath = path.join(rootDir, package, 'package.json');
const packageJsonPath = packagePath(package);
return JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
}

function writePkg(project, pkg) {
const packageJsonPath = packagePath(package);
const text = JSON.stringify(pkg, null, 2);
return fs.writeFileSync(packageJsonPath, text);
}

function packagePath(project) {
return path.join(rootDir, package, 'package.json');
}

function projectPath(project) {
return path.join(rootDir, project);
}


function checkGit(tasks) {
tasks.push(
{
Expand Down Expand Up @@ -55,6 +66,7 @@ const isValidVersion = input => Boolean(semver.valid(input));
module.exports = {
isValidVersion,
readPkg,
writePkg,
rootDir,
projectPath,
checkGit,
Expand Down
16 changes: 16 additions & 0 deletions .scripts/prepare.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ function preparePackage(tasks, package, version) {
{
title: `${pkg.name}: npm link @ionic/core`,
task: () => execa('npm', ['link', '@ionic/core'], { cwd: projectRoot })
},
{
title: `${pkg.name}: update ionic/core dep to ${version}`,
task: () => {
updateDependency(pkg, "@ionic/core", version);
common.writePkg(package, pkg);
}
}
);
}
Expand Down Expand Up @@ -206,6 +213,15 @@ function preparePackage(tasks, package, version) {
}
}

function updateDependency(pkg, dependency, version) {
if (pkg.dependencies && pkg.dependencies[dependency]) {
pkg.dependencies[dependency] = version;
}
if (pkg.devDependencies && pkg.devDependencies[dependency]) {
pkg.devDependencies[dependency] = version;
}
}


function updatePackageVersion(tasks, package, version) {
const projectRoot = common.projectPath(package);
Expand Down
2,829 changes: 2,828 additions & 1 deletion angular/package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"files": [
"dist/"
],
"dependencies": {
"@ionic/core": "latest"
},
"devDependencies": {
"@angular/animations": "latest",
"@angular/common": "latest",
Expand All @@ -49,7 +52,6 @@
"@angular/platform-browser": "latest",
"@angular/platform-browser-dynamic": "latest",
"@angular/router": "latest",
"@ionic/core": "latest",
"chalk": "^2.3.2",
"execa": "^0.10.0",
"fs-extra": "^5.0.0",
Expand Down

0 comments on commit 974b949

Please sign in to comment.