@dword-design/base 12.2.0 → 13.0.0

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.
Files changed (49) hide show
  1. package/README.md +68 -68
  2. package/dist/cli.js +6 -7
  3. package/dist/commands/check-unknown-files/index.js +9 -13
  4. package/dist/commands/check-unknown-files/unknown-files-error.js +3 -3
  5. package/dist/commands/commit/index.js +2 -2
  6. package/dist/commands/depcheck/index.js +16 -16
  7. package/dist/commands/prepare/index.js +3 -5
  8. package/dist/commands/test-docker/index.js +5 -11
  9. package/dist/commands/test-raw/index.js +5 -18
  10. package/dist/get-depcheck-special-base/index.js +2 -5
  11. package/dist/get-generated-files/babel.js +5 -1
  12. package/dist/get-generated-files/common-editor-ignore.js +1 -1
  13. package/dist/get-generated-files/editorconfig.js +1 -1
  14. package/dist/get-generated-files/get-editor-ignore/index.js +2 -3
  15. package/dist/get-generated-files/get-eslint/index.js +3 -3
  16. package/dist/get-generated-files/get-github-workflow/steps/get-release.js +3 -5
  17. package/dist/get-generated-files/get-github-workflow/steps/get-test.js +3 -11
  18. package/dist/get-generated-files/get-github-workflow/strategies/job-matrix.js +2 -4
  19. package/dist/get-generated-files/get-gitignore/index.js +2 -3
  20. package/dist/get-generated-files/get-gitpod/index.js +1 -1
  21. package/dist/get-generated-files/get-gitpod-dockerfile.js +1 -1
  22. package/dist/get-generated-files/get-license-string.js +1 -1
  23. package/dist/get-generated-files/get-package-config/index.js +5 -7
  24. package/dist/get-generated-files/get-readme-string/index.js +13 -13
  25. package/dist/get-generated-files/get-readme-string/replacements.js +97 -99
  26. package/dist/get-generated-files/get-renovate/index.js +2 -2
  27. package/dist/get-generated-files/get-vscode/index.js +1 -3
  28. package/dist/get-generated-files/gitattributes.js +1 -1
  29. package/dist/get-generated-files/github-deprecated-dependencies-issue-template.js +1 -1
  30. package/dist/get-generated-files/github-labels.js +6 -10
  31. package/dist/get-generated-files/index.js +24 -42
  32. package/dist/get-generated-files/typescript.js +12 -1
  33. package/dist/index.js +85 -43
  34. package/dist/load-config/index.js +4 -2
  35. package/dist/load-config-sync/index.js +4 -2
  36. package/package.json +18 -29
  37. package/dist/__snapshots__/index.spec.js.snap +0 -84
  38. package/dist/commands/prepare/__snapshots__/index.spec.js.snap +0 -143
  39. package/dist/commands/test-raw/__snapshots__/index.spec.js.snap +0 -53
  40. package/dist/get-generated-files/__snapshots__/index.spec.js.snap +0 -57
  41. package/dist/get-generated-files/get-editor-ignore/__snapshots__/index.spec.js.snap +0 -29
  42. package/dist/get-generated-files/get-github-sync-metadata/__snapshots__/index.spec.js.snap +0 -72
  43. package/dist/get-generated-files/get-github-workflow/__snapshots__/index.spec.js.snap +0 -1133
  44. package/dist/get-generated-files/get-gitignore/__snapshots__/index.spec.js.snap +0 -13
  45. package/dist/get-generated-files/get-gitpod/__snapshots__/index.spec.js.snap +0 -32
  46. package/dist/get-generated-files/get-package-config/__snapshots__/index.spec.js.snap +0 -116
  47. package/dist/get-generated-files/get-readme-string/__snapshots__/index.spec.js.snap +0 -236
  48. package/dist/get-generated-files/get-vscode/__snapshots__/index.spec.js.snap +0 -35
  49. package/dist/get-generated-files/github-deprecated-dependencies/__snapshots__/index.spec.js.snap +0 -57
package/README.md CHANGED
@@ -3,51 +3,51 @@
3
3
  <!-- /TITLE -->
4
4
 
5
5
  <!-- BADGES/ -->
6
- <p>
7
- <a href="https://npmjs.org/package/@dword-design/base">
8
- <img
9
- src="https://img.shields.io/npm/v/@dword-design/base.svg"
10
- alt="npm version"
11
- >
12
- </a><img src="https://img.shields.io/badge/os-linux%20%7C%C2%A0macos%20%7C%C2%A0windows-blue" alt="Linux macOS Windows compatible"><a href="https://github.com/dword-design/base/actions">
13
- <img
14
- src="https://github.com/dword-design/base/workflows/build/badge.svg"
15
- alt="Build status"
16
- >
17
- </a><a href="https://codecov.io/gh/dword-design/base">
18
- <img
19
- src="https://codecov.io/gh/dword-design/base/branch/master/graph/badge.svg"
20
- alt="Coverage status"
21
- >
22
- </a><a href="https://david-dm.org/dword-design/base">
23
- <img src="https://img.shields.io/david/dword-design/base" alt="Dependency status">
24
- </a><img src="https://img.shields.io/badge/renovate-enabled-brightgreen" alt="Renovate enabled"><br/><a href="https://gitpod.io/#https://github.com/dword-design/base">
25
- <img
26
- src="https://gitpod.io/button/open-in-gitpod.svg"
27
- alt="Open in Gitpod"
28
- width="114"
29
- >
30
- </a><a href="https://www.buymeacoffee.com/dword">
31
- <img
32
- src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
33
- alt="Buy Me a Coffee"
34
- width="114"
35
- >
36
- </a><a href="https://paypal.me/SebastianLandwehr">
37
- <img
38
- src="https://sebastianlandwehr.com/images/paypal.svg"
39
- alt="PayPal"
40
- width="163"
41
- >
42
- </a><a href="https://www.patreon.com/dworddesign">
43
- <img
44
- src="https://sebastianlandwehr.com/images/patreon.svg"
45
- alt="Patreon"
46
- width="163"
47
- >
48
- </a>
49
- </p>
50
- <!-- /BADGES -->
6
+ <p>
7
+ <a href="https://npmjs.org/package/@dword-design/base">
8
+ <img
9
+ src="https://img.shields.io/npm/v/@dword-design/base.svg"
10
+ alt="npm version"
11
+ >
12
+ </a><img src="https://img.shields.io/badge/os-linux%20%7C%C2%A0macos%20%7C%C2%A0windows-blue" alt="Linux macOS Windows compatible"><a href="https://github.com/dword-design/base/actions">
13
+ <img
14
+ src="https://github.com/dword-design/base/workflows/build/badge.svg"
15
+ alt="Build status"
16
+ >
17
+ </a><a href="https://codecov.io/gh/dword-design/base">
18
+ <img
19
+ src="https://codecov.io/gh/dword-design/base/branch/master/graph/badge.svg"
20
+ alt="Coverage status"
21
+ >
22
+ </a><a href="https://david-dm.org/dword-design/base">
23
+ <img src="https://img.shields.io/david/dword-design/base" alt="Dependency status">
24
+ </a><img src="https://img.shields.io/badge/renovate-enabled-brightgreen" alt="Renovate enabled"><br/><a href="https://gitpod.io/#https://github.com/dword-design/base">
25
+ <img
26
+ src="https://gitpod.io/button/open-in-gitpod.svg"
27
+ alt="Open in Gitpod"
28
+ width="114"
29
+ >
30
+ </a><a href="https://www.buymeacoffee.com/dword">
31
+ <img
32
+ src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
33
+ alt="Buy Me a Coffee"
34
+ width="114"
35
+ >
36
+ </a><a href="https://paypal.me/SebastianLandwehr">
37
+ <img
38
+ src="https://sebastianlandwehr.com/images/paypal.svg"
39
+ alt="PayPal"
40
+ width="163"
41
+ >
42
+ </a><a href="https://www.patreon.com/dworddesign">
43
+ <img
44
+ src="https://sebastianlandwehr.com/images/patreon.svg"
45
+ alt="Patreon"
46
+ width="163"
47
+ >
48
+ </a>
49
+ </p>
50
+ <!-- /BADGES -->
51
51
 
52
52
  <!-- DESCRIPTION/ -->
53
53
  Base package for projects.
@@ -66,7 +66,7 @@ $ yarn add @dword-design/base
66
66
  <!-- /INSTALL -->
67
67
 
68
68
  <!-- LICENSE/ -->
69
- ## Contribute
69
+ ## Contribute
70
70
 
71
71
  Are you missing something or want to contribute? Feel free to file an [issue](https://github.com/dword-design/base/issues) or a [pull request](https://github.com/dword-design/base/pulls)! ⚙️
72
72
 
@@ -75,27 +75,27 @@ Are you missing something or want to contribute? Feel free to file an [issue](ht
75
75
  Hey, I am Sebastian Landwehr, a freelance web developer, and I love developing web apps and open source packages. If you want to support me so that I can keep packages up to date and build more helpful tools, you can donate here:
76
76
 
77
77
  <p>
78
- <a href="https://www.buymeacoffee.com/dword">
79
- <img
80
- src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
81
- alt="Buy Me a Coffee"
82
- width="114"
83
- >
84
- </a>&nbsp;If you want to send me a one time donation. The coffee is pretty good 😊.<br/>
85
- <a href="https://paypal.me/SebastianLandwehr">
86
- <img
87
- src="https://sebastianlandwehr.com/images/paypal.svg"
88
- alt="PayPal"
89
- width="163"
90
- >
91
- </a>&nbsp;Also for one time donations if you like PayPal.<br/>
92
- <a href="https://www.patreon.com/dworddesign">
93
- <img
94
- src="https://sebastianlandwehr.com/images/patreon.svg"
95
- alt="Patreon"
96
- width="163"
97
- >
98
- </a>&nbsp;Here you can support me regularly, which is great so I can steadily work on projects.
78
+ <a href="https://www.buymeacoffee.com/dword">
79
+ <img
80
+ src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"
81
+ alt="Buy Me a Coffee"
82
+ width="114"
83
+ >
84
+ </a>&nbsp;If you want to send me a one time donation. The coffee is pretty good 😊.<br/>
85
+ <a href="https://paypal.me/SebastianLandwehr">
86
+ <img
87
+ src="https://sebastianlandwehr.com/images/paypal.svg"
88
+ alt="PayPal"
89
+ width="163"
90
+ >
91
+ </a>&nbsp;Also for one time donations if you like PayPal.<br/>
92
+ <a href="https://www.patreon.com/dworddesign">
93
+ <img
94
+ src="https://sebastianlandwehr.com/images/patreon.svg"
95
+ alt="Patreon"
96
+ width="163"
97
+ >
98
+ </a>&nbsp;Here you can support me regularly, which is great so I can steadily work on projects.
99
99
  </p>
100
100
 
101
101
  Thanks a lot for your support! ❤️
@@ -103,5 +103,5 @@ Thanks a lot for your support! ❤️
103
103
  ## License
104
104
 
105
105
  [MIT License](https://opensource.org/license/mit/) © [Sebastian Landwehr](https://sebastianlandwehr.com)
106
- <!-- /LICENSE -->
106
+ <!-- /LICENSE -->
107
107
 
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { mapValues, values } from '@dword-design/functions';
2
+ import { mapValues } from 'lodash-es';
3
3
  import makeCli from 'make-cli';
4
4
  import { Base } from "./index.js";
5
5
  import loadConfig from "./load-config/index.js";
@@ -18,9 +18,8 @@ const testOptions = [{
18
18
  name: '--ui'
19
19
  }];
20
20
  try {
21
- var _ref, _checkUnknownFiles$co, _base$config$commands;
22
21
  await makeCli({
23
- commands: (_ref = (_checkUnknownFiles$co = {
22
+ commands: Object.values(mapValues({
24
23
  checkUnknownFiles: {
25
24
  handler: () => base.checkUnknownFiles()
26
25
  },
@@ -58,14 +57,14 @@ try {
58
57
  }),
59
58
  options: testOptions
60
59
  },
61
- ...(_base$config$commands = base.config.commands, mapValues((command, name) => ({
60
+ ...mapValues(base.config.commands, (command, name) => ({
62
61
  ...command,
63
62
  handler: (...args) => base.run(name, ...args)
64
- }))(_base$config$commands))
65
- }, mapValues((command, name) => ({
63
+ }))
64
+ }, (command, name) => ({
66
65
  name,
67
66
  ...command
68
- }))(_checkUnknownFiles$co)), values(_ref))
67
+ })))
69
68
  });
70
69
  } catch (error) {
71
70
  console.error(error);
@@ -1,10 +1,8 @@
1
- import { filter, fromPairs, keys, map } from '@dword-design/functions';
2
1
  import { globby } from 'globby';
3
2
  import ignore from 'ignore';
4
3
  import UnknownFilesError from "./unknown-files-error.js";
5
4
  export default async function () {
6
- var _this$generatedFiles, _ref, _globby;
7
- const allowedMatches = [...(_this$generatedFiles = this.generatedFiles, keys(_this$generatedFiles)), ...Object.keys({
5
+ const allowedMatches = [...Object.keys(this.generatedFiles), ...Object.keys({
8
6
  '.baserc.json': true,
9
7
  '.env.schema.json': true,
10
8
  '.git': true,
@@ -18,27 +16,25 @@ export default async function () {
18
16
  PRCHECKLIST: true,
19
17
  demo: true,
20
18
  doc: true,
21
- 'eslint.config.js': true,
19
+ 'eslint.config.ts': true,
20
+ fixtures: true,
22
21
  'global-test-hooks.js': true,
23
22
  'pnpm-lock.yaml': true,
24
23
  'pnpm-workspace.yaml': true,
25
24
  'types.d.ts': true
26
- }), ...Object.keys(this.config.testRunner === 'playwright' ? {
25
+ }), ...Object.keys({
27
26
  '**/*-snapshots/**': true,
28
27
  // For some reason without the trailing ** didn't work
29
- 'playwright.config.js': true
30
- } : {
31
- '**/__image_snapshots__': true,
32
- '**/__snapshots__': true
28
+ 'playwright.config.ts': true
33
29
  }), ...this.config.allowedMatches];
34
- const unknownFiles = (_ref = (_globby = globby('**', {
30
+ let unknownFiles = await globby('**', {
35
31
  cwd: this.cwd,
36
32
  dot: true,
37
33
  gitignore: true,
38
34
  ignore: allowedMatches
39
- }), await _globby), filter(ignore().add(this.getGitignoreConfig()).createFilter())(_ref));
35
+ });
36
+ unknownFiles = unknownFiles.filter(ignore().add(this.getGitignoreConfig()).createFilter());
40
37
  if (unknownFiles.length > 0) {
41
- var _ref2, _unknownFiles;
42
- throw new UnknownFilesError((_ref2 = (_unknownFiles = unknownFiles, map(file => [file, true])(_unknownFiles)), fromPairs(_ref2)));
38
+ throw new UnknownFilesError(Object.fromEntries(unknownFiles.map(file => [file, true])));
43
39
  }
44
40
  }
@@ -1,13 +1,13 @@
1
- import { endent, identity, join, keys, map, sortBy } from '@dword-design/functions';
1
+ import endent from 'endent';
2
2
  import fs from 'fs-extra';
3
+ import { identity, sortBy } from 'lodash-es';
3
4
  const packageConfig = fs.readJsonSync(new URL('../../../package.json', import.meta.url));
4
5
  export default class extends Error {
5
6
  constructor(files) {
6
- var _ref, _ref2, _ref3, _files;
7
7
  super(endent`
8
8
  There are files in this repository that are not known to ${packageConfig.name}. Let's discuss about them in a PR!
9
9
 
10
- ${_ref = (_ref2 = (_ref3 = (_files = files, keys(_files)), map(file => `* ${file}`)(_ref3)), sortBy(identity)(_ref2)), join('\n')(_ref)}
10
+ ${sortBy(Object.keys(files).map(file => `* ${file}`), identity).join('\n')}
11
11
  `);
12
12
  }
13
13
  }
@@ -1,11 +1,11 @@
1
- import { execa } from 'execa';
1
+ import { execaCommand } from 'execa';
2
2
  export default function (options) {
3
3
  options = {
4
4
  log: process.env.NODE_ENV !== 'test',
5
5
  stderr: 'inherit',
6
6
  ...options
7
7
  };
8
- return execa('git-cz', [...(options.allowEmpty ? ['--allow-empty'] : [])], {
8
+ return execaCommand(`git-cz${options.allowEmpty ? ' --allow-empty' : ''}`, {
9
9
  cwd: this.cwd,
10
10
  ...(options.log && {
11
11
  stdout: 'inherit'
@@ -1,18 +1,18 @@
1
- import { endent, isEmpty, join, map, mapValues, omit, values } from '@dword-design/functions';
2
1
  import depcheck from 'depcheck';
2
+ import endent from 'endent';
3
+ import { isEmpty, mapValues, omit } from 'lodash-es';
3
4
  export default async function () {
4
- var _this$packageConfig, _this$packageConfig2, _ref, _ref2, _result$dependencies, _ref3, _result$devDependenci, _ref4, _ref5, _result$invalidFiles;
5
5
  const dependenciesResult = await depcheck(this.cwd, {
6
- package: (_this$packageConfig = this.packageConfig, omit(['devDependencies'])(_this$packageConfig)),
6
+ package: omit(this.packageConfig, ['devDependencies']),
7
7
  skipMissing: true,
8
8
  ...this.config.depcheckConfig,
9
- ignorePatterns: ['*.spec.js', ...(this.config.testRunner === 'playwright' ? ['/fixtures', '/playwright.config.js'] : ['/global-test-hooks.js']), 'package.json', 'eslint.config.js']
9
+ ignorePatterns: ['*.spec.ts', '/fixtures', '/playwright.config.ts', 'package.json', 'eslint.config.ts']
10
10
  });
11
11
  const devDependenciesResult = await depcheck(this.cwd, {
12
- package: (_this$packageConfig2 = this.packageConfig, omit(['dependencies'])(_this$packageConfig2)),
12
+ package: omit(this.packageConfig, ['dependencies']),
13
13
  skipMissing: true,
14
14
  ...this.config.depcheckConfig,
15
- ignorePatterns: ['!*.spec.js', ...(this.config.testRunner === 'playwright' ? ['!/fixtures', '!/playwright.config.js'] : ['!/global-test-hooks.js']), 'eslint.config.js']
15
+ ignorePatterns: ['!*.spec.ts', '!/fixtures', '!/playwright.config.ts', 'eslint.config.ts']
16
16
  });
17
17
  const result = {
18
18
  dependencies: dependenciesResult.dependencies,
@@ -22,16 +22,16 @@ export default async function () {
22
22
  ...devDependenciesResult.invalidFiles
23
23
  }
24
24
  };
25
- const errorMessage = (_ref = [...(result.dependencies.length > 0 ? [endent`
26
- Unused dependencies
27
- ${_ref2 = (_result$dependencies = result.dependencies, map(dep => `* ${dep}`)(_result$dependencies)), join('\n')(_ref2)}
28
- `] : []), ...(result.devDependencies.length > 0 ? [endent`
29
- Unused devDependencies
30
- ${_ref3 = (_result$devDependenci = result.devDependencies, map(dep => `* ${dep}`)(_result$devDependenci)), join('\n')(_ref3)}
31
- `] : []), ...(isEmpty(result.invalidFiles) ? [] : [endent`
32
- Invalid files
33
- ${_ref4 = (_ref5 = (_result$invalidFiles = result.invalidFiles, mapValues((error, name) => `* ${name}: ${error}`)(_result$invalidFiles)), values(_ref5)), join('\n')(_ref4)}
34
- `])], join('\n\n')(_ref));
25
+ const errorMessage = [...(result.dependencies.length > 0 ? [endent`
26
+ Unused dependencies
27
+ ${result.dependencies.map(dep => `* ${dep}`).join('\n')}
28
+ `] : []), ...(result.devDependencies.length > 0 ? [endent`
29
+ Unused devDependencies
30
+ ${result.devDependencies.map(dep => `* ${dep}`).join('\n')}
31
+ `] : []), ...(isEmpty(result.invalidFiles) ? [] : [endent`
32
+ Invalid files
33
+ ${Object.values(mapValues(result.invalidFiles, (error, name) => `* ${name}: ${error}`)).join('\n')}
34
+ `])].join('\n\n');
35
35
  if (errorMessage) {
36
36
  throw new Error(errorMessage);
37
37
  }
@@ -1,12 +1,11 @@
1
1
  import { createRequire } from 'node:module';
2
2
  import pathLib from 'node:path';
3
- import { first, keys } from '@dword-design/functions';
4
3
  import packageName from 'depcheck-package-name';
5
4
  import { execa, execaCommand } from 'execa';
6
5
  import fs from 'fs-extra';
7
6
  import outputFiles from 'output-files';
8
- const _require = createRequire(import.meta.url);
9
- const commitlintPackageConfig = _require(packageName`@commitlint/cli/package.json`);
7
+ const resolver = createRequire(import.meta.url);
8
+ const commitlintPackageConfig = resolver(packageName`@commitlint/cli/package.json`);
10
9
  export default async function (options) {
11
10
  options = {
12
11
  log: process.env.NODE_ENV !== 'test',
@@ -15,7 +14,6 @@ export default async function (options) {
15
14
  };
16
15
  await outputFiles(this.cwd, this.generatedFiles);
17
16
  if (await fs.exists(pathLib.join(this.cwd, '.git'))) {
18
- var _ref, _commitlintPackageCon;
19
17
  await execaCommand('husky install', {
20
18
  cwd: this.cwd,
21
19
  ...(options.log && {
@@ -23,7 +21,7 @@ export default async function (options) {
23
21
  }),
24
22
  stderr: options.stderr
25
23
  });
26
- await execa('husky', ['set', '.husky/commit-msg', `npx ${_ref = (_commitlintPackageCon = commitlintPackageConfig.bin, keys(_commitlintPackageCon)), first(_ref)} --edit "$1"`], {
24
+ await execa('husky', ['set', '.husky/commit-msg', `npx ${Object.keys(commitlintPackageConfig.bin)[0]} --edit "$1"`], {
27
25
  cwd: this.cwd,
28
26
  ...(options.log && {
29
27
  stdout: 'inherit'
@@ -1,29 +1,23 @@
1
- import os from 'node:os';
2
- import { filter, flatMap, join, keys, map, replace } from '@dword-design/functions';
1
+ import { userInfo as getUserInfo } from 'node:os';
3
2
  import { constantCase } from 'change-case';
4
3
  import { execa } from 'execa';
5
4
  import { findUpSync } from 'find-up';
6
5
  import fs from 'fs-extra';
7
6
  export default async function (options) {
8
- var _ref, _this$packageConfig$n, _ref2, _ref3;
9
7
  options = {
10
8
  log: process.env.NODE_ENV !== 'test',
11
9
  patterns: [],
12
10
  stderr: 'inherit',
13
11
  ...options
14
12
  };
15
- const volumeName = (_ref = (_this$packageConfig$n = this.packageConfig.name, replace('@', '')(_this$packageConfig$n)), replace('/', '-')(_ref));
13
+ const volumeName = this.packageConfig.name.replace('@/src', '').replace('/', '-');
16
14
  const envSchemaPath = findUpSync('.env.schema.json', {
17
15
  cwd: this.cwd
18
16
  });
19
- const envVariableNames = (_ref2 = (_ref3 = envSchemaPath ? await fs.readJson(envSchemaPath) : {}, keys(_ref3)), map(name => {
20
- var _name;
21
- return `TEST_${_name = name, constantCase(_name)}`;
22
- })(_ref2));
23
- const userInfo = os.userInfo();
17
+ const envVariableNames = Object.keys(envSchemaPath ? await fs.readJson(envSchemaPath) : {}).map(name => `TEST_${constantCase(name)}`);
18
+ const userInfo = getUserInfo();
24
19
  try {
25
- var _ref4, _envVariableNames, _ref5;
26
- return await execa('docker', ['run', '--rm', ...(_ref4 = (_envVariableNames = envVariableNames, filter(name => process.env[name] !== undefined)(_envVariableNames)), flatMap(name => ['--env', `${name}=${process.env[name]}`])(_ref4)), '-v', `${this.cwd}:/app`, '-v', `${volumeName}:/app/node_modules`, 'dworddesign/testing:latest', 'bash', '-c', (_ref5 = ['pnpm install --frozen-lockfile', '&&', 'pnpm test:raw', ...(options.updateSnapshots ? [' --update-snapshots'] : []), ...options.patterns.map(pattern => `"${pattern}"`), ...(options.grep ? [`-g "${options.grep}"`] : [])], join(' ')(_ref5))], {
20
+ return await execa('docker', ['run', '--rm', ...envVariableNames.filter(name => process.env[name] !== undefined).flatMap(name => ['--env', `${name}=${process.env[name]}`]), '-v', `${this.cwd}:/app`, '-v', `${volumeName}:/app/node_modules`, 'dworddesign/testing:latest', 'bash', '-c', ['pnpm install --frozen-lockfile', '&&', 'pnpm test:raw', ...(options.updateSnapshots ? [' --update-snapshots'] : []), ...options.patterns.map(pattern => `"${pattern}"`), ...(options.grep ? [`-g "${options.grep}"`] : [])].join(' ')], {
27
21
  cwd: this.cwd,
28
22
  ...(options.log && {
29
23
  stdout: 'inherit'
@@ -1,19 +1,14 @@
1
- import { createRequire } from 'node:module';
2
- import P from 'node:path';
3
- import { endent, includes } from '@dword-design/functions';
4
1
  import Ajv from 'ajv';
5
2
  import packageName from 'depcheck-package-name';
3
+ import endent from 'endent';
6
4
  import { execa } from 'execa';
7
- import fs from 'fs-extra';
8
5
  import isCI from "./is-ci.js";
9
6
  import packageJsonSchema from "./package-json-schema.js";
10
- const _require = createRequire(import.meta.url);
11
7
  const ajv = new Ajv({
12
8
  allowUnionTypes: true
13
9
  });
14
10
  const validatePackageJson = ajv.compile(packageJsonSchema);
15
11
  export default async function (options) {
16
- var _ref;
17
12
  options = {
18
13
  log: process.env.NODE_ENV !== 'test',
19
14
  patterns: [],
@@ -32,26 +27,18 @@ export default async function (options) {
32
27
  }
33
28
  const runDockerTests = !isCI({
34
29
  cwd: this.cwd
35
- }) || !(_ref = ['win32', 'darwin'], includes(process.platform)(_ref));
36
- return execa(this.packageConfig.type === 'module' ? packageName`c8` : packageName`nyc`, [...(this.packageConfig.type === 'module' ? ['--exclude', 'eslint.config.js'] : []), ...(this.config.testRunner === 'playwright' ? ['playwright', 'test', '--pass-with-no-tests', ...(runDockerTests ? [] : ['--grep-invert', '@usesdocker']), ...(options.updateSnapshots ? ['--update-snapshots'] : []), ...(options.ui ? ['--ui'] : []), ...(options.uiHost ? ['--ui-host', options.uiHost] : []), ...(options.grep ? ['--grep', options.grep] : []), '--trace', 'retain-on-failure', ...(isCI({
30
+ }) || !['win32', 'darwin'].includes(process.platform);
31
+ return execa(packageName`c8`, ['playwright', 'test', '--pass-with-no-tests', ...(runDockerTests ? [] : ['--grep-invert', '@usesdocker']), ...(options.updateSnapshots ? ['--update-snapshots'] : []), ...(options.ui ? ['--ui'] : []), ...(options.uiHost ? ['--ui-host', options.uiHost] : []), ...(options.grep ? ['--grep', options.grep] : []), '--trace', 'retain-on-failure', ...(isCI({
37
32
  cwd: this.cwd
38
33
  }) ? ['--forbid-only'] : []),
39
34
  /**
40
35
  * Reporter set to dot in CI environments by default.
41
36
  * See https://github.com/microsoft/playwright/blob/42ade54975f6990c41cddc7b6e11c46a36648d0d/packages/playwright/src/common/config.ts#L301.
42
37
  */
43
- '--reporter', 'list', ...options.patterns] : ['--reporter', 'lcov', '--reporter', 'text', '--cwd', this.cwd, '--all', '--exclude', '**/*.spec.js', '--exclude', 'coverage', '--exclude', 'tmp-*', '--exclude', 'dist', 'mocha', '--reporter', _require.resolve(packageName`mocha-spec-reporter-with-file-names`), '--ui', packageName`mocha-ui-exports-auto-describe`, '--require', packageName`@dword-design/pretest`, ...((await fs.exists(P.join(this.cwd, 'global-test-hooks.js'))) ? ['--require', 'global-test-hooks.js'] : []), '--file', _require.resolve(packageName`@dword-design/setup-test`), ...(runDockerTests ? [] : ['--ignore', '**/*.usesdocker.spec.js']), '--timeout', 130_000, ...(options.patterns.length > 0 ? options.patterns : ['{,!(node_modules)/**/}*.spec.js']), ...(options.grep ? ['--grep', options.grep] : []), ...(process.platform === 'win32' ? ['--exit'] : [])])], {
38
+ '--reporter', 'list', ...options.patterns], {
44
39
  cwd: this.cwd,
45
40
  env: {
46
- NODE_ENV: 'test',
47
- ...(this.packageConfig.type === 'module' && {
48
- NODE_OPTIONS: `--require=${packageName`suppress-experimental-warnings`} --require=${packageName`@dword-design/suppress-babel-register-esm-warning`} --experimental-loader=${packageName`babel-register-esm`}`
49
- }),
50
- ...(this.config.testRunner === 'playwright' ? {
51
- PW_DISABLE_TS_ESM: true
52
- } : options.updateSnapshots ? {
53
- SNAPSHOT_UPDATE: 1
54
- } : {})
41
+ NODE_ENV: 'test'
55
42
  },
56
43
  ...(options.log && {
57
44
  stdout: 'inherit'
@@ -1,5 +1,2 @@
1
- import P from 'node:path';
2
- export default name => filePath => {
3
- var _filePath;
4
- return (_filePath = filePath, P.basename(_filePath)) === 'package.json' && name !== '@dword-design/base-config-node' ? [name] : [];
5
- };
1
+ import pathLib from 'node:path';
2
+ export default name => filePath => pathLib.basename(filePath) === 'package.json' && name !== '@dword-design/base-config-node' ? [name] : [];
@@ -1,4 +1,8 @@
1
1
  import packageName from 'depcheck-package-name';
2
2
  export default {
3
- extends: packageName`@dword-design/babel-config`
3
+ plugins: [[packageName`babel-plugin-module-resolver`, {
4
+ alias: {
5
+ '@/src': './dist'
6
+ }
7
+ }], packageName`babel-plugin-add-import-extension`]
4
8
  };
@@ -1 +1 @@
1
- export default ['babel.config.json', '.commitlintrc.json', '.cz.json', '.devcontainer', '.editorconfig', 'eslint.config.js', '.gitattributes', '.github', '.gitignore', '.gitpod.Dockerfile', '.gitpod.yml', '.husky', '.npmrc', '.nyc_output', '.releaserc.json', '.renovaterc.json', '.vscode', 'CHANGELOG.md', 'coverage', 'LICENSE.md', 'node_modules', 'pnpm-lock.yaml'];
1
+ export default ['babel.config.json', '.commitlintrc.json', '.cz.json', '.devcontainer', '.editorconfig', 'eslint.config.ts', '.gitattributes', '.github', '.gitignore', '.gitpod.Dockerfile', '.gitpod.yml', '.husky', '.npmrc', '.nyc_output', '.releaserc.json', '.renovaterc.json', '.vscode', 'CHANGELOG.md', 'coverage', 'LICENSE.md', 'node_modules', 'pnpm-lock.yaml'];
@@ -1,4 +1,4 @@
1
- import { endent } from '@dword-design/functions';
1
+ import endent from 'endent';
2
2
  export default endent`
3
3
  # Editor configuration, see http://editorconfig.org
4
4
  root = true
@@ -1,6 +1,5 @@
1
- import { identity, sortBy } from '@dword-design/functions';
1
+ import { identity, sortBy } from 'lodash-es';
2
2
  import commonEditorIgnore from "../common-editor-ignore.js";
3
3
  export default function () {
4
- var _ref;
5
- return _ref = [...commonEditorIgnore, ...this.config.editorIgnore], sortBy(identity)(_ref);
4
+ return sortBy([...commonEditorIgnore, ...this.config.editorIgnore], identity);
6
5
  }
@@ -1,18 +1,18 @@
1
- import { endent } from '@dword-design/functions';
2
1
  import packageName from 'depcheck-package-name';
2
+ import endent from 'endent';
3
3
  export default function () {
4
4
  return this.config.eslintConfig || endent`
5
5
  ${this.packageConfig.name === '@dword-design/eslint-config' ? endent`
6
6
  import { defineConfig, globalIgnores } from '${packageName`eslint`}/config';
7
7
 
8
- import config from './src/index.js';
8
+ import config from './src';
9
9
  ` : endent`
10
10
  import config from '${packageName`@dword-design/eslint-config`}';
11
11
  import { defineConfig, globalIgnores } from '${packageName`eslint`}/config';
12
12
  `}
13
13
 
14
14
  export default defineConfig([
15
- globalIgnores(['eslint.config.js']),
15
+ globalIgnores(['eslint.config.ts']),
16
16
  config,
17
17
  ]);\n
18
18
  `;
@@ -1,9 +1,7 @@
1
- import { map } from '@dword-design/functions';
2
1
  import packageName from 'depcheck-package-name';
3
2
  import parsePackagejsonName from 'parse-packagejson-name';
4
3
  const ci = `dw-${parsePackagejsonName(packageName`@dword-design/ci`).fullName}`;
5
4
  export default function () {
6
- var _ref;
7
5
  return [{
8
6
  env: {
9
7
  GITHUB_REPOSITORY: '${{ secrets.GITHUB_REPOSITORY }}',
@@ -11,7 +9,7 @@ export default function () {
11
9
  },
12
10
  name: 'Push changed files',
13
11
  run: `pnpm ${ci} push-changed-files`
14
- }, ...(_ref = [...this.config.preDeploySteps, {
12
+ }, ...[...this.config.preDeploySteps, {
15
13
  env: {
16
14
  GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}',
17
15
  ...(this.config.npmPublish ? {
@@ -21,8 +19,8 @@ export default function () {
21
19
  },
22
20
  name: 'Release',
23
21
  run: 'pnpm semantic-release'
24
- }], map(step => ({
22
+ }].map(step => ({
25
23
  if: "github.ref == 'refs/heads/master'",
26
24
  ...step
27
- }))(_ref))];
25
+ }))];
28
26
  }
@@ -1,11 +1,9 @@
1
1
  import pathLib from 'node:path';
2
- import { endent, fromPairs, keys, map } from '@dword-design/functions';
3
2
  import { constantCase } from 'change-case';
4
3
  import { findUpStop, findUpSync } from 'find-up';
5
4
  import fs from 'fs-extra';
6
5
  import gitHubAction from 'tagged-template-noop';
7
6
  export default function () {
8
- var _ref, _ref2, _ref3, _envVariableNames;
9
7
  const envSchemaPath = findUpSync(path => {
10
8
  if (fs.existsSync(pathLib.join(path, '.env.schema.json'))) {
11
9
  return '.env.schema.json';
@@ -16,13 +14,10 @@ export default function () {
16
14
  }, {
17
15
  cwd: this.cwd
18
16
  });
19
- const envVariableNames = (_ref = (_ref2 = envSchemaPath ? fs.readJsonSync(envSchemaPath) : {}, keys(_ref2)), map(name => {
20
- var _name;
21
- return `TEST_${_name = name, constantCase(_name)}`;
22
- })(_ref));
17
+ const envVariableNames = Object.keys(envSchemaPath ? fs.readJsonSync(envSchemaPath) : {}).map(name => `TEST_${constantCase(name)}`);
23
18
  return [{
24
19
  env: {
25
- ...(_ref3 = (_envVariableNames = envVariableNames, map(name => [name, `\${{ secrets.${name} }}`])(_envVariableNames)), fromPairs(_ref3)),
20
+ ...Object.fromEntries(envVariableNames.map(name => [name, `\${{ secrets.${name} }}`])),
26
21
  GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
27
22
  },
28
23
  run: 'pnpm test'
@@ -32,10 +27,7 @@ export default function () {
32
27
  with: {
33
28
  'if-no-files-found': 'ignore',
34
29
  name: 'Images from tests',
35
- path: endent`
36
- **/__image_snapshots__/__diff_output__
37
- test-results/*/**
38
- `
30
+ path: 'test-results/*/**'
39
31
  }
40
32
  }];
41
33
  }
@@ -1,11 +1,9 @@
1
- import { map } from '@dword-design/functions';
2
1
  import gitHubAction from 'tagged-template-noop';
3
2
  import checkUnknownFilesSteps from "../steps/check-unknown-files.js";
4
3
  import coverageSteps from "../steps/coverage.js";
5
4
  import getReleaseSteps from "../steps/get-release.js";
6
5
  import getTestSteps from "../steps/get-test.js";
7
6
  export default function () {
8
- var _coverageSteps;
9
7
  return {
10
8
  release: {
11
9
  needs: 'test',
@@ -53,10 +51,10 @@ export default function () {
53
51
  run: 'corepack enable'
54
52
  }, {
55
53
  run: 'pnpm install --frozen-lockfile'
56
- }, ...getTestSteps.call(this), ...(_coverageSteps = coverageSteps, map(step => ({
54
+ }, ...getTestSteps.call(this), ...coverageSteps.map(step => ({
57
55
  if: `matrix.os == 'ubuntu-latest' && matrix.node == ${this.config.nodeVersion}`,
58
56
  ...step
59
- }))(_coverageSteps))],
57
+ }))],
60
58
  strategy: {
61
59
  matrix: {
62
60
  include: [...this.config.supportedNodeVersions.map(version => ({
@@ -1,5 +1,4 @@
1
- import { identity, sortBy } from '@dword-design/functions';
1
+ import { identity, sortBy } from 'lodash-es';
2
2
  export default function () {
3
- var _ref;
4
- return _ref = ['.DS_Store', '/.env.json', '/.test.env.json', '/.nyc_output', '/coverage', '/node_modules', ...(this.config.testRunner === 'playwright' ? ['/test-results'] : []), ...this.config.gitignore], sortBy(identity)(_ref);
3
+ return sortBy(['.DS_Store', '/.env.json', '/.test.env.json', '/.nyc_output', '/coverage', '/node_modules', '/test-results', ...this.config.gitignore], identity);
5
4
  }
@@ -1,5 +1,5 @@
1
- import { endent } from '@dword-design/functions';
2
1
  import * as personalData from '@dword-design/personal-data';
2
+ import endent from 'endent';
3
3
  import parsePackagejsonName from 'parse-packagejson-name';
4
4
  export default function () {
5
5
  const packageName = parsePackagejsonName(this.packageConfig.name).fullName;