@dword-design/base-config-nuxt 5.0.5 → 5.0.6

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,13 +1,19 @@
1
1
  import packageName from 'depcheck-package-name';
2
- export default {
2
+ export default (config => ({
3
3
  extends: packageName`@dword-design/eslint-config`,
4
4
  globals: {
5
5
  $fetch: 'readonly'
6
6
  },
7
+ overrides: [{
8
+ files: 'pages/**/*.vue',
9
+ globals: {
10
+ definePageMeta: 'readonly'
11
+ }
12
+ }],
7
13
  rules: {
8
14
  'import/no-unresolved': ['error', {
9
- ignore: ['#imports']
15
+ ignore: ['#imports', '#components', ...config.importAliases]
10
16
  }],
11
17
  'import/no-webpack-loader-syntax': 'off'
12
18
  }
13
- };
19
+ }));
package/dist/index.js CHANGED
@@ -11,78 +11,81 @@ import { fileURLToPath } from 'url';
11
11
  import analyze from "./analyze.js";
12
12
  import depcheckSpecial from "./depcheck-special.js";
13
13
  import dev from "./dev.js";
14
- import eslintConfig from "./eslint.config.js";
14
+ import getEslintConfig from "./get-eslint-config.js";
15
15
  import lint from "./lint.js";
16
16
  import prepublishOnly from "./prepublish-only.js";
17
17
  import start from "./start.js";
18
18
  const __dirname = P.dirname(fileURLToPath(import.meta.url));
19
19
  const _require = createRequire(import.meta.url);
20
20
  const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
21
- export default {
22
- 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'],
23
- commands: {
24
- analyze,
25
- dev,
26
- prepublishOnly,
27
- start
28
- },
29
- depcheckConfig: {
30
- parsers: {
31
- '**/*.scss': depcheckParserSass,
32
- '**/*.vue': depcheckParserVue
21
+ export default ((config = {}) => {
22
+ config.importAliases = config.importAliases || [];
23
+ 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'],
25
+ commands: {
26
+ analyze,
27
+ dev,
28
+ prepublishOnly,
29
+ start
33
30
  },
34
- specials: [depcheckSpecial]
35
- },
36
- editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'app.vue', 'dist', 'nuxt.config.js'],
37
- eslintConfig,
38
- gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/app.vue', '/dist', '/nuxt.config.js'],
39
- lint,
40
- nodeVersion: 18,
41
- npmPublish: true,
42
- packageConfig: {
43
- main: 'dist/index.js'
44
- },
45
- prepare: async () => {
46
- const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
47
- const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
48
- const translations = await globby('i18n/*.json');
49
- const hasI18n = translations.length > 0;
50
- await outputFiles({
51
- '.stylelintrc.json': `${JSON.stringify({
52
- extends: packageName`@dword-design/stylelint-config`
53
- }, undefined, 2)}\n`,
54
- 'app.vue': endent`
55
- <template>
56
- <NuxtLayout>
57
- <NuxtPage />
58
- </NuxtLayout>
59
- </template>
31
+ depcheckConfig: {
32
+ parsers: {
33
+ '**/*.scss': depcheckParserSass,
34
+ '**/*.vue': depcheckParserVue
35
+ },
36
+ specials: [depcheckSpecial]
37
+ },
38
+ editorIgnore: ['.eslintcache', '.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'app.vue', 'dist', 'nuxt.config.js'],
39
+ eslintConfig: getEslintConfig(config),
40
+ gitignore: ['/.eslintcache', '/.nuxt', '/.output', '/.stylelintcache', '/app.vue', '/dist', '/nuxt.config.js'],
41
+ lint,
42
+ nodeVersion: 18,
43
+ npmPublish: true,
44
+ packageConfig: {
45
+ main: 'dist/index.js'
46
+ },
47
+ prepare: async () => {
48
+ const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), _require.resolve('./config.js')).split(P.sep).join('/')}`;
49
+ const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), _require.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
50
+ const translations = await globby('i18n/*.json');
51
+ const hasI18n = translations.length > 0;
52
+ await outputFiles({
53
+ '.stylelintrc.json': `${JSON.stringify({
54
+ extends: packageName`@dword-design/stylelint-config`
55
+ }, undefined, 2)}\n`,
56
+ 'app.vue': endent`
57
+ <template>
58
+ <NuxtLayout>
59
+ <NuxtPage />
60
+ </NuxtLayout>
61
+ </template>
60
62
 
61
- <script setup>
62
- import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
63
+ <script setup>
64
+ import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
63
65
 
64
- ${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
66
+ ${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
65
67
 
66
- useHead({
67
- ${[...(hasI18n ? [endent`
68
- htmlAttrs: {
69
- lang: i18nHead.value.htmlAttrs.lang,
70
- },
71
- link: i18nHead.value.link,
72
- meta: i18nHead.value.meta,
73
- `] : []), "titleTemplate: title => title ? `${title} | ${runtimeConfig.public.name}` : `${runtimeConfig.public.name}${runtimeConfig.public.title ? `: ${runtimeConfig.public.title}` : ''}`"].join('\n')}
74
- })
75
- </script>\n
76
- `,
77
- 'nuxt.config.js': javascript`
78
- import deepmerge from '${packageName`deepmerge`}'
79
- import config from '${configPath}'
80
- import parentConfig from '${parentConfigPath}'
68
+ useHead({
69
+ ${[...(hasI18n ? [endent`
70
+ htmlAttrs: {
71
+ lang: i18nHead.value.htmlAttrs.lang,
72
+ },
73
+ link: i18nHead.value.link,
74
+ meta: i18nHead.value.meta,
75
+ `] : []), "titleTemplate: title => title ? `${title} | ${runtimeConfig.public.name}` : `${runtimeConfig.public.name}${runtimeConfig.public.title ? `: ${runtimeConfig.public.title}` : ''}`"].join('\n')}
76
+ })
77
+ </script>\n
78
+ `,
79
+ 'nuxt.config.js': javascript`
80
+ import deepmerge from '${packageName`deepmerge`}'
81
+ import config from '${configPath}'
82
+ import parentConfig from '${parentConfigPath}'
81
83
 
82
- export default deepmerge(parentConfig, config)\n
83
- `
84
- });
85
- },
86
- supportedNodeVersions: [16, 18],
87
- useJobMatrix: true
88
- };
84
+ export default deepmerge(parentConfig, config)\n
85
+ `
86
+ });
87
+ },
88
+ supportedNodeVersions: [16, 18],
89
+ useJobMatrix: true
90
+ };
91
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",