-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(testUnit): use consistent /coverage directory for Node & Browser…
… projects Add integration test for coverage report to ensure it is created in the right place
- Loading branch information
Brett Uglow
committed
Nov 27, 2016
1 parent
164877b
commit 7b2bfca
Showing
9 changed files
with
72 additions
and
27 deletions.
There are no files selected for viewing
46 changes: 39 additions & 7 deletions
46
lib/buildTool/npm/documentation/templates/config/prepublish.js.tpl
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 |
---|---|---|
@@ -1,25 +1,57 @@ | ||
'use strict'; | ||
|
||
// START_CONFIT_GENERATED_CONTENT | ||
// Update the swanky.config.yaml file's version number | ||
// START_CONFIT_GENERATED_CONTENT<% | ||
var configPath = paths.config.configDir + resources.documentation.configSubDir; | ||
var relativePath = configPath.replace(/([^/]+)/g, '..'); | ||
%> | ||
const path = require('path'); | ||
const basePath = path.join(__dirname, '/<%= relativePath %>'); | ||
const latestVersion = require('latest-version'); | ||
const fs = require('fs'); | ||
const pkgName = '<%- pkg.name %>'; | ||
const pkgRepo = '<%- pkg.repository.url.substr(pkg.repository.url.lastIndexOf('/') + 1).replace('.git', '') %>'; | ||
|
||
const IS_DRYRUN = process.argv.indexOf('-d') > -1; // Allow a dry-run to see what changes would be made | ||
|
||
let FILES_TO_PROCESS = [ | ||
// Update the swanky.config.yaml file's version number and server path | ||
{ | ||
name: '<%= documentation.srcDir %>swanky.config.yaml', | ||
searchRE: /^version:.*$/m, | ||
replacement: (version) => `version: ${version}` | ||
}, | ||
{ | ||
name: '<%= documentation.srcDir %>swanky.config.yaml', | ||
searchRE: /^serverPath:.*$/m, | ||
replacement: () => `serverPath: ${pkgRepo}` | ||
} | ||
]; | ||
|
||
// In the next section you can modify FILES_TO_PROCESS to meet your needs... | ||
// END_CONFIT_GENERATED_CONTENT | ||
|
||
|
||
|
||
// START_CONFIT_GENERATED_CONTENT | ||
latestVersion(pkgName).then(version => { | ||
console.log(`Latest version of ${pkgName}: ${version}`); | ||
|
||
// Read Swanky config YAML file, modify the version and server-path, then save it again | ||
let text = fs.readFileSync('<%= documentation.srcDir %>swanky.config.yaml', 'utf8'); | ||
// Patch the files | ||
FILES_TO_PROCESS.forEach(file => { | ||
let fileName = path.join(basePath, file.name); | ||
let text = fs.readFileSync(fileName, 'utf8'); | ||
text = text.replace(/^version:.*$/m, `version: ${version}`); | ||
text = text.replace(/^serverPath:.*$/m, `serverPath: ${pkgRepo}`); | ||
text = text.replace(file.searchRE, file.replacement(version)); | ||
fs.writeFileSync('<%= documentation.srcDir %>swanky.config.yaml', text, 'utf8'); | ||
if (IS_DRYRUN) { | ||
console.info(`Updated version in ${file.name}:`); | ||
console.info(text); | ||
console.info('---------------'); | ||
} else { | ||
fs.writeFileSync(fileName, text, 'utf8'); | ||
console.log(`Updated version in ${file.name}`); | ||
} | ||
}); | ||
}); | ||
// END_CONFIT_GENERATED_CONTENT | ||
|
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
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