Skip to content

Commit

Permalink
Publish readme
Browse files Browse the repository at this point in the history
  • Loading branch information
b-gran committed Apr 8, 2018
1 parent e86e358 commit feccc89
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .neutrinorc.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ module.exports = {
const isNextRelease = neutrino.options.args.next
const packageJson = neutrino.options.packageJson
const mainFile = path.resolve(path.join(neutrino.options.output, packageJson.main))
const readme = path.join(__dirname, 'README.md')

return Future.node(done => fs.access(mainFile, done))
.mapRej(() => {
Expand All @@ -136,6 +137,20 @@ module.exports = {
.node(done => fs.writeFile(publishablePackageJsonPath, packageJsonString, done))
})

// Copy README to build & substitute assets
.chain(() => Future.node(done => fs.readFile(readme, done)))
.chain(readmeContents => {
const substituteAssets = readmeContents.toString().replace(
/\(assets\/([\w\-_.]+)\)/,
'(https://github.com/b-gran/object-editor-react/raw/master/assets/$1)'
)
return Future.node(done => fs.writeFile(
path.resolve(path.join(neutrino.options.output, 'README.md')),
substituteAssets,
done
))
})

// Run publish
.chain(() => {
console.log()
Expand Down

0 comments on commit feccc89

Please sign in to comment.