Skip to content

Commit c3b3df9

Browse files
committedFeb 16, 2025
feat: new workspace, use vite for bundling
1 parent 1ee8ef7 commit c3b3df9

8 files changed

+891
-732
lines changed
 

‎index.html

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
7+
<title>AnyFrame rebuild test</title>
8+
<script src="./dist/index.iife.js"></script>
9+
</head>
10+
<body>
11+
<div
12+
class="box bg-[0_255_0] [display]-flex [justify-content,align-items]-center [border-radius]-1rem"
13+
>
14+
TenoxUI App
15+
</div>
16+
<script>
17+
const { AnyFrame } = __anyframe_core__
18+
const ui = new AnyFrame({
19+
property: {
20+
// bg: 'background'
21+
},
22+
classes: {
23+
'--bg-opacity': {
24+
bg: '{1}% || 1'
25+
},
26+
background: {
27+
bg: 'rgb({0} / var(--bg-opacity)) || red'
28+
}
29+
},
30+
apply: {
31+
'.box': '[width,height]-200px'
32+
}
33+
})
34+
35+
const allClasses2 = [...document.querySelectorAll('*')].flatMap((el) => {
36+
let classes
37+
return (
38+
((classes = el.getAttribute('class')) == null
39+
? void 0
40+
: classes.split(/\s+/).filter(Boolean)) || []
41+
)
42+
})
43+
44+
console.log(allClasses2)
45+
46+
const stylesheet = ui.create(allClasses2)
47+
console.log(stylesheet)
48+
const styleTag = document.createElement('style')
49+
styleTag.textContent = stylesheet
50+
document.head.appendChild(styleTag)
51+
console.log(document.head.innerHTML)
52+
</script>
53+
</body>
54+
</html>

‎package.json

+24-23
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
{
22
"name": "@anyframe/core",
3-
"version": "0.1.0",
4-
"description": "AnyFrame core module",
5-
"author": "AnyFrame",
3+
"version": "0.2.0",
4+
"description": "Starter repository template for anyframe project",
5+
"author": "NOuSantx <nousantx@gmail.com>",
66
"license": "MIT",
7-
"homepage": "https://github.com/anyframe-org/core#readme",
7+
"homepage": "https://github.com/nousantx/starter-repo-template#readme",
88
"keywords": [
9-
"css-framework",
10-
"tenoxui",
11-
"library"
9+
"keywords"
1210
],
1311
"repository": {
1412
"type": "git",
15-
"url": "git+https://github.com/anyframe-org/core.git"
13+
"url": "git+https://github.com/nousantx/starter-repo-template.git"
1614
},
1715
"bugs": {
18-
"url": "https://github.com/anyframe-org/core/issues"
16+
"url": "https://github.com/nousantx/starter-repo-template/issues"
1917
},
2018
"files": [
2119
"dist",
@@ -26,25 +24,28 @@
2624
"type": "module",
2725
"types": "dist/index.d.ts",
2826
"main": "dist/index.cjs",
29-
"module": "dist/index.esm.js",
30-
"browser": "dist/index.umd.js",
27+
"module": "dist/index.es.js",
28+
"browser": "dist/index.iife.js",
29+
"exports": {
30+
".": {
31+
"require": "dist/index.cjs",
32+
"import": "dist/index.es.js"
33+
}
34+
},
3135
"scripts": {
32-
"build": "rollup -c",
36+
"dev": "vite build --watch",
37+
"build": "tsc && vite build",
38+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist",
39+
"build:all": "pnpm build && pnpm build:types",
3340
"test": "saintest"
3441
},
42+
"packageManager": "pnpm@10.4.0",
3543
"devDependencies": {
3644
"@nousantx/someutils": "^0.6.1",
37-
"@rollup/plugin-commonjs": "^28.0.2",
38-
"@rollup/plugin-node-resolve": "^16.0.0",
39-
"@rollup/plugin-terser": "^0.4.4",
40-
"@rollup/plugin-typescript": "^12.1.2",
41-
"@tenoxui/property": "^1.4.5",
42-
"@tenoxui/static": "0.3.2",
43-
"@types/node": "^22.13.1",
44-
"rollup": "^4.34.6",
45-
"saintest": "0.2.0",
46-
"tslib": "^2.8.1",
47-
"typescript": "^5.7.3"
45+
"@tenoxui/static": "^0.3.3",
46+
"saintest": "^0.2.0",
47+
"typescript": "^5.7.3",
48+
"vite": "^6.1.0"
4849
},
4950
"dependencies": {
5051
"@tenoxui/types": "^0.1.2"

‎pnpm-lock.yaml

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

‎rollup.config.js

-104
This file was deleted.

‎test/h.test.js ‎test/css.test.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, beforeEach, afterEach } from 'saintest'
2-
import { AnyFrame } from '../dist/index.esm.js'
2+
import { AnyFrame } from '../dist/index.es.js'
33

44
describe('AnyFrame', () => {
55
describe('Configuration', () => {
@@ -86,9 +86,6 @@ describe('AnyFrame', () => {
8686
})
8787

8888
it('should parse style correctly', () => {
89-
console.log(ui.create(['bg-red']))
90-
91-
9289
expect(ui.create(['bg-primary'])).toContain('.bg-primary { background: #ccf654 }')
9390
})
9491

@@ -99,7 +96,7 @@ describe('AnyFrame', () => {
9996
}
10097
})
10198
const styles = ui.create(['bg-red'])
102-
expect(styles).toContain('@layer base, theme, components, utilities;')
99+
expect(styles).toContain('@layer theme, base, components, utilities;')
103100
expect(styles).toContain('body { background: #0000ff }')
104101
})
105102

‎tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
"rootDir": "src",
88
"strict": true,
99
"esModuleInterop": true,
10-
"noUnusedLocals": true
10+
"noUnusedLocals": true,
11+
"moduleResolution": "bundler",
12+
"skipLibCheck": true
1113
},
1214
"include": ["src"],
1315
"exclude": ["node_modules", "dist"]

‎vite.config.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { defineConfig } from 'vite'
2+
3+
export default defineConfig({
4+
build: {
5+
target: 'es2017',
6+
lib: {
7+
name: '__anyframe_core__',
8+
entry: './src/index.ts',
9+
formats: ['es', 'iife', 'cjs', 'umd'],
10+
fileName: (format) => `index.${format}${format !== 'cjs' ? '.js' : ''}`
11+
},
12+
sourcemap: true,
13+
rollupOptions: {
14+
output: { exports: 'named' }
15+
}
16+
}
17+
})

‎yarn.lock

-599
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.