Skip to content
This repository has been archived by the owner on May 29, 2023. It is now read-only.

Commit

Permalink
Merge 65bbb2e into e9ef3cb
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirpotekhin committed Feb 13, 2020
2 parents e9ef3cb + 65bbb2e commit 2854911
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"build:geolocation": "ng run geolocation:build",
"test:geolocation": "ng run geolocation:test",
"test:geolocation:watch": "ng run geolocation:test --watch=true",
"publish:geolocation": "npm publish ./dist/geolocation"
"publish:geolocation": "npm publish ./dist/geolocation",
"postbuild": "node scripts/postbuild.js"
},
"license": "MIT",
"author": {
Expand Down
25 changes: 25 additions & 0 deletions scripts/postbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');

const DIST_LIB_PATH = 'dist/geolocation/';
const README_PATH = 'README.md';
const ASSETS_PATH = 'projects/demo/src/assets';
const PATH_TO_README = DIST_LIB_PATH + README_PATH;

copyExtraFiles();

function copyExtraFiles() {
if (!fs.existsSync(README_PATH)) {
throw new Error('Requested files do not exit');
} else {
copyReadmeIntoDistFolder(README_PATH, PATH_TO_README);
}
}

function copyReadmeIntoDistFolder(srcPath, toPath) {
const fileBody = fs.readFileSync(srcPath).toString();
const withoutLogos = fileBody
.replace(`![ng-web-apis logo](${ASSETS_PATH}/logo.svg) `, '')
.replace(`<img src="${ASSETS_PATH}/web-api.svg" align="top"> `, '');

fs.writeFileSync(toPath, withoutLogos);
}

0 comments on commit 2854911

Please sign in to comment.