joys-fonts 0.1.0 → 0.1.2

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.
package/README.md CHANGED
@@ -86,11 +86,15 @@ When you run `npx joys-fonts add joys-iran-sans-x`, the CLI will:
86
86
 
87
87
  The following fonts are packaged and available for installation:
88
88
 
89
+ <!-- FONTS_START -->
90
+ - `joys-inter`
89
91
  - `joys-iran-sans-x`
90
92
  - `joys-iran-yekan-x`
91
93
  - `joys-kalameh`
92
94
  - `joys-morabba`
95
+ - `joys-vazir`
93
96
  - `joys-yekan-bakh`
97
+ <!-- FONTS_END -->
94
98
 
95
99
  ---
96
100
 
package/bin/deploy.js ADDED
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { execSync } from 'child_process';
4
+ import fs from 'fs';
5
+
6
+ function run(cmd) {
7
+ try {
8
+ return execSync(cmd, { stdio: 'inherit' });
9
+ } catch (err) {
10
+ console.error(`❌ Failed to run command: ${cmd}`);
11
+ process.exit(1);
12
+ }
13
+ }
14
+
15
+ function getOutput(cmd) {
16
+ try {
17
+ return execSync(cmd, { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
18
+ } catch (err) {
19
+ return '';
20
+ }
21
+ }
22
+
23
+ // 1. Run build
24
+ console.log('đŸ—ī¸ Building project...');
25
+ run('npm run build');
26
+
27
+ // 2. Check if git is dirty (meaning manifest, llm.txt, README.md, or other files changed)
28
+ const isDirty = getOutput('git status --porcelain') !== '';
29
+
30
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
31
+ const name = pkg.name;
32
+ let version = pkg.version;
33
+
34
+ if (isDirty) {
35
+ console.log('🔄 Changes detected. Bumping version...');
36
+
37
+ // Bump patch version (e.g. 0.1.0 -> 0.1.1)
38
+ run('npm version patch --no-git-tag-version');
39
+
40
+ // Read the updated version
41
+ const updatedPkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
42
+ version = updatedPkg.version;
43
+ console.log(`📈 Version bumped to ${version}`);
44
+
45
+ // Stage changes
46
+ console.log('đŸ“Ļ Staging changes...');
47
+ run('git add .');
48
+
49
+ // Commit
50
+ console.log('💾 Committing changes...');
51
+ run(`git commit -m "chore: bump version to ${version} and update assets"`);
52
+
53
+ // Push
54
+ console.log('🚀 Pushing to GitHub...');
55
+ run('git push');
56
+ } else {
57
+ console.log('✨ No changes detected in the workspace.');
58
+ }
59
+
60
+ // 3. Check NPM registry and publish if needed
61
+ console.log(`🔍 Checking if version ${version} of ${name} is already published...`);
62
+ let versionExists = false;
63
+ try {
64
+ const stdout = execSync(`npm view ${name}@${version} version --json`, {
65
+ stdio: ['pipe', 'pipe', 'ignore'],
66
+ timeout: 5000
67
+ }).toString().trim();
68
+
69
+ if (stdout) {
70
+ const parsed = JSON.parse(stdout);
71
+ if (parsed === version || (Array.isArray(parsed) && parsed.includes(version))) {
72
+ versionExists = true;
73
+ }
74
+ }
75
+ } catch (err) {
76
+ versionExists = false;
77
+ }
78
+
79
+ if (versionExists) {
80
+ console.log(`âš ī¸ Version ${version} is already published on NPM. Skipping publish.`);
81
+ process.exit(0);
82
+ }
83
+
84
+ console.log(`â„šī¸ Version ${version} is not published yet. Publishing to NPM...`);
85
+ try {
86
+ run('pnpm publish --no-git-checks');
87
+ console.log(`✅ Successfully published ${name}@${version} to NPM!`);
88
+ } catch (err) {
89
+ console.error(`❌ Failed to publish: ${err.message}`);
90
+ process.exit(1);
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joys-fonts",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Persian web fonts installer for Tailwind CSS projects",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -8,11 +8,6 @@
8
8
  "bin": {
9
9
  "joys-fonts": "bin/cli.js"
10
10
  },
11
- "scripts": {
12
- "build": "node generate-manifest.js",
13
- "test": "node test/cli.test.js",
14
- "deploy": "npm run build && git add . && (git diff --cached --quiet || git commit -m \"chore: update assets and manifest\") && git push"
15
- },
16
11
  "files": [
17
12
  "bin",
18
13
  "src",
@@ -31,5 +26,10 @@
31
26
  "cli"
32
27
  ],
33
28
  "author": "joys",
34
- "license": "MIT"
29
+ "license": "MIT",
30
+ "scripts": {
31
+ "build": "node generate-manifest.js",
32
+ "test": "node test/cli.test.js",
33
+ "deploy": "node bin/deploy.js"
34
+ }
35
35
  }