Skip to content

Commit

Permalink
build: copy readmes to dist folder on build
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkgs committed Feb 4, 2024
1 parent 3318549 commit d195d90
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ SVG gauge component for Angular
<table>
<tr>
<td>
<img src="./assets/gauge.png" alt="ng2-gauge" />
<img src="https://raw.githubusercontent.com/hawkgs/ng2-gauge/master/assets/gauge.png" alt="ng2-gauge" />
</td>
<td>
<img src="./assets/demo.gif" />
<img src="https://raw.githubusercontent.com/hawkgs/ng2-gauge/master/assets/demo.gif" />
<p><em>Suitable for building virtual dashboards (initially designed for that).</em></p>
</td>
</tr>
Expand Down
141 changes: 141 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"scripts": {
"ng": "ng",
"start": "ng serve demo-app",
"build": "ng build ng2-gauge",
"build": "ng build ng2-gauge && ts-node ./scripts/copy-readme.ts",
"watch:ng2-gauge": "ng build ng2-gauge --watch",
"test": "ng test",
"lint": "ng lint ng2-gauge"
Expand Down Expand Up @@ -57,6 +57,7 @@
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"ng-packagr": "^17.1.2",
"ts-node": "^10.9.2",
"typescript": "~5.2.2"
}
}
2 changes: 1 addition & 1 deletion projects/ng2-gauge/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"lib": {
"entryFile": "src/public_api.ts"
}
}
}
17 changes: 17 additions & 0 deletions scripts/copy-readme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const fs = require('fs');

const copyFileToBuildRoot = (src: string) => {
const fileName = src.split('/').pop();
fs.copyFile(src, `./dist/ng2-gauge/${fileName}`, (err: unknown) => {
if (err) {
throw new Error(`Unable to copy ${fileName}`);
}
});
};

console.log('Copying additional files to the dist folder ...');

copyFileToBuildRoot('./README.md');
copyFileToBuildRoot('./CHANGELOG.md');

console.log('Done!');

0 comments on commit d195d90

Please sign in to comment.