Skip to content

Commit 087fa40

Browse files
authored
Merge pull request #25 from dabico/refactoring/esm
2 parents f09a5cb + cb986ba commit 087fa40

File tree

9 files changed

+312
-326
lines changed

9 files changed

+312
-326
lines changed

.github/workflows/publish.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
push:
44
tags:
55
- 'v*'
6-
workflow_dispatch:
6+
77
jobs:
88
publish:
99
runs-on: ubuntu-latest
@@ -13,12 +13,12 @@ jobs:
1313
- name: Setup Node
1414
uses: actions/setup-node@v4
1515
with:
16-
node-version: '18'
16+
node-version: '20'
1717
registry-url: 'https://registry.npmjs.org'
1818
- name: Install dependencies
1919
run: npm clean-install
2020
- name: Generate CSS files
21-
run: npm run generate
21+
run: npm run build
2222
- name: Prepare files
2323
run: |
2424
mkdir octicons
@@ -39,5 +39,3 @@ jobs:
3939
if: startsWith(github.ref, 'refs/tags/')
4040
with:
4141
files: octicons.tar.gz
42-
- name: Clean up generated files
43-
run: npm run clean

.idea/runConfigurations/generate.xml .idea/runConfigurations/build.xml

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.prettierrc.js

-11
This file was deleted.

.prettierrc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"endOfLine": "lf",
3+
"printWidth": 120,
4+
"tabWidth": 4,
5+
"useTabs": false,
6+
"singleQuote": false,
7+
"arrowParens": "always",
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"semi": true
11+
}

eslint.config.js

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import recommendedConfig from "eslint-plugin-prettier/recommended";
4+
import eslintConfigPrettier from "eslint-config-prettier";
5+
6+
const { rules: prettierRules } = eslintConfigPrettier;
7+
const prettierConfigsRecommended = recommendedConfig;
18
const {
2-
configs: { recommended: jsConfigRecommended },
3-
} = require("@eslint/js");
4-
const { node, es2024 } = require("globals");
5-
const esLintConfigPrettier = require("eslint-config-prettier");
6-
const prettierRecommended = require("eslint-plugin-prettier/recommended");
9+
configs: { recommended: jsConfigsRecommended },
10+
} = js;
711

8-
module.exports = [
9-
jsConfigRecommended,
10-
prettierRecommended,
11-
esLintConfigPrettier,
12+
export default [
13+
jsConfigsRecommended,
14+
prettierConfigsRecommended,
1215
{
13-
files: ["**/*.js"],
16+
files: ["**/*.js", "octicons-css"],
1417
languageOptions: {
15-
sourceType: "commonjs",
18+
sourceType: "module",
1619
ecmaVersion: 2024,
17-
globals: { ...node, ...es2024 },
20+
globals: {
21+
...globals.node,
22+
...globals.es2024,
23+
},
1824
},
1925
rules: {
26+
...prettierRules,
2027
"no-unused-vars": [
2128
"error",
2229
{

generate.js

-113
This file was deleted.

octicons-css

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env node
2+
import CleanCSS from "clean-css";
3+
import { mkdir, writeFile } from "node:fs/promises";
4+
import { FontAssetType, generateFonts, OtherAssetType } from "fantasticon";
5+
6+
await mkdir("./fonts", { recursive: true });
7+
await generateFonts({
8+
inputDir: "./node_modules/@primer/octicons/build/svg",
9+
outputDir: ".",
10+
name: "octicons",
11+
fontTypes: [
12+
FontAssetType.EOT,
13+
FontAssetType.WOFF2,
14+
FontAssetType.WOFF,
15+
],
16+
assetTypes: [OtherAssetType.CSS],
17+
pathOptions: {
18+
woff: `./fonts/octicons.woff`,
19+
woff2: `./fonts/octicons.woff2`,
20+
eot: `./fonts/octicons.eot`,
21+
},
22+
fontHeight: 300,
23+
descent: undefined,
24+
normalize: true,
25+
round: undefined,
26+
selector: null,
27+
tag: "i",
28+
templates: { css: "./octicons.css.hbs" },
29+
fontsUrl: "./fonts",
30+
prefix: "octicon",
31+
});
32+
33+
const { styles } = await new CleanCSS({ returnPromise: true }).minify(["./octicons.css"]);
34+
await writeFile("./octicons.min.css", styles, { flag: "w+" });

0 commit comments

Comments
 (0)