@dword-design/base 9.4.60 → 9.5.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/cli.js CHANGED
@@ -59,9 +59,10 @@ const run = async () => {
59
59
  name: '-u, --update-snapshots'
60
60
  }]
61
61
  },
62
- ...(_base$config$commands = base.config.commands, mapValues(command => typeof command === 'function' ? {
63
- handler: command
64
- } : command)(_base$config$commands))
62
+ ...(_base$config$commands = base.config.commands, mapValues((command, name) => ({
63
+ ...command,
64
+ handler: (...args) => base.run(name, ...args)
65
+ }))(_base$config$commands))
65
66
  }, mapValues((command, name) => ({
66
67
  name,
67
68
  ...command
@@ -1,18 +1,18 @@
1
1
  import { execa } from 'execa';
2
2
  import { createRequire } from 'module';
3
3
  import parsePackagejsonName from 'parse-packagejson-name';
4
- const require = createRequire(import.meta.url);
4
+ const _require = createRequire(import.meta.url);
5
5
  export default async function (options) {
6
6
  const packageName = parsePackagejsonName(this.packageConfig.name).fullName;
7
7
  if (this.config.git !== undefined && packageName !== this.config.git.project) {
8
8
  throw new Error(`Package name '${packageName}' has to be equal to repository name '${this.config.git.project}'`);
9
9
  }
10
10
  options = {
11
- resolvePluginsRelativeTo: require.resolve('@dword-design/eslint-config'),
11
+ resolvePluginsRelativeTo: _require.resolve('@dword-design/eslint-config'),
12
12
  ...options
13
13
  };
14
14
  try {
15
- await execa('eslint', ['--fix', '--ext', '.js,.json,.vue', '--ignore-path', '.gitignore', '--resolve-plugins-relative-to', options.resolvePluginsRelativeTo, '.'], {
15
+ await execa('eslint', ['--fix', '--ext', '.js,.json,.vue', '--ignore-path', '.gitignore', '--config', _require.resolve('@dword-design/eslint-config'), '--no-eslintrc', '--resolve-plugins-relative-to', options.resolvePluginsRelativeTo, '.'], {
16
16
  all: true
17
17
  });
18
18
  } catch (error) {
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import babelConfig from '@dword-design/babel-config';
2
2
  import endent from "@dword-design/functions/dist/endent.js";
3
3
  import identity from "@dword-design/functions/dist/identity.js";
4
+ import mapValues from "@dword-design/functions/dist/map-values.js";
4
5
  import deepmerge from 'deepmerge';
5
6
  import depcheck from 'depcheck';
6
7
  import depcheckDetectorExeca from 'depcheck-detector-execa';
@@ -38,6 +39,7 @@ import getGeneratedFiles from "./get-generated-files/index.js";
38
39
  import getGitInfo from "./get-git-info/index.js";
39
40
  class Base {
40
41
  constructor(config) {
42
+ var _this$config$commands;
41
43
  const jitiInstance = jiti(process.cwd(), {
42
44
  esmResolve: true,
43
45
  interopDefault: true,
@@ -108,9 +110,18 @@ class Base {
108
110
  }
109
111
  configsToMerge.push(config);
110
112
  this.config = deepmerge.all(configsToMerge, mergeOptions);
113
+ this.config = {
114
+ ...this.config,
115
+ commands: (_this$config$commands = this.config.commands, mapValues(command => typeof command === 'function' ? {
116
+ handler: command
117
+ } : command)(_this$config$commands))
118
+ };
111
119
  this.packageConfig = this.getPackageConfig();
112
120
  this.generatedFiles = this.getGeneratedFiles();
113
121
  }
122
+ run(name, ...args) {
123
+ return this.config.commands[name].handler.call(this, ...args);
124
+ }
114
125
  }
115
126
  Object.assign(Base.prototype, {
116
127
  checkUnknownFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dword-design/base",
3
- "version": "9.4.60",
3
+ "version": "9.5.1",
4
4
  "description": "Base package for projects.",
5
5
  "repository": "dword-design/base",
6
6
  "funding": "https://github.com/sponsors/dword-design",