@dword-design/base-config-nuxt 6.2.5 → 6.2.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/build.js CHANGED
@@ -1,28 +1,42 @@
1
- import { createRequire } from 'node:module';
2
- import { execa } from 'execa';
1
+ import pathLib from 'node:path';
2
+ import dotenv from '@dword-design/dotenv-json-extended';
3
+ import { execaCommand } from 'execa';
3
4
  import fs from 'fs-extra';
4
- const resolver = createRequire(import.meta.url);
5
- const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
6
- export default async (options = {}) => {
5
+ export default async function (options) {
7
6
  options = {
7
+ env: {},
8
8
  log: process.env.NODE_ENV !== 'test',
9
+ stderr: 'inherit',
9
10
  ...options
10
11
  };
11
- const nuxt = await execa(nuxtWrapper, ['build'], {
12
- ...(options.log ? {
13
- stdio: 'inherit'
14
- } : {}),
12
+ const nuxt = await execaCommand('nuxt build', {
13
+ ...(options.log && {
14
+ stdout: 'inherit'
15
+ }),
16
+ stderr: options.stderr,
15
17
  ...(process.env.NODE_ENV === 'test' ? {
16
18
  env: {
17
19
  NUXT_TELEMETRY_DISABLED: 1
18
20
  }
19
- } : {})
21
+ } : {}),
22
+ cwd: this.cwd,
23
+ env: {
24
+ ...dotenv.parse({
25
+ cwd: this.cwd
26
+ }),
27
+ ...options.env
28
+ }
20
29
  });
21
- if (await fs.exists('model')) {
22
- await fs.remove('dist');
23
- await execa('babel', ['--out-dir', 'dist', '--copy-files', '--no-copy-ignored', '--ignore', '**/*.spec.js', 'model'], ...(options.log ? [{
24
- stdio: 'inherit'
25
- }] : []));
30
+ if (await fs.exists(pathLib.join(this.cwd, 'model'))) {
31
+ await fs.remove(pathLib.join(this.cwd, 'dist'));
32
+ await execaCommand('babel --out-dir dist --copy-files --no-copy-ignored --ignore **/*.spec.js model', {
33
+ ...(options.log && {
34
+ stdout: 'inherit'
35
+ }),
36
+ cwd: this.cwd,
37
+ env: options.env,
38
+ stderr: options.stderr
39
+ });
26
40
  }
27
41
  return nuxt;
28
- };
42
+ }
package/dist/dev.js CHANGED
@@ -1,13 +1,24 @@
1
- import { createRequire } from 'node:module';
2
- import { execa } from 'execa';
3
- const resolver = createRequire(import.meta.url);
4
- const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
5
- export default (options = {}) => {
1
+ import dotenv from '@dword-design/dotenv-json-extended';
2
+ import { execaCommand } from 'execa';
3
+ export default function (options) {
6
4
  options = {
5
+ env: {},
7
6
  log: process.env.NODE_ENV !== 'test',
7
+ stderr: 'inherit',
8
8
  ...options
9
9
  };
10
- return execa(nuxtWrapper, ['dev'], {
11
- [options.log ? 'stdio' : 'stderr']: 'inherit'
10
+ return execaCommand('nuxt dev', {
11
+ ...(options.log && {
12
+ stdout: 'inherit'
13
+ }),
14
+ cwd: this.cwd,
15
+ env: {
16
+ ...dotenv.parse({
17
+ cwd: this.cwd
18
+ }),
19
+ ...options.env
20
+ },
21
+ reject: process.env.NODE_ENV !== 'test',
22
+ stderr: options.stderr
12
23
  });
13
- };
24
+ }
@@ -1,12 +1,15 @@
1
- import P from 'node:path';
1
+ import pathLib from 'node:path';
2
2
  import { filter, first, map } from '@dword-design/functions';
3
3
  import jitiBabelTransform from '@dword-design/jiti-babel-transform';
4
4
  import { createJiti } from 'jiti';
5
5
  import requirePackageName from 'require-package-name';
6
- export default path => {
7
- if (P.basename(path) === 'config.js') {
6
+ export default ({
7
+ cwd = '.'
8
+ }) => path => {
9
+ if (pathLib.basename(path) === 'config.js') {
8
10
  var _ref, _ref2, _modules;
9
- const jitiInstance = createJiti(process.cwd(), {
11
+ // TODO: Check full path including cwd so that we check config.js at project root
12
+ const jitiInstance = createJiti(pathLib.resolve(cwd), {
10
13
  esmResolve: true,
11
14
  interopDefault: true,
12
15
  transform: jitiBabelTransform
package/dist/index.js CHANGED
@@ -8,55 +8,59 @@ import depcheckParserVue from 'depcheck-parser-vue';
8
8
  import outputFiles from 'output-files';
9
9
  import analyze from "./analyze.js";
10
10
  import build from "./build.js";
11
- import depcheckSpecial from "./depcheck-special.js";
12
11
  import dev from "./dev.js";
13
12
  import eslintConfig from "./eslint-config.js";
13
+ import getDepcheckSpecial from "./get-depcheck-special.js";
14
14
  import lint from "./lint.js";
15
15
  import prepublishOnly from "./prepublish-only.js";
16
16
  import start from "./start.js";
17
17
  const __dirname = P.dirname(fileURLToPath(import.meta.url));
18
18
  const resolver = createRequire(import.meta.url);
19
19
  const isInNodeModules = __dirname.split(P.sep).includes('node_modules');
20
- export default {
21
- 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'],
22
- commands: {
23
- analyze,
24
- build,
25
- dev,
26
- prepublishOnly,
27
- start
28
- },
29
- depcheckConfig: {
30
- parsers: {
31
- '**/*.scss': depcheckParserSass,
32
- '**/*.vue': depcheckParserVue
20
+ export default function () {
21
+ return {
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'],
23
+ commands: {
24
+ analyze,
25
+ build,
26
+ dev,
27
+ prepublishOnly,
28
+ start
33
29
  },
34
- specials: [depcheckSpecial]
35
- },
36
- editorIgnore: ['.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'dist', 'nuxt.config.js'],
37
- eslintConfig,
38
- gitignore: ['/.nuxt', '/.output', '/.stylelintcache', '/dist', '/nuxt.config.js'],
39
- lint,
40
- npmPublish: true,
41
- packageConfig: {
42
- main: 'dist/index.js'
43
- },
44
- prepare: async () => {
45
- const configPath = isInNodeModules ? '@dword-design/base-config-nuxt/config' : `./${P.relative(process.cwd(), resolver.resolve('./config.js')).split(P.sep).join('/')}`;
46
- const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(process.cwd(), resolver.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
47
- await outputFiles({
48
- '.stylelintrc.json': `${JSON.stringify({
49
- extends: packageName`@dword-design/stylelint-config`
50
- }, undefined, 2)}\n`,
51
- 'nuxt.config.js': javascript`
52
- import config from '${configPath}';
30
+ depcheckConfig: {
31
+ parsers: {
32
+ '**/*.scss': depcheckParserSass,
33
+ '**/*.vue': depcheckParserVue
34
+ },
35
+ specials: [getDepcheckSpecial({
36
+ cwd: this.cwd
37
+ })]
38
+ },
39
+ editorIgnore: ['.stylelintcache', '.stylelintrc.json', '.nuxt', '.output', 'dist', 'nuxt.config.js'],
40
+ eslintConfig,
41
+ gitignore: ['/.nuxt', '/.output', '/.stylelintcache', '/dist', '/nuxt.config.js'],
42
+ lint,
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(this.cwd, resolver.resolve('./config.js')).split(P.sep).join('/')}`;
49
+ const parentConfigPath = isInNodeModules ? '@dword-design/base-config-nuxt/nuxt.config' : `./${P.relative(this.cwd, resolver.resolve('./nuxt.config.js')).split(P.sep).join('/')}`;
50
+ await outputFiles(this.cwd, {
51
+ '.stylelintrc.json': `${JSON.stringify({
52
+ extends: packageName`@dword-design/stylelint-config`
53
+ }, undefined, 2)}\n`,
54
+ 'nuxt.config.js': javascript`
55
+ import config from '${configPath}';
53
56
 
54
- export default {
55
- extends: ['${parentConfigPath}'],
56
- ...config,
57
- };\n
58
- `
59
- });
60
- },
61
- useJobMatrix: true
62
- };
57
+ export default {
58
+ extends: ['${parentConfigPath}'],
59
+ ...config,
60
+ };\n
61
+ `
62
+ });
63
+ },
64
+ useJobMatrix: true
65
+ };
66
+ }
package/dist/lint.js CHANGED
@@ -1,16 +1,36 @@
1
- import { createRequire } from 'node:module';
2
- import { execa, execaCommand } from 'execa';
3
- const resolver = createRequire(import.meta.url);
4
- const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
5
- export default async (options = {}) => {
1
+ import dotenv from '@dword-design/dotenv-json-extended';
2
+ import { execaCommand } from 'execa';
3
+ export default async function (options) {
6
4
  options = {
5
+ env: {},
7
6
  log: process.env.NODE_ENV !== 'test',
7
+ stderr: 'inherit',
8
8
  ...options
9
9
  };
10
- await execa(nuxtWrapper, ['prepare'], ...(options.log ? [{
11
- stdio: 'inherit'
12
- }] : []));
13
- await execaCommand('stylelint --fix --allow-empty-input --ignore-path .gitignore **/*.{css,scss,vue}', ...(options.log ? [{
14
- stdio: 'inherit'
15
- }] : []));
16
- };
10
+ await execaCommand('nuxi prepare', {
11
+ ...(options.log && {
12
+ stdout: 'inherit'
13
+ }),
14
+ cwd: this.cwd,
15
+ env: {
16
+ ...dotenv.parse({
17
+ cwd: this.cwd
18
+ }),
19
+ ...options.env
20
+ },
21
+ stderr: options.stderr
22
+ });
23
+ await execaCommand('stylelint --fix --allow-empty-input --ignore-path .gitignore **/*.{css,scss,vue}', {
24
+ ...(options.log && {
25
+ stdout: 'inherit'
26
+ }),
27
+ cwd: this.cwd,
28
+ env: {
29
+ ...dotenv.parse({
30
+ cwd: this.cwd
31
+ }),
32
+ ...options.env
33
+ },
34
+ stderr: options.stderr
35
+ });
36
+ }
package/dist/start.js CHANGED
@@ -1,13 +1,24 @@
1
- import { createRequire } from 'node:module';
2
- import { execa } from 'execa';
3
- const resolver = createRequire(import.meta.url);
4
- const nuxtWrapper = resolver.resolve('./nuxt-wrapper.js');
5
- export default (options = {}) => {
1
+ import dotenv from '@dword-design/dotenv-json-extended';
2
+ import { execaCommand } from 'execa';
3
+ export default function (options) {
6
4
  options = {
5
+ env: {},
7
6
  log: process.env.NODE_ENV !== 'test',
7
+ stderr: 'inherit',
8
8
  ...options
9
9
  };
10
- return execa(nuxtWrapper, ['start'], ...(options.log ? [{
11
- stdio: 'inherit'
12
- }] : []));
13
- };
10
+ return execaCommand('nuxt start', {
11
+ ...(options.log && {
12
+ stdout: 'inherit'
13
+ }),
14
+ cwd: this.cwd,
15
+ env: {
16
+ ...dotenv.parse({
17
+ cwd: this.cwd
18
+ }),
19
+ ...options.env
20
+ },
21
+ reject: process.env.NODE_ENV !== 'test',
22
+ stderr: options.stderr
23
+ });
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "6.2.5",
3
+ "version": "6.2.6",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@dword-design/depcheck-parser-sass": "^4.0.4",
30
- "@dword-design/dotenv-json-extended": "^2.0.25",
30
+ "@dword-design/dotenv-json-extended": "^3.0.1",
31
31
  "@dword-design/functions": "^6.0.2",
32
32
  "@dword-design/jiti-babel-transform": "^2.0.0",
33
33
  "@dword-design/stylelint-config": "^4.0.2",
@@ -50,15 +50,14 @@
50
50
  "vite-svg-loader": "^5.1.0"
51
51
  },
52
52
  "devDependencies": {
53
- "@dword-design/base": "^12.0.14",
54
- "@dword-design/tester": "^2.0.19",
55
- "@dword-design/tester-plugin-tmp-dir": "^2.1.26",
53
+ "@dword-design/base": "^12.0.18",
56
54
  "@nuxtjs/sitemap": "^7.3.0",
55
+ "@playwright/test": "^1.52.0",
57
56
  "axios": "^1.9.0",
58
57
  "depcheck": "^1.4.7",
59
58
  "expect": "^29.7.0",
59
+ "get-port": "^7.1.0",
60
60
  "nuxt-dev-ready": "^3.0.0",
61
- "p-wait-for": "^5.0.2",
62
61
  "playwright": "^1.52.0",
63
62
  "playwright-chromium": "^1.52.0",
64
63
  "port-ready": "^0.1.0",
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env node
2
- import dotenv from '@dword-design/dotenv-json-extended';
3
- import { execa } from 'execa';
4
- dotenv.config();
5
- execa('nuxt', process.argv.slice(2), {
6
- stdio: 'inherit'
7
- });