nextia 3.0.2 → 4.0.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.
Files changed (3) hide show
  1. package/README.md +2 -7
  2. package/package.json +4 -9
  3. package/src/bin.js +0 -187
package/README.md CHANGED
@@ -2,15 +2,10 @@
2
2
 
3
3
  ## Create fast web applications
4
4
 
5
+ # Go to test
5
6
  ```sh
6
7
  npm i
7
- # Go to examples
8
- cd examples
9
- ```
10
-
11
- ```sh
12
- # create project
13
- npx nextia@latest my-app
8
+ cd test
14
9
  ```
15
10
 
16
11
  [npm](https://www.npmjs.com/package/nextia)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nextia",
3
3
  "description": "Create fast web applications",
4
- "version": "3.0.2",
4
+ "version": "4.0.1",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -17,19 +17,14 @@
17
17
  "react"
18
18
  ],
19
19
  "main": "src/lib.js",
20
- "bin": {
21
- "nextia": "src/bin.js"
22
- },
23
20
  "eslintConfig": {
24
21
  "extends": "./node_modules/standard/eslintrc.json"
25
22
  },
26
23
  "scripts": {
27
- "start": "echo 'go to examples'",
24
+ "start": "echo 'go to test'",
28
25
  "clean": "rm -fr node_modules package-lock.json",
29
26
  "make": "npm run clean && npm install",
30
- "eslint": "standard src",
31
- "nextia": "node src/bin.js",
32
- "nextia:my-app": "node src/bin.js my-app"
27
+ "lint": "standard 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --verbose"
33
28
  },
34
29
  "peerDependencies": {
35
30
  "react": "^19.0.0",
@@ -38,4 +33,4 @@
38
33
  "devDependencies": {
39
34
  "standard": "^17.1.2"
40
35
  }
41
- }
36
+ }
package/src/bin.js DELETED
@@ -1,187 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Copyright (c) 2025 Sinuhe Maceda 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 { mkdir, writeFile } from 'node:fs/promises'
13
-
14
- async function createPage (name, isNext, isType) {
15
- const toPascalCase = str => str
16
- .toLowerCase()
17
- .replace(/[^a-zA-Z0-9 ]/g, ' ') // replace special characters
18
- .split(/\s+/) // split by spaces
19
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
20
- .join('')
21
-
22
- const index = isNext ? 1 : 0
23
- const config = {
24
- root: ['pages', 'app'],
25
- file: ['index.jsx', 'page.jsx'],
26
- directive: [
27
- '',
28
- `'use client'
29
-
30
- `]
31
- }
32
-
33
- const dirName = `./src/${config.root[index]}/${name}`
34
-
35
- try {
36
- await mkdir(dirName)
37
-
38
- const pageName = toPascalCase(name) + 'Page'
39
-
40
- // index.jsx
41
- writeFile(`${dirName}/${config.file[index]}`,
42
- `${config.directive[index]}import React, { useEffect } from 'react'
43
- import { useFx, css } from 'nextia'
44
- import functions from './functions'
45
- import './style.css'
46
-
47
- export default function ${pageName} () {
48
- const { state, fx } = useFx(functions)
49
-
50
- return (
51
- <section className={css('${pageName}', '')}>
52
- ${pageName}
53
- </section>
54
- )
55
- }
56
- `)
57
-
58
- // style.sss
59
- writeFile(`${dirName}/style.css`,
60
- `.${pageName} {
61
- }`)
62
-
63
- // function.js
64
- writeFile(`${dirName}/functions.js`,
65
- `const initialState = {
66
- }
67
-
68
- export default { initialState }
69
- `)
70
- } catch (err) {
71
- console.error(err)
72
- }
73
- }
74
-
75
- async function createComponent (name, isType) {
76
- const dirName = `./src/components/${name}`
77
-
78
- try {
79
- await mkdir(dirName)
80
- const componentName = name.replaceAll('/', '') + '-component'
81
-
82
- // index.jsx
83
- writeFile(`${dirName}/index.jsx`,
84
- `import React, { useEffect } from 'react'
85
- import { css } from 'nextia'
86
- import './style.css'
87
-
88
- export default function ${name} ({ className, style }) {
89
- return (
90
- <article className={css('${componentName}', className)} style={style}>
91
- ${componentName}
92
- </article>
93
- )
94
- }
95
- `)
96
-
97
- // style.css
98
- writeFile(`${dirName}/style.css`,
99
- `.${componentName} {
100
- }`
101
- )
102
- } catch (err) {
103
- console.error(err)
104
- }
105
- }
106
-
107
- async function createContainer (name, isType) {
108
- const dirName = `./src/containers/${name}`
109
-
110
- try {
111
- await mkdir(dirName)
112
- const containerName = name.replaceAll('/', '') + '-container'
113
-
114
- // index.jsx
115
- writeFile(`${dirName}/index.jsx`,
116
- `import React, { useEffect } from 'react'
117
- import { useFx, css } from 'nextia'
118
- import functions from './functions'
119
- import './style.css'
120
-
121
- export default function ${name} ({ className, style }) {
122
- const { state, fx } = useFx(functions)
123
-
124
- return (
125
- <article className={css('${containerName}', className, '')} style={style}>
126
- ${containerName}
127
- </article>
128
- )
129
- }
130
- `)
131
-
132
- // style.css
133
- writeFile(`${dirName}/style.css`,
134
- `.${containerName} {
135
- }`)
136
-
137
- // function.js
138
- writeFile(`${dirName}/functions.js`,
139
- `const initialState = {
140
- }
141
-
142
- export default { initialState }
143
- `)
144
- } catch (err) {
145
- console.error(err)
146
- }
147
- }
148
-
149
- /**
150
- * main
151
- */
152
-
153
- const CMD = process.argv[2]
154
- const PROJECT_NAME = process.argv[2]
155
- const FILE_NAME = process.argv[3]
156
-
157
- switch (CMD) {
158
- case 'page':
159
- case 'page:type':
160
- case 'next:page':
161
- case 'next:page:type':
162
- if (FILE_NAME) {
163
- createPage(
164
- FILE_NAME,
165
- ['next:page', 'next:page:type'].includes(CMD),
166
- ['page:type', 'next:page:type'].includes(CMD))
167
- } else console.warn('npm run page <page-name>')
168
- break
169
-
170
- case 'component':
171
- case 'component:type':
172
- if (FILE_NAME) createComponent(FILE_NAME, CMD === 'component:type')
173
- else console.warn('npm run component <ComponentName>')
174
- break
175
-
176
- case 'container':
177
- case 'container:type':
178
- if (FILE_NAME) createContainer(FILE_NAME, CMD === 'component:type')
179
- else console.warn('npm run container <ContainerName>')
180
- break
181
-
182
- default:
183
- // create project
184
- if (PROJECT_NAME) console.info(`Project name: ${PROJECT_NAME}`)
185
- else console.warn('npx nextia@latest <my-app>')
186
- break
187
- }