Skip to content

Commit

Permalink
tools: add pkg install instruction tpl
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Apr 28, 2020
1 parent 20ce586 commit bc3ca84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/src/partials/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,15 @@ export const packageBanner = (name: string) => {
.substr(0, 8);
return `![${name}](${CONFIG.bannerURL}${name}.svg?${sha1})`;
};

export const packageInstallation = (pkg: Package) => `\`\`\`bash
yarn add ${pkg.name}
\`\`\`
\`\`\`html
// ES module
<script type="module" src="https://unpkg.com/${pkg.name}?module" crossorigin></script>
// UMD
<script src="https://unpkg.com/${pkg.name}/lib/index.umd.js" crossorigin></script>
\`\`\``;
3 changes: 3 additions & 0 deletions tools/src/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
packageBanner,
packageDeps,
packageDesc,
packageInstallation,
packageSize,
packageStatus,
relatedPackages,
Expand All @@ -24,10 +25,12 @@ try {

const partials: IObjectOf<string | Fn0<Nullable<string>>> = {
"pkg.name": CONFIG.root.name,
"pkg.version": CONFIG.root.version,
"pkg.description": () => packageDesc(CONFIG.root),
"pkg.deps": () => packageDeps(CONFIG.root),
"pkg.size": packageSize,
"pkg.banner": () => packageBanner(CONFIG.root.name),
"pkg.install": () => packageInstallation(CONFIG.root),
status: () => packageStatus(CONFIG.meta.status),
examples: () => examplesTable(CONFIG.root.name),
supportPackages: () => supportPackages(CONFIG.root.name),
Expand Down

0 comments on commit bc3ca84

Please sign in to comment.