webfont-builder 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ name: Build and Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - name: 📥 Checkout repository
14
+ uses: actions/checkout@v4
15
+
16
+ - name: 🔧 Set up Node.js
17
+ uses: actions/setup-node@v4
18
+ with:
19
+ node-version: '22'
20
+ registry-url: 'https://registry.npmjs.org/'
21
+
22
+ - name: 📦 Install dependencies
23
+ run: npm ci
24
+
25
+ - name: 🚀 Publish to npm
26
+ run: npm publish
27
+ env:
28
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
29
+
30
+ - name: 🏷️ Extract version from package.json
31
+ id: extract_version
32
+ run: |
33
+ VERSION=$(node -p "require('./package.json').version")
34
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
35
+
36
+ - name: 🏷️ Create and push Git tag
37
+ run: |
38
+ git config user.name "github-actions"
39
+ git config user.email "github-actions@github.com"
40
+ git tag -a "v${{ steps.extract_version.outputs.version }}" -m "Release v${{ steps.extract_version.outputs.version }}"
41
+ git push origin "v${{ steps.extract_version.outputs.version }}"
@@ -0,0 +1,35 @@
1
+ # defaults
2
+ **/.git
3
+ **/.svn
4
+ **/.hg
5
+ **/node_modules
6
+
7
+ # build and dist Output
8
+ dist
9
+ build
10
+ .out
11
+ .next
12
+
13
+ # logs
14
+ npm-debug.log
15
+ yarn-debug.log
16
+ yarn-error.log
17
+ pnpm-debug.log
18
+
19
+ # environment files
20
+ .env
21
+ .env.local
22
+ .env.*.local
23
+
24
+ # lockfiles (if using a monorepo or specific package manager setup)
25
+ package-lock.json
26
+ yarn.lock
27
+ pnpm-lock.yaml
28
+
29
+ # miscellaneous
30
+ coverage/
31
+ .DS_Store
32
+ *.min.js
33
+ public/
34
+ tmp/
35
+ *.md
package/.prettierrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "trailingComma": "all",
7
+ "printWidth": 100,
8
+ "bracketSpacing": true,
9
+ "arrowParens": "always",
10
+ "endOfLine": "lf",
11
+ "singleAttributePerLine": true
12
+ }
package/README.md CHANGED
@@ -4,22 +4,33 @@ The `webfont-builder` package is a simple script which purpose is to help build
4
4
 
5
5
  ## Getting Started
6
6
 
7
- 1. Install `webfont-builder` in the font package:
7
+ Install the package:
8
8
 
9
9
  ```bash
10
- $ npm install -D webfont-builder
10
+ npm i -D webfont-builder
11
11
  ```
12
12
 
13
- 2. Invoke the builder:
13
+ Include the binary in your `build` script:
14
+
15
+ ```json
16
+ {
17
+ ...
18
+ "scripts": {
19
+ "build": "webfont-builder",
20
+ ...
21
+ },
22
+ ...
23
+ }
24
+ ```
14
25
 
26
+ Build the font:
15
27
  ```bash
16
- $ webfont-builder
28
+ npm run build
17
29
  ```
18
30
 
19
31
 
20
32
 
21
33
 
22
-
23
34
  <br/>
24
35
 
25
36
  ## Built With
@@ -44,22 +55,4 @@ $ webfont-builder
44
55
 
45
56
  ## Acknowledgments
46
57
 
47
- - [clean-css](https://github.com/clean-css/clean-css)
48
-
49
-
50
-
51
-
52
-
53
- <br/>
54
-
55
- ## Deployment
56
-
57
- 1. Install dependencies:
58
- ```bash
59
- $ npm install
60
- ```
61
-
62
- 3. Publish to `npm`:
63
- ```bash
64
- $ npm publish
65
- ```
58
+ - [clean-css](https://github.com/clean-css/clean-css)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webfont-builder",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "The webfont-builder package is a simple script which purpose is to help build Web Fonts so they can be easily self-hosted in production-grade applications.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -8,6 +8,9 @@
8
8
  "start": "node src/index.js",
9
9
  "test": "echo \"Error: no test specified\" && exit 1"
10
10
  },
11
+ "bin": {
12
+ "webfont-builder": "./src/index.js"
13
+ },
11
14
  "repository": {
12
15
  "type": "git",
13
16
  "url": "git+https://github.com/jesusgraterol/webfont-builder.git"
@@ -19,6 +22,10 @@
19
22
  },
20
23
  "homepage": "https://github.com/jesusgraterol/webfont-builder#readme",
21
24
  "dependencies": {
22
- "clean-css": "^5.3.3"
25
+ "clean-css": "5.3.3"
26
+ },
27
+ "devDependencies": {
28
+ "eslint-config-prettier": "10.1.5",
29
+ "prettier": "3.6.2"
23
30
  }
24
31
  }
package/src/index.js CHANGED
@@ -1,13 +1,7 @@
1
1
  #! /usr/bin/env node
2
- import {
3
- rmSync,
4
- mkdirSync,
5
- writeFileSync,
6
- cpSync
7
- } from 'node:fs';
2
+ import { rmSync, mkdirSync, writeFileSync, cpSync } from 'node:fs';
8
3
  import CleanCSS from 'clean-css';
9
4
 
10
-
11
5
  /* ************************************************************************************************
12
6
  * HELPERS *
13
7
  ************************************************************************************************ */
@@ -26,27 +20,24 @@ const __cleanDist = () => {
26
20
  const __minifyFontDeclaration = () => {
27
21
  const file = new CleanCSS().minify(['src/index.css']);
28
22
  writeFileSync('dist/index.css', file.styles, { encoding: 'utf-8' });
29
- }
23
+ };
30
24
 
31
25
  /**
32
26
  * Copies the raw font assets from the source into the distribution directory.
33
27
  */
34
28
  const __copyFontAssets = () => cpSync('src/woff2', 'dist/woff2', { recursive: true });
35
29
 
36
-
37
-
38
-
39
30
  /* ************************************************************************************************
40
31
  * EXECUTION *
41
32
  ************************************************************************************************ */
42
33
 
43
34
  (() => {
44
- // clean the distribution directory
45
- __cleanDist();
35
+ // clean the distribution directory
36
+ __cleanDist();
46
37
 
47
38
  // minify the font declaration
48
39
  __minifyFontDeclaration();
49
40
 
50
41
  // finally, copy the font assets
51
42
  __copyFontAssets();
52
- })();
43
+ })();