@reliverse/helpers 2.2.9 → 2.3.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.
@@ -60,9 +60,7 @@ export async function clearLoggerInternalsInPackages(options) {
60
60
  }
61
61
  const outputDir = pkg.outputDir;
62
62
  if (!existsSync(outputDir)) {
63
- log(
64
- ` \u23ED\uFE0F Skipping ${pkg.name} (dist directory not found: ${outputDir})`
65
- );
63
+ log(` \u23ED\uFE0F Skipping ${pkg.name} (dist directory not found: ${outputDir})`);
66
64
  skippedCount++;
67
65
  continue;
68
66
  }
@@ -96,10 +94,8 @@ export async function clearLoggerInternalsInPackages(options) {
96
94
  }
97
95
  }
98
96
  if (verbose) {
99
- log(
100
- `
101
- Summary: Updated ${updatedCount} file(s), skipped ${skippedCount} package(s)`
102
- );
97
+ log(`
98
+ Summary: Updated ${updatedCount} file(s), skipped ${skippedCount} package(s)`);
103
99
  }
104
100
  return {
105
101
  updated: updatedCount,
@@ -32,19 +32,13 @@ function replaceInPackageJson(filePath, direction) {
32
32
  DEFAULT_PATTERN_TS_TO_JS.lastIndex = 0;
33
33
  if (DEFAULT_PATTERN_TS_TO_JS.test(content)) {
34
34
  DEFAULT_PATTERN_TS_TO_JS.lastIndex = 0;
35
- updated = updated.replace(
36
- DEFAULT_PATTERN_TS_TO_JS,
37
- '"default": "./dist/$1.js"'
38
- );
35
+ updated = updated.replace(DEFAULT_PATTERN_TS_TO_JS, '"default": "./dist/$1.js"');
39
36
  hasChanges = true;
40
37
  }
41
38
  TYPES_PATTERN_TS_TO_JS.lastIndex = 0;
42
39
  if (TYPES_PATTERN_TS_TO_JS.test(content)) {
43
40
  TYPES_PATTERN_TS_TO_JS.lastIndex = 0;
44
- updated = updated.replace(
45
- TYPES_PATTERN_TS_TO_JS,
46
- '"types": "./dist/$1.d.ts"'
47
- );
41
+ updated = updated.replace(TYPES_PATTERN_TS_TO_JS, '"types": "./dist/$1.d.ts"');
48
42
  hasChanges = true;
49
43
  }
50
44
  ROOT_JS_PATTERN_TS_TO_JS.lastIndex = 0;
@@ -73,24 +67,18 @@ function replaceInPackageJson(filePath, direction) {
73
67
  DIST_JS_PATTERN_JS_TO_TS.lastIndex = 0;
74
68
  if (DIST_JS_PATTERN_JS_TO_TS.test(content)) {
75
69
  DIST_JS_PATTERN_JS_TO_TS.lastIndex = 0;
76
- updated = updated.replace(
77
- DIST_JS_PATTERN_JS_TO_TS,
78
- '"default": "./src/$1.ts"'
79
- );
70
+ updated = updated.replace(DIST_JS_PATTERN_JS_TO_TS, '"default": "./src/$1.ts"');
80
71
  hasChanges = true;
81
72
  }
82
73
  DIST_DTS_PATTERN_JS_TO_TS.lastIndex = 0;
83
74
  if (DIST_DTS_PATTERN_JS_TO_TS.test(content)) {
84
75
  DIST_DTS_PATTERN_JS_TO_TS.lastIndex = 0;
85
- updated = updated.replace(
86
- DIST_DTS_PATTERN_JS_TO_TS,
87
- '"types": "./src/$1.ts"'
88
- );
76
+ updated = updated.replace(DIST_DTS_PATTERN_JS_TO_TS, '"types": "./src/$1.ts"');
89
77
  hasChanges = true;
90
78
  }
91
79
  ROOT_JS_PATTERN_JS_TO_TS.lastIndex = 0;
92
80
  updated = updated.replace(ROOT_JS_PATTERN_JS_TO_TS, (match, fileName) => {
93
- if (!fileName.startsWith("src/") && !fileName.startsWith("dist/")) {
81
+ if (!(fileName.startsWith("src/") || fileName.startsWith("dist/"))) {
94
82
  const baseName = fileName.replace(/\.js$/, "");
95
83
  hasChanges = true;
96
84
  return `"default": "./src/${baseName}.ts"`;
@@ -99,7 +87,7 @@ function replaceInPackageJson(filePath, direction) {
99
87
  });
100
88
  ROOT_DTS_PATTERN_JS_TO_TS.lastIndex = 0;
101
89
  updated = updated.replace(ROOT_DTS_PATTERN_JS_TO_TS, (match, fileName) => {
102
- if (!fileName.startsWith("src/") && !fileName.startsWith("dist/")) {
90
+ if (!(fileName.startsWith("src/") || fileName.startsWith("dist/"))) {
103
91
  const baseName = fileName.replace(/\.d\.ts$/, "");
104
92
  hasChanges = true;
105
93
  return `"types": "./src/${baseName}.ts"`;
@@ -114,11 +102,7 @@ function replaceInPackageJson(filePath, direction) {
114
102
  return false;
115
103
  }
116
104
  export async function replaceExportsInPackages(options = {}) {
117
- const {
118
- direction = "ts-to-js",
119
- cwd = process.cwd(),
120
- ignorePackages
121
- } = options;
105
+ const { direction = "ts-to-js", cwd = process.cwd(), ignorePackages } = options;
122
106
  const glob = new Glob("**/package.json");
123
107
  const packageJsonFiles = [];
124
108
  for await (const file of glob.scan({ cwd, onlyFiles: true })) {
@@ -133,7 +117,7 @@ export async function replaceExportsInPackages(options = {}) {
133
117
  try {
134
118
  const content = readFileSync(file, "utf-8");
135
119
  const pkg = JSON.parse(content);
136
- if (!pkg?.name || !shouldIgnorePackage(pkg.name, ignorePackages)) {
120
+ if (!(pkg?.name && shouldIgnorePackage(pkg.name, ignorePackages))) {
137
121
  filteredFiles.push(file);
138
122
  }
139
123
  } catch {
@@ -39,10 +39,7 @@ export function getCurrentWorkingDirectory(useCache = true) {
39
39
  }
40
40
  return currentDirectory;
41
41
  } catch (error) {
42
- console.error(
43
- "Error getting current working directory:",
44
- handleError(error)
45
- );
42
+ console.error("Error getting current working directory:", handleError(error));
46
43
  throw error;
47
44
  }
48
45
  }
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@reliverse/helpers",
3
- "version": "2.2.9",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
- "type": "module",
6
5
  "description": "@reliverse/helpers is a collection of helper functions for the dler monorepo.",
6
+ "license": "MIT",
7
+ "files": [
8
+ "dist",
9
+ "package.json"
10
+ ],
11
+ "type": "module",
7
12
  "exports": {
8
13
  ".": {
9
14
  "types": "./dist/mod.d.ts",
@@ -14,13 +19,8 @@
14
19
  "access": "public"
15
20
  },
16
21
  "dependencies": {
17
- "@reliverse/relifso": "2.2.9",
18
- "@reliverse/matcha": "2.2.8",
19
- "@reliverse/typerso": "2.2.8"
20
- },
21
- "files": [
22
- "dist",
23
- "package.json"
24
- ],
25
- "license": "MIT"
22
+ "@reliverse/matcha": "2.3.0",
23
+ "@reliverse/relifso": "2.3.0",
24
+ "@reliverse/typerso": "2.3.0"
25
+ }
26
26
  }