@dword-design/base-config-nuxt 6.0.0 → 6.1.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.md +1 -1
- package/README.md +1 -1
- package/dist/depcheck-special.js +1 -3
- package/dist/index.js +4 -31
- package/dist/modules/i18n/index.js +36 -0
- package/dist/modules/i18n/plugin.js +7 -0
- package/dist/modules/locale-link/component.vue +1 -5
- package/dist/nuxt.config.js +5 -1
- package/dist/plugins/title.js +12 -0
- package/package.json +28 -26
- package/dist/modules/i18n.js +0 -31
package/LICENSE.md
CHANGED
package/README.md
CHANGED
|
@@ -103,5 +103,5 @@ Thanks a lot for your support! ❤️
|
|
|
103
103
|
|
|
104
104
|
## License
|
|
105
105
|
|
|
106
|
-
[MIT License](https://opensource.org/
|
|
106
|
+
[MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com)
|
|
107
107
|
<!-- /LICENSE -->
|
package/dist/depcheck-special.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import filter from
|
|
2
|
-
import first from "@dword-design/functions/dist/first.js";
|
|
3
|
-
import map from "@dword-design/functions/dist/map.js";
|
|
1
|
+
import { filter, first, map } from '@dword-design/functions';
|
|
4
2
|
import jitiBabelTransform from '@dword-design/jiti-babel-transform';
|
|
5
3
|
import jiti from 'jiti';
|
|
6
4
|
import P from 'path';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import depcheckParserSass from '@dword-design/depcheck-parser-sass';
|
|
2
|
-
import endent from
|
|
3
|
-
import javascript from "@dword-design/functions/dist/endent.js";
|
|
2
|
+
import { endent as javascript } from '@dword-design/functions';
|
|
4
3
|
import packageName from 'depcheck-package-name';
|
|
5
4
|
import depcheckParserVue from 'depcheck-parser-vue';
|
|
6
|
-
import { globby } from 'globby';
|
|
7
5
|
import { createRequire } from 'module';
|
|
8
6
|
import outputFiles from 'output-files';
|
|
9
7
|
import P from 'path';
|
|
@@ -21,7 +19,7 @@ const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
|
|
|
21
19
|
export default ((config = {}) => {
|
|
22
20
|
config.importAliases = config.importAliases || [];
|
|
23
21
|
return {
|
|
24
|
-
allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
|
|
22
|
+
allowedMatches: ['.stylelintrc.json', 'server/api/**/*.js', 'server/plugins/**/*.js', 'server/routes/**/*.js', 'server/middleware/**/*.js', 'app.vue', 'assets', 'components', 'composables', 'content', 'i18n', 'layouts', 'middleware', 'model', 'modules', 'config.js', 'pages', 'plugins', 'public', 'store', 'types'],
|
|
25
23
|
commands: {
|
|
26
24
|
analyze,
|
|
27
25
|
dev,
|
|
@@ -35,9 +33,9 @@ export default ((config = {}) => {
|
|
|
35
33
|
},
|
|
36
34
|
specials: [depcheckSpecial]
|
|
37
35
|
},
|
|
38
|
-
editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', '
|
|
36
|
+
editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'dist', 'nuxt.config.js'],
|
|
39
37
|
eslintConfig: getEslintConfig(config),
|
|
40
|
-
gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/
|
|
38
|
+
gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/dist', '/nuxt.config.js'],
|
|
41
39
|
lint,
|
|
42
40
|
npmPublish: true,
|
|
43
41
|
packageConfig: {
|
|
@@ -46,35 +44,10 @@ export default ((config = {}) => {
|
|
|
46
44
|
prepare: async () => {
|
|
47
45
|
const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
|
|
48
46
|
const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
|
|
49
|
-
const translations = await globby('i18n/*.json');
|
|
50
|
-
const hasI18n = translations.length > 0;
|
|
51
47
|
await outputFiles({
|
|
52
48
|
'.stylelintrc.json': `${JSON.stringify({
|
|
53
49
|
extends: packageName`@dword-design/stylelint-config`
|
|
54
50
|
}, undefined, 2)}\n`,
|
|
55
|
-
'app.vue': endent`
|
|
56
|
-
<template>
|
|
57
|
-
<NuxtLayout>
|
|
58
|
-
<NuxtPage />
|
|
59
|
-
</NuxtLayout>
|
|
60
|
-
</template>
|
|
61
|
-
|
|
62
|
-
<script setup>
|
|
63
|
-
import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
|
|
64
|
-
|
|
65
|
-
${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
|
|
66
|
-
|
|
67
|
-
useHead({
|
|
68
|
-
${[...(hasI18n ? [endent`
|
|
69
|
-
htmlAttrs: {
|
|
70
|
-
lang: i18nHead.value.htmlAttrs.lang,
|
|
71
|
-
},
|
|
72
|
-
link: i18nHead.value.link,
|
|
73
|
-
meta: i18nHead.value.meta,
|
|
74
|
-
`] : []), "titleTemplate: title => title ? `${title} | ${runtimeConfig.public.name}` : `${runtimeConfig.public.name}${runtimeConfig.public.title ? `: ${runtimeConfig.public.title}` : ''}`"].join('\n')}
|
|
75
|
-
})
|
|
76
|
-
</script>\n
|
|
77
|
-
`,
|
|
78
51
|
'nuxt.config.js': javascript`
|
|
79
52
|
import deepmerge from '${packageName`deepmerge`}'
|
|
80
53
|
import config from '${configPath}'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { addPlugin, createResolver, installModule } from '@nuxt/kit';
|
|
2
|
+
import packageName from 'depcheck-package-name';
|
|
3
|
+
import { globby } from 'globby';
|
|
4
|
+
import P from 'path';
|
|
5
|
+
const resolver = createResolver(import.meta.url);
|
|
6
|
+
export default (async (options, nuxt) => {
|
|
7
|
+
const locales = (await globby('*.json', {
|
|
8
|
+
cwd: P.join(nuxt.options.srcDir, 'i18n')
|
|
9
|
+
})).map(filename => P.basename(filename, '.json'));
|
|
10
|
+
const defaultLocale = locales.includes('en') ? 'en' : locales[0];
|
|
11
|
+
if (locales.length === 0) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
await installModule(packageName`@nuxtjs/i18n`, {
|
|
15
|
+
defaultLocale,
|
|
16
|
+
detectBrowserLanguage: locales.length === 1 ? false : {
|
|
17
|
+
fallbackLocale: defaultLocale,
|
|
18
|
+
redirectOn: 'no prefix',
|
|
19
|
+
useCookie: false
|
|
20
|
+
},
|
|
21
|
+
langDir: 'i18n',
|
|
22
|
+
lazy: true,
|
|
23
|
+
locales: locales.map(locale => ({
|
|
24
|
+
code: locale,
|
|
25
|
+
file: `${locale}.json`,
|
|
26
|
+
iso: locale
|
|
27
|
+
})),
|
|
28
|
+
strategy: `${locales.length === 1 ? 'no_' : ''}prefix`,
|
|
29
|
+
...(process.env.BASE_URL && {
|
|
30
|
+
baseUrl: process.env.BASE_URL
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
addPlugin(resolver.resolve('./plugin.js'), {
|
|
34
|
+
append: true
|
|
35
|
+
});
|
|
36
|
+
});
|
package/dist/nuxt.config.js
CHANGED
|
@@ -20,6 +20,9 @@ export default {
|
|
|
20
20
|
}] : [])]
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
+
devtools: {
|
|
24
|
+
enabled: true
|
|
25
|
+
},
|
|
23
26
|
modules: [(options, nuxt) => {
|
|
24
27
|
if (!config.userScalable) {
|
|
25
28
|
const viewportMeta = nuxt.options.app.head.meta.find(meta => meta.name === 'viewport');
|
|
@@ -37,7 +40,8 @@ export default {
|
|
|
37
40
|
failOnWarning: true,
|
|
38
41
|
fix: true,
|
|
39
42
|
lintOnStart: false
|
|
40
|
-
}], resolver.resolve('./modules/i18n.js'), resolver.resolve('./modules/locale-link/index.js'), resolver.resolve('./modules/svg.js')],
|
|
43
|
+
}], resolver.resolve('./modules/i18n/index.js'), resolver.resolve('./modules/locale-link/index.js'), resolver.resolve('./modules/svg.js')],
|
|
44
|
+
plugins: [resolver.resolve('./plugins/title.js')],
|
|
41
45
|
router: {
|
|
42
46
|
options: {
|
|
43
47
|
linkActiveClass: 'active'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useHead, useRuntimeConfig } from '#imports';
|
|
2
|
+
export default defineNuxtPlugin(() => {
|
|
3
|
+
const {
|
|
4
|
+
public: {
|
|
5
|
+
name,
|
|
6
|
+
title
|
|
7
|
+
}
|
|
8
|
+
} = useRuntimeConfig();
|
|
9
|
+
useHead({
|
|
10
|
+
titleTemplate: pageTitle => pageTitle ? `${pageTitle} | ${name}` : `${name}${title ? `: ${title}` : ''}`
|
|
11
|
+
});
|
|
12
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dword-design/base-config-nuxt",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"repository": "dword-design/base-config-nuxt",
|
|
5
5
|
"funding": "https://github.com/sponsors/dword-design",
|
|
6
6
|
"license": "MIT",
|
|
@@ -26,47 +26,49 @@
|
|
|
26
26
|
"test": "base test"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@dword-design/depcheck-parser-sass": "^4.0.
|
|
30
|
-
"@dword-design/dotenv-json-extended": "^2.0.
|
|
31
|
-
"@dword-design/functions": "^
|
|
32
|
-
"@dword-design/jiti-babel-transform": "^
|
|
29
|
+
"@dword-design/depcheck-parser-sass": "^4.0.4",
|
|
30
|
+
"@dword-design/dotenv-json-extended": "^2.0.25",
|
|
31
|
+
"@dword-design/functions": "^6.0.1",
|
|
32
|
+
"@dword-design/jiti-babel-transform": "^2.0.0",
|
|
33
33
|
"@dword-design/stylelint-config": "^4.0.0",
|
|
34
|
-
"@nuxt/kit": "^3.
|
|
34
|
+
"@nuxt/kit": "^3.12.4",
|
|
35
35
|
"@nuxtjs/eslint-module": "^4.1.0",
|
|
36
|
-
"@nuxtjs/i18n": "npm:@dword-design/nuxt-i18n",
|
|
37
|
-
"@nuxtjs/stylelint-module": "^5.0
|
|
36
|
+
"@nuxtjs/i18n": "npm:@dword-design/nuxt-i18n@^0.0.5",
|
|
37
|
+
"@nuxtjs/stylelint-module": "^5.2.0",
|
|
38
38
|
"deepmerge": "^4.3.1",
|
|
39
|
-
"depcheck-package-name": "^3.0.
|
|
39
|
+
"depcheck-package-name": "^3.0.1",
|
|
40
40
|
"depcheck-parser-vue": "^5.0.0",
|
|
41
|
-
"execa": "^
|
|
42
|
-
"fs-extra": "^11.
|
|
43
|
-
"globby": "^14.0.
|
|
44
|
-
"jiti": "^1.
|
|
45
|
-
"nuxt": "^3.
|
|
46
|
-
"nuxt-babel-runtime": "^5.0.
|
|
41
|
+
"execa": "^9.3.1",
|
|
42
|
+
"fs-extra": "^11.2.0",
|
|
43
|
+
"globby": "^14.0.2",
|
|
44
|
+
"jiti": "^1.21.6",
|
|
45
|
+
"nuxt": "^3.12.4",
|
|
46
|
+
"nuxt-babel-runtime": "^5.0.6",
|
|
47
47
|
"nuxt-basic-authentication-module": "^0.2.1",
|
|
48
|
-
"output-files": "^2.0.
|
|
48
|
+
"output-files": "^2.0.32",
|
|
49
49
|
"require-package-name": "^2.0.1",
|
|
50
|
-
"stylelint": "^16.2
|
|
50
|
+
"stylelint": "^16.8.2",
|
|
51
51
|
"vite-svg-loader": "^5.1.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@dword-design/base": "^11.
|
|
55
|
-
"@dword-design/puppeteer": "^7.0.
|
|
56
|
-
"@dword-design/tester": "^2.0.
|
|
57
|
-
"@dword-design/tester-plugin-puppeteer": "^3.0.
|
|
58
|
-
"@dword-design/tester-plugin-tmp-dir": "^2.1.
|
|
54
|
+
"@dword-design/base": "^11.2.3",
|
|
55
|
+
"@dword-design/puppeteer": "^7.0.2",
|
|
56
|
+
"@dword-design/tester": "^2.0.19",
|
|
57
|
+
"@dword-design/tester-plugin-puppeteer": "^3.0.3",
|
|
58
|
+
"@dword-design/tester-plugin-tmp-dir": "^2.1.26",
|
|
59
59
|
"@funken-studio/sitemap-nuxt-3": "^4.0.4",
|
|
60
|
-
"axios": "^1.
|
|
61
|
-
"depcheck": "^1.4.
|
|
60
|
+
"axios": "^1.7.4",
|
|
61
|
+
"depcheck": "^1.4.7",
|
|
62
|
+
"expect": "^29.7.0",
|
|
62
63
|
"nuxt-dev-ready": "^3.0.0",
|
|
63
64
|
"port-ready": "^0.1.0",
|
|
64
|
-
"tree-kill-promise": "^3.0.
|
|
65
|
-
"xml-formatter": "^3.
|
|
65
|
+
"tree-kill-promise": "^3.0.14",
|
|
66
|
+
"xml-formatter": "^3.6.3"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
69
|
"h3": "*"
|
|
69
70
|
},
|
|
71
|
+
"packageManager": "pnpm@9.7.1+sha512.faf344af2d6ca65c4c5c8c2224ea77a81a5e8859cbc4e06b1511ddce2f0151512431dd19e6aff31f2c6a8f5f2aced9bd2273e1fed7dd4de1868984059d2c4247",
|
|
70
72
|
"engines": {
|
|
71
73
|
"node": ">=18"
|
|
72
74
|
},
|
package/dist/modules/i18n.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { installModule } from '@nuxt/kit';
|
|
2
|
-
import packageName from 'depcheck-package-name';
|
|
3
|
-
import { globby } from 'globby';
|
|
4
|
-
import P from 'path';
|
|
5
|
-
export default (async (options, nuxt) => {
|
|
6
|
-
const locales = (await globby('*.json', {
|
|
7
|
-
cwd: P.join(nuxt.options.srcDir, 'i18n')
|
|
8
|
-
})).map(filename => P.basename(filename, '.json'));
|
|
9
|
-
const defaultLocale = locales.includes('en') ? 'en' : locales[0];
|
|
10
|
-
if (locales.length > 0) {
|
|
11
|
-
await installModule(packageName`@nuxtjs/i18n`, {
|
|
12
|
-
defaultLocale,
|
|
13
|
-
detectBrowserLanguage: locales.length === 1 ? false : {
|
|
14
|
-
fallbackLocale: defaultLocale,
|
|
15
|
-
redirectOn: 'no prefix',
|
|
16
|
-
useCookie: false
|
|
17
|
-
},
|
|
18
|
-
langDir: 'i18n',
|
|
19
|
-
lazy: true,
|
|
20
|
-
locales: locales.map(locale => ({
|
|
21
|
-
code: locale,
|
|
22
|
-
file: `${locale}.json`,
|
|
23
|
-
iso: locale
|
|
24
|
-
})),
|
|
25
|
-
strategy: `${locales.length === 1 ? 'no_' : ''}prefix`,
|
|
26
|
-
...(process.env.BASE_URL && {
|
|
27
|
-
baseUrl: process.env.BASE_URL
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
});
|