nuxt-spec 0.2.0-alpha.8 → 0.2.0
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 +21 -21
- package/README.md +364 -364
- package/app/app.vue +10 -10
- package/app/components/NuxtSpecApiTestComponent.vue +24 -24
- package/app/components/NuxtSpecTestComponent.vue +9 -9
- package/app/components/index.ts +2 -0
- package/app/utils/vitest-utils.ts +5 -5
- package/bin/cli.js +53 -53
- package/bin/setup.js +243 -243
- package/config/index.d.ts +17 -17
- package/config/index.mjs +79 -79
- package/config/templates/pnpm-workspace.yaml.template +4 -4
- package/config/templates/vitest.config.ts.template +5 -5
- package/config/utils/merge.mjs +43 -43
- package/config/utils/warnings.mjs +32 -26
- package/nuxt.config.ts +19 -14
- package/package.json +12 -4
- package/utils/e2e.ts +30 -30
- package/utils/index.d.ts +70 -70
- package/utils/index.ts +12 -12
- package/utils/screenshot.ts +89 -89
package/app/app.vue
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<
|
|
4
|
-
<div>
|
|
5
|
-
Test-pack layer for <a href="https://nuxt.com/">Nuxt</a> applications
|
|
6
|
-
</div>
|
|
7
|
-
<NuxtSpecTestComponent id="test" text="Test Component" />
|
|
8
|
-
<NuxtSpecApiTestComponent />
|
|
9
|
-
</div>
|
|
10
|
-
</template>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<NuxtWelcome />
|
|
4
|
+
<div>
|
|
5
|
+
Test-pack layer for <a href="https://nuxt.com/">Nuxt</a> applications
|
|
6
|
+
</div>
|
|
7
|
+
<NuxtSpecTestComponent id="test" text="Test Component" />
|
|
8
|
+
<NuxtSpecApiTestComponent />
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<h2>API Test</h2>
|
|
4
|
-
<button id="api-fetch" @click="fetchData">
|
|
5
|
-
Fetch Data
|
|
6
|
-
</button>
|
|
7
|
-
<div id="api-result">
|
|
8
|
-
{{ data }}
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script setup lang="ts">
|
|
14
|
-
const data = ref('')
|
|
15
|
-
const fetchData = async () => {
|
|
16
|
-
try {
|
|
17
|
-
data.value = await $fetch('https://jsonplaceholder.typicode.com/posts/1')
|
|
18
|
-
console.debug('Fetched data:', data.value)
|
|
19
|
-
} catch (error) {
|
|
20
|
-
data.value = 'Error fetching data'
|
|
21
|
-
console.error('API fetch error:', error)
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<h2>API Test</h2>
|
|
4
|
+
<button id="api-fetch" @click="fetchData">
|
|
5
|
+
Fetch Data
|
|
6
|
+
</button>
|
|
7
|
+
<div id="api-result">
|
|
8
|
+
{{ data }}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
const data = ref('')
|
|
15
|
+
const fetchData = async () => {
|
|
16
|
+
try {
|
|
17
|
+
data.value = await $fetch('https://jsonplaceholder.typicode.com/posts/1')
|
|
18
|
+
console.debug('Fetched data:', data.value)
|
|
19
|
+
} catch (error) {
|
|
20
|
+
data.value = 'Error fetching data'
|
|
21
|
+
console.error('API fetch error:', error)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div style="margin: 1rem 0; padding: 0.5rem; border: 1px solid black;">
|
|
3
|
-
{{ text }}
|
|
4
|
-
</div>
|
|
5
|
-
</template>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
defineProps({ text: { type: String, default: 'nuxt-spec' } })
|
|
9
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<div style="margin: 1rem 0; padding: 0.5rem; border: 1px solid black;">
|
|
3
|
+
{{ text }}
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script setup lang="ts">
|
|
8
|
+
defineProps({ text: { type: String, default: 'nuxt-spec' } })
|
|
9
|
+
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Element.checkVisibility() is not available in Vitest
|
|
2
|
-
global.Element.prototype.checkVisibility = function () {
|
|
3
|
-
// in tests we always just assume the element is visible
|
|
4
|
-
return true
|
|
5
|
-
}
|
|
1
|
+
// Element.checkVisibility() is not available in Vitest
|
|
2
|
+
global.Element.prototype.checkVisibility = function () {
|
|
3
|
+
// in tests we always just assume the element is visible
|
|
4
|
+
return true
|
|
5
|
+
}
|
package/bin/cli.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { getPackageManager } from 'elrh-cosca'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* CLI tool to scaffold necessary adjustments in project folder.
|
|
7
|
-
*
|
|
8
|
-
* Currently only allows `setup` to be passed as parameter.
|
|
9
|
-
*
|
|
10
|
-
* Second parameter for `setup` might be a boolean to indicate auto mode
|
|
11
|
-
* (no prompts, force = true) or manual mode (with prompts, force = false).
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// get parameters passed by user
|
|
15
|
-
const args = process.argv.slice(2);
|
|
16
|
-
|
|
17
|
-
// execute actions based on first param
|
|
18
|
-
// additional params might be passed into the called functions
|
|
19
|
-
(async () => {
|
|
20
|
-
let status = 0
|
|
21
|
-
try {
|
|
22
|
-
switch (args[0]) {
|
|
23
|
-
case 'setup':
|
|
24
|
-
await (await import('./setup.js')).specSetup(args[1] || false)
|
|
25
|
-
break
|
|
26
|
-
default:
|
|
27
|
-
console.log(`Usage: \`${getCmd()} nuxt-spec setup [true|false]\``)
|
|
28
|
-
status = 1
|
|
29
|
-
}
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('Setup failed:', error.message)
|
|
32
|
-
status = 1
|
|
33
|
-
}
|
|
34
|
-
process.exit(status)
|
|
35
|
-
})()
|
|
36
|
-
|
|
37
|
-
// try detecting what package manager was used
|
|
38
|
-
// to give user appropriate usage hint
|
|
39
|
-
function getCmd() {
|
|
40
|
-
const packageManager = getPackageManager()
|
|
41
|
-
switch (packageManager) {
|
|
42
|
-
case 'pnpm':
|
|
43
|
-
return 'pnpx'
|
|
44
|
-
case 'yarn':
|
|
45
|
-
return 'yarn dlx'
|
|
46
|
-
case 'bun':
|
|
47
|
-
return 'bunx'
|
|
48
|
-
case 'deno':
|
|
49
|
-
return 'deno run --allow-run npm:npx'
|
|
50
|
-
default:
|
|
51
|
-
return 'npx'
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { getPackageManager } from 'elrh-cosca'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* CLI tool to scaffold necessary adjustments in project folder.
|
|
7
|
+
*
|
|
8
|
+
* Currently only allows `setup` to be passed as parameter.
|
|
9
|
+
*
|
|
10
|
+
* Second parameter for `setup` might be a boolean to indicate auto mode
|
|
11
|
+
* (no prompts, force = true) or manual mode (with prompts, force = false).
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
// get parameters passed by user
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
// execute actions based on first param
|
|
18
|
+
// additional params might be passed into the called functions
|
|
19
|
+
(async () => {
|
|
20
|
+
let status = 0
|
|
21
|
+
try {
|
|
22
|
+
switch (args[0]) {
|
|
23
|
+
case 'setup':
|
|
24
|
+
await (await import('./setup.js')).specSetup(args[1] || false)
|
|
25
|
+
break
|
|
26
|
+
default:
|
|
27
|
+
console.log(`Usage: \`${getCmd()} nuxt-spec setup [true|false]\``)
|
|
28
|
+
status = 1
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Setup failed:', error.message)
|
|
32
|
+
status = 1
|
|
33
|
+
}
|
|
34
|
+
process.exit(status)
|
|
35
|
+
})()
|
|
36
|
+
|
|
37
|
+
// try detecting what package manager was used
|
|
38
|
+
// to give user appropriate usage hint
|
|
39
|
+
function getCmd() {
|
|
40
|
+
const packageManager = getPackageManager()
|
|
41
|
+
switch (packageManager) {
|
|
42
|
+
case 'pnpm':
|
|
43
|
+
return 'pnpx'
|
|
44
|
+
case 'yarn':
|
|
45
|
+
return 'yarn dlx'
|
|
46
|
+
case 'bun':
|
|
47
|
+
return 'bunx'
|
|
48
|
+
case 'deno':
|
|
49
|
+
return 'deno run --allow-run npm:npx'
|
|
50
|
+
default:
|
|
51
|
+
return 'npx'
|
|
52
|
+
}
|
|
53
|
+
}
|