Skip to content

Commit

Permalink
chore(gadget-prism): 开放给所有用户 (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhsd-harry committed Jun 11, 2024
1 parent 88a979a commit 822bde4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 77 deletions.
6 changes: 5 additions & 1 deletion scripts/prefetch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ endGroup();
const fileList = [];
for (const prefetchTarget of prefetchTargets) {
console.info("target:", prefetchTarget);
const { type, moduleName, gadget: { name, fileName }, distFilePath, version, appendCode, removeCode = [], ignoreSemverDiff, url } = prefetchTarget;
const { type, moduleName, gadget: { name, fileName }, distFilePath, appendCode, removeCode = [], ignoreSemverDiff, url } = prefetchTarget;
let { version } = prefetchTarget;
const file = path.join("src/gadgets", name, fileName);
fileList.push(file);
console.info(`[${name}]`, "Start to fetch...");
Expand Down Expand Up @@ -97,6 +98,9 @@ for (const prefetchTarget of prefetchTargets) {
console.info(`[${name}]`, "wrote the code file and eslintrc successfully.");
if (type === "npm") {
const packageInfo = await fetchNPMPackageInfo(moduleName);
if (Object.hasOwn(packageInfo["dist-tags"], version)) {
version = packageInfo["dist-tags"][version];
}
const distVersions = Object.keys(packageInfo.versions);
console.info(`[${name}]`, "distVersions:", distVersions);
const targetVersion = semver.maxSatisfying(distVersions, version || "*");
Expand Down
16 changes: 8 additions & 8 deletions scripts/prefetch/targets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
distFilePath: dist/localforage.js
version: "1"

- type: npm
gadget:
name: prism-language-wiki
fileName: MediaWiki:Gadget-wikiparser-node.js
moduleName: wikiparser-node
distFilePath: bundle/bundle.min.js
version: "browser"

- type: npm
gadget:
name: prism-language-javascript
Expand All @@ -30,14 +38,6 @@
distFilePath: components/prism-core.js
version: "1"

- type: npm
gadget:
name: prism-core
fileName: MediaWiki:Gadget-prism-coy.css
moduleName: prismjs
distFilePath: themes/prism-coy.css
version: "1"

- type: npm
gadget:
name: prism-core
Expand Down
35 changes: 10 additions & 25 deletions src/gadgets/prism-core/MediaWiki:Gadget-prism-coy.css

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

75 changes: 38 additions & 37 deletions src/gadgets/prism-language-wiki/MediaWiki:Gadget-wikiparser-node.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/gadgets/prism/MediaWiki:Gadget-prism.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pre.prism-prettyprint-container {
white-space: pre-wrap !important;
#mw-content-text code.prism-prettyprint.language-wiki {
white-space: pre-wrap;
}

.line-numbers span.line-numbers-rows {
Expand Down
6 changes: 2 additions & 4 deletions src/gadgets/prism/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ supportsUrlLoad: false

targets: []

skins:
- vector
skins: []

actions: []

type: general

package: false

rights:
- techedit
rights: []

peers: []

Expand Down

0 comments on commit 822bde4

Please sign in to comment.