Skip to content

Commit 9f67c0c

Browse files
authored
release: version 2025.5.16 (#20)
* release: version 2025.5.16 * feat: optimized gitignore / npmignore
1 parent 1b4c0ec commit 9f67c0c

16 files changed

Lines changed: 429 additions & 227 deletions

.gitignore

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,22 @@
1-
node_modules/
2-
3-
npm-debug.log
4-
yarn-debug.log*
5-
yarn-error.log*
1+
*
62

3+
node_modules/
74
.idea/
85
.vscode/
96

10-
*.log
11-
*.tmp
12-
*.temp
13-
*.suo
14-
*.ntvs*
15-
*.njsproj
16-
*.sln
17-
*.sw?
18-
*.iml
19-
207
.DS_Store
21-
Thumbs.db
22-
23-
dist/
24-
build/
25-
26-
config.js
27-
secrets.json
28-
29-
*.key
30-
*.pem
318

32-
.coverage
9+
!.browserslistrc
10+
!.editorconfig
11+
!.prettierrc.json
12+
!LICENSE
13+
!main.js
14+
!package.json
15+
!README.md
16+
!yarn.lock
17+
18+
!.github/
19+
!public/
20+
!public/**
21+
!utils/
22+
!utils/**

.npmignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
!/package.json
2-
!/README.md
3-
!/src/**/*
4-
!/*.css
5-
61
*
2+
3+
!LICENSE
4+
!main.js
5+
!package.json
6+
!README.md
7+
8+
!utils/
9+
!utils/**

.prettierrc.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"printWidth": 120,
5+
"trailingComma": "all",
6+
"arrowParens": "avoid",
7+
"bracketSpacing": true,
8+
"htmlWhitespaceSensitivity": "ignore"
9+
}

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
`Style-Forge` package is a comprehensive CSS framework designed for modern web development. It provides a wide range of utilities and components to streamline the process of building responsive, aesthetically pleasing websites. With features like customizable themes, utility classes, and support for modern CSS technologies like flexbox and grid, style-forge aims to enhance productivity and maintainability in frontend development.
1010

11+
## 🚀 Quick Start
12+
13+
```bash
14+
npx style-forge
15+
```
16+
1117
## Documentation
1218

1319
To check out docs, visit [style-forge.github.io](https://style-forge.github.io/).

builder.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

main.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env node
2+
3+
import { readFileSync, existsSync, unlinkSync } from 'fs'
4+
import { dirname, resolve } from 'path'
5+
import { fileURLToPath } from 'url'
6+
import { spawn } from 'child_process'
7+
8+
// packages
9+
import chalk from 'chalk'
10+
import inquirer from 'inquirer'
11+
12+
// utils
13+
import { config } from './utils/config.js'
14+
import { MODULES } from './utils/modules.js'
15+
import { getProjectRoot } from './utils/getProjectRoot.js'
16+
import { installPackages, uninstallPackages } from './utils/pkg.js'
17+
18+
const __filename = fileURLToPath(import.meta.url)
19+
const __dirname = dirname(__filename)
20+
21+
async function main() {
22+
console.clear()
23+
24+
console.log(`
25+
${chalk.hex('#00ffff').bold(' ⚡ STYLE-FORGE ⚡ ')}
26+
`)
27+
28+
const projectRoot = getProjectRoot()
29+
30+
if (!projectRoot) {
31+
console.error('\n❌ Project root not found. Make sure you are inside a valid project with package.json\n')
32+
process.exit(1)
33+
}
34+
35+
const pkg = JSON.parse(readFileSync(resolve(projectRoot, 'package.json'), 'utf8'))
36+
const deps = pkg.dependencies || {}
37+
38+
const choices = MODULES.map(name => {
39+
const version = deps[name] ? ` (${deps[name]})` : ''
40+
return {
41+
name: name + version,
42+
value: name,
43+
checked: !!deps[name],
44+
}
45+
})
46+
47+
const { selected } = await inquirer.prompt([
48+
{
49+
type: 'checkbox',
50+
name: 'selected',
51+
message: 'Select modules to install:',
52+
choices,
53+
},
54+
])
55+
56+
const toInstall = selected.filter(m => !deps[m])
57+
const toUninstall = MODULES.filter(m => deps[m] && !selected.includes(m))
58+
59+
if (toInstall.length > 0) await installPackages(toInstall)
60+
if (toUninstall.length > 0) await uninstallPackages(toUninstall)
61+
62+
if (selected.length > 0) {
63+
const buildPath = resolve(__dirname, './utils/builder.js')
64+
const child = spawn('node', [buildPath], { stdio: 'inherit' })
65+
66+
child.on('exit', code => {
67+
if (code !== 0) {
68+
console.error('\n❌ Failed to build style-forge.css.\n')
69+
}
70+
})
71+
} else {
72+
const outputPath = resolve(projectRoot, `${config.output.dir}/${config.output.name}.css`)
73+
74+
if (existsSync(outputPath)) {
75+
unlinkSync(outputPath)
76+
console.log(`\n🧹 Removed ${config.output.name}.css (no modules selected).\n`)
77+
} else {
78+
console.log('\n❗ No modules selected, nothing to build.\n')
79+
}
80+
}
81+
}
82+
83+
main().catch(err => {
84+
if (err?.isTtyError || err?.message?.includes('SIGINT') || err.name === 'ExitPromptError') {
85+
console.log('\n👋 Bye!\n')
86+
process.exit(0)
87+
}
88+
89+
console.error('\n❌ Unhandled error:', err)
90+
process.exit(1)
91+
})

package.json

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
{
22
"name": "style-forge",
3-
"version": "2025.5.13",
3+
"version": "2025.5.16",
44
"description": "Style-Forge: CSS framework with themes, utilities, flexbox, and grid for creating responsive websites.",
55
"type": "module",
6-
"main": "style-forge.css",
6+
"bin": {
7+
"style-forge": "./main.js"
8+
},
79
"repository": {
810
"type": "git",
911
"url": "git+https://github.com/Style-Forge/hub.git"
@@ -32,31 +34,28 @@
3234
"helpers",
3335
"colors"
3436
],
35-
"scripts": {
36-
"build": "node builder.js"
37-
},
38-
"devDependencies": {
39-
"autoprefixer": "^10.4.20",
40-
"postcss": "^8.4.49",
37+
"dependencies": {
38+
"autoprefixer": "^10.4.21",
39+
"chalk": "^5.4.1",
40+
"inquirer": "^12.6.1",
41+
"json-stringify-pretty-compact": "^4.0.0",
42+
"postcss": "^8.5.3",
4143
"postcss-combine-duplicated-selectors": "^10.0.3",
42-
"postcss-discard-comments": "^7.0.3",
44+
"postcss-discard-comments": "^7.0.4",
4345
"postcss-import": "^16.1.0",
4446
"postcss-minify": "^1.1.0"
4547
},
46-
"dependencies": {
47-
"style-forge.base": "^2025.2.5",
48-
"style-forge.colors": "^2025.5.13",
49-
"style-forge.form": "^2025.2.5",
50-
"style-forge.helpers": "^2025.2.8",
51-
"style-forge.media": "^2025.2.8",
52-
"style-forge.patterns": "^2025.2.5",
53-
"style-forge.themes": "^2025.2.5"
54-
},
5548
"bugs": {
5649
"url": "https://github.com/Style-Forge/hub/issues"
5750
},
5851
"homepage": "https://style-forge.github.io/",
5952
"publishConfig": {
6053
"registry": "https://registry.npmjs.org/"
54+
},
55+
"engines": {
56+
"node": ">=18"
57+
},
58+
"devDependencies": {
59+
"prettier": "2.8.8"
6160
}
6261
}

src/all.css

Lines changed: 0 additions & 6 deletions
This file was deleted.

style-forge.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

utils/builder.js

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { readFileSync, mkdirSync, writeFileSync } from 'fs'
2+
import { dirname, resolve } from 'path'
3+
4+
// packages
5+
import postcss from 'postcss'
6+
import pImport from 'postcss-import'
7+
import pDuplicated from 'postcss-combine-duplicated-selectors'
8+
import pComments from 'postcss-discard-comments'
9+
import pAutoprefixer from 'autoprefixer'
10+
import pMinify from 'postcss-minify'
11+
12+
// Utils
13+
import { MODULES } from './modules.js'
14+
import { config } from './config.js'
15+
import { getProjectRoot } from './getProjectRoot.js'
16+
17+
const projectRoot = getProjectRoot()
18+
19+
const OUTPUT = resolve(projectRoot, `${config.output.dir}/${config.output.name}.css`)
20+
21+
const pkg = JSON.parse(readFileSync(resolve(projectRoot, 'package.json'), 'utf8'))
22+
const deps = Object.keys(pkg.dependencies || {})
23+
24+
const title = pkg.name + ' ' + pkg.version
25+
const license = pkg.license + ' License'
26+
const link = pkg.repository.url.replace('git+', '').replace('.git', '')
27+
const HEADER = '/*! ' + [title, license, link].join(' | ') + ' */'
28+
29+
const ordered = MODULES.filter(x => x !== 'style-forge.colors' && deps.includes(x))
30+
31+
if (ordered.length === 0) {
32+
console.log(`❗ No compatible modules found for building ${config.output.name}.css`)
33+
process.exit(0)
34+
}
35+
36+
const imports = ordered.map(name => `@import "${name}";`).join('\n')
37+
38+
const plugins = [
39+
pImport,
40+
pAutoprefixer,
41+
pDuplicated({ removeDuplicatedProperties: true }),
42+
pComments({ removeAll: true }),
43+
pMinify,
44+
]
45+
46+
postcss(plugins)
47+
.process(imports, { from: undefined, to: OUTPUT })
48+
.then(result => {
49+
mkdirSync(dirname(OUTPUT), { recursive: true })
50+
writeFileSync(OUTPUT, [HEADER, result.css].join('\n'))
51+
console.log(`\n✅ ${config.output.name}.css built successfully.\n`)
52+
})
53+
.catch(err => {
54+
console.error('❌ Build failed:', err)
55+
})

0 commit comments

Comments
 (0)