Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update AspNetCore-v3 projects to 3.1.4; change nuget package deploy t…
…o the same scripts used by v5; read nuget key from file; Release 3.1.4
- Loading branch information
1 parent
e9bfa98
commit 3aa90d9
Showing
11 changed files
with
163 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "aspnetcore-v3", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"deploy-local": "node tools/deploy local", | ||
"deploy-remote": "node tools/deploy remote" | ||
}, | ||
"author": "Jay Traband", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"del": "^6.0.0", | ||
"fs-extra": "^9.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var fs = require("fs-extra"); | ||
var exec = require('child_process').exec; | ||
var del = require('del'); | ||
|
||
|
||
// Get single command line argument, and show usage method if its incorrect */ | ||
function getArg() { | ||
var args = process.argv.slice(2); | ||
if (args.length !== 1 || args[0].indexOf('.js') >= 0) { | ||
var msg = "Usage: " + process.argv[0] + " " + process.argv[1] + " [filenameRoot]" | ||
throw new Error(msg); | ||
} | ||
return args[0]; | ||
} | ||
|
||
// exec cmd, then call fn if cmd was successful | ||
// options.cwd = current working dir | ||
// cb is function(err, stdout, stderr); | ||
function execCmd(cmd, options, callback) { | ||
options = options || {}; | ||
exec(cmd, function (error, stdout, stderr) { | ||
stdout && console.log('stdout: ' + stdout); | ||
stderr && console.log('stderr: ' + stderr); | ||
error && console.log('error: ' + error); | ||
if (callback) callback(error, stdout, stderr); | ||
}); | ||
} | ||
|
||
/** Return the first line of text from the file */ | ||
function readFirstLine(filename) { | ||
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'}); | ||
const line = data.toString().split(/[\r\n]/)[0]; | ||
return line; | ||
} | ||
|
||
module.exports = { | ||
execCmd: execCmd, | ||
getArg: getArg, | ||
readFirstLine: readFirstLine | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/** | ||
* Deploys nupkg to local cache dir for testing | ||
*/ | ||
var fs = require("fs-extra"); | ||
var del = require('del'); | ||
const bu = require('.\\build-utils'); | ||
|
||
const localNugetCacheDir = process.env.LOCALAPPDATA + '\\NuGet\\Test'; | ||
const version = '3.1.4'; | ||
const debugOrRelease = 'Release' | ||
|
||
var baseNames = [ | ||
'Breeze.AspNetCore.NetCore', | ||
'Breeze.Core', | ||
'Breeze.Persistence', | ||
'Breeze.Persistence.EFCore', | ||
'Breeze.Persistence.NH', | ||
]; | ||
|
||
const arg = bu.getArg(); | ||
argl = arg.toLowerCase(); | ||
if (argl == 'local') { | ||
deployLocal(); | ||
} else if (argl == 'remote') { | ||
deployRemote(); | ||
} else { | ||
console.log(`You must pass in either 'local' or 'remote'. You passed: ${argl}`); | ||
} | ||
|
||
// should ONLY be called manually after testing locally installed nugets from nugetPack step. | ||
// deliberately does NOT have a dependency on nugetPack | ||
|
||
function deployLocal() { | ||
deleteLocalAppCache(baseNames); | ||
const nupkgs = getNupkgs(baseNames); | ||
nupkgs.forEach(nupkg => { | ||
// call will look something like the line below | ||
// --> nuget add .\Breeze.Core\bin\Debug\Breeze.Core.5.0.2.nupkg -Source C:/Users/Jay/AppData/Local/NuGet/Test | ||
cmd = `nuget add ${nupkg} -Source ${localNugetCacheDir}`; | ||
console.log(cmd); | ||
bu.execCmd(cmd); | ||
}); | ||
} | ||
|
||
function deployRemote() { | ||
// Before running, put the nuget key in a file 2 levels above (outside the repo) | ||
const key = bu.readFirstLine('../../~nugetkey.txt'); | ||
const nupkgs = getNupkgs(baseNames); | ||
nupkgs.forEach(nupkg => { | ||
var cmd = `nuget push ${nupkg} ${key} -Source https://www.nuget.org`; | ||
console.log(cmd); | ||
bu.execCmd(cmd); | ||
}); | ||
} | ||
|
||
function getNupkgs(baseNames) { | ||
const nupkgs = baseNames.map(baseName => { | ||
// check if nupkg exists. | ||
var fn = `.\\${baseName}\\bin\\${debugOrRelease}\\${baseName}.${version}.nupkg`; | ||
if (!fs.existsSync(fn)) { | ||
console.log('Unable to locate: ' + fn); | ||
process.exit(1); | ||
} | ||
return fn; | ||
}); | ||
return nupkgs; | ||
} | ||
|
||
function deleteLocalAppCache(baseNames) { | ||
baseNames.forEach(baseName => { | ||
const cacheDir = localNugetCacheDir + '\\' + baseName; | ||
console.log(cacheDir); | ||
if (fs.existsSync(cacheDir)) { | ||
console.log('Deleting: ' + cacheDir) | ||
del(cacheDir, { force: true} ); | ||
} | ||
}) | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters