@dword-design/base-config-nuxt 5.0.4 → 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.
package/dist/config.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
'
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
+
<script setup>
|
|
64
|
+
import { ${['useHead', ...(hasI18n ? ['useLocaleHead'] : []), 'useRuntimeConfig'].join(', ')} } from '#imports'
|
|
63
65
|
|
|
64
|
-
|
|
66
|
+
${[hasI18n ? ['const i18nHead = useLocaleHead({ addSeoAttributes: true })'] : [], 'const runtimeConfig = useRuntimeConfig()'].join('\n')}
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
};
|
|
84
|
+
export default deepmerge(parentConfig, config)\n
|
|
85
|
+
`
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
supportedNodeVersions: [16, 18],
|
|
89
|
+
useJobMatrix: true
|
|
90
|
+
};
|
|
91
|
+
});
|