relion 0.1.1 → 0.2.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 (37) hide show
  1. package/package.json +84 -73
  2. package/src/cli.js +6 -0
  3. package/src/commands.js +16 -30
  4. package/src/defaults.js +6 -14
  5. package/src/index.js +48 -125
  6. package/src/lib/checkpoint.js +10 -10
  7. package/src/lib/configuration.js +21 -21
  8. package/src/lib/detect-package-manager.js +21 -18
  9. package/src/lib/format-commit-message.js +2 -2
  10. package/src/lib/latest-semver-tag.js +17 -17
  11. package/src/lib/lifecycles/bump.js +99 -91
  12. package/src/lib/lifecycles/changelog.js +47 -46
  13. package/src/lib/lifecycles/commit.js +34 -34
  14. package/src/lib/lifecycles/tag.js +32 -30
  15. package/src/lib/print-error.js +4 -4
  16. package/src/lib/run-exec.js +13 -12
  17. package/src/lib/run-execFile.js +13 -12
  18. package/src/lib/run-lifecycle-script.js +11 -11
  19. package/src/lib/stringify-package.js +9 -9
  20. package/src/lib/updaters/index.js +57 -54
  21. package/src/lib/updaters/types/csproj.js +6 -6
  22. package/src/lib/updaters/types/gradle.js +7 -7
  23. package/src/lib/updaters/types/json.js +12 -12
  24. package/src/lib/updaters/types/maven.js +22 -22
  25. package/src/lib/updaters/types/openapi.js +8 -8
  26. package/src/lib/updaters/types/plain-text.js +3 -3
  27. package/src/lib/updaters/types/python.js +19 -19
  28. package/src/lib/updaters/types/yaml.js +8 -8
  29. package/src/lib/write-file.js +4 -4
  30. package/src/preset/constants.js +1 -1
  31. package/src/preset/index.js +8 -8
  32. package/src/preset/parser.js +2 -2
  33. package/src/preset/templates/index.js +8 -8
  34. package/src/preset/whatBump.js +14 -13
  35. package/src/preset/writer.js +19 -19
  36. package/CHANGELOG.md +0 -47
  37. package/bin/cli.js +0 -9
package/package.json CHANGED
@@ -1,74 +1,85 @@
1
1
  {
2
- "name": "relion",
3
- "version": "0.1.1",
4
- "description": "Release workflow helper for Node.js projects.",
5
- "author": "Kh4f",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/Kh4f/relion.git"
10
- },
11
- "bugs": {
12
- "url": "https://github.com/Kh4f/relion/issues"
13
- },
14
- "homepage": "https://github.com/Kh4f/relion#readme",
15
- "keywords": [
16
- "relion",
17
- "release",
18
- "release-workflow",
19
- "release-helper",
20
- "semantic-release",
21
- "conventional-changelog",
22
- "standard-version",
23
- "commit-and-tag-version"
24
- ],
25
- "main": "./src/index.js",
26
- "type": "module",
27
- "bin": "bin/cli.js",
28
- "files": [
29
- "bin",
30
- "src",
31
- "package.json",
32
- "LICENSE",
33
- "README.md",
34
- "CHANGELOG.md"
35
- ],
36
- "scripts": {
37
- "lint": "eslint .",
38
- "lint:fix": "npm run lint -- --fix",
39
- "format:base": "prettier \"./**/*.{ts,js}\"",
40
- "format:fix": "npm run format:base -- --write",
41
- "format:check": "npm run format:base -- --check",
42
- "release": "node bin/cli.js --changelog --bump --commit --tag",
43
- "release:gh-notes": "node bin/cli.js --profile gh-release-notes --changelog"
44
- },
45
- "dependencies": {
46
- "chalk": "^5.4.1",
47
- "conventional-changelog": "^6.0.0",
48
- "conventional-changelog-config-spec": "^2.1.0",
49
- "conventional-changelog-conventionalcommits": "^8.0.0",
50
- "conventional-recommended-bump": "^11.0.0",
51
- "detect-indent": "^7.0.1",
52
- "detect-newline": "^4.0.1",
53
- "dotgitignore": "^2.1.0",
54
- "figures": "^6.1.0",
55
- "find-up": "^7.0.0",
56
- "git-semver-tags": "^8.0.0",
57
- "jsdom": "^26.1.0",
58
- "mergician": "^2.0.2",
59
- "semver": "^7.7.2",
60
- "w3c-xmlserializer": "^5.0.0",
61
- "yaml": "^2.8.0",
62
- "yargs": "^17.7.2"
63
- },
64
- "devDependencies": {
65
- "@eslint/js": "^9.27.0",
66
- "eslint": "^9.27.0",
67
- "eslint-config-prettier": "^10.1.5",
68
- "eslint-plugin-import": "^2.31.0",
69
- "eslint-plugin-jest": "^28.11.0",
70
- "eslint-plugin-n": "^17.18.0",
71
- "eslint-plugin-promise": "^7.2.1",
72
- "prettier": "^3.5.3"
73
- }
74
- }
2
+ "name": "relion",
3
+ "version": "0.2.0",
4
+ "description": "Release workflow helper for Node.js projects.",
5
+ "author": "Kh4f",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Kh4f/relion.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/Kh4f/relion/issues"
13
+ },
14
+ "homepage": "https://github.com/Kh4f/relion#readme",
15
+ "keywords": [
16
+ "relion",
17
+ "release",
18
+ "release-workflow",
19
+ "release-helper",
20
+ "semantic-release",
21
+ "conventional-changelog",
22
+ "standard-version",
23
+ "commit-and-tag-version"
24
+ ],
25
+ "main": "./src/index.js",
26
+ "type": "module",
27
+ "bin": "./src/cli.js",
28
+ "files": [
29
+ "src",
30
+ "package.json",
31
+ "LICENSE",
32
+ "README.md"
33
+ ],
34
+ "simple-git-hooks": {
35
+ "pre-commit": "pnpm lint-staged"
36
+ },
37
+ "lint-staged": {
38
+ "*.{js,ts}": "pnpm lint:fix"
39
+ },
40
+ "dependencies": {
41
+ "chalk": "^5.4.1",
42
+ "compare-func": "^2.0.0",
43
+ "conventional-changelog": "^6.0.0",
44
+ "conventional-changelog-config-spec": "^2.1.0",
45
+ "conventional-changelog-conventionalcommits": "^8.0.0",
46
+ "conventional-recommended-bump": "^11.0.0",
47
+ "detect-indent": "^7.0.1",
48
+ "detect-newline": "^4.0.1",
49
+ "dotgitignore": "^2.1.0",
50
+ "figures": "^6.1.0",
51
+ "find-up": "^7.0.0",
52
+ "git-semver-tags": "^8.0.0",
53
+ "jsdom": "^26.1.0",
54
+ "mergician": "^2.0.2",
55
+ "semver": "^7.7.2",
56
+ "w3c-xmlserializer": "^5.0.0",
57
+ "yaml": "^2.8.0",
58
+ "yargs": "^17.7.2"
59
+ },
60
+ "devDependencies": {
61
+ "@eslint/js": "^9.29.0",
62
+ "@stylistic/eslint-plugin": "^4.4.1",
63
+ "@types/node": "^24.0.3",
64
+ "eslint": "^9.29.0",
65
+ "globals": "^16.2.0",
66
+ "lint-staged": "^16.1.2",
67
+ "prettier": "^3.5.3",
68
+ "simple-git-hooks": "^2.13.0",
69
+ "tsdown": "^0.12.8",
70
+ "typescript": "^5.8.3",
71
+ "typescript-eslint": "^8.34.1",
72
+ "vitest": "^3.2.4"
73
+ },
74
+ "scripts": {
75
+ "lint": "eslint",
76
+ "lint:fix": "eslint --fix",
77
+ "test": "vitest run",
78
+ "test:watch": "vitest",
79
+ "build": "tsdown",
80
+ "build:watch": "tsdown --watch",
81
+ "build:prod": "tsdown --production",
82
+ "release": "node ./src/cli.js --changelog --bump --commit --tag",
83
+ "release:gh-notes": "node ./src/cli.js --changelog --profile gh-release-notes "
84
+ }
85
+ }
package/src/cli.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ import relion from './index.js'
4
+ import cmdParser from './commands.js'
5
+
6
+ relion(cmdParser.argv)
package/src/commands.js CHANGED
@@ -1,15 +1,11 @@
1
- import spec from 'conventional-changelog-config-spec';
2
- import { getConfiguration } from './lib/configuration.js';
3
- import defaults from './defaults.js';
4
- import yargs from 'yargs/yargs';
5
- import { hideBin } from 'yargs/helpers';
1
+ import spec from 'conventional-changelog-config-spec'
2
+ import { getConfiguration } from './lib/configuration.js'
3
+ import defaults from './defaults.js'
4
+ import yargs from 'yargs/yargs'
5
+ import { hideBin } from 'yargs/helpers'
6
6
 
7
7
  const yargsInstance = yargs(hideBin(process.argv))
8
8
  .usage('Usage: $0 [options]')
9
- .option('packageFiles', {
10
- default: defaults.packageFiles,
11
- array: true,
12
- })
13
9
  .option('bumpFiles', {
14
10
  default: defaults.bumpFiles,
15
11
  array: true,
@@ -30,12 +26,6 @@ const yargsInstance = yargs(hideBin(process.argv))
30
26
  describe: 'Read the CHANGELOG from this file',
31
27
  default: defaults.infile,
32
28
  })
33
- .option('message', {
34
- alias: ['m'],
35
- describe:
36
- '[DEPRECATED] Commit message, replaces %s with new version.\nThis option will be removed in the next major version, please use --releaseCommitMessageFormat.',
37
- type: 'string',
38
- })
39
29
  .option('sign', {
40
30
  alias: 's',
41
31
  describe: 'Should the git commit and tag be signed?',
@@ -60,7 +50,7 @@ const yargsInstance = yargs(hideBin(process.argv))
60
50
  default: defaults.commitAll,
61
51
  })
62
52
  .option('silent', {
63
- describe: "Don't print logs and errors",
53
+ describe: 'Don\'t print logs and errors',
64
54
  type: 'boolean',
65
55
  default: defaults.silent,
66
56
  })
@@ -145,11 +135,6 @@ const yargsInstance = yargs(hideBin(process.argv))
145
135
  type: 'string',
146
136
  describe: 'Only populate commits made under this path',
147
137
  })
148
- .option('changelogHeader', {
149
- type: 'string',
150
- describe:
151
- '[DEPRECATED] Use a custom header when generating and updating changelog.\nThis option will be removed in the next major version, please use --header.',
152
- })
153
138
  .option('lerna-package', {
154
139
  type: 'string',
155
140
  describe: 'Name of the package from which the tags will be extracted',
@@ -161,9 +146,10 @@ const yargsInstance = yargs(hideBin(process.argv))
161
146
  })
162
147
  .check((argv) => {
163
148
  if (typeof argv.scripts !== 'object' || Array.isArray(argv.scripts)) {
164
- throw Error('scripts must be an object');
165
- } else {
166
- return true;
149
+ throw Error('scripts must be an object')
150
+ }
151
+ else {
152
+ return true
167
153
  }
168
154
  })
169
155
  .alias('version', 'v')
@@ -175,16 +161,16 @@ const yargsInstance = yargs(hideBin(process.argv))
175
161
  )
176
162
  .pkgConf('relion')
177
163
  .config(await getConfiguration())
178
- .wrap(97);
164
+ .wrap(97)
179
165
 
180
166
  Object.keys(spec.properties).forEach((propertyKey) => {
181
- const property = spec.properties[propertyKey];
182
- if (!defaults.preset[propertyKey]) return;
167
+ const property = spec.properties[propertyKey]
168
+ if (!defaults.preset[propertyKey]) return
183
169
  yargsInstance.option('preset.' + propertyKey, {
184
170
  type: property.type,
185
171
  describe: property.description,
186
172
  default: defaults.preset[propertyKey],
187
- });
188
- });
173
+ })
174
+ })
189
175
 
190
- export default yargsInstance;
176
+ export default yargsInstance
package/src/defaults.js CHANGED
@@ -1,4 +1,4 @@
1
- const defaultPresetURL = import.meta.resolve('./preset/index.js');
1
+ const defaultPresetURL = import.meta.resolve('./preset/index.js')
2
2
 
3
3
  const defaults = {
4
4
  bump: false,
@@ -20,7 +20,7 @@ const defaults = {
20
20
  tagForce: false,
21
21
  gitTagFallback: true,
22
22
  npmPublishHint: undefined,
23
- packageFiles: ['package.json', 'bower.json', 'manifest.json'],
23
+ bumpFiles: ['package.json', 'package-lock.json'],
24
24
 
25
25
  context: {
26
26
  linkReferences: true,
@@ -29,8 +29,6 @@ const defaults = {
29
29
 
30
30
  preset: {
31
31
  name: defaultPresetURL,
32
- // defaults provided by the spec
33
- // https://github.com/conventional-changelog/conventional-changelog-config-spec/tree/master/versions/2.2.0
34
32
  header: '# Changelog\n\n\n',
35
33
  types: [
36
34
  { type: 'feat', section: 'Features' },
@@ -42,11 +40,10 @@ const defaults = {
42
40
  { type: 'perf', hidden: true },
43
41
  { type: 'test', hidden: true },
44
42
  ],
45
- /* preMajor value is defined in spec, but should not be in defaults
46
- since it's set to true automatically if version < 1.0.0,
43
+ /* Is set to true automatically if version < 1.0.0,
47
44
  or matches the user config if provided.
48
45
  */
49
- // preMajor: false,
46
+ // preMajor: true,
50
47
  commitUrlFormat: '{{host}}/{{owner}}/{{repository}}/commit/{{hash}}',
51
48
  compareUrlFormat: '{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...{{currentTag}}',
52
49
  issueUrlFormat: '{{host}}/{{owner}}/{{repository}}/issues/{{id}}',
@@ -58,11 +55,6 @@ const defaults = {
58
55
  writerOpts: {
59
56
  commitsSort: false,
60
57
  },
61
- };
58
+ }
62
59
 
63
- defaults.bumpFiles = defaults.packageFiles.concat([
64
- 'package-lock.json',
65
- 'npm-shrinkwrap.json',
66
- ]);
67
-
68
- export default defaults;
60
+ export default defaults
package/src/index.js CHANGED
@@ -1,126 +1,49 @@
1
- import bump, { getNewVersion } from './lib/lifecycles/bump.js';
2
- import changelog from './lib/lifecycles/changelog.js';
3
- import commit from './lib/lifecycles/commit.js';
4
- import fs from 'fs';
5
- import latestSemverTag from './lib/latest-semver-tag.js';
6
- import path from 'path';
7
- import printError from './lib/print-error.js';
8
- import tag from './lib/lifecycles/tag.js';
9
- import { resolveUpdaterObjectFromArgument } from './lib/updaters/index.js';
10
- import defaults from './defaults.js';
11
- import { mergician } from 'mergician';
12
- import { execSync } from 'child_process';
1
+ import bump, { getNewVersion } from './lib/lifecycles/bump.js'
2
+ import changelog from './lib/lifecycles/changelog.js'
3
+ import commit from './lib/lifecycles/commit.js'
4
+ import { readFileSync } from 'fs'
5
+ import tag from './lib/lifecycles/tag.js'
6
+ import defaults from './defaults.js'
7
+ import { mergician } from 'mergician'
8
+ import { execSync } from 'child_process'
13
9
 
14
10
  export default async function relion(argv) {
15
- /**
16
- * `--message` (`-m`) support will be removed in the next major version.
17
- */
18
- const message = argv.m || argv.message;
19
- if (message) {
20
- /**
21
- * The `--message` flag uses `%s` for version substitutions, we swap this
22
- * for the substitution defined in the config-spec for future-proofing upstream
23
- * handling.
24
- */
25
- argv.preset.releaseCommitMessageFormat = message.replace(/%s/g, '{{currentTag}}');
26
- if (!argv.silent) {
27
- console.warn(
28
- '[relion]: --message (-m) will be removed in the next major release. Use --releaseCommitMessageFormat.',
29
- );
30
- }
31
- }
11
+ let args = mergician(defaults, argv)
12
+ if (args.profile) args = mergeProfileConfig(args)
32
13
 
33
- if (argv.changelogHeader) {
34
- argv.preset.header = argv.changelogHeader;
35
- if (!argv.silent) {
36
- console.warn(
37
- '[relion]: --changelogHeader will be removed in the next major release. Use --header.',
38
- );
39
- }
40
- }
14
+ if (args.all) args.bump = args.changelog = args.commit = args.tag = true
41
15
 
42
- if (argv.preset.header && argv.preset.header.search(changelog.START_OF_LAST_RELEASE_PATTERN) !== -1) {
43
- throw Error(`custom changelog header must not match ${changelog.START_OF_LAST_RELEASE_PATTERN}`);
44
- }
16
+ const currentVersion = getCurrentVersion()
17
+ const newVersion = await getNewVersion(args, currentVersion)
18
+ args.context.version = newVersion
19
+ args.context.newTag = args.tagPrefix + newVersion
45
20
 
46
- /**
47
- * If an argument for `packageFiles` provided, we include it as a "default" `bumpFile`.
48
- */
49
- if (argv.packageFiles) {
50
- defaults.bumpFiles = defaults.bumpFiles.concat(argv.packageFiles);
51
- }
21
+ if (lastCommitHasTag()) {
22
+ // use the current version as the new version if there's no new commits
23
+ // to avoid empty new release changelog generation
24
+ args.context.version = currentVersion
52
25
 
53
- let args = mergician(defaults, argv);
54
- if (args.profile) {
55
- args = mergeProfileConfig(args);
56
- }
57
-
58
- let pkg;
59
- for (const packageFile of args.packageFiles) {
60
- const updater = await resolveUpdaterObjectFromArgument(packageFile);
61
- if (!updater) return;
62
- const pkgPath = path.resolve(process.cwd(), updater.filename);
63
- try {
64
- const contents = fs.readFileSync(pkgPath, 'utf8');
65
- pkg = {
66
- version: updater.updater.readVersion(contents),
67
- private:
68
- typeof updater.updater.isPrivate === 'function'
69
- ? updater.updater.isPrivate(contents)
70
- : false,
71
- };
72
- break;
73
- // eslint-disable-next-line no-unused-vars
74
- } catch (err) {
75
- /* This probably shouldn't be empty? */
26
+ if (args.releaseCount === 1) {
27
+ // genearate the last release changelog
28
+ args.releaseCount = 2
76
29
  }
77
30
  }
78
- try {
79
- let version;
80
- if (pkg && pkg.version) {
81
- version = pkg.version;
82
- } else if (args.gitTagFallback) {
83
- version = await latestSemverTag(args);
84
- } else {
85
- throw new Error('no package file found');
86
- }
87
31
 
88
- if (args.all) {
89
- args.bump = true;
90
- args.changelog = true;
91
- args.commit = true;
92
- args.tag = true;
93
- }
94
-
95
- const newVersion = await getNewVersion(args, version);
96
- args.context.version = newVersion;
97
- args.context.newTag = args.tagPrefix + newVersion;
98
-
99
- if (lastCommitHasTag()) {
100
- // use the current version as the new version if there's no new commits
101
- // to avoid empty new release changelog generation
102
- args.context.version = version;
32
+ if (args.bump) await bump(args, newVersion)
33
+ if (args.changelog) await changelog(args, newVersion)
34
+ if (args.commit) await commit(args, newVersion)
35
+ if (args.tag) await tag(newVersion, false, args)
36
+ }
103
37
 
104
- if (args.releaseCount === 1) {
105
- // genearate the last release changelog
106
- args.releaseCount = 2;
107
- }
108
- }
109
-
110
- args.bump && (await bump(args, newVersion));
111
- args.changelog && (await changelog(args, newVersion));
112
- args.commit && (await commit(args, newVersion));
113
- args.tag && (await tag(newVersion, pkg ? pkg.private : false, args));
114
- } catch (err) {
115
- printError(args, err.message);
116
- throw err;
117
- }
38
+ function getCurrentVersion() {
39
+ const packageJsonContent = readFileSync('package.json', 'utf-8')
40
+ return /"version".*?"(.*?)"/.exec(packageJsonContent)?.[1]
118
41
  }
119
42
 
120
43
  function lastCommitHasTag() {
121
- const lastCommit = execSync('git rev-parse HEAD').toString().trim();
122
- const tags = execSync(`git tag --points-at ${lastCommit}`).toString().trim();
123
- return !!tags;
44
+ const lastCommit = execSync('git rev-parse HEAD').toString().trim()
45
+ const tags = execSync(`git tag --points-at ${lastCommit}`).toString().trim()
46
+ return !!tags
124
47
  }
125
48
 
126
49
  /**
@@ -129,24 +52,24 @@ function lastCommitHasTag() {
129
52
  */
130
53
  function mergeProfileConfig(args) {
131
54
  function uniqBy(arr, keyFn) {
132
- const seen = new Set();
133
- return arr.filter(item => {
134
- const key = keyFn(item);
135
- if (seen.has(key)) return false;
136
- seen.add(key);
137
- return true;
138
- });
55
+ const seen = new Set()
56
+ return arr.filter((item) => {
57
+ const key = keyFn(item)
58
+ if (seen.has(key)) return false
59
+ seen.add(key)
60
+ return true
61
+ })
139
62
  }
140
63
 
141
- const profileKey = `_${args.profile}`;
64
+ const profileKey = `_${args.profile}`
142
65
  const merged = mergician({
143
66
  prependArrays: true,
144
- dedupArrays: true
145
- })(args, structuredClone(args[profileKey]));
67
+ dedupArrays: true,
68
+ })(args, structuredClone(args[profileKey]))
146
69
 
147
- const dedupedTypes = uniqBy(merged.preset.types, item => item.type);
148
- merged.preset.types = dedupedTypes;
70
+ const dedupedTypes = uniqBy(merged.preset.types, item => item.type)
71
+ merged.preset.types = dedupedTypes
149
72
 
150
- delete merged[profileKey];
151
- return merged;
152
- }
73
+ delete merged[profileKey]
74
+ return merged
75
+ }
@@ -1,23 +1,23 @@
1
- import chalk from 'chalk';
2
- import figures from 'figures';
3
- import util from 'util';
1
+ import chalk from 'chalk'
2
+ import figures from 'figures'
3
+ import util from 'util'
4
4
 
5
5
  export default function (argv, msg, args, figure) {
6
6
  const defaultFigure = argv.dryRun
7
7
  ? chalk.yellow(figures.tick)
8
- : chalk.green(figures.tick);
8
+ : chalk.green(figures.tick)
9
9
  if (!argv.silent) {
10
10
  console.info(
11
- (figure || defaultFigure) +
12
- ' ' +
13
- util.format.apply(
11
+ (figure || defaultFigure)
12
+ + ' '
13
+ + util.format.apply(
14
14
  util,
15
15
  [msg].concat(
16
16
  args.map(function (arg) {
17
- return chalk.bold(arg);
17
+ return chalk.bold(arg)
18
18
  }),
19
19
  ),
20
20
  ),
21
- );
21
+ )
22
22
  }
23
- }
23
+ }
@@ -1,35 +1,35 @@
1
- import path from 'path';
2
- import { findUpSync } from 'find-up';
3
- import { readFileSync } from 'fs';
4
- import { pathToFileURL } from 'url';
5
-
1
+ import path from 'path'
2
+ import { findUpSync } from 'find-up'
3
+ import { readFileSync } from 'fs'
4
+ import { pathToFileURL } from 'url'
6
5
 
7
6
  const CONFIGURATION_FILES = [
8
7
  '', '.json', '.js', '.cjs', '.mjs', '.ts']
9
- .map(ext => `.versionrc${ext}`);
10
-
8
+ .map(ext => `.versionrc${ext}`)
11
9
 
12
10
  export async function getConfiguration() {
13
- let config = {};
14
- const configPath = findUpSync(CONFIGURATION_FILES);
15
- if (!configPath) return config;
11
+ let config = {}
12
+ const configPath = findUpSync(CONFIGURATION_FILES)
13
+ if (!configPath) return config
16
14
 
17
- const ext = path.extname(configPath);
18
- const regex = /^\.([cm]?js|ts)$/;
15
+ const ext = path.extname(configPath)
16
+ const regex = /^\.([cm]?js|ts)$/
19
17
  if (regex.test(ext)) {
20
- const exportedConfig = (await import(pathToFileURL(configPath).href)).default;
18
+ const exportedConfig = (await import(pathToFileURL(configPath).href)).default
21
19
  if (typeof exportedConfig === 'function') {
22
- config = exportedConfig();
23
- } else {
24
- config = exportedConfig;
20
+ config = exportedConfig()
25
21
  }
26
- } else {
27
- config = JSON.parse(readFileSync(configPath));
22
+ else {
23
+ config = exportedConfig
24
+ }
25
+ }
26
+ else {
27
+ config = JSON.parse(readFileSync(configPath))
28
28
  }
29
29
 
30
30
  if (typeof config !== 'object') {
31
- throw Error(`[relion] Invalid configuration in ${configPath} provided. Expected an object but found ${typeof config}.`,);
31
+ throw Error(`[relion] Invalid configuration in ${configPath} provided. Expected an object but found ${typeof config}.`)
32
32
  }
33
33
 
34
- return config;
35
- }
34
+ return config
35
+ }