nuxt-spec 0.3.0-alpha.3 → 0.3.1-alpha.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- # MIT License
2
-
3
- Copyright (c) 2025-present Alois Sečkár
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.
1
+ # MIT License
2
+
3
+ Copyright (c) 2025-present Alois Sečkár
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/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # Nuxt Spec
2
-
3
- ![Nuxt Spec](https://github.com/AloisSeckar/nuxt-spec/blob/main/public/nuxt-spec.png)
4
-
5
- A _"testing done right"_ Nuxt base layer.
6
-
7
- ## How to use
8
-
9
- See [ONLINE DOCS](https://nuxt-spec.netlify.app) for all the necessary information.
10
-
11
- See [CHANGELOG](https://nuxt-spec.netlify.app/3-1-changelog.html) for the full list of changes.
12
-
13
- See [CONTRIBUTING](https://nuxt-spec.netlify.app/4-1-contributing.html) if you want to help.
1
+ # Nuxt Spec
2
+
3
+ ![Nuxt Spec](https://github.com/AloisSeckar/nuxt-spec/blob/main/public/nuxt-spec.png)
4
+
5
+ A _"testing done right"_ Nuxt base layer.
6
+
7
+ ## How to use
8
+
9
+ See [ONLINE DOCS](https://nuxt-spec.netlify.app) for all the necessary information.
10
+
11
+ See [CHANGELOG](https://nuxt-spec.netlify.app/3-1-changelog.html) for the full list of changes.
12
+
13
+ See [CONTRIBUTING](https://nuxt-spec.netlify.app/4-1-contributing.html) if you want to help.
package/app/app.vue CHANGED
@@ -1,10 +1,10 @@
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
+ <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,7 +1,7 @@
1
- // type hint for tsconfig.nuxt-spec.json
2
- declare module '*.vue' {
3
- import type { DefineComponent } from 'vue'
4
-
5
- const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>
6
- export default component
7
- }
1
+ // type hint for tsconfig.nuxt-spec.json
2
+ declare module '*.vue' {
3
+ import type { DefineComponent } from 'vue'
4
+
5
+ const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>
6
+ export default component
7
+ }
@@ -1,2 +1,2 @@
1
- export { default as NuxtSpecTestComponent } from './NuxtSpecTestComponent.vue'
2
- export { default as NuxtSpecApiTestComponent } from './NuxtSpecApiTestComponent.vue'
1
+ export { default as NuxtSpecTestComponent } from './NuxtSpecTestComponent.vue'
2
+ export { default as NuxtSpecApiTestComponent } from './NuxtSpecApiTestComponent.vue'
@@ -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,54 +1,38 @@
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()} 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 command = 'nuxt-spec'
41
- const packageManager = getPackageManager()
42
- switch (packageManager) {
43
- case 'pnpm':
44
- return `pnpx ${command}`
45
- case 'yarn':
46
- return `yarn dlx ${command}`
47
- case 'bun':
48
- return `bunx ${command}`
49
- case 'deno':
50
- return `deno run -A npm:${command}`
51
- default:
52
- return `npx ${command}`
53
- }
54
- }
1
+ #!/usr/bin/env node
2
+
3
+ import { getCmd } from './helpers/commands.js'
4
+
5
+ /**
6
+ * CLI tool to scaffold necessary adjustments in project folder.
7
+ *
8
+ * Allows `setup` or `update` to be passed as parameter.
9
+ *
10
+ * Second parameter 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
+ case 'update':
27
+ await (await import('./update.js')).specUpdate(args[1] || false)
28
+ break
29
+ default:
30
+ console.log(`Usage: \`${getCmd()} setup [true|false]\` or \`${getCmd()} update [true|false]\``)
31
+ status = 1
32
+ }
33
+ } catch (error) {
34
+ console.error('Setup failed:', error.message)
35
+ status = 1
36
+ }
37
+ process.exit(status)
38
+ })()
@@ -0,0 +1,52 @@
1
+ import { getPackageManager } from 'elrh-cosca'
2
+
3
+ // use nuxt-spec CLI tool
4
+ export function getCmd() {
5
+ const command = 'nuxt-spec'
6
+ const packageManager = getPackageManager()
7
+ switch (packageManager) {
8
+ case 'pnpm':
9
+ return `pnpx ${command}`
10
+ case 'yarn':
11
+ return `yarn dlx ${command}`
12
+ case 'bun':
13
+ return `bunx ${command}`
14
+ case 'deno':
15
+ return `deno run -A npm:${command}`
16
+ default:
17
+ return `npx ${command}`
18
+ }
19
+ }
20
+
21
+ // update nuxt-spec
22
+ export function getUpdateCmd(packageManager, target) {
23
+ switch (packageManager) {
24
+ case 'pnpm':
25
+ return `pnpm update ${target}`
26
+ case 'yarn':
27
+ return `yarn upgrade ${target}`
28
+ case 'bun':
29
+ return `bun update ${target}`
30
+ case 'deno':
31
+ return `deno add npm:${target}`
32
+ default:
33
+ return `npm update ${target}`
34
+ }
35
+ }
36
+
37
+ // install/update playwright
38
+ export function getPlaywrightInstallCmd(packageManager) {
39
+ const command = 'playwright-core install'
40
+ switch (packageManager) {
41
+ case 'pnpm':
42
+ return `pnpm exec ${command}`
43
+ case 'yarn':
44
+ return `yarn ${command}`
45
+ case 'bun':
46
+ return `bunx ${command}`
47
+ case 'deno':
48
+ return `deno run -A npm:${command}`
49
+ default:
50
+ return `npx ${command}`
51
+ }
52
+ }
@@ -1,16 +1,16 @@
1
- #!/usr/bin/env node
2
-
3
- import { createInterface } from 'node:readline'
4
-
5
- const rl = createInterface({ input: process.stdin, output: process.stdout })
6
-
7
- rl.question('Are you sure the current solution was properly tested and verified? (y/n) ', (answer) => {
8
- rl.close()
9
- if (answer.trim().toLowerCase().startsWith('y')) {
10
- console.log('Proceeding with publish...')
11
- process.exit(0)
12
- } else {
13
- console.error('Publish aborted. Please run the tests and try again.')
14
- process.exit(1)
15
- }
16
- })
1
+ #!/usr/bin/env node
2
+
3
+ import { createInterface } from 'node:readline'
4
+
5
+ const rl = createInterface({ input: process.stdin, output: process.stdout })
6
+
7
+ rl.question('Are you sure the current solution was properly tested and verified? (y/n) ', (answer) => {
8
+ rl.close()
9
+ if (answer.trim().toLowerCase().startsWith('y')) {
10
+ console.log('Proceeding with publish...')
11
+ process.exit(0)
12
+ } else {
13
+ console.error('Publish aborted. Please run the tests and try again.')
14
+ process.exit(1)
15
+ }
16
+ })