Skip to content

Commit c833ecb

Browse files
committed
(chore)package CDN for NPM
1 parent 06b24af commit c833ecb

File tree

3 files changed

+57
-2
lines changed

3 files changed

+57
-2
lines changed

README.CDN.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Highlight.js CDN Assets
2+
3+
[![install size](https://packagephobia.now.sh/badge?p=highlight.js)](https://packagephobia.now.sh/result?p=highlight.js)
4+
5+
**This package contains only the CDN build assets of highlight.js.**
6+
7+
This may be what you want if you'd like to install the pre-built distributable highlight.js client-side assets via NPM. If you're wanting to use highlight.js mainly on the server-side you likely want the [highlight.js][1] package instead.
8+
9+
To access these files via CDN:<br>
10+
https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/
11+
12+
**If you just want a single .js file with the common languages built-in:
13+
<https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js>**
14+
15+
---
16+
17+
## Highlight.js
18+
19+
Highlight.js is a syntax highlighter written in JavaScript. It works in
20+
the browser as well as on the server. It works with pretty much any
21+
markup, doesn’t depend on any framework, and has automatic language
22+
detection.
23+
24+
If you'd like to read the full README:<br>
25+
<https://github.com/highlightjs/highlight.js/blob/master/README.md>
26+
27+
## License
28+
29+
Highlight.js is released under the BSD License. See [LICENSE][7] file
30+
for details.
31+
32+
## Links
33+
34+
The official site for the library is at <https://highlightjs.org/>.
35+
36+
The Github project may be found at: <https://github.com/highlightjs/highlight.js>
37+
38+
Further in-depth documentation for the API and other topics is at
39+
<http://highlightjs.readthedocs.io/>.
40+
41+
Authors and contributors are listed in the [AUTHORS.txt][8] file.
42+
43+
[1]: https://www.npmjs.com/package/highlight.js
44+
[7]: https://github.com/highlightjs/highlight.js/blob/master/LICENSE
45+
[8]: https://github.com/highlightjs/highlight.js/blob/master/AUTHORS.txt

tools/build_cdn.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,20 @@ const config = require("./build_config");
77
const { install, install_cleancss, mkdir } = require("./lib/makestuff");
88
const log = (...args) => console.log(...args);
99
const { buildBrowserHighlightJS } = require("./build_browser");
10+
const { buildPackageJSON } = require("./build_node");
1011
const path = require("path");
1112

13+
async function installPackageJSON() {
14+
await buildPackageJSON();
15+
let json = require(`${process.env.BUILD_DIR}/package`);
16+
json.name = "highlight.js-cdn-assets";
17+
fs.writeFile(`${process.env.BUILD_DIR}/package.json`, JSON.stringify(json, null, ' '));
18+
}
19+
1220
async function buildCDN(options) {
1321
install("./LICENSE", "LICENSE");
14-
install("./README.md","README.md");
22+
install("./README.CDN.md","README.md");
23+
installPackageJSON();
1524

1625
installStyles();
1726

tools/build_node.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ async function buildPackageJSON() {
5757
}
5858
return acc;
5959
}, []);
60-
fs.writeFile(`${process.env.BUILD_DIR}/package.json`, JSON.stringify(json, null, ' '));
60+
await fs.writeFile(`${process.env.BUILD_DIR}/package.json`, JSON.stringify(json, null, ' '));
6161
}
6262

6363
async function buildLanguages(languages) {
@@ -100,3 +100,4 @@ async function buildNode(options) {
100100
}
101101

102102
module.exports.build = buildNode;
103+
module.exports.buildPackageJSON = buildPackageJSON;

0 commit comments

Comments
 (0)