beathers 5.7.3 → 5.9.1
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/.prettierrc.js +2 -0
- package/CHANGELOG +39 -1
- package/css/beathers.min.css +3 -3
- package/css/beathers.min.css.map +1 -1
- package/package.json +40 -34
- package/readme.md +2 -2
- package/scripts/cli.js +0 -0
- package/scripts/commands/build.js +4 -4
- package/scripts/commands/clean.d.ts +2 -0
- package/scripts/commands/clean.d.ts.map +1 -0
- package/scripts/commands/clean.js +22 -0
- package/scripts/commands/fonts.d.ts.map +1 -1
- package/scripts/commands/fonts.js +4 -3
- package/scripts/commands/index.js +8 -8
- package/scripts/commands/init.js +1 -1
- package/scripts/commands/version-update.d.ts +2 -0
- package/scripts/commands/version-update.d.ts.map +1 -0
- package/scripts/commands/version-update.js +122 -0
- package/scripts/commands/version.js +1 -1
- package/scripts/helpers/BuildScssVariables.d.ts +1 -1
- package/scripts/helpers/BuildScssVariables.d.ts.map +1 -1
- package/scripts/helpers/BuildScssVariables.js +20 -10
- package/scripts/helpers/LoadUserConfigs.js +1 -1
- package/scripts/helpers/ReadDefaultValues.js +20 -20
- package/scripts/types.d.ts +1 -1
- package/scripts/types.d.ts.map +1 -1
- package/scss/_variables.scss +106 -106
- package/scss/beathers.min.scss +2 -2
- package/scss/functions/_colors.scss +19 -7
- package/scss/functions/_mediaQueries.scss +7 -3
- package/scss/functions/_others.scss +49 -15
- package/scss/functions/_typographic.scss +6 -2
- package/scss/functions/_validations.scss +71 -29
- package/scss/settings/_configs.scss +48 -48
- package/scss/settings/_defaults.scss +26 -31
- package/scss/style/_button.scss +9 -7
- package/scss/style/_colors.scss +15 -5
- package/scss/style/_dialog.scss +28 -27
- package/scss/style/_glass.scss +27 -9
- package/scss/style/_grid.scss +36 -10
- package/scss/style/_loader.scss +20 -8
- package/scss/style/_resets.scss +12 -4
- package/scss/style/_shaping.scss +235 -106
- package/scss/style/_typographic.scss +101 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beathers",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Beather is a lightweight SCSS library that serves as a comprehensive design system for your projects. It offers a structured and consistent approach to manage colors, fonts, and other design related variables, making it easier to maintain a cohesive visual identity across your application.",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,9 +17,26 @@
|
|
|
17
17
|
"./scss/*": "./scss/*",
|
|
18
18
|
"./package.json": "./package.json"
|
|
19
19
|
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/BhoenixStudio/Beathers.git"
|
|
23
|
+
},
|
|
20
24
|
"bin": {
|
|
21
25
|
"beathers": "scripts/cli.js"
|
|
22
26
|
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"watch": "nodemon --watch src/scss/ --ext scss --exec \"pnpm build:dev\"",
|
|
29
|
+
"build:dev": "sass --style expanded --source-map --embed-sources --no-error-css src/scss/:css/",
|
|
30
|
+
"build:pack": "sass --style compressed --source-map --embed-sources --no-error-css src/scss/:css/",
|
|
31
|
+
"build:publish": "pnpm build:clean && tsc && copyfiles -u 2 \"src/scss/**/*\" scss/ && pnpm build:pack",
|
|
32
|
+
"build:test": "pnpm build:publish && tsx scripts/cli.js",
|
|
33
|
+
"build:clean": "tsx src/scripts/commands/clean.ts",
|
|
34
|
+
"build:update": "ts-node src/scripts/commands/version-update.ts",
|
|
35
|
+
"lint": "eslint . && stylelint \"**/*.scss\"",
|
|
36
|
+
"lint:fix": "eslint . --fix && stylelint \"**/*.scss\" --fix",
|
|
37
|
+
"format:check": "prettier --check --ignore-path .gitignore .",
|
|
38
|
+
"format:fix": "prettier --write --ignore-path .gitignore . && pnpm lint"
|
|
39
|
+
},
|
|
23
40
|
"keywords": [
|
|
24
41
|
"design-system",
|
|
25
42
|
"scss-library",
|
|
@@ -46,34 +63,35 @@
|
|
|
46
63
|
"license": "MIT",
|
|
47
64
|
"homepage": "https://bhoenixstudio.com/beathers",
|
|
48
65
|
"dependencies": {
|
|
49
|
-
"fs-extra": "^11.3.
|
|
50
|
-
"sass": "^1.
|
|
66
|
+
"fs-extra": "^11.3.4",
|
|
67
|
+
"sass": "^1.98.0"
|
|
51
68
|
},
|
|
52
69
|
"devDependencies": {
|
|
53
|
-
"@eslint/js": "^
|
|
70
|
+
"@eslint/js": "^10.0.1",
|
|
54
71
|
"@types/fs-extra": "^11.0.4",
|
|
55
|
-
"@types/node": "^
|
|
72
|
+
"@types/node": "^25.5.0",
|
|
56
73
|
"@types/scss-parser": "^1.0.4",
|
|
57
|
-
"autoprefixer": "^10.4.
|
|
74
|
+
"autoprefixer": "^10.4.27",
|
|
58
75
|
"copyfiles": "^2.4.1",
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"eslint-plugin-css": "^0.
|
|
61
|
-
"eslint-plugin-import": "^2.
|
|
62
|
-
"globals": "^
|
|
63
|
-
"nodemon": "^3.1.
|
|
76
|
+
"eslint": "^10.1.0",
|
|
77
|
+
"eslint-plugin-css": "^0.12.0",
|
|
78
|
+
"eslint-plugin-import": "^2.32.0",
|
|
79
|
+
"globals": "^17.4.0",
|
|
80
|
+
"nodemon": "^3.1.14",
|
|
64
81
|
"npm-run-all": "^4.1.5",
|
|
65
|
-
"postcss": "^8.5.
|
|
82
|
+
"postcss": "^8.5.8",
|
|
66
83
|
"postcss-cli": "^11.0.1",
|
|
67
84
|
"postcss-scss": "^4.0.9",
|
|
68
|
-
"prettier": "^3.
|
|
69
|
-
"rimraf": "^6.
|
|
70
|
-
"stylelint": "^
|
|
85
|
+
"prettier": "^3.8.1",
|
|
86
|
+
"rimraf": "^6.1.3",
|
|
87
|
+
"stylelint": "^17.6.0",
|
|
71
88
|
"stylelint-config-prettier": "^9.0.5",
|
|
72
|
-
"stylelint-config-standard-scss": "^
|
|
73
|
-
"stylelint-scss": "^
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"typescript
|
|
89
|
+
"stylelint-config-standard-scss": "^17.0.0",
|
|
90
|
+
"stylelint-scss": "^7.0.0",
|
|
91
|
+
"ts-node": "^10.9.2",
|
|
92
|
+
"tsx": "^4.21.0",
|
|
93
|
+
"typescript": "^6.0.2",
|
|
94
|
+
"typescript-eslint": "^8.58.0"
|
|
77
95
|
},
|
|
78
96
|
"files": [
|
|
79
97
|
"css/**/*.{css,map}",
|
|
@@ -85,17 +103,5 @@
|
|
|
85
103
|
"docs/**/*.md",
|
|
86
104
|
"CHANGELOG",
|
|
87
105
|
"readme.md"
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
"watch": "nodemon --watch src/scss/ --ext scss --exec \"npm run build:dev\"",
|
|
91
|
-
"build:dev": "sass --style expanded --source-map --embed-sources --no-error-css src/scss/:css/",
|
|
92
|
-
"build:pack": "sass --style compressed --source-map --embed-sources --no-error-css src/scss/:css/",
|
|
93
|
-
"build:test": "tsx src/scripts/cli.ts",
|
|
94
|
-
"build:clean": "rimraf css scss && rimraf index.js index.d.ts index.d.ts.map && rimraf data scripts",
|
|
95
|
-
"build:publish": "npm run build:clean && tsc && copyfiles -u 2 \"src/scss/**/*\" scss/ && npm run build:pack",
|
|
96
|
-
"lint": "eslint . && stylelint \"**/*.scss\"",
|
|
97
|
-
"lint:fix": "eslint . --fix && stylelint \"**/*.scss\" --fix",
|
|
98
|
-
"format:check": "prettier --check --ignore-path .gitignore .",
|
|
99
|
-
"format:fix": "prettier --write --ignore-path .gitignore . && npm run lint"
|
|
100
|
-
}
|
|
101
|
-
}
|
|
106
|
+
]
|
|
107
|
+
}
|
package/readme.md
CHANGED
|
@@ -127,7 +127,7 @@ import 'beathers/css/beathers.min.css'
|
|
|
127
127
|
"success": { "light": "#28a745", "dark": "#20c997" }
|
|
128
128
|
},
|
|
129
129
|
"typography": {
|
|
130
|
-
"defaultFontFamilies": ["
|
|
130
|
+
"defaultFontFamilies": ["system-ui', 'Arial', 'sans-serif"]
|
|
131
131
|
},
|
|
132
132
|
"settings": {
|
|
133
133
|
"axisDivisions": 12,
|
|
@@ -258,7 +258,7 @@ export default {
|
|
|
258
258
|
success: { light: '#28a745', dark: '#20c997' },
|
|
259
259
|
},
|
|
260
260
|
typography: {
|
|
261
|
-
defaultFontFamilies: ['
|
|
261
|
+
defaultFontFamilies: ['system-ui', 'Arial', 'sans-serif'],
|
|
262
262
|
fontSizes: {
|
|
263
263
|
xs: '12px',
|
|
264
264
|
sm: '14px',
|
package/scripts/cli.js
CHANGED
|
File without changes
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import { exec } from 'child_process';
|
|
3
2
|
import fs from 'fs-extra';
|
|
3
|
+
import { exec } from 'node:child_process';
|
|
4
|
+
import path from 'node:path';
|
|
4
5
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import
|
|
6
|
-
import { promisify } from 'util';
|
|
6
|
+
import { promisify } from 'node:util';
|
|
7
7
|
import { promptInput } from '../commands/index.js';
|
|
8
8
|
import { BuildScssVariables, DeepMerge, LoadUserConfigs, ReadDefaultValues } from '../helpers/index.js';
|
|
9
9
|
const execAsync = promisify(exec);
|
|
@@ -93,7 +93,7 @@ async function BuildTheme(customOutputPath) {
|
|
|
93
93
|
const userConfigs = await LoadUserConfigs();
|
|
94
94
|
console.log('🔄 Building theme variables...');
|
|
95
95
|
const theme = DeepMerge(defaults, userConfigs);
|
|
96
|
-
const variablesString = BuildScssVariables(theme
|
|
96
|
+
const variablesString = BuildScssVariables(theme);
|
|
97
97
|
await fs.writeFile(variablesPath, variablesString, { flag: 'w' });
|
|
98
98
|
console.log(`✅ Theme variables generated`);
|
|
99
99
|
console.log('');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/scripts/commands/clean.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
const targets = ['public/css', 'css', 'scss', 'index.js', 'index.d.ts', 'index.d.ts.map', 'data', 'scripts'];
|
|
5
|
+
async function clean() {
|
|
6
|
+
const cwd = process.cwd();
|
|
7
|
+
const cleaned = [];
|
|
8
|
+
for (const target of targets) {
|
|
9
|
+
const targetPath = path.join(cwd, target);
|
|
10
|
+
if (await fs.pathExists(targetPath)) {
|
|
11
|
+
await fs.remove(targetPath);
|
|
12
|
+
cleaned.push(target);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (cleaned.length > 0) {
|
|
16
|
+
console.log('🧹 Cleaned the following files/folders:');
|
|
17
|
+
cleaned.forEach((f) => console.log(' -', f));
|
|
18
|
+
}
|
|
19
|
+
else
|
|
20
|
+
console.log('No files or folders needed cleaning.');
|
|
21
|
+
}
|
|
22
|
+
await clean();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/scripts/commands/fonts.ts"],"names":[],"mappings":"AAMA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/scripts/commands/fonts.ts"],"names":[],"mappings":"AAMA,wBAAsB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA2F7C;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BhD;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CA4BhD"}
|
|
@@ -36,15 +36,16 @@ export async function AddFont() {
|
|
|
36
36
|
const title = await promptInput(question('title', l));
|
|
37
37
|
const unicode = await promptInput(question('unicode', l));
|
|
38
38
|
const isLocal = await promptUser(question('isLocal', l));
|
|
39
|
-
if (
|
|
39
|
+
if (isLocal)
|
|
40
|
+
format = await promptSelection(question('format', l), ['woff2', 'woff']);
|
|
41
|
+
else {
|
|
40
42
|
while (true) {
|
|
41
43
|
url = await promptInput(question('url', l));
|
|
42
44
|
if (url && /^https?:\/\//.test(url))
|
|
43
45
|
break;
|
|
44
46
|
console.error('❌ Invalid URL format. URL must start with \x1b[36mhttp://\x1b[0m or \x1b[36mhttps://\x1b[0m');
|
|
45
47
|
}
|
|
46
|
-
|
|
47
|
-
format = await promptSelection(question('format', l), ['woff2', 'woff']);
|
|
48
|
+
}
|
|
48
49
|
variants[l] = {
|
|
49
50
|
title: title ?? fontName,
|
|
50
51
|
...(unicode && { unicode }),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
|
-
import path from 'path';
|
|
3
|
+
import path from 'node:path';
|
|
4
4
|
// Functions
|
|
5
5
|
export async function promptUser(question) {
|
|
6
|
-
const readline = await import('readline');
|
|
6
|
+
const readline = await import('node:readline');
|
|
7
7
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
8
8
|
return new Promise((resolve) => {
|
|
9
9
|
rl.question(question, (answer) => {
|
|
@@ -13,7 +13,7 @@ export async function promptUser(question) {
|
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
15
|
export async function promptInput(question) {
|
|
16
|
-
const readline = await import('readline');
|
|
16
|
+
const readline = await import('node:readline');
|
|
17
17
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
18
18
|
return new Promise((resolve) => {
|
|
19
19
|
rl.question(question, (answer) => {
|
|
@@ -23,7 +23,7 @@ export async function promptInput(question) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
export async function promptSelection(question, options) {
|
|
26
|
-
const readline = await import('readline');
|
|
26
|
+
const readline = await import('node:readline');
|
|
27
27
|
return new Promise((resolve) => {
|
|
28
28
|
const ask = () => {
|
|
29
29
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -31,7 +31,7 @@ export async function promptSelection(question, options) {
|
|
|
31
31
|
options.forEach((option, index) => console.log(` ${index + 1}. ${option}`));
|
|
32
32
|
rl.question('Enter your choice (number): ', (answer) => {
|
|
33
33
|
rl.close();
|
|
34
|
-
const choice = parseInt(answer.trim()) - 1;
|
|
34
|
+
const choice = Number.parseInt(answer.trim()) - 1;
|
|
35
35
|
if (choice >= 0 && choice < options.length)
|
|
36
36
|
resolve(options[choice]);
|
|
37
37
|
else {
|
|
@@ -60,9 +60,9 @@ export async function loadConfig(filePath) {
|
|
|
60
60
|
}
|
|
61
61
|
else if (['.js', '.ts'].includes(extension)) {
|
|
62
62
|
let content = await fs.readFile(filePath, 'utf-8');
|
|
63
|
-
content = content.
|
|
64
|
-
content = content.
|
|
65
|
-
content = content.
|
|
63
|
+
content = content.replaceAll(/import.*from.*['"].*['"];?\n/g, '');
|
|
64
|
+
content = content.replaceAll(/export default\s+/, '');
|
|
65
|
+
content = content.replaceAll(/satisfies Theme\s*$/, '');
|
|
66
66
|
try {
|
|
67
67
|
const config = eval(`(${content})`);
|
|
68
68
|
return config;
|
package/scripts/commands/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import path from 'path';
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
import { promptSelection, promptUser } from '../commands/index.js';
|
|
6
6
|
import { ReadDefaultValues } from '../helpers/index.js';
|
|
7
7
|
async function getDefaultValues() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-update.d.ts","sourceRoot":"","sources":["../../src/scripts/commands/version-update.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
const EXCLUDE = [
|
|
5
|
+
'node_modules',
|
|
6
|
+
'.git',
|
|
7
|
+
'pnpm-lock.yaml',
|
|
8
|
+
'dist',
|
|
9
|
+
'build',
|
|
10
|
+
'.next',
|
|
11
|
+
'.turbo',
|
|
12
|
+
'.vscode',
|
|
13
|
+
'.DS_Store',
|
|
14
|
+
'coverage',
|
|
15
|
+
'out',
|
|
16
|
+
'logs',
|
|
17
|
+
'tmp',
|
|
18
|
+
'temp',
|
|
19
|
+
'yarn.lock',
|
|
20
|
+
'package-lock.json',
|
|
21
|
+
];
|
|
22
|
+
function bumpVersion(version, type) {
|
|
23
|
+
const [major, minor, patch] = version.split('.').map(Number);
|
|
24
|
+
if (type === 'magor')
|
|
25
|
+
return `${major + 1}.0.0`;
|
|
26
|
+
if (type === 'minor')
|
|
27
|
+
return `${major}.${minor + 1}.0`;
|
|
28
|
+
return `${major}.${minor}.${patch + 1}`;
|
|
29
|
+
}
|
|
30
|
+
function findAllFiles(dir, exts = ['.ts', '.js', '.json', '.md', '.scss'], exclude = []) {
|
|
31
|
+
let results = [];
|
|
32
|
+
const list = fs.readdirSync(dir);
|
|
33
|
+
list.forEach((file) => {
|
|
34
|
+
const filePath = path.join(dir, file);
|
|
35
|
+
if (exclude.some((ex) => filePath.includes(ex)))
|
|
36
|
+
return;
|
|
37
|
+
const stat = fs.statSync(filePath);
|
|
38
|
+
if (stat?.isDirectory())
|
|
39
|
+
results = results.concat(findAllFiles(filePath, exts, exclude));
|
|
40
|
+
else if (exts.includes(path.extname(file)))
|
|
41
|
+
results.push(filePath);
|
|
42
|
+
});
|
|
43
|
+
return results;
|
|
44
|
+
}
|
|
45
|
+
async function main() {
|
|
46
|
+
const args = process.argv.slice(2);
|
|
47
|
+
const flag = args.find((a) => a.startsWith('--'))?.replace('--', '');
|
|
48
|
+
const type = flag === 'minor' || flag === 'magor' ? flag : 'patch';
|
|
49
|
+
const pkgPath = path.resolve('package.json');
|
|
50
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
51
|
+
const oldVersion = pkg.version;
|
|
52
|
+
const newVersion = bumpVersion(oldVersion, type);
|
|
53
|
+
pkg.version = newVersion;
|
|
54
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
55
|
+
const updatedFiles = [pkgPath];
|
|
56
|
+
const workspaceRoot = path.resolve('.');
|
|
57
|
+
process.stdout.write('\u23F3 Updating version across files... ');
|
|
58
|
+
const files = findAllFiles(workspaceRoot, ['.ts', '.js', '.json', '.md', '.scss'], EXCLUDE);
|
|
59
|
+
for (const file of files) {
|
|
60
|
+
if (path.resolve(file) === pkgPath)
|
|
61
|
+
continue;
|
|
62
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
63
|
+
if (!content.includes(oldVersion))
|
|
64
|
+
continue;
|
|
65
|
+
const updated = content.replaceAll(new RegExp(oldVersion.replaceAll('.', String.raw `\.`), 'g'), newVersion);
|
|
66
|
+
fs.writeFileSync(file, updated);
|
|
67
|
+
updatedFiles.push(file);
|
|
68
|
+
}
|
|
69
|
+
process.stdout.write('\r');
|
|
70
|
+
const changelogPath = path.resolve('CHANGELOG');
|
|
71
|
+
let changelogContent = '';
|
|
72
|
+
let changelogExists = false;
|
|
73
|
+
try {
|
|
74
|
+
changelogContent = fs.readFileSync(changelogPath, 'utf-8');
|
|
75
|
+
changelogExists = true;
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
console.log('⚠️ No CHANGELOG file found, skipping changelog update.');
|
|
79
|
+
}
|
|
80
|
+
if (changelogExists) {
|
|
81
|
+
const today = new Date();
|
|
82
|
+
const yyyy = today.getFullYear();
|
|
83
|
+
const mm = String(today.getMonth() + 1).padStart(2, '0');
|
|
84
|
+
const dd = String(today.getDate()).padStart(2, '0');
|
|
85
|
+
const dateStr = `${yyyy}-${mm}-${dd}`;
|
|
86
|
+
let newSection = `## [${newVersion}] - ${dateStr}\n\n`;
|
|
87
|
+
if (type === 'minor' || type === 'magor')
|
|
88
|
+
newSection += '### Changed\n\n- \n\n### Added\n\n- \n\n';
|
|
89
|
+
newSection += '### Fixed\n\n-\n';
|
|
90
|
+
const lines = changelogContent.split(/\r?\n/);
|
|
91
|
+
let insertIdx = lines.findIndex((l) => l.trim().toLowerCase() === '# changelog');
|
|
92
|
+
if (insertIdx === -1)
|
|
93
|
+
insertIdx = 0;
|
|
94
|
+
insertIdx++;
|
|
95
|
+
while (insertIdx < lines.length && lines[insertIdx].trim() === '')
|
|
96
|
+
insertIdx++;
|
|
97
|
+
lines.splice(insertIdx, 0, newSection);
|
|
98
|
+
fs.writeFileSync(changelogPath, lines.join('\n'));
|
|
99
|
+
updatedFiles.push(changelogPath);
|
|
100
|
+
}
|
|
101
|
+
// Success message
|
|
102
|
+
console.log('✅', 'Version updated from', `\x1b[36m${oldVersion}\x1b[0m`, 'to', `\x1b[36m${newVersion}\x1b[0m`, '\n');
|
|
103
|
+
if (updatedFiles.length) {
|
|
104
|
+
console.log('\x1b[36mUpdated files:\x1b[0m');
|
|
105
|
+
updatedFiles.forEach((f) => {
|
|
106
|
+
const relPath = path.relative(workspaceRoot, f).split(path.sep).join('/');
|
|
107
|
+
const fileName = path.basename(f);
|
|
108
|
+
console.log(` • \x1b]8;;file://${workspaceRoot.replaceAll('\\', '/')}/${relPath}\x1b\\${fileName}\x1b]8;;\x1b\\`);
|
|
109
|
+
});
|
|
110
|
+
console.log();
|
|
111
|
+
if (updatedFiles.includes(changelogPath)) {
|
|
112
|
+
const relChangelog = path.relative(workspaceRoot, changelogPath).split(path.sep).join('/');
|
|
113
|
+
console.log(`\x1b[33mEdit your new changelog section:\x1b[0m \x1b]8;;file://${workspaceRoot.replaceAll('\\', '/')}/${relChangelog}\x1b\\CHANGELOG\x1b]8;;\x1b\\\n`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
console.log('No files needed updating.');
|
|
118
|
+
}
|
|
119
|
+
main().catch((err) => {
|
|
120
|
+
console.error('❌ Error:', err.message);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import path from 'path';
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
export function Version() {
|
|
6
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = path.dirname(__filename);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildScssVariables.d.ts","sourceRoot":"","sources":["../../src/scripts/helpers/BuildScssVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"BuildScssVariables.d.ts","sourceRoot":"","sources":["../../src/scripts/helpers/BuildScssVariables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AA0MnC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAYvD"}
|
|
@@ -18,13 +18,21 @@ function BuildColors(colors) {
|
|
|
18
18
|
function BuildTypography(typography) {
|
|
19
19
|
let scss = '\n\n// --- Typography ---\n';
|
|
20
20
|
scss += '$defaultFontFamilies:';
|
|
21
|
-
scss += typography?.defaultFontFamilies?.length
|
|
21
|
+
scss += typography?.defaultFontFamilies?.length
|
|
22
|
+
? typography.defaultFontFamilies.join(', ').replaceAll('"', '')
|
|
23
|
+
: 'null';
|
|
22
24
|
scss += ';\n';
|
|
23
25
|
let fontPath = typography?.fontMainPath;
|
|
24
26
|
if (!fontPath?.startsWith('/'))
|
|
25
27
|
fontPath = `/${fontPath}`;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
if (fontPath)
|
|
29
|
+
scss += `$fontMainPath: "${fontPath}";\n`;
|
|
30
|
+
else
|
|
31
|
+
scss += '$fontMainPath: null;\n';
|
|
32
|
+
if (typography?.fontFormat)
|
|
33
|
+
scss += `$fontFormat: "${typography.fontFormat}";\n`;
|
|
34
|
+
else
|
|
35
|
+
scss += '$fontFormat: null;\n';
|
|
28
36
|
scss += '$fontWeights: (';
|
|
29
37
|
scss += typography?.fontWeights?.length ? typography.fontWeights.map((fW) => `"${fW}"`).join(', ') : '';
|
|
30
38
|
scss += ');\n';
|
|
@@ -32,11 +40,14 @@ function BuildTypography(typography) {
|
|
|
32
40
|
scss += typography?.fontStyles?.length ? typography.fontStyles.map((fS) => `"${fS}"`).join(', ') : '';
|
|
33
41
|
scss += ');\n';
|
|
34
42
|
scss += '$fontSizes: (';
|
|
35
|
-
|
|
43
|
+
const fontSizes = Object.entries(typography?.fontSizes ?? {});
|
|
44
|
+
if (fontSizes?.length) {
|
|
36
45
|
scss += '\n';
|
|
37
|
-
|
|
38
|
-
scss += `"${name}": ${value}
|
|
39
|
-
|
|
46
|
+
fontSizes.forEach(([name, value], i) => {
|
|
47
|
+
scss += `"${name}": ${value}`;
|
|
48
|
+
if (i !== fontSizes.length - 1)
|
|
49
|
+
scss += ',\n';
|
|
50
|
+
});
|
|
40
51
|
scss += '\n';
|
|
41
52
|
}
|
|
42
53
|
scss += ');\n';
|
|
@@ -57,7 +68,7 @@ function BuildTypography(typography) {
|
|
|
57
68
|
for (const [lang, variant] of Object.entries(font.variants)) {
|
|
58
69
|
scss += `"${lang}": (\n`;
|
|
59
70
|
if (variant?.title)
|
|
60
|
-
scss += `"title": ${variant.title.
|
|
71
|
+
scss += `"title": ${variant.title.replaceAll('"', '')},\n`;
|
|
61
72
|
if (variant?.unicode)
|
|
62
73
|
scss += `"unicode": "${variant.unicode}",\n`;
|
|
63
74
|
if (variant?.format)
|
|
@@ -166,8 +177,7 @@ function BuildLoader(loader) {
|
|
|
166
177
|
scss += `$loaderDuration: ${loader?.duration ?? 'null'};\n`;
|
|
167
178
|
return scss;
|
|
168
179
|
}
|
|
169
|
-
|
|
170
|
-
export function BuildScssVariables(theme, isLocalBuild = false) {
|
|
180
|
+
export function BuildScssVariables(theme) {
|
|
171
181
|
const { colors, roles, settings, typography, glass, loader } = theme;
|
|
172
182
|
let scss = '// Generated by Beathers builder\n // Do not edit this file directly\n\n';
|
|
173
183
|
scss += BuildColors(colors);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
|
-
import path from 'path';
|
|
3
|
+
import path from 'node:path';
|
|
4
4
|
const userConfigFiles = ['beathers.configs.js', 'beathers.configs.ts', 'beathers.configs.json'];
|
|
5
5
|
function findConfigFile(basePath) {
|
|
6
6
|
for (const filename of userConfigFiles) {
|
|
@@ -7,7 +7,7 @@ function sanitize(val) {
|
|
|
7
7
|
return true;
|
|
8
8
|
if (trimmed === 'false')
|
|
9
9
|
return false;
|
|
10
|
-
if (!isNaN(Number(trimmed)))
|
|
10
|
+
if (!Number.isNaN(Number(trimmed)))
|
|
11
11
|
return Number(trimmed);
|
|
12
12
|
return trimmed;
|
|
13
13
|
}
|
|
@@ -24,7 +24,7 @@ function cleanString(value) {
|
|
|
24
24
|
function cleanNumber(value) {
|
|
25
25
|
let result = null;
|
|
26
26
|
const num = Number(value);
|
|
27
|
-
if (!isNaN(num) && num.toString() === value)
|
|
27
|
+
if (!Number.isNaN(num) && num.toString() === value)
|
|
28
28
|
result = num;
|
|
29
29
|
return result;
|
|
30
30
|
}
|
|
@@ -38,34 +38,34 @@ function buildArray(value) {
|
|
|
38
38
|
}
|
|
39
39
|
function buildJson(value) {
|
|
40
40
|
const raw = value
|
|
41
|
-
.
|
|
42
|
-
.
|
|
43
|
-
.
|
|
44
|
-
.
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
.
|
|
41
|
+
.replaceAll('(', '{')
|
|
42
|
+
.replaceAll(')', '}')
|
|
43
|
+
.replaceAll("'", '"')
|
|
44
|
+
.replaceAll(/(\w+):/g, '"$1":')
|
|
45
|
+
.replaceAll(/:\s*"?(\d+)"?\.(\d+)(rem)?/g, ':"$1.$2$3"')
|
|
46
|
+
.replaceAll(/:\s*(\w+)/g, ': "$1"')
|
|
47
|
+
.replaceAll(/,\s*}/g, '\n}');
|
|
48
48
|
const parsed = JSON.parse(raw);
|
|
49
49
|
const sanitized = sanitize(parsed);
|
|
50
50
|
return sanitized;
|
|
51
51
|
}
|
|
52
52
|
function buildColors(value) {
|
|
53
53
|
const raw = value
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
.
|
|
57
|
-
.
|
|
58
|
-
.
|
|
59
|
-
.
|
|
54
|
+
.replaceAll('(', '{')
|
|
55
|
+
.replaceAll(')', '}')
|
|
56
|
+
.replaceAll("'", '"')
|
|
57
|
+
.replaceAll(/#([0-9a-fA-F]{3,6})/g, '"#$1"')
|
|
58
|
+
.replaceAll(/,\s*}/g, '}')
|
|
59
|
+
.replaceAll(/\n\s*/g, '');
|
|
60
60
|
const parsed = JSON.parse(raw);
|
|
61
61
|
return parsed;
|
|
62
62
|
}
|
|
63
63
|
function buildWrappers(value) {
|
|
64
64
|
const raw = value
|
|
65
|
-
.
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
.
|
|
65
|
+
.replaceAll('(', '{')
|
|
66
|
+
.replaceAll(')', '}')
|
|
67
|
+
.replaceAll(/(\w+):\s*([0-9%px]+)\s+([0-9.]+rem)/g, '"$1": {"width": "$2", "padding": "$3"}')
|
|
68
|
+
.replaceAll(/,\s*}/g, '}');
|
|
69
69
|
const parsed = JSON.parse(raw);
|
|
70
70
|
return parsed;
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ export async function ReadDefaultValues(files, VariableNames) {
|
|
|
75
75
|
for (const file of files) {
|
|
76
76
|
const content = await fs.readFile(file, 'utf8');
|
|
77
77
|
for (const name of VariableNames) {
|
|
78
|
-
const variableRegex = new RegExp(
|
|
78
|
+
const variableRegex = new RegExp(String.raw `^\s*\$${name}\s*:\s*([\s\S]*?)\s*!default\s*;?`, 'm');
|
|
79
79
|
const match = variableRegex.exec(content);
|
|
80
80
|
if (match) {
|
|
81
81
|
const value = match[1].trim();
|
package/scripts/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** CSS size unit values supporting px, rem, em, viewport units, and percentages */
|
|
2
|
-
type SizeUnit = 0 | `${number}px` | `${number}rem` | `${number}em` | `${number}vw` | `${number}vh` | `${number}%`;
|
|
2
|
+
type SizeUnit = 0 | '0' | `${number}px` | `${number}rem` | `${number}em` | `${number}vw` | `${number}vh` | `${number}%`;
|
|
3
3
|
/** Color configuration object with optional light and dark theme hex values */
|
|
4
4
|
type ColorType = Record<string, {
|
|
5
5
|
light?: `#${string}`;
|
package/scripts/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/scripts/types.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,KAAK,QAAQ,GAAG,CAAC,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/scripts/types.ts"],"names":[],"mappings":"AAEA,mFAAmF;AACnF,KAAK,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,KAAK,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,IAAI,GAAG,GAAG,MAAM,GAAG,CAAA;AAIvH,+EAA+E;AAC/E,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAAC,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAA;CAAE,CAAC,CAAA;AAG9E,sDAAsD;AACtD,KAAK,UAAU,GAAG,MAAM,GAAG,aAA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