From 50fb0c20bb8b07283bf67da8e8a560bf7e95110f Mon Sep 17 00:00:00 2001 From: David Zearing Date: Wed, 5 Oct 2016 15:44:27 -0700 Subject: [PATCH 01/14] Adding publish scripts. --- changes/testbump-guid.json | 14 +++ scripts/enumerate.js | 98 ++++++++++++++++ scripts/package.json | 15 +++ scripts/publish.js | 223 +++++++++++++++++++++++++++++++++++++ scripts/utils.js | 51 +++++++++ 5 files changed, 401 insertions(+) create mode 100644 changes/testbump-guid.json create mode 100644 scripts/enumerate.js create mode 100644 scripts/package.json create mode 100644 scripts/publish.js create mode 100644 scripts/utils.js diff --git a/changes/testbump-guid.json b/changes/testbump-guid.json new file mode 100644 index 00000000000..6866ee48764 --- /dev/null +++ b/changes/testbump-guid.json @@ -0,0 +1,14 @@ +{ + "changes": [ + { + "packageName": "@microsoft/gulp-core-build-sass", + "type": "patch", + "comments": ["Fixing bug that caused x issue."] + }, + { + "packageName": "@microsoft/gulp-core-build-typescript", + "type": "patch", + "comments": ["b"] + } + ] +} diff --git a/scripts/enumerate.js b/scripts/enumerate.js new file mode 100644 index 00000000000..0a95d508536 --- /dev/null +++ b/scripts/enumerate.js @@ -0,0 +1,98 @@ +'use strict'; + +let fs = require('fs'); +let path = require('path'); +let { fileExists, directoryExists } = require('./utils'); + +let rootPackagePath = path.resolve('./package.json'); + +function findPackagesSync(dir, results) { + let excludes = [ + '.git', + 'node_modules', + 'typings', + 'lib', + 'src', + 'dist', + 'coverage', + 'common' + ]; + + results = results || []; + let list = fs.readdirSync(dir).filter(file => excludes.indexOf(file) === -1); + + list.forEach((file) => { + let fullPath = path.resolve(dir, file); + + if (directoryExists(fullPath)) { + findPackagesSync(fullPath, results); + + } else if (fullPath !== rootPackagePath && fileExists(fullPath) && path.basename(file) === 'package.json') { + results.push(fullPath); + } + }); + + return results; +} + +function forEachPackage(dir, cb) { + let packageCount = 0; + let packageLocations = findPackagesSync('.'); + + packageLocations.forEach(packageLocation => { + // crack open packages. + let data = fs.readFileSync(packageLocation, 'utf8'); + let pkg = JSON.parse(data); + + cb(pkg, packageLocation); + }); +} + +function getAllProjects() { + let allProjects = {}; + + forEachPackage('.', (pkg, location) => { + allProjects[pkg.name] = { + package: pkg, + path: location + }; + }); + + return allProjects; +} + +function findReposSync(dir, results) { + let excludes = [ + 'node_modules' + ]; + results = results || []; + + let list = fs.readdirSync(dir); + + list = list.filter(file => excludes.indexOf(file) === -1); + + list.forEach((file) => { + let fullPath = path.resolve(dir, file); + if (directoryExists(fullPath)) { + if (file === '.git') { + results.push(dir); + } else { + findReposSync(fullPath, results); + } + } + }); + + return results; +} + +function forEachRepo(dir, cb) { + findReposSync('.').forEach(repoPath => cb(repoPath)); +} + +module.exports = { + findPackagesSync, + forEachPackage, + getAllProjects, + findReposSync, + forEachRepo +}; diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 00000000000..ba41752f785 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,15 @@ +{ + "name": "web-build-tools-scripts", + "version": "1.0.0", + "description": "", + "main": "enumerate.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "rimraf": "^2.5.4", + "semver": "^5.3.0" + } +} diff --git a/scripts/publish.js b/scripts/publish.js new file mode 100644 index 00000000000..3af851a5cc8 --- /dev/null +++ b/scripts/publish.js @@ -0,0 +1,223 @@ +'use strict'; + +let { getAllProjects, forEachPackage } = require('./enumerate'); +let fs = require('fs'); +let path = require('path'); +let semver = require('semver'); + +let _downstreamDeps = getDownstreamDependencies(); +let _allPackages = getAllProjects(); +let _changeTypes = { + major: 2, + minor: 1, + patch: 0, + 2: 'major', + 1: 'minor', + 0: 'patch' +}; +let _shouldCommit = false; + +/* Find all changes and return parsed change definitions. */ +function findChangesSync() { + let changeFiles = []; + let allChanges = {}; + let changesPath = path.join(process.cwd(), 'changes'); + + console.log(`Finding changes in: ${ changesPath }`); + + try { + changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); + } catch (e) { } + + // Add the minimum changes defined by the change descriptions. + changeFiles.forEach((file) => { + let fullPath = path.resolve('./changes', file); + let changeDescription = JSON.parse(fs.readFileSync(fullPath, 'utf8')); + + for (let i = 0; i < changeDescription.changes.length; i++) { + let change = changeDescription.changes[i]; + + addChange(allChanges, change.packageName, _allPackages[change.packageName].path, _changeTypes[change.type], change.comments); + } + }); + + let packages = Object.keys(allChanges); + let updatedDeps = {}; + + // Update the versions for downstream dependencies within the repo. + for (let packageName of packages) { + addDependencies(allChanges, packageName, updatedDeps); + } + + // Update orders so that downstreams are marked to come after upstreams. + for (let packageName in allChanges) { + let change = allChanges[packageName]; + let pkg = _allPackages[packageName].package; + let deps = _downstreamDeps[packageName]; + + // Write the new version expected for the change. + change.newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); + + if (deps) { + for (let depName of deps) { + let depChange = allChanges[depName]; + + if (depChange) { + depChange.order = Math.max(change.order + 1, depChange.order); + } + } + } + } + + return allChanges; +} + +/** Add a change request to the allChanges dictionary if necessary. */ +function addChange(allChanges, packageName, packagePath, changeType, comments) { + changeType = changeType || _changeTypes.patch; + comments = comments || []; + + if (!allChanges[packageName]) { + allChanges[packageName] = { packageName, packagePath, changeType, comments, order: 0 }; + } else { + let currentChange = allChanges[packageName]; + + currentChange.changeType = Math.max(currentChange.changeType, changeType); + currentChange.comments = currentChange.comments.concat(comments); + } +} + +/** Build a downstream dependencies lookup table. */ +function getDownstreamDependencies() { + let downstreamDeps = {}; + + forEachPackage('.', (pkg, location) => { + for (let depName in pkg.dependencies) { + if (!downstreamDeps[depName]) { + downstreamDeps[depName] = []; + } + downstreamDeps[depName].push(pkg.name); + } + }); + + return downstreamDeps; +} + +/** Add downstream changes that are implicitly required by version bumps. */ +function addDependencies(allChanges, packageName, updatedDeps) { + if (!updatedDeps) { + updatedDeps = {}; + } + + if (!updatedDeps[packageName]) { + updatedDeps[packageName] = true; + let change = allChanges[packageName]; + let dependencies = _downstreamDeps[packageName]; + + for (let i = 0; dependencies && i < dependencies.length; i++) { + let depPackage = _allPackages[dependencies[i]]; + + addChange( + allChanges, + depPackage.package.name, + depPackage.path, + _changeTypes.patch, + [`Updating dependency: ${packageName}`] + ); + + addDependencies(allChanges, dependencies[i], updatedDeps); + } + } +} + +/** Print changes to apply. */ +function printChanges(changes) { + for (let changeName in changes) { + let change = changes[changeName]; + + if (_allPackages[change.packageName]) { + let pkg = _allPackages[change.packageName].package; + let newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); + + console.log(`${change.packageName} [${_changeTypes[change.changeType]}] ${pkg.version} -> ${newVersion}`); + change.comments.forEach(comment => console.log(`|-- ${comment}`)) + } + } +} + +/** Apply set of changes. */ +function applyChanges(allChanges) { + let orderedChanges = ( + Object + .keys(allChanges) + .map(key => allChanges[key]) + .sort((a, b) => a.order < b.order ? -1 : 1)); + if (orderedChanges.length > 1) { + for (let change of orderedChanges) { + updatePackage(change, allChanges); + updateChangeLog(change); + } + + deleteChangeFiles(); + commitChanges(); + + for (let change of orderedChanges) { + publishPackage(change); + } + + commitTags(allChanges); + } +} + +/** Update the package.json for a given change. */ +function updatePackage(change, allChanges) { + + console.log(`* ${_changeTypes[change.changeType]} bumping package ${change.packageName} to ${change.newVersion}`); + + let pkg = _allPackages[change.packageName].package; + + pkg.version = change.newVersion; + + for (let depName in pkg.dependencies) { + if (allChanges[depName]) { + let requiredVersion = pkg.dependencies[depName]; + let newVersionRange = `>=${change.newVersion} <${semver.inc(change.newVersion, 'major')}`; + + if (!semver.satisfies(change.newVersion, requiredVersion)) { + + console.log(` - updating ${depName}: ${requiredVersion} to ${newVersionRange}`); + pkg.dependencies[depName] = newVersionRange; + } + } + } + + //console.log(JSON.stringify(pkg, null, 2)); +} + +function commitChanges() { + // git add + // git commit + // git push + console.log(`commiting all changes`); +} + +function publishPackage(change) { + // npm publish + console.log(`npm publish ${change.packageName}`); +} +function commitTags(changes) { + + console.log(`commiting tags`); +} + +function updateChangeLog(change) { + console.log(`updating ${change.packageName} CHANGELOG.md`) +} +function deleteChangeFiles() { + console.log('deleting change files'); +} + +let changes = findChangesSync(); + +applyChanges(changes); +// printChanges(changes); \ No newline at end of file diff --git a/scripts/utils.js b/scripts/utils.js new file mode 100644 index 00000000000..2627f785967 --- /dev/null +++ b/scripts/utils.js @@ -0,0 +1,51 @@ +let fs = require('fs'); +let rimraf = require('rimraf'); + +function fileExists(path) { + let exists = false; + try { + let lstat = fs.lstatSync(path); + exists = lstat.isFile(); + } catch (e) { } + + return exists; +} + +function directoryExists(path) { + let exists = false; + try { + let lstat = fs.lstatSync(path); + exists = lstat.isDirectory(); + } catch (e) { } + + return exists; +} + +function deleteFile(filePath) { + return new Promise(done => { + if (fileExists(filePath)) { + console.log(`Deleting: ${filepath}`); + fs.unlinkSync(filePath); + } + + done(); + }); +} + +function deleteDirectory(directoryPath) { + return new Promise(done => { + if (directoryExists(directoryPath)) { + console.log(`Deleting: ${directoryPath}`); + rimraf(directoryPath, done); + } else { + done(); + } + }); +} + +module.exports = { + fileExists, + directoryExists, + deleteFile, + deleteDirectory +}; From debffefaef2096aa5d41424051095e78c3c272e0 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Wed, 5 Oct 2016 15:47:32 -0700 Subject: [PATCH 02/14] Updating publish script to write the file. --- scripts/publish.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/publish.js b/scripts/publish.js index 3af851a5cc8..b0876fdd850 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -191,7 +191,7 @@ function updatePackage(change, allChanges) { } } - //console.log(JSON.stringify(pkg, null, 2)); + fs.writeFileSync(change.packagePath, JSON.stringify(pkg, null, 2), 'utf8'); } function commitChanges() { From 743b3d6cf5f13cb158e27a96e0b4ddff737aae0f Mon Sep 17 00:00:00 2001 From: David Zearing Date: Wed, 5 Oct 2016 17:07:29 -0700 Subject: [PATCH 03/14] Improvements to scripts. --- scripts/publish.js | 86 +++++++++++++++++++++++++++++++--------------- scripts/utils.js | 15 ++++---- 2 files changed, 64 insertions(+), 37 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index b0876fdd850..3b3e5545a23 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -1,21 +1,27 @@ 'use strict'; -let { getAllProjects, forEachPackage } = require('./enumerate'); let fs = require('fs'); +let os = require('os'); let path = require('path'); let semver = require('semver'); +let deleteFile = require('./utils').deleteFile; +let forEachPackage = require('./enumerate').forEachPackage; +let getAllProjects = require('./enumerate').getAllProjects; let _downstreamDeps = getDownstreamDependencies(); let _allPackages = getAllProjects(); let _changeTypes = { - major: 2, - minor: 1, - patch: 0, - 2: 'major', - 1: 'minor', - 0: 'patch' + major: 3, + minor: 2, + patch: 1, + dependency: 0, + 3: 'major', + 2: 'minor', + 1: 'patch', + 0: 'dependency' }; -let _shouldCommit = false; + +let _shouldCommit = process.argv.indexOf('--commit'); /* Find all changes and return parsed change definitions. */ function findChangesSync() { @@ -23,7 +29,7 @@ function findChangesSync() { let allChanges = {}; let changesPath = path.join(process.cwd(), 'changes'); - console.log(`Finding changes in: ${ changesPath }`); + console.log(`Finding changes in: ${changesPath}`); try { changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); @@ -56,7 +62,7 @@ function findChangesSync() { let deps = _downstreamDeps[packageName]; // Write the new version expected for the change. - change.newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); + change.newVersion = (change.changeType > _changeTypes.dependency) ? semver.inc(pkg.version, _changeTypes[change.changeType]) : pkg.version; if (deps) { for (let depName of deps) { @@ -74,7 +80,6 @@ function findChangesSync() { /** Add a change request to the allChanges dictionary if necessary. */ function addChange(allChanges, packageName, packagePath, changeType, comments) { - changeType = changeType || _changeTypes.patch; comments = comments || []; if (!allChanges[packageName]) { @@ -121,7 +126,7 @@ function addDependencies(allChanges, packageName, updatedDeps) { allChanges, depPackage.package.name, depPackage.path, - _changeTypes.patch, + _changeTypes.dependency, [`Updating dependency: ${packageName}`] ); @@ -137,7 +142,7 @@ function printChanges(changes) { if (_allPackages[change.packageName]) { let pkg = _allPackages[change.packageName].package; - let newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); + let newVersion = (change.changeType > _changeTypes.dependency) ? semver.inc(pkg.version, _changeTypes[change.changeType]) : pkg.version; console.log(`${change.packageName} [${_changeTypes[change.changeType]}] ${pkg.version} -> ${newVersion}`); change.comments.forEach(comment => console.log(`|-- ${comment}`)) @@ -172,49 +177,74 @@ function applyChanges(allChanges) { /** Update the package.json for a given change. */ function updatePackage(change, allChanges) { - console.log(`* ${_changeTypes[change.changeType]} bumping package ${change.packageName} to ${change.newVersion}`); + console.log(os.EOL + `* Applying ${_changeTypes[change.changeType]} update for ${change.packageName} to ${change.newVersion}`); let pkg = _allPackages[change.packageName].package; - pkg.version = change.newVersion; - for (let depName in pkg.dependencies) { - if (allChanges[depName]) { + let depChange = allChanges[depName]; + + if (depChange) { let requiredVersion = pkg.dependencies[depName]; - let newVersionRange = `>=${change.newVersion} <${semver.inc(change.newVersion, 'major')}`; + let newVersionRange = `>=${depChange.newVersion} <${semver.inc(change.newVersion, 'major')}`; - if (!semver.satisfies(change.newVersion, requiredVersion)) { + console.log(` - updating ${depName}: ${requiredVersion} to ${newVersionRange}`); + pkg.dependencies[depName] = newVersionRange; - console.log(` - updating ${depName}: ${requiredVersion} to ${newVersionRange}`); - pkg.dependencies[depName] = newVersionRange; + if (!semver.satisfies(change.newVersion, requiredVersion)) { + change.changeType = Math.max(change.changeType, _changeTypes.patch); + change.newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); } } } - fs.writeFileSync(change.packagePath, JSON.stringify(pkg, null, 2), 'utf8'); + pkg.version = change.newVersion; + + if (_shouldCommit) { + fs.writeFileSync(change.packagePath, JSON.stringify(pkg, null, 2), 'utf8'); + } } function commitChanges() { // git add // git commit // git push - console.log(`commiting all changes`); + console.log(os.EOL + `Committing all changes`); } function publishPackage(change) { // npm publish - console.log(`npm publish ${change.packageName}`); + console.log(os.EOL + `Running: npm publish ${change.packageName}`); } -function commitTags(changes) { - console.log(`commiting tags`); +function commitTags(changes) { + console.log(os.EOL + `Committing tags`); } function updateChangeLog(change) { - console.log(`updating ${change.packageName} CHANGELOG.md`) + console.log(` - updating CHANGELOG.md`); } + function deleteChangeFiles() { - console.log('deleting change files'); + let changesPath = path.join(process.cwd(), 'changes'); + let changeFiles = []; + console.log(`Deleting change requests`); + + try { + changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); + } catch (e) { } + + if (changeFiles.length) { + console.log(`Deleting ${changeFiles.length} change file(s).`); + + for (let fileName of changeFiles) { + let filePath = path.join(changesPath, fileName); + + console.log(` - ${ filePath}`); + + deleteFile(filePath); + } + } } let changes = findChangesSync(); diff --git a/scripts/utils.js b/scripts/utils.js index 2627f785967..52fbbbcb489 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -22,18 +22,15 @@ function directoryExists(path) { } function deleteFile(filePath) { - return new Promise(done => { - if (fileExists(filePath)) { - console.log(`Deleting: ${filepath}`); - fs.unlinkSync(filePath); - } - - done(); - }); + if (fileExists(filePath)) { + console.log(`Deleting: ${filePath}`); + fs.unlinkSync(filePath); + } + return Promise.resolve(); } function deleteDirectory(directoryPath) { - return new Promise(done => { + return new Promise(done => { if (directoryExists(directoryPath)) { console.log(`Deleting: ${directoryPath}`); rimraf(directoryPath, done); From d0bba40a9ca07269e2097586f439750ad162baad Mon Sep 17 00:00:00 2001 From: David Zearing Date: Wed, 5 Oct 2016 17:14:53 -0700 Subject: [PATCH 04/14] Adding git add. --- scripts/publish.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 3b3e5545a23..0c55a05ab76 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -5,6 +5,7 @@ let os = require('os'); let path = require('path'); let semver = require('semver'); let deleteFile = require('./utils').deleteFile; +let execSync = require('child_process').execSync; let forEachPackage = require('./enumerate').forEachPackage; let getAllProjects = require('./enumerate').getAllProjects; @@ -206,6 +207,9 @@ function updatePackage(change, allChanges) { } function commitChanges() { + execSync('git add .', { + cwd: process.cwd() + }); // git add // git commit // git push @@ -214,28 +218,27 @@ function commitChanges() { function publishPackage(change) { // npm publish - console.log(os.EOL + `Running: npm publish ${change.packageName}`); + console.log(os.EOL + `TODO: Running: npm publish ${change.packageName}`); } function commitTags(changes) { - console.log(os.EOL + `Committing tags`); + console.log(os.EOL + `TODO: Committing tags`); } function updateChangeLog(change) { - console.log(` - updating CHANGELOG.md`); + console.log(` - TODO: updating CHANGELOG.md`); } function deleteChangeFiles() { let changesPath = path.join(process.cwd(), 'changes'); let changeFiles = []; - console.log(`Deleting change requests`); try { changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); } catch (e) { } if (changeFiles.length) { - console.log(`Deleting ${changeFiles.length} change file(s).`); + console.log(os.EOL + `Deleting ${changeFiles.length} change file(s).`); for (let fileName of changeFiles) { let filePath = path.join(changesPath, fileName); From 1cd63651f76fcac0ef6b6a472cf8d6000d16e738 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Wed, 5 Oct 2016 17:48:32 -0700 Subject: [PATCH 05/14] Update. --- scripts/enumerate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/enumerate.js b/scripts/enumerate.js index 0a95d508536..db7d397e524 100644 --- a/scripts/enumerate.js +++ b/scripts/enumerate.js @@ -2,7 +2,8 @@ let fs = require('fs'); let path = require('path'); -let { fileExists, directoryExists } = require('./utils'); +let fileExists = require('./utils').fileExists; +let directoryExists = require('./utils').directoryExists; let rootPackagePath = path.resolve('./package.json'); From e9fd11dcb469193948f10238de51934b2be438fd Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 13:39:41 -0700 Subject: [PATCH 06/14] Updating publish script. --- scripts/publish.js | 85 ++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 29 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 0c55a05ab76..7cbd06574fb 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -22,7 +22,7 @@ let _changeTypes = { 0: 'dependency' }; -let _shouldCommit = process.argv.indexOf('--commit'); +let _shouldCommit = process.argv.indexOf('--commit') >= 0; /* Find all changes and return parsed change definitions. */ function findChangesSync() { @@ -158,6 +158,7 @@ function applyChanges(allChanges) { .keys(allChanges) .map(key => allChanges[key]) .sort((a, b) => a.order < b.order ? -1 : 1)); + if (orderedChanges.length > 1) { for (let change of orderedChanges) { updatePackage(change, allChanges); @@ -165,7 +166,10 @@ function applyChanges(allChanges) { } deleteChangeFiles(); - commitChanges(); + gitAddChanges(allChanges); + gitAddTags(allChanges); + gitCommit(); + gitPush(); for (let change of orderedChanges) { publishPackage(change); @@ -177,7 +181,6 @@ function applyChanges(allChanges) { /** Update the package.json for a given change. */ function updatePackage(change, allChanges) { - console.log(os.EOL + `* Applying ${_changeTypes[change.changeType]} update for ${change.packageName} to ${change.newVersion}`); let pkg = _allPackages[change.packageName].package; @@ -187,12 +190,13 @@ function updatePackage(change, allChanges) { if (depChange) { let requiredVersion = pkg.dependencies[depName]; - let newVersionRange = `>=${depChange.newVersion} <${semver.inc(change.newVersion, 'major')}`; + let newVersionRange = `>=${depChange.newVersion} <${semver.inc(depChange.newVersion, 'major')}`; console.log(` - updating ${depName}: ${requiredVersion} to ${newVersionRange}`); pkg.dependencies[depName] = newVersionRange; - if (!semver.satisfies(change.newVersion, requiredVersion)) { + if (!semver.satisfies(depChange.newVersion, requiredVersion)) { + console.log(`semver not satisfied: ${depChange.packageName} ${depChange.newVersion} ${requiredVersion}`); change.changeType = Math.max(change.changeType, _changeTypes.patch); change.newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); } @@ -206,23 +210,44 @@ function updatePackage(change, allChanges) { } } -function commitChanges() { - execSync('git add .', { - cwd: process.cwd() - }); - // git add - // git commit - // git push - console.log(os.EOL + `Committing all changes`); +function execCommand(commandLine, workingPath) { + workingPath = workingPath || process.cwd(); + + console.log(`Executing: "${commandLine}" from ${workingPath}`); + + if (_shouldCommit) { + execSync(commandLine, { + cwd: workingPath + }); + } } -function publishPackage(change) { - // npm publish - console.log(os.EOL + `TODO: Running: npm publish ${change.packageName}`); +function gitAddChanges() { + execCommand('git add .'); +} + +function gitAddTags(allChanges) { + for (let packageName in allChanges) { + let change = allChanges[packageName]; + + if (change.changeType > _changeTypes.dependency) { + let tagName = packageName + ':v' + change.newVersion; + + execCommand(`git tag ${tagName}`); + } + } +} + +function gitCommit() { + execCommand('git commit -m "Applying package updates."'); } -function commitTags(changes) { - console.log(os.EOL + `TODO: Committing tags`); +function gitPush() { + execCommand('git push --follow-tags'); +} + +function publishPackage(change) { + execCommand(`npm publish`, change.packagePath); } function updateChangeLog(change) { @@ -230,22 +255,24 @@ function updateChangeLog(change) { } function deleteChangeFiles() { - let changesPath = path.join(process.cwd(), 'changes'); - let changeFiles = []; + if (_shouldCommit) { + let changesPath = path.join(process.cwd(), 'changes'); + let changeFiles = []; - try { - changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); - } catch (e) { } + try { + changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); + } catch (e) { } - if (changeFiles.length) { - console.log(os.EOL + `Deleting ${changeFiles.length} change file(s).`); + if (changeFiles.length) { + console.log(os.EOL + `Deleting ${changeFiles.length} change file(s).`); - for (let fileName of changeFiles) { - let filePath = path.join(changesPath, fileName); + for (let fileName of changeFiles) { + let filePath = path.join(changesPath, fileName); - console.log(` - ${ filePath}`); + console.log(` - ${filePath}`); - deleteFile(filePath); + deleteFile(filePath); + } } } } From ad586d7b7a985e45cf920703ccb563eb0e74395a Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 13:42:41 -0700 Subject: [PATCH 07/14] Removing commitTags --- scripts/publish.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 7cbd06574fb..0db6c9702a0 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -174,8 +174,6 @@ function applyChanges(allChanges) { for (let change of orderedChanges) { publishPackage(change); } - - commitTags(allChanges); } } From 9accb8b42a85e9d8c9c7cf3e723a7fc569e7c832 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 15:52:01 -0700 Subject: [PATCH 08/14] Updates so that dependency updates trickle down correctly. --- scripts/publish.js | 210 +++++++++++++++++++++------------------------ 1 file changed, 96 insertions(+), 114 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 0db6c9702a0..38f77f58b87 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -44,18 +44,13 @@ function findChangesSync() { for (let i = 0; i < changeDescription.changes.length; i++) { let change = changeDescription.changes[i]; - addChange(allChanges, change.packageName, _allPackages[change.packageName].path, _changeTypes[change.type], change.comments); + addChange(allChanges, change); } }); let packages = Object.keys(allChanges); let updatedDeps = {}; - // Update the versions for downstream dependencies within the repo. - for (let packageName of packages) { - addDependencies(allChanges, packageName, updatedDeps); - } - // Update orders so that downstreams are marked to come after upstreams. for (let packageName in allChanges) { let change = allChanges[packageName]; @@ -80,17 +75,32 @@ function findChangesSync() { } /** Add a change request to the allChanges dictionary if necessary. */ -function addChange(allChanges, packageName, packagePath, changeType, comments) { - comments = comments || []; +function addChange(allChanges, change) { + let packageName = change.packageName; + let pkgEntry = _allPackages[packageName]; + let pkg = pkgEntry.package; + let currentChange; if (!allChanges[packageName]) { - allChanges[packageName] = { packageName, packagePath, changeType, comments, order: 0 }; + currentChange = allChanges[packageName] = { + packageName, + packagePath: pkgEntry.path, + changeType: _changeTypes[change.type], + comments: change.comments || [], + order: 0, + changes: [change] + }; } else { - let currentChange = allChanges[packageName]; - - currentChange.changeType = Math.max(currentChange.changeType, changeType); - currentChange.comments = currentChange.comments.concat(comments); + currentChange = allChanges[packageName]; + currentChange.changeType = Math.max(currentChange.changeType, _changeTypes[change.type]); + currentChange.comments = currentChange.comments.concat(change.comments); + currentChange.changes.push(change); } + + currentChange.newVersion = currentChange.changeType > 0 ? semver.inc(pkg.version, _changeTypes[currentChange.changeType]) : pkg.version; + currentChange.newVersionRange = `>=${currentChange.newVersion} <${semver.inc(currentChange.newVersion, 'major')}`; + + updateDownstreamDependencies(allChanges, packageName, currentChange.newVersionRange); } /** Build a downstream dependencies lookup table. */ @@ -109,70 +119,30 @@ function getDownstreamDependencies() { return downstreamDeps; } -/** Add downstream changes that are implicitly required by version bumps. */ -function addDependencies(allChanges, packageName, updatedDeps) { - if (!updatedDeps) { - updatedDeps = {}; - } - - if (!updatedDeps[packageName]) { - updatedDeps[packageName] = true; - let change = allChanges[packageName]; - let dependencies = _downstreamDeps[packageName]; - - for (let i = 0; dependencies && i < dependencies.length; i++) { - let depPackage = _allPackages[dependencies[i]]; - - addChange( - allChanges, - depPackage.package.name, - depPackage.path, - _changeTypes.dependency, - [`Updating dependency: ${packageName}`] - ); - - addDependencies(allChanges, dependencies[i], updatedDeps); - } - } -} - -/** Print changes to apply. */ -function printChanges(changes) { - for (let changeName in changes) { - let change = changes[changeName]; - - if (_allPackages[change.packageName]) { - let pkg = _allPackages[change.packageName].package; - let newVersion = (change.changeType > _changeTypes.dependency) ? semver.inc(pkg.version, _changeTypes[change.changeType]) : pkg.version; - - console.log(`${change.packageName} [${_changeTypes[change.changeType]}] ${pkg.version} -> ${newVersion}`); - change.comments.forEach(comment => console.log(`|-- ${comment}`)) - } - } -} - -/** Apply set of changes. */ -function applyChanges(allChanges) { - let orderedChanges = ( - Object - .keys(allChanges) - .map(key => allChanges[key]) - .sort((a, b) => a.order < b.order ? -1 : 1)); - - if (orderedChanges.length > 1) { - for (let change of orderedChanges) { - updatePackage(change, allChanges); - updateChangeLog(change); - } - - deleteChangeFiles(); - gitAddChanges(allChanges); - gitAddTags(allChanges); - gitCommit(); - gitPush(); - - for (let change of orderedChanges) { - publishPackage(change); +function updateDownstreamDependencies(allChanges, packageName, newVersionRange) { + let change = allChanges[packageName]; + let downstreamNames = _downstreamDeps[packageName]; + + // Iterate through all downstream dependencies for the package. + if (downstreamNames) { + for (let depName of downstreamNames) { + let pkgEntry = _allPackages[depName]; + let pkg = pkgEntry.package; + let requiredVersion = pkgEntry.package.dependencies[packageName]; + + // If the version range has not yet been updated to this version, update it. + if (requiredVersion !== newVersionRange) { + pkgEntry.package.dependencies[packageName] = newVersionRange; + + // Either it already satisfies the new version, or doesn't. If not, the downstream dep needs to be republished. + let changeType = semver.satisfies(change.newVersion, requiredVersion) ? _changeTypes.dependency : _changeTypes.patch; + + addChange(allChanges, { + packageName: pkg.name, + type: _changeTypes[changeType], + comments: [`Updating ${packageName}: ${newVersionRange} (was ${ requiredVersion })`] + }); + } } } } @@ -183,37 +153,21 @@ function updatePackage(change, allChanges) { let pkg = _allPackages[change.packageName].package; - for (let depName in pkg.dependencies) { - let depChange = allChanges[depName]; - - if (depChange) { - let requiredVersion = pkg.dependencies[depName]; - let newVersionRange = `>=${depChange.newVersion} <${semver.inc(depChange.newVersion, 'major')}`; - - console.log(` - updating ${depName}: ${requiredVersion} to ${newVersionRange}`); - pkg.dependencies[depName] = newVersionRange; - - if (!semver.satisfies(depChange.newVersion, requiredVersion)) { - console.log(`semver not satisfied: ${depChange.packageName} ${depChange.newVersion} ${requiredVersion}`); - change.changeType = Math.max(change.changeType, _changeTypes.patch); - change.newVersion = semver.inc(pkg.version, _changeTypes[change.changeType]); - } - } - } - pkg.version = change.newVersion; + change.changes.forEach(subChange => subChange.comments.forEach(comment => console.log( ` - [${subChange.type}] ${comment}`))); + if (_shouldCommit) { fs.writeFileSync(change.packagePath, JSON.stringify(pkg, null, 2), 'utf8'); } } -function execCommand(commandLine, workingPath) { +function execCommand(commandLine, workingPath, isDisabled) { workingPath = workingPath || process.cwd(); console.log(`Executing: "${commandLine}" from ${workingPath}`); - if (_shouldCommit) { + if (_shouldCommit && !isDisabled) { execSync(commandLine, { cwd: workingPath }); @@ -229,7 +183,7 @@ function gitAddTags(allChanges) { let change = allChanges[packageName]; if (change.changeType > _changeTypes.dependency) { - let tagName = packageName + ':v' + change.newVersion; + let tagName = packageName + '_v' + change.newVersion; execCommand(`git tag ${tagName}`); } @@ -241,41 +195,69 @@ function gitCommit() { } function gitPush() { - execCommand('git push --follow-tags'); + execCommand('git push --follow-tags', null, true); } function publishPackage(change) { - execCommand(`npm publish`, change.packagePath); + execCommand(`npm publish`, change.packagePath, true); } function updateChangeLog(change) { - console.log(` - TODO: updating CHANGELOG.md`); +// console.log(` - TODO: updating CHANGELOG.md`); } function deleteChangeFiles() { - if (_shouldCommit) { - let changesPath = path.join(process.cwd(), 'changes'); - let changeFiles = []; + let changesPath = path.join(process.cwd(), 'changes'); + let changeFiles = []; - try { - changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); - } catch (e) { } + try { + changeFiles = fs.readdirSync(changesPath).filter(filename => filename.indexOf('.json') >= 0); + } catch (e) { } - if (changeFiles.length) { - console.log(os.EOL + `Deleting ${changeFiles.length} change file(s).`); + if (changeFiles.length) { + console.log(os.EOL + `Deleting ${changeFiles.length} change file(s).`); - for (let fileName of changeFiles) { - let filePath = path.join(changesPath, fileName); + for (let fileName of changeFiles) { + let filePath = path.join(changesPath, fileName); - console.log(` - ${filePath}`); + console.log(` - ${filePath}`); + if (_shouldCommit) { deleteFile(filePath); } } } } +/** Apply set of changes. */ +function applyChanges(allChanges) { + let orderedChanges = ( + Object + .keys(allChanges) + .map(key => allChanges[key]) + .sort((a, b) => a.order < b.order ? -1 : 1)); + + if (orderedChanges.length > 1) { + for (let change of orderedChanges) { + updatePackage(change, allChanges); + updateChangeLog(change); + } + + deleteChangeFiles(); + gitAddChanges(allChanges); + gitCommit(); + gitAddTags(allChanges); + gitPush(); + + for (let change of orderedChanges) { + if (change.changeType > _changeTypes.dependency) { + publishPackage(change); + } + } + } +} + + let changes = findChangesSync(); -applyChanges(changes); -// printChanges(changes); \ No newline at end of file +applyChanges(changes); \ No newline at end of file From 065b1fe3e26dc2acb46776696ce0b7619e3f2c6d Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 16:36:56 -0700 Subject: [PATCH 09/14] Changes --- .vscode/launch.json | 4 ++-- changes/testbump-guid.json | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 21d3c6d8fd2..7e816b25572 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,10 +5,10 @@ "name": "Launch", "type": "node", "request": "launch", - "program": "node_modules/gulp/bin/gulp.js", + "program": "${workspaceRoot}/scripts/publish.js", "stopOnEntry": false, "args": [], - "cwd": ".", + "cwd": "${workspaceRoot}", "runtimeExecutable": null, "runtimeArgs": [ "--nolazy" diff --git a/changes/testbump-guid.json b/changes/testbump-guid.json index 6866ee48764..c3e626d8997 100644 --- a/changes/testbump-guid.json +++ b/changes/testbump-guid.json @@ -1,14 +1,18 @@ { "changes": [ { - "packageName": "@microsoft/gulp-core-build-sass", + "packageName": "@microsoft/gulp-core-build", "type": "patch", - "comments": ["Fixing bug that caused x issue."] + "comments": [ + "Fixing bug that caused x issue." + ] }, { - "packageName": "@microsoft/gulp-core-build-typescript", + "packageName": "@microsoft/gulp-core-build-sass", "type": "patch", - "comments": ["b"] + "comments": [ + "Fixing bug that caused x issue." + ] } ] -} +} \ No newline at end of file From ed17a9e163eb7dd8431ced057cd905d61f99f60e Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 16:39:59 -0700 Subject: [PATCH 10/14] npmx update. --- npmx.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/npmx.json b/npmx.json index d5029a0df57..fda6eb54c0e 100644 --- a/npmx.json +++ b/npmx.json @@ -61,6 +61,10 @@ { "packageName": "@microsoft/web-library-build", "projectFolder": "web-library-build" + }, + { + "packageName": "web-build-tools-scripts", + "projectFolder": "scripts" } ] } \ No newline at end of file From abfc3d404e546b7a7533e6eb254f0718e68966e5 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 16:56:54 -0700 Subject: [PATCH 11/14] Updating shrinkwrap. --- common/npm-shrinkwrap.json | 185 +++++++----------- common/package.json | 3 +- .../npmx-web-build-tools-scripts/package.json | 9 + 3 files changed, 81 insertions(+), 116 deletions(-) create mode 100644 common/temp_modules/npmx-web-build-tools-scripts/package.json diff --git a/common/npm-shrinkwrap.json b/common/npm-shrinkwrap.json index d8760dfe5ad..ebda5065af2 100644 --- a/common/npm-shrinkwrap.json +++ b/common/npm-shrinkwrap.json @@ -67,21 +67,9 @@ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz" }, "accepts": { - "version": "1.1.4", - "from": "accepts@1.1.4", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.1.4.tgz", - "dependencies": { - "mime-db": { - "version": "1.12.0", - "from": "mime-db@>=1.12.0 <1.13.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.12.0.tgz" - }, - "mime-types": { - "version": "2.0.14", - "from": "mime-types@>=2.0.4 <2.1.0", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.14.tgz" - } - } + "version": "1.3.3", + "from": "accepts@1.3.3", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz" }, "acorn": { "version": "3.3.0", @@ -269,9 +257,9 @@ "resolved": "https://registry.npmjs.org/Base64/-/Base64-0.2.1.tgz" }, "base64-arraybuffer": { - "version": "0.1.2", - "from": "base64-arraybuffer@0.1.2", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.2.tgz" + "version": "0.1.5", + "from": "base64-arraybuffer@0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz" }, "base64-js": { "version": "1.2.0", @@ -330,9 +318,9 @@ "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz" }, "binary-extensions": { - "version": "1.6.0", + "version": "1.7.0", "from": "binary-extensions@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.6.0.tgz" + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.7.0.tgz" }, "binaryextensions": { "version": "1.0.1", @@ -459,9 +447,9 @@ "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-2.1.0.tgz" }, "caniuse-db": { - "version": "1.0.30000541", + "version": "1.0.30000547", "from": "caniuse-db@>=1.0.30000488 <2.0.0", - "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000541.tgz" + "resolved": "https://registry.npmjs.org/caniuse-db/-/caniuse-db-1.0.30000547.tgz" }, "cardinal": { "version": "1.0.0", @@ -837,9 +825,9 @@ "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-1.0.12.tgz" }, "deasync": { - "version": "0.1.7", + "version": "0.1.8", "from": "deasync@>=0.1.7 <0.2.0", - "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.7.tgz" + "resolved": "https://registry.npmjs.org/deasync/-/deasync-0.1.8.tgz" }, "debug": { "version": "2.2.0", @@ -977,9 +965,9 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz" }, "emojis-list": { - "version": "2.0.1", + "version": "2.1.0", "from": "emojis-list@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.0.1.tgz" + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz" }, "encodeurl": { "version": "1.0.1", @@ -999,26 +987,19 @@ } }, "engine.io": { - "version": "1.6.11", - "from": "engine.io@1.6.11", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.6.11.tgz" + "version": "1.7.0", + "from": "engine.io@1.7.0", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.7.0.tgz" }, "engine.io-client": { - "version": "1.6.11", - "from": "engine.io-client@1.6.11", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.6.11.tgz", - "dependencies": { - "ws": { - "version": "1.0.1", - "from": "ws@1.0.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.0.1.tgz" - } - } + "version": "1.7.0", + "from": "engine.io-client@1.7.0", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-1.7.0.tgz" }, "engine.io-parser": { - "version": "1.2.4", - "from": "engine.io-parser@1.2.4", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.2.4.tgz", + "version": "1.3.0", + "from": "engine.io-parser@1.3.0", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-1.3.0.tgz", "dependencies": { "has-binary": { "version": "0.1.6", @@ -1057,19 +1038,7 @@ "errorhandler": { "version": "1.4.3", "from": "errorhandler@>=1.4.2 <1.5.0", - "resolved": "https://registry.npmjs.org/errorhandler/-/errorhandler-1.4.3.tgz", - "dependencies": { - "accepts": { - "version": "1.3.3", - "from": "accepts@>=1.3.0 <1.4.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz" - }, - "negotiator": { - "version": "0.6.1", - "from": "negotiator@0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz" - } - } + "resolved": "https://registry.npmjs.org/errorhandler/-/errorhandler-1.4.3.tgz" }, "es5-ext": { "version": "0.10.12", @@ -1186,19 +1155,7 @@ "express": { "version": "4.14.0", "from": "express@>=4.14.0 <4.15.0", - "resolved": "https://registry.npmjs.org/express/-/express-4.14.0.tgz", - "dependencies": { - "accepts": { - "version": "1.3.3", - "from": "accepts@>=1.3.3 <1.4.0", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz" - }, - "negotiator": { - "version": "0.6.1", - "from": "negotiator@0.6.1", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz" - } - } + "resolved": "https://registry.npmjs.org/express/-/express-4.14.0.tgz" }, "express-session": { "version": "1.11.3", @@ -1342,16 +1299,9 @@ "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.4.2.tgz" }, "fined": { - "version": "1.0.1", + "version": "1.0.2", "from": "fined@>=1.0.1 <2.0.0", - "resolved": "https://registry.npmjs.org/fined/-/fined-1.0.1.tgz", - "dependencies": { - "lodash.isarray": { - "version": "4.0.0", - "from": "lodash.isarray@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-4.0.0.tgz" - } - } + "resolved": "https://registry.npmjs.org/fined/-/fined-1.0.2.tgz" }, "first-chunk-stream": { "version": "1.0.0", @@ -1394,9 +1344,9 @@ "resolved": "https://registry.npmjs.org/async/-/async-2.0.1.tgz" }, "lodash": { - "version": "4.16.2", + "version": "4.16.4", "from": "lodash@>=4.8.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.2.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.4.tgz" } } }, @@ -1900,9 +1850,9 @@ "resolved": "https://registry.npmjs.org/gulp-istanbul/-/gulp-istanbul-0.10.4.tgz", "dependencies": { "lodash": { - "version": "4.16.2", + "version": "4.16.4", "from": "lodash@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.2.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.4.tgz" } } }, @@ -2333,9 +2283,9 @@ "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz" }, "ieee754": { - "version": "1.1.6", + "version": "1.1.8", "from": "ieee754@>=1.1.4 <2.0.0", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.6.tgz" + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.8.tgz" }, "in-publish": { "version": "2.0.0", @@ -2465,9 +2415,9 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz" }, "is-my-json-valid": { - "version": "2.14.0", + "version": "2.15.0", "from": "is-my-json-valid@>=2.12.4 <3.0.0", - "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.14.0.tgz" + "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz" }, "is-number": { "version": "2.1.0", @@ -2739,9 +2689,9 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz" }, "jsonpointer": { - "version": "2.0.0", - "from": "jsonpointer@2.0.0", - "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-2.0.0.tgz" + "version": "4.0.0", + "from": "jsonpointer@>=4.0.0 <5.0.0", + "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.0.tgz" }, "jsprim": { "version": "1.3.1", @@ -2803,9 +2753,9 @@ "resolved": "https://registry.npmjs.org/karma-phantomjs-launcher/-/karma-phantomjs-launcher-1.0.2.tgz", "dependencies": { "lodash": { - "version": "4.16.2", + "version": "4.16.4", "from": "lodash@>=4.0.1 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.2.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.4.tgz" } } }, @@ -3421,9 +3371,9 @@ "resolved": "https://registry.npmjs.org/natives/-/natives-1.1.0.tgz" }, "negotiator": { - "version": "0.4.9", - "from": "negotiator@0.4.9", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.4.9.tgz" + "version": "0.6.1", + "from": "negotiator@0.6.1", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz" }, "node-emoji": { "version": "1.4.1", @@ -3598,6 +3548,11 @@ "from": "temp_modules/npmx-node-library-build", "resolved": "file:temp_modules/npmx-node-library-build" }, + "npmx-web-build-tools-scripts": { + "version": "0.0.0", + "from": "temp_modules/npmx-web-build-tools-scripts", + "resolved": "file:temp_modules/npmx-web-build-tools-scripts" + }, "npmx-web-library-build": { "version": "0.0.0", "from": "temp_modules/npmx-web-library-build", @@ -3855,14 +3810,14 @@ "resolved": "https://registry.npmjs.org/phantomjs-polyfill/-/phantomjs-polyfill-0.0.2.tgz" }, "phantomjs-prebuilt": { - "version": "2.1.12", + "version": "2.1.13", "from": "phantomjs-prebuilt@>=2.1.6 <2.2.0", - "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.12.tgz", + "resolved": "https://registry.npmjs.org/phantomjs-prebuilt/-/phantomjs-prebuilt-2.1.13.tgz", "dependencies": { "es6-promise": { - "version": "3.2.1", - "from": "es6-promise@>=3.2.1 <3.3.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz" + "version": "4.0.5", + "from": "es6-promise@>=4.0.3 <4.1.0", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.0.5.tgz" }, "fs-extra": { "version": "0.30.0", @@ -4230,9 +4185,9 @@ "resolved": "https://registry.npmjs.org/sass-graph/-/sass-graph-2.1.2.tgz", "dependencies": { "lodash": { - "version": "4.16.2", + "version": "4.16.4", "from": "lodash@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.2.tgz" + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.16.4.tgz" }, "yargs": { "version": "4.8.1", @@ -4346,9 +4301,9 @@ "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz" }, "socket.io": { - "version": "1.4.8", + "version": "1.5.0", "from": "socket.io@>=1.4.5 <2.0.0", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.4.8.tgz" + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-1.5.0.tgz" }, "socket.io-adapter": { "version": "0.4.0", @@ -4370,9 +4325,9 @@ } }, "socket.io-client": { - "version": "1.4.8", - "from": "socket.io-client@1.4.8", - "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.4.8.tgz", + "version": "1.5.0", + "from": "socket.io-client@1.5.0", + "resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-1.5.0.tgz", "dependencies": { "component-emitter": { "version": "1.2.0", @@ -4415,9 +4370,9 @@ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz" }, "spdx-expression-parse": { - "version": "1.0.3", + "version": "1.0.4", "from": "spdx-expression-parse@>=1.0.0 <1.1.0", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.3.tgz" + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz" }, "spdx-license-ids": { "version": "1.2.2", @@ -4873,11 +4828,6 @@ } } }, - "utf8": { - "version": "2.1.0", - "from": "utf8@2.1.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.0.tgz" - }, "util": { "version": "0.10.3", "from": "util@>=0.10.3 <1.0.0", @@ -5133,9 +5083,14 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" }, "ws": { - "version": "1.1.0", - "from": "ws@1.1.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.0.tgz" + "version": "1.1.1", + "from": "ws@1.1.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-1.1.1.tgz" + }, + "wtf-8": { + "version": "1.0.0", + "from": "wtf-8@1.0.0", + "resolved": "https://registry.npmjs.org/wtf-8/-/wtf-8-1.0.0.tgz" }, "xmlhttprequest-ssl": { "version": "1.5.1", diff --git a/common/package.json b/common/package.json index e08876a5f35..77739543404 100644 --- a/common/package.json +++ b/common/package.json @@ -8,7 +8,8 @@ "npmx-gulp-core-build-typescript": "file:./temp_modules/npmx-gulp-core-build-typescript", "npmx-gulp-core-build-webpack": "file:./temp_modules/npmx-gulp-core-build-webpack", "npmx-node-library-build": "file:./temp_modules/npmx-node-library-build", - "npmx-web-library-build": "file:./temp_modules/npmx-web-library-build" + "npmx-web-library-build": "file:./temp_modules/npmx-web-library-build", + "npmx-web-build-tools-scripts": "file:./temp_modules/npmx-web-build-tools-scripts" }, "description": "Temporary file generated by the NPMX tool", "name": "npmx-common", diff --git a/common/temp_modules/npmx-web-build-tools-scripts/package.json b/common/temp_modules/npmx-web-build-tools-scripts/package.json new file mode 100644 index 00000000000..17ea786f687 --- /dev/null +++ b/common/temp_modules/npmx-web-build-tools-scripts/package.json @@ -0,0 +1,9 @@ +{ + "name": "npmx-web-build-tools-scripts", + "version": "0.0.0", + "private": true, + "dependencies": { + "rimraf": "^2.5.4", + "semver": "^5.3.0" + } +} From 5ef09207c385491b74c80dfa6fbcb9a746ca57b2 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 17:27:08 -0700 Subject: [PATCH 12/14] Adding strict. --- scripts/utils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/utils.js b/scripts/utils.js index 52fbbbcb489..aaa3216fb91 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -1,3 +1,5 @@ +'use strict'; + let fs = require('fs'); let rimraf = require('rimraf'); From 3480ad577fa7d3092e354d6de840b28675e9574e Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 17:43:36 -0700 Subject: [PATCH 13/14] Updating change file. --- changes/testbump-guid.json | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/changes/testbump-guid.json b/changes/testbump-guid.json index c3e626d8997..f7995416895 100644 --- a/changes/testbump-guid.json +++ b/changes/testbump-guid.json @@ -1,17 +1,10 @@ { "changes": [ { - "packageName": "@microsoft/gulp-core-build", + "packageName": "@microsoft/gulp-core-serve", "type": "patch", "comments": [ - "Fixing bug that caused x issue." - ] - }, - { - "packageName": "@microsoft/gulp-core-build-sass", - "type": "patch", - "comments": [ - "Fixing bug that caused x issue." + "Republishing a package from new repo." ] } ] From fd787102ef4aafa3176127d34664847533739979 Mon Sep 17 00:00:00 2001 From: David Zearing Date: Thu, 6 Oct 2016 17:53:34 -0700 Subject: [PATCH 14/14] Renabling git push and publish. Deleting changelog updating placeholder for now. --- scripts/publish.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/publish.js b/scripts/publish.js index 38f77f58b87..f40c29f6d4c 100644 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -195,15 +195,11 @@ function gitCommit() { } function gitPush() { - execCommand('git push --follow-tags', null, true); + execCommand('git push --follow-tags'); } function publishPackage(change) { - execCommand(`npm publish`, change.packagePath, true); -} - -function updateChangeLog(change) { -// console.log(` - TODO: updating CHANGELOG.md`); + execCommand(`npm publish`, change.packagePath); } function deleteChangeFiles() { @@ -240,7 +236,6 @@ function applyChanges(allChanges) { if (orderedChanges.length > 1) { for (let change of orderedChanges) { updatePackage(change, allChanges); - updateChangeLog(change); } deleteChangeFiles();