@uipkge/nuxt 0.1.34 → 0.1.35

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/bin/cli.mjs CHANGED
@@ -2,6 +2,7 @@
2
2
  import { execSync } from 'child_process'
3
3
  import fs from 'fs'
4
4
  import path from 'path'
5
+ import { createInterface } from 'readline'
5
6
 
6
7
  const PKG_DIR = path.resolve(import.meta.dirname, '..')
7
8
  const TARGET_DIR = process.cwd()
@@ -18,29 +19,9 @@ function exists(file) {
18
19
  return fs.existsSync(path.join(TARGET_DIR, file))
19
20
  }
20
21
 
21
- console.log('\nšŸš€ @uipkge/nuxt setup\n')
22
-
23
- if (isInstalled) {
24
- console.log('šŸ“¦ Package ready')
25
- } else {
26
- console.log('šŸ“¦ Building package...')
27
- run('npm run build', { cwd: PKG_DIR })
28
- }
29
-
30
- console.log('\nšŸ“„ Installing @nuxtjs/i18n...')
31
- run('npm install @nuxtjs/i18n@latest', { cwd: TARGET_DIR })
32
-
33
- if (!isInstalled) {
34
- run('npm link', { cwd: PKG_DIR })
35
- run('npm link @uipkge/nuxt', { cwd: TARGET_DIR })
36
- }
37
-
38
- const nuxtConfigPath = path.join(TARGET_DIR, 'nuxt.config.ts')
39
-
40
22
  function prompt(question) {
41
- const readline = require('readline')
42
23
  return new Promise(resolve => {
43
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
24
+ const rl = createInterface({ input: process.stdin, output: process.stdout })
44
25
  rl.question(question, ans => { rl.close(); resolve(ans) })
45
26
  })
46
27
  }
@@ -50,12 +31,30 @@ async function getInput(question, defaultValue) {
50
31
  return answer.trim() || defaultValue
51
32
  }
52
33
 
53
- console.log('\nāš™ļø i18now configuration:')
34
+ async function main() {
35
+ console.log('\nšŸš€ @uipkge/nuxt setup\n')
36
+
37
+ if (isInstalled) {
38
+ console.log('šŸ“¦ Package ready')
39
+ } else {
40
+ console.log('šŸ“¦ Building package...')
41
+ run('npm run build', { cwd: PKG_DIR })
42
+ }
43
+
44
+ console.log('\nšŸ“„ Installing @nuxtjs/i18n...')
45
+ run('npm install @nuxtjs/i18n@latest', { cwd: TARGET_DIR })
54
46
 
55
- const projectId = await getInput('Enter projectId (or press Enter to skip): ', '')
56
- const apiKey = await getInput('Enter apiKey (or press Enter to skip): ', '')
47
+ if (!isInstalled) {
48
+ run('npm link', { cwd: PKG_DIR })
49
+ run('npm link @uipkge/nuxt', { cwd: TARGET_DIR })
50
+ }
57
51
 
58
- const nuxtConfigContent = `export default defineNuxtConfig({
52
+ console.log('\nāš™ļø i18now configuration:')
53
+ const projectId = await getInput('Enter projectId (or press Enter to skip): ', '')
54
+ const apiKey = await getInput('Enter apiKey (or press Enter to skip): ', '')
55
+
56
+ const nuxtConfigPath = path.join(TARGET_DIR, 'nuxt.config.ts')
57
+ const nuxtConfigContent = `export default defineNuxtConfig({
59
58
  compatibilityDate: '2025-07-15',
60
59
  devtools: { enabled: true },
61
60
  modules: ['@nuxtjs/i18n', '@uipkge/nuxt'],
@@ -68,17 +67,17 @@ const nuxtConfigContent = `export default defineNuxtConfig({
68
67
  },
69
68
  })
70
69
  `
71
- fs.writeFileSync(nuxtConfigPath, nuxtConfigContent)
70
+ fs.writeFileSync(nuxtConfigPath, nuxtConfigContent)
72
71
 
73
- const pagesDir = path.join(TARGET_DIR, 'app/pages')
74
- if (!fs.existsSync(pagesDir)) {
75
- fs.mkdirSync(pagesDir, { recursive: true })
76
- }
72
+ const pagesDir = path.join(TARGET_DIR, 'app/pages')
73
+ if (!fs.existsSync(pagesDir)) {
74
+ fs.mkdirSync(pagesDir, { recursive: true })
75
+ }
77
76
 
78
- const testPagePath = path.join(TARGET_DIR, 'app/pages/i18now-test.vue')
79
- if (!fs.existsSync(testPagePath)) {
80
- console.log('šŸ“„ Creating test page at /i18now-test...')
81
- fs.writeFileSync(testPagePath, `<script setup>
77
+ const testPagePath = path.join(TARGET_DIR, 'app/pages/i18now-test.vue')
78
+ if (!fs.existsSync(testPagePath)) {
79
+ console.log('šŸ“„ Creating test page at /i18now-test...')
80
+ fs.writeFileSync(testPagePath, `<script setup>
82
81
  const { t, locale } = useI18now()
83
82
  </script>
84
83
 
@@ -102,6 +101,9 @@ const { t, locale } = useI18now()
102
101
  </div>
103
102
  </template>
104
103
  `)
104
+ }
105
+
106
+ console.log('\nāœ… Ready! Run: npm run dev\n')
105
107
  }
106
108
 
107
- console.log('\nāœ… Ready! Run: npm run dev\n')
109
+ main()
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.0.0"
6
6
  },
7
- "version": "0.1.34",
7
+ "version": "0.1.35",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uipkge/nuxt",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "bin": {