@dword-design/base-config-nuxt 6.1.8 → 6.2.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/dist/build.js ADDED
@@ -0,0 +1,28 @@
1
+ import { execa } from 'execa';
2
+ import fs from 'fs-extra';
3
+ import { createRequire } from 'module';
4
+ const _require = createRequire(import.meta.url);
5
+ const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
6
+ export default async (options = {}) => {
7
+ options = {
8
+ log: process.env.NODE_ENV !== 'test',
9
+ ...options
10
+ };
11
+ const nuxt = await execa(nuxtWrapper, ['build'], {
12
+ ...(options.log ? {
13
+ stdio: 'inherit'
14
+ } : {}),
15
+ ...(process.env.NODE_ENV === 'test' ? {
16
+ env: {
17
+ NUXT_TELEMETRY_DISABLED: 1
18
+ }
19
+ } : {})
20
+ });
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
+ }] : []));
26
+ }
27
+ return nuxt;
28
+ };
package/dist/config.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import pathLib from 'path';
2
2
  import { pathToFileURL } from 'url';
3
3
  let config;
4
+ const moduleUrl = pathToFileURL(pathLib.join(process.cwd(), 'config.js')).href;
4
5
  try {
5
- const modulePath = pathLib.join(process.cwd(), 'config.js');
6
- config = (await import(pathToFileURL(modulePath).href)).default;
6
+ config = (await import(moduleUrl)).default;
7
7
  } catch (error) {
8
- if (error.code === 'ERR_MODULE_NOT_FOUND') {
8
+ if (error.code === 'ERR_MODULE_NOT_FOUND' && error.url === moduleUrl) {
9
9
  config = {};
10
10
  } else {
11
11
  throw error;
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import outputFiles from 'output-files';
7
7
  import P from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import analyze from "./analyze.js";
10
+ import build from "./build.js";
10
11
  import depcheckSpecial from "./depcheck-special.js";
11
12
  import dev from "./dev.js";
12
13
  import getEslintConfig from "./get-eslint-config.js";
@@ -22,6 +23,7 @@ export default (config = {}) => {
22
23
  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
24
  commands: {
24
25
  analyze,
26
+ build,
25
27
  dev,
26
28
  prepublishOnly,
27
29
  start
@@ -1,32 +1,10 @@
1
- import { execa } from 'execa';
2
- import fs from 'fs-extra';
3
- import { createRequire } from 'module';
1
+ import build from "./build.js";
4
2
  import lint from "./lint.js";
5
- const _require = createRequire(import.meta.url);
6
- const nuxtWrapper = _require.resolve('./nuxt-wrapper.js');
7
3
  export default async (options = {}) => {
8
4
  options = {
9
5
  log: process.env.NODE_ENV !== 'test',
10
6
  ...options
11
7
  };
12
- await lint({
13
- log: options.log
14
- });
15
- const nuxt = await execa(nuxtWrapper, ['build'], {
16
- ...(options.log ? {
17
- stdio: 'inherit'
18
- } : {}),
19
- ...(process.env.NODE_ENV === 'test' ? {
20
- env: {
21
- NUXT_TELEMETRY_DISABLED: 1
22
- }
23
- } : {})
24
- });
25
- if (await fs.exists('model')) {
26
- await fs.remove('dist');
27
- await execa('babel', ['--out-dir', 'dist', '--copy-files', '--no-copy-ignored', '--ignore', '**/*.spec.js', 'model'], ...(options.log ? [{
28
- stdio: 'inherit'
29
- }] : []));
30
- }
31
- return nuxt;
8
+ await lint(options);
9
+ return build(options);
32
10
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base-config-nuxt",
3
- "version": "6.1.8",
3
+ "version": "6.2.1",
4
4
  "repository": "dword-design/base-config-nuxt",
5
5
  "funding": "https://github.com/sponsors/dword-design",
6
6
  "license": "MIT",