This repository has been archived by the owner on May 29, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
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
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); | ||
} |