generated from rose-pine/rose-pine-template
-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from jorismertz/main
Import list generator script & workflow
- Loading branch information
Showing
30 changed files
with
134 additions
and
35 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Update release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'styles/**/rose-pine.user.css' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
release: | ||
name: Update release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
run: | | ||
bash ./build.sh | ||
cd ./scripts && npm install && cd .. | ||
node ./scripts/generate-imports.js | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh release upload userstyle-imports import.json --clobber |
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,4 @@ | ||
scripts/node_modules | ||
package-lock.json | ||
bun.lockb | ||
import.json |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
npx prettier@latest --parser=less --write ./**/*.css | ||
npx prettier@latest --parser=less --write ./styles/**/*.css | ||
npx prettier@latest --write ./**/*.md |
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,59 @@ | ||
#!/usr/bin/env node | ||
|
||
import * as fs from "fs"; | ||
import usercssMeta from "usercss-meta"; | ||
|
||
const settings = { | ||
updateInterval: 24, | ||
updateOnlyEnabled: true, | ||
patchCsp: true, | ||
}; | ||
|
||
const result = []; | ||
const ignored = []; | ||
|
||
console.log("Generating import list..."); | ||
|
||
const themes = fs.readdirSync("./styles"); | ||
for (const theme of themes) { | ||
const data = fs.readFileSync(`./styles/${theme}/rose-pine.user.css`); | ||
const metaDataRegex = /\/\*\s*==UserStyle==.*==\/UserStyle==\s*\*\//is; | ||
const metaData = metaDataRegex.exec(data.toString()); | ||
|
||
if (!metaData) { | ||
ignored.push(theme); | ||
continue; | ||
} | ||
|
||
const usercssData = usercssMeta.parse(metaData[0]).metadata; | ||
result.push({ | ||
enabled: true, | ||
name: usercssData.name ?? "", | ||
description: usercssData.description ?? "", | ||
author: "Rose Piné", | ||
updateUrl: usercssData.updateURL ?? "", | ||
usercssData, | ||
sourceCode: data.toString(), | ||
}); | ||
} | ||
|
||
fs.writeFileSync( | ||
"import.json", | ||
JSON.stringify( | ||
[ | ||
{ | ||
settings, | ||
}, | ||
...result, | ||
], | ||
null, | ||
2, | ||
), | ||
); | ||
|
||
if (ignored.length) { | ||
console.log( | ||
"The following themes were ignored because they are missing UserCSS metadata:", | ||
ignored.join(", "), | ||
); | ||
} |
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,7 @@ | ||
{ | ||
"name": "scripts", | ||
"type": "module", | ||
"dependencies": { | ||
"usercss-meta": "^0.12.0" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
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
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
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
Oops, something went wrong.