nextia 4.0.0 → 4.0.2
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/package.json +1 -1
- package/create-nextia/LICENSE +0 -21
- package/create-nextia/README.md +0 -17
- package/create-nextia/package.json +0 -38
- package/create-nextia/src/bin.js +0 -241
- package/create-nextia/templates/nextjs/README.md +0 -34
- package/create-nextia/templates/nextjs/_env.development +0 -4
- package/create-nextia/templates/nextjs/_env.production +0 -3
- package/create-nextia/templates/nextjs/_env.test +0 -3
- package/create-nextia/templates/nextjs/_gitignore +0 -9
- package/create-nextia/templates/nextjs/jsconfig.json +0 -5
- package/create-nextia/templates/nextjs/next.config.js +0 -18
- package/create-nextia/templates/nextjs/package.json +0 -39
- package/create-nextia/templates/nextjs/public/logo.svg +0 -865
- package/create-nextia/templates/nextjs/src/app/counter/functions.js +0 -6
- package/create-nextia/templates/nextjs/src/app/counter/page.js +0 -42
- package/create-nextia/templates/nextjs/src/app/counter/style.css +0 -2
- package/create-nextia/templates/nextjs/src/app/env/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/env/page.js +0 -24
- package/create-nextia/templates/nextjs/src/app/env/style.css +0 -1
- package/create-nextia/templates/nextjs/src/app/functions.js +0 -33
- package/create-nextia/templates/nextjs/src/app/home/functions.js +0 -43
- package/create-nextia/templates/nextjs/src/app/home/page.js +0 -184
- package/create-nextia/templates/nextjs/src/app/home/style.css +0 -51
- package/create-nextia/templates/nextjs/src/app/images/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/images/page.jsx +0 -26
- package/create-nextia/templates/nextjs/src/app/images/style.css +0 -10
- package/create-nextia/templates/nextjs/src/app/layout.js +0 -109
- package/create-nextia/templates/nextjs/src/app/media-query/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/media-query/page.js +0 -33
- package/create-nextia/templates/nextjs/src/app/media-query/style.css +0 -38
- package/create-nextia/templates/nextjs/src/app/mockapi/functions.js +0 -71
- package/create-nextia/templates/nextjs/src/app/mockapi/page.js +0 -95
- package/create-nextia/templates/nextjs/src/app/mockapi/style.css +0 -57
- package/create-nextia/templates/nextjs/src/app/my-context/functions.js +0 -11
- package/create-nextia/templates/nextjs/src/app/my-context/page.js +0 -27
- package/create-nextia/templates/nextjs/src/app/my-context/style.css +0 -1
- package/create-nextia/templates/nextjs/src/app/not-found.js +0 -7
- package/create-nextia/templates/nextjs/src/app/page.js +0 -3
- package/create-nextia/templates/nextjs/src/app/search-params/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/search-params/page.js +0 -49
- package/create-nextia/templates/nextjs/src/app/search-params/style.css +0 -1
- package/create-nextia/templates/nextjs/src/app/subpage/hello/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/subpage/hello/page.js +0 -16
- package/create-nextia/templates/nextjs/src/app/subpage/hello/style.css +0 -1
- package/create-nextia/templates/nextjs/src/app/translate/functions.js +0 -4
- package/create-nextia/templates/nextjs/src/app/translate/page.js +0 -35
- package/create-nextia/templates/nextjs/src/app/translate/style.css +0 -1
- package/create-nextia/templates/nextjs/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/create-nextia/templates/nextjs/src/assets/i18n/index.js +0 -26
- package/create-nextia/templates/nextjs/src/assets/icon/icons.svg +0 -498
- package/create-nextia/templates/nextjs/src/assets/img/image.jpg +0 -0
- package/create-nextia/templates/nextjs/src/assets/theme/animations.css +0 -89
- package/create-nextia/templates/nextjs/src/assets/theme/index.css +0 -38
- package/create-nextia/templates/nextjs/src/assets/theme/util.css +0 -71
- package/create-nextia/templates/nextjs/src/components/Counter/index.js +0 -37
- package/create-nextia/templates/nextjs/src/components/Counter/style.css +0 -5
- package/create-nextia/templates/nextjs/src/components/Icon/index.jsx +0 -55
- package/create-nextia/templates/nextjs/src/components/Link/index.jsx +0 -10
- package/create-nextia/templates/nextjs/src/components/Translation/index.jsx +0 -12
- package/create-nextia/templates/nextjs/src/components/Translation/style.css +0 -1
- package/create-nextia/templates/nextjs/src/components/index.js +0 -6
- package/create-nextia/templates/nextjs/src/containers/I18n/index.jsx +0 -23
- package/create-nextia/templates/nextjs/src/containers/Translate/index.jsx +0 -30
- package/create-nextia/templates/nextjs/src/containers/Translate/style.css +0 -2
- package/create-nextia/templates/nextjs/src/containers/index.js +0 -7
- package/create-nextia/templates/nextjs/src/services/api.js +0 -10
- package/create-nextia/templates/nextjs/src/services/http.js +0 -135
- package/create-nextia/templates/nextjs/src/utils/hooks.js +0 -26
- package/create-nextia/templates/nextjs/src/utils/index.js +0 -21
- package/create-nextia/templates/nextjs/vitest.config.js +0 -38
- package/create-nextia/templates/vitejs/README.md +0 -33
- package/create-nextia/templates/vitejs/_env.development +0 -4
- package/create-nextia/templates/vitejs/_env.production +0 -2
- package/create-nextia/templates/vitejs/_env.test +0 -2
- package/create-nextia/templates/vitejs/_gitignore +0 -6
- package/create-nextia/templates/vitejs/package.json +0 -39
- package/create-nextia/templates/vitejs/public/error.html +0 -14
- package/create-nextia/templates/vitejs/public/logo.svg +0 -865
- package/create-nextia/templates/vitejs/src/assets/fonts/Roboto-Regular.ttf +0 -0
- package/create-nextia/templates/vitejs/src/assets/i18n/index.js +0 -26
- package/create-nextia/templates/vitejs/src/assets/icon/icons.svg +0 -498
- package/create-nextia/templates/vitejs/src/assets/img/image.jpg +0 -0
- package/create-nextia/templates/vitejs/src/assets/theme/animations.css +0 -89
- package/create-nextia/templates/vitejs/src/assets/theme/index.css +0 -38
- package/create-nextia/templates/vitejs/src/assets/theme/util.css +0 -71
- package/create-nextia/templates/vitejs/src/components/Counter/index.jsx +0 -38
- package/create-nextia/templates/vitejs/src/components/Counter/style.css +0 -5
- package/create-nextia/templates/vitejs/src/components/Icon/index.jsx +0 -51
- package/create-nextia/templates/vitejs/src/components/Link/index.jsx +0 -12
- package/create-nextia/templates/vitejs/src/components/Translation/index.jsx +0 -12
- package/create-nextia/templates/vitejs/src/components/Translation/style.css +0 -1
- package/create-nextia/templates/vitejs/src/components/index.js +0 -6
- package/create-nextia/templates/vitejs/src/containers/I18n/index.jsx +0 -23
- package/create-nextia/templates/vitejs/src/containers/Translate/index.jsx +0 -30
- package/create-nextia/templates/vitejs/src/containers/Translate/style.css +0 -2
- package/create-nextia/templates/vitejs/src/containers/index.js +0 -7
- package/create-nextia/templates/vitejs/src/index.html +0 -18
- package/create-nextia/templates/vitejs/src/index.jsx +0 -9
- package/create-nextia/templates/vitejs/src/pages/counter/functions.js +0 -6
- package/create-nextia/templates/vitejs/src/pages/counter/index.jsx +0 -39
- package/create-nextia/templates/vitejs/src/pages/counter/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/env/functions.js +0 -4
- package/create-nextia/templates/vitejs/src/pages/env/index.jsx +0 -28
- package/create-nextia/templates/vitejs/src/pages/env/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/functions.js +0 -27
- package/create-nextia/templates/vitejs/src/pages/home/functions.js +0 -43
- package/create-nextia/templates/vitejs/src/pages/home/index.jsx +0 -182
- package/create-nextia/templates/vitejs/src/pages/home/style.css +0 -51
- package/create-nextia/templates/vitejs/src/pages/http/not-found/index.jsx +0 -17
- package/create-nextia/templates/vitejs/src/pages/http/not-found/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/images/functions.js +0 -4
- package/create-nextia/templates/vitejs/src/pages/images/index.jsx +0 -23
- package/create-nextia/templates/vitejs/src/pages/images/style.css +0 -9
- package/create-nextia/templates/vitejs/src/pages/index.jsx +0 -104
- package/create-nextia/templates/vitejs/src/pages/media-query/functions.js +0 -4
- package/create-nextia/templates/vitejs/src/pages/media-query/index.jsx +0 -30
- package/create-nextia/templates/vitejs/src/pages/media-query/style.css +0 -38
- package/create-nextia/templates/vitejs/src/pages/mockapi/functions.js +0 -71
- package/create-nextia/templates/vitejs/src/pages/mockapi/index.jsx +0 -98
- package/create-nextia/templates/vitejs/src/pages/mockapi/style.css +0 -57
- package/create-nextia/templates/vitejs/src/pages/my-context/functions.js +0 -8
- package/create-nextia/templates/vitejs/src/pages/my-context/index.jsx +0 -27
- package/create-nextia/templates/vitejs/src/pages/my-context/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/search-params/functions.js +0 -4
- package/create-nextia/templates/vitejs/src/pages/search-params/index.jsx +0 -42
- package/create-nextia/templates/vitejs/src/pages/search-params/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/functions.js +0 -3
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/index.jsx +0 -14
- package/create-nextia/templates/vitejs/src/pages/subpage/hello/style.css +0 -1
- package/create-nextia/templates/vitejs/src/pages/translate/functions.js +0 -5
- package/create-nextia/templates/vitejs/src/pages/translate/index.jsx +0 -32
- package/create-nextia/templates/vitejs/src/pages/translate/style.css +0 -12
- package/create-nextia/templates/vitejs/src/services/api.js +0 -9
- package/create-nextia/templates/vitejs/src/services/http.js +0 -135
- package/create-nextia/templates/vitejs/src/utils/hooks.js +0 -44
- package/create-nextia/templates/vitejs/src/utils/index.js +0 -25
- package/create-nextia/templates/vitejs/vite.config.js +0 -100
package/package.json
CHANGED
package/create-nextia/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Sinuhe Maceda https://sinuhe.dev
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/create-nextia/README.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# create-nextia
|
|
2
|
-
|
|
3
|
-
## nextia command
|
|
4
|
-
|
|
5
|
-
# Go to test
|
|
6
|
-
```sh
|
|
7
|
-
npm i
|
|
8
|
-
npm run test:my-app
|
|
9
|
-
node --run test:my-app
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## create project
|
|
13
|
-
```sh
|
|
14
|
-
npm create nextia@latest my-app
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
[npm](https://www.npmjs.com/package/create-nextia)
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "create-nextia",
|
|
3
|
-
"description": "nextia command",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">22"
|
|
7
|
-
},
|
|
8
|
-
"type": "module",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"author": {
|
|
11
|
-
"name": "Sinuhe Maceda",
|
|
12
|
-
"email": "sinuhe.dev@gmail.com",
|
|
13
|
-
"url": "https://sinuhe.dev"
|
|
14
|
-
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/sinuhedev/nextia.git",
|
|
18
|
-
"directory": "create-nextia"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://github.com/sinuhedev/nextia/create-nextia#readme",
|
|
21
|
-
"keywords": [
|
|
22
|
-
"react"
|
|
23
|
-
],
|
|
24
|
-
"bin": {
|
|
25
|
-
"create-nextia": "src/bin.js"
|
|
26
|
-
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"start": "node src/bin.js ",
|
|
29
|
-
"clean": "rm -fr node_modules package-lock.json && [ -d 'my-app' ] && rm -r 'my-app'",
|
|
30
|
-
"make": "npm run clean && npm install",
|
|
31
|
-
"lint": "standard src",
|
|
32
|
-
"test:my-app": " [ -d 'my-app' ] && rm -r 'my-app' ; node src/bin.js ",
|
|
33
|
-
"test:page": "cd my-app ; node ../src/bin.js page my-page",
|
|
34
|
-
"test:component": "cd my-app ; node ../src/bin.js component MyComponent",
|
|
35
|
-
"test:container": "cd my-app ; node ../src/bin.js container MyContainer",
|
|
36
|
-
"test:next:page": "cd my-app ; node ../src/bin.js next:page my-page"
|
|
37
|
-
}
|
|
38
|
-
}
|
package/create-nextia/src/bin.js
DELETED
|
@@ -1,241 +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/create-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
|
-
import readline from 'node:readline/promises'
|
|
16
|
-
import { stdin as input, stdout as output } from 'node:process'
|
|
17
|
-
|
|
18
|
-
async function createPage (name, isNext) {
|
|
19
|
-
const toPascalCase = str => str
|
|
20
|
-
.toLowerCase()
|
|
21
|
-
.replace(/[^a-zA-Z0-9 ]/g, ' ') // replace special characters
|
|
22
|
-
.split(/\s+/) // split by spaces
|
|
23
|
-
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
24
|
-
.join('')
|
|
25
|
-
|
|
26
|
-
const index = isNext ? 1 : 0
|
|
27
|
-
const config = {
|
|
28
|
-
root: ['pages', 'app'],
|
|
29
|
-
file: ['index.jsx', 'page.jsx'],
|
|
30
|
-
directive: [
|
|
31
|
-
'',
|
|
32
|
-
`'use client'
|
|
33
|
-
|
|
34
|
-
`]
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const dirName = `./src/${config.root[index]}/${name}`
|
|
38
|
-
|
|
39
|
-
try {
|
|
40
|
-
await mkdir(dirName)
|
|
41
|
-
|
|
42
|
-
const pageName = toPascalCase(name) + 'Page'
|
|
43
|
-
|
|
44
|
-
// index.jsx
|
|
45
|
-
writeFile(`${dirName}/${config.file[index]}`,
|
|
46
|
-
`${config.directive[index]}import React, { useEffect } from 'react'
|
|
47
|
-
import { useFx, css } from 'nextia'
|
|
48
|
-
import functions from './functions'
|
|
49
|
-
import './style.css'
|
|
50
|
-
|
|
51
|
-
export default function ${pageName} () {
|
|
52
|
-
const { state, fx } = useFx(functions)
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<section className={css('${pageName}', '')}>
|
|
56
|
-
${pageName}
|
|
57
|
-
</section>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
`)
|
|
61
|
-
|
|
62
|
-
// style.sss
|
|
63
|
-
writeFile(`${dirName}/style.css`,
|
|
64
|
-
`.${pageName} {
|
|
65
|
-
}`)
|
|
66
|
-
|
|
67
|
-
// function.js
|
|
68
|
-
writeFile(`${dirName}/functions.js`,
|
|
69
|
-
`const initialState = {
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export default { initialState }
|
|
73
|
-
`)
|
|
74
|
-
} catch (err) {
|
|
75
|
-
console.error(err)
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function createComponent (name) {
|
|
80
|
-
const dirName = `./src/components/${name}`
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
await mkdir(dirName)
|
|
84
|
-
const componentName = name.replaceAll('/', '') + '-component'
|
|
85
|
-
|
|
86
|
-
// index.jsx
|
|
87
|
-
writeFile(`${dirName}/index.jsx`,
|
|
88
|
-
`import React, { useEffect } from 'react'
|
|
89
|
-
import { css } from 'nextia'
|
|
90
|
-
import './style.css'
|
|
91
|
-
|
|
92
|
-
export default function ${name} ({ className, style }) {
|
|
93
|
-
return (
|
|
94
|
-
<article className={css('${componentName}', className)} style={style}>
|
|
95
|
-
${componentName}
|
|
96
|
-
</article>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
`)
|
|
100
|
-
|
|
101
|
-
// style.css
|
|
102
|
-
writeFile(`${dirName}/style.css`,
|
|
103
|
-
`.${componentName} {
|
|
104
|
-
}`
|
|
105
|
-
)
|
|
106
|
-
} catch (err) {
|
|
107
|
-
console.error(err)
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
async function createContainer (name) {
|
|
112
|
-
const dirName = `./src/containers/${name}`
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
await mkdir(dirName)
|
|
116
|
-
const containerName = name.replaceAll('/', '') + '-container'
|
|
117
|
-
|
|
118
|
-
// index.jsx
|
|
119
|
-
writeFile(`${dirName}/index.jsx`,
|
|
120
|
-
`import React, { useEffect } from 'react'
|
|
121
|
-
import { useFx, css } from 'nextia'
|
|
122
|
-
import functions from './functions'
|
|
123
|
-
import './style.css'
|
|
124
|
-
|
|
125
|
-
export default function ${name} ({ className, style }) {
|
|
126
|
-
const { state, fx } = useFx(functions)
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<article className={css('${containerName}', className, '')} style={style}>
|
|
130
|
-
${containerName}
|
|
131
|
-
</article>
|
|
132
|
-
)
|
|
133
|
-
}
|
|
134
|
-
`)
|
|
135
|
-
|
|
136
|
-
// style.css
|
|
137
|
-
writeFile(`${dirName}/style.css`,
|
|
138
|
-
`.${containerName} {
|
|
139
|
-
}`)
|
|
140
|
-
|
|
141
|
-
// function.js
|
|
142
|
-
writeFile(`${dirName}/functions.js`,
|
|
143
|
-
`const initialState = {
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export default { initialState }
|
|
147
|
-
`)
|
|
148
|
-
} catch (err) {
|
|
149
|
-
console.error(err)
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async function createProject () {
|
|
154
|
-
const rl = readline.createInterface({ input, output })
|
|
155
|
-
const templates = ['', 'vitejs', 'nextjs']
|
|
156
|
-
let projectName, projectPath, template
|
|
157
|
-
|
|
158
|
-
// inputs
|
|
159
|
-
try {
|
|
160
|
-
projectName = await rl.question('Project name: ')
|
|
161
|
-
template = await rl.question('1) vitejs \n2) nextjs \n: ')
|
|
162
|
-
} catch (err) {
|
|
163
|
-
if (err.name !== 'AbortError') {
|
|
164
|
-
console.error('Unexpected error:', err)
|
|
165
|
-
}
|
|
166
|
-
} finally {
|
|
167
|
-
rl.close()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// Is new project
|
|
171
|
-
try {
|
|
172
|
-
projectPath = process.cwd() + `/${projectName}/`
|
|
173
|
-
await access(projectPath)
|
|
174
|
-
console.error(`The "${projectName}" already exists.`)
|
|
175
|
-
return
|
|
176
|
-
} catch (error) {
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// templates
|
|
180
|
-
const num = Number(template)
|
|
181
|
-
if (!(Number.isInteger(num) && num >= 1 && num <= templates.length)) {
|
|
182
|
-
console.error('The template does not exist.')
|
|
183
|
-
return
|
|
184
|
-
}
|
|
185
|
-
template = dirname(fileURLToPath(import.meta.url)) + '/../templates/' + templates[template]
|
|
186
|
-
|
|
187
|
-
// Create new project
|
|
188
|
-
try {
|
|
189
|
-
const mv = fileName => rename(projectPath + `_${fileName}`, projectPath + `.${fileName}`)
|
|
190
|
-
await cp(template, projectPath, { recursive: true })
|
|
191
|
-
const replaceToken = async (filename, token, value) => {
|
|
192
|
-
const content = await readFile(projectPath + filename, 'utf8')
|
|
193
|
-
const updated = content.replaceAll(token, value)
|
|
194
|
-
await writeFile(projectPath + filename, updated, 'utf8')
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
await mv('env.development')
|
|
198
|
-
await mv('env.production')
|
|
199
|
-
await mv('env.test')
|
|
200
|
-
await mv('gitignore')
|
|
201
|
-
|
|
202
|
-
// replace tokens
|
|
203
|
-
await replaceToken('README.md', 'TEMPLATE', projectName)
|
|
204
|
-
await replaceToken('package.json', 'TEMPLATE', projectName)
|
|
205
|
-
} catch (err) {
|
|
206
|
-
console.error(err)
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* main
|
|
212
|
-
*/
|
|
213
|
-
|
|
214
|
-
const CMD = process.argv[2]
|
|
215
|
-
const FILE_NAME = process.argv[3]
|
|
216
|
-
|
|
217
|
-
switch (CMD) {
|
|
218
|
-
case 'page':
|
|
219
|
-
if (FILE_NAME) createPage(FILE_NAME, false)
|
|
220
|
-
else console.warn('npm run page <page-name>')
|
|
221
|
-
break
|
|
222
|
-
|
|
223
|
-
case 'component':
|
|
224
|
-
if (FILE_NAME) createComponent(FILE_NAME)
|
|
225
|
-
else console.warn('npm run component <ComponentName>')
|
|
226
|
-
break
|
|
227
|
-
|
|
228
|
-
case 'container':
|
|
229
|
-
if (FILE_NAME) createContainer(FILE_NAME)
|
|
230
|
-
else console.warn('npm run container <ContainerName>')
|
|
231
|
-
break
|
|
232
|
-
|
|
233
|
-
case 'next:page':
|
|
234
|
-
if (FILE_NAME) createPage(FILE_NAME, true)
|
|
235
|
-
else console.warn('npm run next:page <page-name>')
|
|
236
|
-
break
|
|
237
|
-
|
|
238
|
-
default:
|
|
239
|
-
createProject()
|
|
240
|
-
break
|
|
241
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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 serve
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## env
|
|
18
|
-
|
|
19
|
-
```.env
|
|
20
|
-
.env # loaded in all cases
|
|
21
|
-
.env.[ENV] # only loaded in specified ENV [ development, test, production ]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
* .env.development
|
|
25
|
-
* .env.production
|
|
26
|
-
* .env.test
|
|
27
|
-
|
|
28
|
-
```env
|
|
29
|
-
NEXT_PUBLIC_LOGGER=true
|
|
30
|
-
NEXT_PUBLIC_TITLE=<ENV>-nextjs
|
|
31
|
-
#
|
|
32
|
-
API=https://65fd14fb9fc4425c653119c5.mockapi.io/api/v1
|
|
33
|
-
```
|
|
34
|
-
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import packageJson from './package.json' with { type: "json" }
|
|
2
|
-
import { execSync } from 'node:child_process'
|
|
3
|
-
|
|
4
|
-
let gitHash = ''
|
|
5
|
-
try {
|
|
6
|
-
gitHash = execSync('git rev-parse --short HEAD 2> /dev/null').toString()
|
|
7
|
-
} catch (e) { }
|
|
8
|
-
|
|
9
|
-
export default {
|
|
10
|
-
reactStrictMode: false,
|
|
11
|
-
devIndicators: false,
|
|
12
|
-
|
|
13
|
-
env: {
|
|
14
|
-
VERSION: packageJson.version,
|
|
15
|
-
GIT_HASH: gitHash
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
@@ -1,39 +0,0 @@
|
|
|
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": "NODE_OPTIONS='--inspect' next dev",
|
|
12
|
-
"start:turbopack": "NODE_OPTIONS='--inspect' next dev --turbopack",
|
|
13
|
-
"clean": "rm -fr package-lock.json node_modules .next .coverage .swc",
|
|
14
|
-
"make": "npm run clean && npm install",
|
|
15
|
-
"build": "next build",
|
|
16
|
-
"serve": "next start",
|
|
17
|
-
"lint": "standard 'src/**/*.{js,jsx}' 'test/**/*.{js,jsx}' --verbose",
|
|
18
|
-
"page": "npm create nextia@latest next:page",
|
|
19
|
-
"component": "npm create nextia@latest component",
|
|
20
|
-
"container": "npm create nextia@latest container",
|
|
21
|
-
"test": "vitest",
|
|
22
|
-
"test:name": "vitest --testNamePattern",
|
|
23
|
-
"test:silent": "vitest --silent",
|
|
24
|
-
"test:coverage": "vitest --coverage --silent"
|
|
25
|
-
},
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@vitejs/plugin-react": "^5.0.0",
|
|
28
|
-
"@vitest/coverage-v8": "^3.2.4",
|
|
29
|
-
"jsdom": "^26.1.0",
|
|
30
|
-
"vitest": "^3.0.4",
|
|
31
|
-
"standard": "^17.1.2"
|
|
32
|
-
},
|
|
33
|
-
"dependencies": {
|
|
34
|
-
"next": "^15.4.6",
|
|
35
|
-
"nextia": "4.0.0",
|
|
36
|
-
"react": "^19.1.1",
|
|
37
|
-
"react-dom": "^19.1.1"
|
|
38
|
-
}
|
|
39
|
-
}
|