nextia 4.0.6 → 4.0.8
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/LICENSE +1 -1
- package/README.md +16 -1
- package/package.json +14 -6
- package/src/bin.js +203 -0
- package/src/lib.js +1 -3
- package/src/template/README.md +33 -0
- package/src/template/_env.dev +2 -0
- package/src/template/_env.prod +1 -0
- package/src/template/_env.test +1 -0
- package/src/template/_gitignore +9 -0
- package/src/template/package.json +39 -0
- package/src/template/public/error.html +14 -0
- package/src/template/public/logo.svg +865 -0
- package/src/template/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/src/template/src/assets/i18n/index.js +8 -0
- package/src/template/src/assets/icon/icons.svg +498 -0
- package/src/template/src/assets/img/image.jpg +0 -0
- package/src/template/src/components/Icon/index.jsx +51 -0
- package/src/template/src/components/Link/index.jsx +12 -0
- package/src/template/src/components/index.js +4 -0
- package/src/template/src/containers/I18n/index.jsx +23 -0
- package/src/template/src/containers/Translate/index.jsx +30 -0
- package/src/template/src/containers/Translate/style.css +2 -0
- package/src/template/src/containers/index.js +7 -0
- package/src/template/src/index.html +18 -0
- package/src/template/src/index.jsx +9 -0
- package/src/template/src/pages/demo/functions.js +4 -0
- package/src/template/src/pages/demo/index.jsx +14 -0
- package/src/template/src/pages/demo/style.css +2 -0
- package/src/template/src/pages/functions.js +9 -0
- package/src/template/src/pages/home/functions.js +43 -0
- package/src/template/src/pages/home/index.jsx +14 -0
- package/src/template/src/pages/home/style.css +1 -0
- package/src/template/src/pages/http/not-found/index.jsx +17 -0
- package/src/template/src/pages/http/not-found/style.css +1 -0
- package/src/template/src/pages/index.jsx +65 -0
- package/src/template/src/theme/animations.css +30 -0
- package/src/template/src/theme/index.css +38 -0
- package/src/template/src/theme/util.css +39 -0
- package/src/template/src/utils/hooks.js +19 -0
- package/src/template/src/utils/index.js +17 -0
- package/src/template/vite.config.js +101 -0
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 Sinuhe
|
|
3
|
+
Copyright (c) 2025 Sinuhe Dev. https://sinuhe.dev
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -2,10 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
## Create fast web applications
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Go to test
|
|
6
|
+
|
|
6
7
|
```sh
|
|
7
8
|
npm i
|
|
8
9
|
cd test
|
|
9
10
|
```
|
|
10
11
|
|
|
12
|
+
commands
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm i
|
|
16
|
+
npm run test:my-app
|
|
17
|
+
node --run test:my-app
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
create project
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npm nextia@latest my-app
|
|
24
|
+
```
|
|
25
|
+
|
|
11
26
|
[npm](https://www.npmjs.com/package/nextia)
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextia",
|
|
3
3
|
"description": "Create fast web applications",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.8",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">22"
|
|
7
|
+
},
|
|
5
8
|
"type": "module",
|
|
6
9
|
"license": "MIT",
|
|
7
10
|
"author": {
|
|
8
|
-
"name": "Sinuhe
|
|
11
|
+
"name": "Sinuhe Dev.",
|
|
9
12
|
"email": "sinuhe.dev@gmail.com",
|
|
10
13
|
"url": "https://sinuhe.dev"
|
|
11
14
|
},
|
|
@@ -13,22 +16,27 @@
|
|
|
13
16
|
"type": "git",
|
|
14
17
|
"url": "git+https://github.com/sinuhedev/nextia.git"
|
|
15
18
|
},
|
|
19
|
+
"homepage": "https://github.com/sinuhedev/nextia",
|
|
16
20
|
"keywords": [
|
|
17
21
|
"react"
|
|
18
22
|
],
|
|
23
|
+
"bin": {
|
|
24
|
+
"nextia": "src/bin.js"
|
|
25
|
+
},
|
|
19
26
|
"main": "src/lib.js",
|
|
20
27
|
"eslintConfig": {
|
|
21
28
|
"extends": "./node_modules/standard/eslintrc.json"
|
|
22
29
|
},
|
|
23
30
|
"scripts": {
|
|
24
31
|
"start": "echo 'go to test'",
|
|
25
|
-
"clean": "rm -fr node_modules package-lock.json",
|
|
32
|
+
"clean": "rm -fr node_modules package-lock.json my-app",
|
|
26
33
|
"make": "npm run clean && npm install",
|
|
27
|
-
"lint": "standard 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --verbose"
|
|
34
|
+
"lint": "standard 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --verbose",
|
|
35
|
+
"test:my-app": "node src/bin.js my-app"
|
|
28
36
|
},
|
|
29
37
|
"peerDependencies": {
|
|
30
|
-
"react": "^19.
|
|
31
|
-
"react-dom": "^19.
|
|
38
|
+
"react": "^19.2.0",
|
|
39
|
+
"react-dom": "^19.2.0"
|
|
32
40
|
},
|
|
33
41
|
"devDependencies": {
|
|
34
42
|
"standard": "^17.1.2"
|
package/src/bin.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) 2025 Sinuhe Dev. https://sinuhe.dev
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* https://github.com/sinuhedev/nextia
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { fileURLToPath } from 'node:url'
|
|
13
|
+
import { dirname } from 'node:path'
|
|
14
|
+
import { mkdir, writeFile, readFile, cp, rename, access } from 'node:fs/promises'
|
|
15
|
+
|
|
16
|
+
async function createPage (name) {
|
|
17
|
+
const toPascalCase = str => str
|
|
18
|
+
.toLowerCase()
|
|
19
|
+
.replace(/[^a-zA-Z0-9 ]/g, ' ') // replace special characters
|
|
20
|
+
.split(/\s+/) // split by spaces
|
|
21
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
22
|
+
.join('')
|
|
23
|
+
|
|
24
|
+
const dirName = `./src/pages/${name}`
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
await mkdir(dirName)
|
|
28
|
+
|
|
29
|
+
const pageName = toPascalCase(name) + 'Page'
|
|
30
|
+
|
|
31
|
+
// index.jsx
|
|
32
|
+
writeFile(`${dirName}/index.jsx`,
|
|
33
|
+
`import React, { useEffect } from 'react'
|
|
34
|
+
import { useFx, css } from 'nextia'
|
|
35
|
+
import functions from './functions'
|
|
36
|
+
import './style.css'
|
|
37
|
+
|
|
38
|
+
export default function ${pageName} () {
|
|
39
|
+
const { state, fx } = useFx(functions)
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<section className={css('${pageName}', '')}>
|
|
43
|
+
${pageName}
|
|
44
|
+
</section>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
`)
|
|
48
|
+
|
|
49
|
+
// style.sss
|
|
50
|
+
writeFile(`${dirName}/style.css`,
|
|
51
|
+
`.${pageName} {
|
|
52
|
+
}`)
|
|
53
|
+
|
|
54
|
+
// function.js
|
|
55
|
+
writeFile(`${dirName}/functions.js`,
|
|
56
|
+
`const initialState = {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default { initialState }
|
|
60
|
+
`)
|
|
61
|
+
} catch (err) {
|
|
62
|
+
console.error(err)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function createComponent (name) {
|
|
67
|
+
const dirName = `./src/components/${name}`
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
await mkdir(dirName)
|
|
71
|
+
const componentName = name.replaceAll('/', '') + '-component'
|
|
72
|
+
|
|
73
|
+
// index.jsx
|
|
74
|
+
writeFile(`${dirName}/index.jsx`,
|
|
75
|
+
`import React, { useEffect } from 'react'
|
|
76
|
+
import { css } from 'nextia'
|
|
77
|
+
import './style.css'
|
|
78
|
+
|
|
79
|
+
export default function ${name} ({ className, style }) {
|
|
80
|
+
return (
|
|
81
|
+
<article className={css('${componentName}', className)} style={style}>
|
|
82
|
+
${componentName}
|
|
83
|
+
</article>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
`)
|
|
87
|
+
|
|
88
|
+
// style.css
|
|
89
|
+
writeFile(`${dirName}/style.css`,
|
|
90
|
+
`.${componentName} {
|
|
91
|
+
}`
|
|
92
|
+
)
|
|
93
|
+
} catch (err) {
|
|
94
|
+
console.error(err)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async function createContainer (name) {
|
|
99
|
+
const dirName = `./src/containers/${name}`
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
await mkdir(dirName)
|
|
103
|
+
const containerName = name.replaceAll('/', '') + '-container'
|
|
104
|
+
|
|
105
|
+
// index.jsx
|
|
106
|
+
writeFile(`${dirName}/index.jsx`,
|
|
107
|
+
`import React, { useEffect } from 'react'
|
|
108
|
+
import { useFx, css } from 'nextia'
|
|
109
|
+
import functions from './functions'
|
|
110
|
+
import './style.css'
|
|
111
|
+
|
|
112
|
+
export default function ${name} ({ className, style }) {
|
|
113
|
+
const { state, fx } = useFx(functions)
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<article className={css('${containerName}', className, '')} style={style}>
|
|
117
|
+
${containerName}
|
|
118
|
+
</article>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
`)
|
|
122
|
+
|
|
123
|
+
// style.css
|
|
124
|
+
writeFile(`${dirName}/style.css`,
|
|
125
|
+
`.${containerName} {
|
|
126
|
+
}`)
|
|
127
|
+
|
|
128
|
+
// function.js
|
|
129
|
+
writeFile(`${dirName}/functions.js`,
|
|
130
|
+
`const initialState = {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default { initialState }
|
|
134
|
+
`)
|
|
135
|
+
} catch (err) {
|
|
136
|
+
console.error(err)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function createProject (name) {
|
|
141
|
+
let projectPath
|
|
142
|
+
|
|
143
|
+
try {
|
|
144
|
+
projectPath = process.cwd() + `/${name}/`
|
|
145
|
+
await access(projectPath)
|
|
146
|
+
console.error(`The "${name}" already exists.`)
|
|
147
|
+
return
|
|
148
|
+
} catch (error) {
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const template = dirname(fileURLToPath(import.meta.url)) + '/template/'
|
|
152
|
+
|
|
153
|
+
// Create new project
|
|
154
|
+
try {
|
|
155
|
+
const mv = fileName => rename(projectPath + `_${fileName}`, projectPath + `.${fileName}`)
|
|
156
|
+
await cp(template, projectPath, { recursive: true })
|
|
157
|
+
const replaceToken = async (filename, token, value) => {
|
|
158
|
+
const content = await readFile(projectPath + filename, 'utf8')
|
|
159
|
+
const updated = content.replaceAll(token, value)
|
|
160
|
+
await writeFile(projectPath + filename, updated, 'utf8')
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
await mv('env.dev')
|
|
164
|
+
await mv('env.prod')
|
|
165
|
+
await mv('env.test')
|
|
166
|
+
await mv('gitignore')
|
|
167
|
+
|
|
168
|
+
// replace tokens
|
|
169
|
+
await replaceToken('README.md', 'TEMPLATE', name)
|
|
170
|
+
await replaceToken('package.json', 'TEMPLATE', name)
|
|
171
|
+
} catch (err) {
|
|
172
|
+
console.error(err)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* main
|
|
178
|
+
*/
|
|
179
|
+
|
|
180
|
+
const ARG1 = process.argv[2]
|
|
181
|
+
const ARG2 = process.argv[3]
|
|
182
|
+
|
|
183
|
+
switch (ARG1) {
|
|
184
|
+
case 'page':
|
|
185
|
+
if (ARG2) createPage(ARG2)
|
|
186
|
+
else console.warn('npm run page <page-name>')
|
|
187
|
+
break
|
|
188
|
+
|
|
189
|
+
case 'component':
|
|
190
|
+
if (ARG2) createComponent(ARG2)
|
|
191
|
+
else console.warn('npm run component <ComponentName>')
|
|
192
|
+
break
|
|
193
|
+
|
|
194
|
+
case 'container':
|
|
195
|
+
if (ARG2) createContainer(ARG2)
|
|
196
|
+
else console.warn('npm run container <ContainerName>')
|
|
197
|
+
break
|
|
198
|
+
|
|
199
|
+
default:
|
|
200
|
+
if (ARG1) createProject(ARG1)
|
|
201
|
+
else console.warn('npm nextia@latest <ProjectName>')
|
|
202
|
+
break
|
|
203
|
+
}
|
package/src/lib.js
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# TEMPLATE
|
|
2
|
+
|
|
3
|
+
## To start
|
|
4
|
+
|
|
5
|
+
Open http://localhost:3000 to view it in the browser.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm i
|
|
9
|
+
npm start
|
|
10
|
+
node --run start
|
|
11
|
+
#
|
|
12
|
+
npm test
|
|
13
|
+
npm run build <ENV>
|
|
14
|
+
npm run preview
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## env
|
|
18
|
+
|
|
19
|
+
```.env
|
|
20
|
+
.env # loaded in all cases
|
|
21
|
+
.env.[ENV] # only loaded in specified ENV [ dev, test, prod ]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
* .env.dev
|
|
25
|
+
* .env.prod
|
|
26
|
+
* .env.test
|
|
27
|
+
|
|
28
|
+
```env
|
|
29
|
+
VITE_TITLE=TITLE
|
|
30
|
+
|
|
31
|
+
VITE_LOGGER=true
|
|
32
|
+
VITE_VIEW_TRANSITION=false
|
|
33
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_TITLE=prod
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_TITLE=test
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TEMPLATE",
|
|
3
|
+
"description": "description",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": true,
|
|
7
|
+
"eslintConfig": {
|
|
8
|
+
"extends": "./node_modules/standard/eslintrc.json"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "vite --mode dev",
|
|
12
|
+
"clean": "rm -fr .coverage node_modules out package-lock.json",
|
|
13
|
+
"make": "npm run clean && npm install",
|
|
14
|
+
"build": "vite build --mode",
|
|
15
|
+
"preview": "vite preview",
|
|
16
|
+
"lint": "standard 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --verbose",
|
|
17
|
+
"page": "npm nextia page",
|
|
18
|
+
"component": "npm nextia component",
|
|
19
|
+
"container": "npm nextia container",
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"test:name": "vitest --testNamePattern",
|
|
22
|
+
"test:silent": "vitest --silent",
|
|
23
|
+
"test:coverage": "vitest --silent --coverage"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
27
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
28
|
+
"autoprefixer": "^10.4.21",
|
|
29
|
+
"jsdom": "^26.1.0",
|
|
30
|
+
"vite": "^7.1.1",
|
|
31
|
+
"vitest": "^3.0.4",
|
|
32
|
+
"standard": "^17.1.2"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"nextia": "^4.0.6",
|
|
36
|
+
"react": "^19.1.1",
|
|
37
|
+
"react-dom": "^19.1.1"
|
|
38
|
+
}
|
|
39
|
+
}
|