create-nuxt-base 0.2.7 → 0.2.9

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.
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "nuxt-base-template",
3
3
  "private": true,
4
+ "type": "module",
4
5
  "scripts": {
5
6
  "init": "npm install",
6
7
  "reinit": "rm -rf node_modules && rm -rf package-lock.json && yes | npx nuxt cleanup && npm cache clean --force && npm i",
7
8
  "build": "nuxt build",
9
+ "app:build": "npm run build",
8
10
  "build:develop": "nuxt build",
9
11
  "build:test": "nuxt build",
10
12
  "start": "nuxt dev",
@@ -18,8 +20,8 @@
18
20
  "generate": "nuxt generate",
19
21
  "preview": "nuxt preview",
20
22
  "postinstall": "nuxt prepare",
21
- "test": "vitest run",
22
- "test:watch": "vitest",
23
+ "app:e2e": "playwright test",
24
+ "test": "echo 'No test specified' && exit 0",
23
25
  "lint": "eslint --ext .ts,.js,.vue .",
24
26
  "lint:fix": "eslint --ext .ts,.js,.vue . --fix",
25
27
  "postbuild": "cd .output/server/node_modules/tslib; npm pkg set 'exports[.].import.node'='./tslib.es6.mjs'"
@@ -27,12 +29,12 @@
27
29
  "dependencies": {
28
30
  "@egoist/tailwindcss-icons": "1.8.1",
29
31
  "@iconify-json/bi": "1.2.0",
30
- "@lenne.tech/nuxt-base": "3.18.0",
32
+ "@lenne.tech/nuxt-base": "3.21.0",
31
33
  "@nuxt/image": "1.8.0",
32
34
  "@vee-validate/yup": "4.13.2",
33
- "@vueuse/core": "11.0.3",
34
- "@vueuse/integrations": "11.0.3",
35
- "@vueuse/nuxt": "11.0.3",
35
+ "@vueuse/core": "11.1.0",
36
+ "@vueuse/integrations": "11.1.0",
37
+ "@vueuse/nuxt": "11.1.0",
36
38
  "ios-pwa-splash": "1.0.0",
37
39
  "pinia": "2.2.2",
38
40
  "tailwind-merge": "2.5.2",
@@ -40,31 +42,29 @@
40
42
  },
41
43
  "devDependencies": {
42
44
  "@lenne.tech/eslint-config-vue": "0.0.16",
43
- "@nuxt/devtools": "1.4.1",
44
- "@nuxt/test-utils": "3.14.1",
45
- "@nuxtjs/color-mode": "3.4.4",
45
+ "@nuxt/devtools": "1.5.1",
46
+ "@nuxt/test-utils": "3.14.2",
47
+ "@nuxtjs/color-mode": "3.5.1",
46
48
  "@nuxtjs/google-fonts": "3.2.0",
47
49
  "@nuxtjs/plausible": "1.0.2",
48
- "@nuxtjs/sitemap": "6.0.1",
50
+ "@nuxtjs/robots": "4.1.7",
51
+ "@nuxtjs/sitemap": "6.1.1",
49
52
  "@nuxtjs/tailwindcss": "6.12.1",
50
- "@playwright/test": "1.46.1",
51
- "@tailwindcss/forms": "0.5.8",
53
+ "@playwright/test": "1.47.2",
54
+ "@tailwindcss/forms": "0.5.9",
52
55
  "@tailwindcss/typography": "0.5.15",
53
- "@types/node": "22.5.4",
54
- "@vitejs/plugin-vue": "5.1.3",
56
+ "@types/node": "22.7.4",
57
+ "@vitejs/plugin-vue": "5.1.4",
55
58
  "@vue/test-utils": "2.4.6",
56
- "eslint": "9.9.1",
59
+ "eslint": "8.57.1",
57
60
  "jsdom": "24.1.3",
58
- "nuxt": "3.13.1",
59
- "nuxt-simple-robots": "4.0.1",
61
+ "nuxt": "3.13.2",
60
62
  "ts-loader": "9.5.1",
61
- "typescript": "5.5.4",
62
- "vitest": "2.0.5"
63
+ "typescript": "5.6.2"
63
64
  },
64
65
  "overrides": {
65
66
  "vue": "latest",
66
67
  "@nuxt/test-utils": {
67
- "vitest": "$vitest",
68
68
  "happy-dom": "13.0.0"
69
69
  },
70
70
  "@lenne.tech/eslint-config-vue": {
@@ -1,77 +1,65 @@
1
+ import type { ConfigOptions } from '@nuxt/test-utils/playwright';
2
+
1
3
  import { defineConfig, devices } from '@playwright/test';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { isCI, isWindows } from 'std-env';
2
6
 
3
- /**
4
- * Read environment variables from file.
5
- * https://github.com/motdotla/dotenv
6
- */
7
- // require('dotenv').config();
7
+ const devicesToTest = [
8
+ 'Desktop Chrome',
9
+ // Test against other common browser engines.
10
+ // 'Desktop Firefox',
11
+ // 'Desktop Safari',
12
+ // Test against mobile viewports.
13
+ // 'Pixel 5',
14
+ // 'iPhone 12',
15
+ // Test against branded browsers.
16
+ // { ...devices['Desktop Edge'], channel: 'msedge' },
17
+ // { ...devices['Desktop Chrome'], channel: 'chrome' },
18
+ ] satisfies Array<(typeof devices)[string] | string>;
8
19
 
9
- /**
10
- * See https://playwright.dev/docs/test-configuration.
11
- */
12
- export default defineConfig({
13
- testDir: './e2e',
20
+ /* See https://playwright.dev/docs/test-configuration. */
21
+ export default defineConfig<ConfigOptions>({
22
+ /* Fail the build on CI if you accidentally left test.only in the source code. */
23
+ forbidOnly: !!isCI,
14
24
  /* Run tests in files in parallel */
15
25
  fullyParallel: true,
16
- /* Fail the build on CI if you accidentally left test.only in the source code. */
17
- forbidOnly: !!process.env.CI,
18
- /* Retry on CI only */
19
- retries: process.env.CI ? 2 : 0,
20
- /* Opt out of parallel tests on CI. */
21
- workers: process.env.CI ? 1 : undefined,
26
+ projects: devicesToTest.map((p) => (typeof p === 'string' ? { name: p, use: devices[p] } : p)),
22
27
  /* Reporter to use. See https://playwright.dev/docs/test-reporters */
23
28
  reporter: 'html',
29
+ /* Retry on CI only */
30
+ retries: isCI ? 2 : 0,
31
+ testDir: './tests',
32
+ timeout: 5 * 60 * 1000,
33
+ timeout: isWindows ? 60000 : undefined,
24
34
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25
35
  use: {
26
- /* Base URL to use in actions like `await page.goto('/')`. */
27
- // baseURL: 'http://127.0.0.1:3000',
28
-
29
- /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
30
- trace: 'on-first-retry',
31
- },
36
+ baseURL: 'http://localhost:3001',
32
37
 
33
- /* Configure projects for major browsers */
34
- projects: [
35
- {
36
- name: 'chromium',
37
- use: { ...devices['Desktop Chrome'] },
38
+ launchOptions: {
39
+ // Slows down Playwright operations by the specified amount of milliseconds
40
+ slowMo: 10,
38
41
  },
39
42
 
40
- {
41
- name: 'firefox',
42
- use: { ...devices['Desktop Firefox'] },
43
+ // Use German language
44
+ locale: 'de',
45
+ /* Nuxt configuration options */
46
+ nuxt: {
47
+ host: 'http://localhost:3001',
48
+ rootDir: fileURLToPath(new URL('.', import.meta.url)),
43
49
  },
44
-
50
+ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
51
+ trace: 'on-first-retry',
52
+ },
53
+ webServer: [
45
54
  {
46
- name: 'webkit',
47
- use: { ...devices['Desktop Safari'] },
55
+ command: 'npm run start',
56
+ reuseExistingServer: !process.env.CI,
57
+ stderr: 'pipe',
58
+ stdout: 'pipe',
59
+ timeout: 120 * 1000,
60
+ url: 'http://localhost:3001',
48
61
  },
49
-
50
- /* Test against mobile viewports. */
51
- // {
52
- // name: 'Mobile Chrome',
53
- // use: { ...devices['Pixel 5'] },
54
- // },
55
- // {
56
- // name: 'Mobile Safari',
57
- // use: { ...devices['iPhone 12'] },
58
- // },
59
-
60
- /* Test against branded browsers. */
61
- // {
62
- // name: 'Microsoft Edge',
63
- // use: { ...devices['Desktop Edge'], channel: 'msedge' },
64
- // },
65
- // {
66
- // name: 'Google Chrome',
67
- // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68
- // },
69
62
  ],
70
-
71
- /* Run your local dev server before starting the tests */
72
- // webServer: {
73
- // command: 'npm run start',
74
- // url: 'http://127.0.0.1:3000',
75
- // reuseExistingServer: !process.env.CI,
76
- // },
63
+ /* Opt out of parallel tests on CI. */
64
+ workers: isCI ? 1 : undefined,
77
65
  });
@@ -17,7 +17,7 @@ export default defineNuxtPlugin({
17
17
 
18
18
  let token = accessTokenState.value;
19
19
  if (isTokenExpired(accessTokenState.value)) {
20
- const refreshTokenResult = await ofetch(config.public.host, {
20
+ const refreshTokenResult = await ofetch(config.public.gqlHost, {
21
21
  body: JSON.stringify({
22
22
  query: 'mutation refreshToken {refreshToken {token, refreshToken}}',
23
23
  variables: {},
@@ -29,7 +29,7 @@ export default defineNuxtPlugin({
29
29
  }).catch((err) => {
30
30
  console.error('2.auth.server.ts::refreshToken::catch', err.data);
31
31
  clearSession();
32
- navigateTo('/auth/login');
32
+ navigateTo('/auth');
33
33
  });
34
34
 
35
35
  const data = refreshTokenResult?.data?.refreshToken;
@@ -38,14 +38,14 @@ export default defineNuxtPlugin({
38
38
  token = data?.token;
39
39
  } else {
40
40
  clearSession();
41
- await navigateTo('/auth/login');
41
+ await navigateTo('/auth');
42
42
  }
43
43
  }
44
44
 
45
45
  if (token && payload?.id) {
46
- const userResult = await ofetch(config.public.host, {
46
+ const userResult = await ofetch(config.public.gqlHost, {
47
47
  body: JSON.stringify({
48
- query: 'query getUser($id: String!){' + 'getUser(id: $id){' + 'id ' + 'avatar ' + 'firstName ' + 'lastName ' + 'email ' + 'gender ' + 'roles ' + '}}',
48
+ query: 'query getUser($id: String!){' + 'getUser(id: $id){' + 'id ' + 'firstName ' + 'lastName ' + 'email ' + 'roles ' + '}}',
49
49
  variables: {
50
50
  id: payload.id,
51
51
  },
@@ -60,7 +60,7 @@ export default defineNuxtPlugin({
60
60
 
61
61
  if (userResult?.errors) {
62
62
  clearSession();
63
- navigateTo('/auth/login');
63
+ navigateTo('/auth');
64
64
  return;
65
65
  }
66
66
 
@@ -0,0 +1,5 @@
1
+ import { test } from '@nuxt/test-utils/playwright';
2
+
3
+ test('init test', async ({ goto, page }) => {
4
+ await goto('.', { waitUntil: 'domcontentloaded' });
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nuxt-base",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Starter to generate a configured environment with VueJS, Nuxt, Tailwind, Eslint, @lenne.tech/nuxt-base, Unit Tests, Cypress etc.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,18 +0,0 @@
1
- import { test, expect } from '@playwright/test';
2
-
3
- test('has title', async ({ page }) => {
4
- await page.goto('https://playwright.dev/');
5
-
6
- // Expect a title "to contain" a substring.
7
- await expect(page).toHaveTitle(/Playwright/);
8
- });
9
-
10
- test('get started link', async ({ page }) => {
11
- await page.goto('https://playwright.dev/');
12
-
13
- // Click the get started link.
14
- await page.getByRole('link', { name: 'Get started' }).click();
15
-
16
- // Expects page to have a heading with the name of Installation.
17
- await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
18
- });
@@ -1,12 +0,0 @@
1
- import { describe, test } from 'vitest';
2
- import { setup } from '@nuxt/test-utils';
3
-
4
- describe('Initialization', async () => {
5
- await setup({
6
- // test context options
7
- });
8
-
9
- test('Init test', () => {
10
- // ... write tests here
11
- });
12
- });
@@ -1,10 +0,0 @@
1
- import vue from '@vitejs/plugin-vue';
2
- import { defineConfig } from 'vite';
3
-
4
- export default defineConfig({
5
- plugins: [vue()],
6
- test: {
7
- globals: true,
8
- environment: 'jsdom',
9
- },
10
- });