@8ms/helpers 2.2.10 → 2.2.13

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.
@@ -31,6 +31,9 @@ jobs:
31
31
  - name: Build
32
32
  run: pnpm build
33
33
 
34
+ - name: Generate exports field
35
+ run: node scripts/generate-exports.js
36
+
34
37
  - name: Publish to npm
35
38
  run: npm publish --access public
36
39
  env:
package/package.json CHANGED
@@ -1,203 +1,349 @@
1
1
  {
2
- "name": "@8ms/helpers",
3
- "license": "UNLICENSED",
4
- "version": "2.2.10",
5
- "repository": {
2
+ "name": "@8ms/helpers",
3
+ "license": "UNLICENSED",
4
+ "version": "2.2.13",
5
+ "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
7
+ "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
8
8
  },
9
- "main": "index.js",
10
- "types": "index.d.ts",
11
- "exports": {
12
- ".": {
13
- "types": "./index.d.ts",
14
- "default": "./index.js"
15
- }
16
- },
17
- "scripts": {
9
+ "main": "index.js",
10
+ "types": "index.d.ts",
11
+ "scripts": {
18
12
  "build": "tsc",
19
- "jest": "jest --watch"
13
+ "jest": "jest --watch"
20
14
  },
21
- "packageManager": "pnpm@9.15.0",
22
- "engines": {
15
+ "packageManager": "pnpm@9.15.0",
16
+ "engines": {
23
17
  "node": "24"
24
18
  },
25
- "dependencies": {
26
- "axios": "^1.13.5",
19
+ "dependencies": {
20
+ "axios": "^1.13.5",
27
21
  "lodash": "^4.17.23",
28
- "luxon": "^3.7.2",
29
- "zod": "^4.3.6"
22
+ "luxon": "^3.7.2",
23
+ "zod": "^4.3.6"
30
24
  },
31
- "peerDependencies": {
32
- "@1password/sdk": "<1.0.0",
33
- "@aws-sdk/client-ec2": "^3.0.0",
34
- "@aws-sdk/client-ecs": "^3.0.0",
35
- "@aws-sdk/client-glue": "^3.0.0",
36
- "@aws-sdk/client-lambda": "^3.0.0",
37
- "@aws-sdk/client-s3": "^3.0.0",
38
- "@aws-sdk/client-ses": "^3.0.0",
39
- "@aws-sdk/client-sqs": "^3.0.0",
40
- "@aws-sdk/client-ssm": "^3.0.0",
41
- "@aws-sdk/lib-storage": "^3.0.0",
25
+ "peerDependencies": {
26
+ "@1password/sdk": "<1.0.0",
27
+ "@aws-sdk/client-ec2": "^3.0.0",
28
+ "@aws-sdk/client-ecs": "^3.0.0",
29
+ "@aws-sdk/client-glue": "^3.0.0",
30
+ "@aws-sdk/client-lambda": "^3.0.0",
31
+ "@aws-sdk/client-s3": "^3.0.0",
32
+ "@aws-sdk/client-ses": "^3.0.0",
33
+ "@aws-sdk/client-sqs": "^3.0.0",
34
+ "@aws-sdk/client-ssm": "^3.0.0",
35
+ "@aws-sdk/lib-storage": "^3.0.0",
42
36
  "@aws-sdk/s3-request-presigner": "^3.0.0",
43
- "@google-cloud/bigquery": "^8.0.0",
44
- "@google-cloud/common": "^6.0.0",
45
- "@google-cloud/storage": "^7.0.0",
46
- "@googleapis/sheets": "^13.0.0",
47
- "@planetscale/database": "^1.0.0",
48
- "@prisma/adapter-mariadb": "^7.0.0",
49
- "@prisma/adapter-pg": "^7.0.0",
50
- "@prisma/adapter-planetscale": "^7.0.0",
51
- "@prisma/client": "^7.0.0",
52
- "crypto-js": "^4.0.0",
53
- "fs-extra": "^11.0.0",
54
- "google-ads-api": "^23.0.0",
55
- "googleapis-common": "^8.0.0",
56
- "next": "^16.0.0",
57
- "react": "^19.0.0",
58
- "react-intersection-observer": "^10.0.0",
59
- "stream-chain": "^3.0.0",
60
- "stream-json": "^1.0.0",
61
- "swr": "^2.0.0"
37
+ "@google-cloud/bigquery": "^8.0.0",
38
+ "@google-cloud/common": "^6.0.0",
39
+ "@google-cloud/storage": "^7.0.0",
40
+ "@googleapis/sheets": "^13.0.0",
41
+ "@planetscale/database": "^1.0.0",
42
+ "@prisma/adapter-mariadb": "^7.0.0",
43
+ "@prisma/adapter-pg": "^7.0.0",
44
+ "@prisma/adapter-planetscale": "^7.0.0",
45
+ "@prisma/client": "^7.0.0",
46
+ "crypto-js": "^4.0.0",
47
+ "fs-extra": "^11.0.0",
48
+ "google-ads-api": "^23.0.0",
49
+ "googleapis-common": "^8.0.0",
50
+ "next": "^16.0.0",
51
+ "react": "^19.0.0",
52
+ "react-intersection-observer": "^10.0.0",
53
+ "stream-chain": "^3.0.0",
54
+ "stream-json": "^1.0.0",
55
+ "swr": "^2.0.0"
62
56
  },
63
57
  "peerDependenciesMeta": {
64
- "@1password/sdk": {
58
+ "@1password/sdk": {
65
59
  "optional": true
66
60
  },
67
- "@aws-sdk/client-ec2": {
61
+ "@aws-sdk/client-ec2": {
68
62
  "optional": true
69
63
  },
70
- "@aws-sdk/client-ecs": {
64
+ "@aws-sdk/client-ecs": {
71
65
  "optional": true
72
66
  },
73
- "@aws-sdk/client-glue": {
67
+ "@aws-sdk/client-glue": {
74
68
  "optional": true
75
69
  },
76
- "@aws-sdk/client-lambda": {
70
+ "@aws-sdk/client-lambda": {
77
71
  "optional": true
78
72
  },
79
- "@aws-sdk/client-s3": {
73
+ "@aws-sdk/client-s3": {
80
74
  "optional": true
81
75
  },
82
- "@aws-sdk/client-ses": {
76
+ "@aws-sdk/client-ses": {
83
77
  "optional": true
84
78
  },
85
- "@aws-sdk/client-sqs": {
79
+ "@aws-sdk/client-sqs": {
86
80
  "optional": true
87
81
  },
88
- "@aws-sdk/client-ssm": {
82
+ "@aws-sdk/client-ssm": {
89
83
  "optional": true
90
84
  },
91
- "@aws-sdk/lib-storage": {
85
+ "@aws-sdk/lib-storage": {
92
86
  "optional": true
93
87
  },
94
88
  "@aws-sdk/s3-request-presigner": {
95
89
  "optional": true
96
90
  },
97
- "@google-cloud/bigquery": {
91
+ "@google-cloud/bigquery": {
98
92
  "optional": true
99
93
  },
100
- "@google-cloud/common": {
94
+ "@google-cloud/common": {
101
95
  "optional": true
102
96
  },
103
- "@google-cloud/storage": {
97
+ "@google-cloud/storage": {
104
98
  "optional": true
105
99
  },
106
- "@googleapis/sheets": {
100
+ "@googleapis/sheets": {
107
101
  "optional": true
108
102
  },
109
- "@planetscale/database": {
103
+ "@planetscale/database": {
110
104
  "optional": true
111
105
  },
112
- "@prisma/adapter-mariadb": {
106
+ "@prisma/adapter-mariadb": {
113
107
  "optional": true
114
108
  },
115
- "@prisma/adapter-pg": {
109
+ "@prisma/adapter-pg": {
116
110
  "optional": true
117
111
  },
118
- "@prisma/adapter-planetscale": {
112
+ "@prisma/adapter-planetscale": {
119
113
  "optional": true
120
114
  },
121
- "@prisma/client": {
115
+ "@prisma/client": {
122
116
  "optional": true
123
117
  },
124
- "crypto-js": {
118
+ "crypto-js": {
125
119
  "optional": true
126
120
  },
127
- "fs-extra": {
121
+ "fs-extra": {
128
122
  "optional": true
129
123
  },
130
- "google-ads-api": {
124
+ "google-ads-api": {
131
125
  "optional": true
132
126
  },
133
- "googleapis-common": {
127
+ "googleapis-common": {
134
128
  "optional": true
135
129
  },
136
- "next": {
130
+ "next": {
137
131
  "optional": true
138
132
  },
139
- "react": {
133
+ "react": {
140
134
  "optional": true
141
135
  },
142
- "stream-chain": {
136
+ "stream-chain": {
143
137
  "optional": true
144
138
  },
145
- "stream-json": {
139
+ "stream-json": {
146
140
  "optional": true
147
141
  },
148
- "swr": {
142
+ "swr": {
149
143
  "optional": true
150
144
  }
151
145
  },
152
- "devDependencies": {
153
- "@1password/sdk": "^0.4.0",
154
- "@aws-sdk/client-ec2": "^3.992.0",
155
- "@aws-sdk/client-ecs": "^3.992.0",
156
- "@aws-sdk/client-glue": "^3.992.0",
157
- "@aws-sdk/client-lambda": "^3.992.0",
158
- "@aws-sdk/client-s3": "^3.992.0",
159
- "@aws-sdk/client-ses": "^3.992.0",
160
- "@aws-sdk/client-sqs": "^3.992.0",
161
- "@aws-sdk/client-ssm": "^3.992.0",
162
- "@aws-sdk/lib-storage": "^3.992.0",
146
+ "devDependencies": {
147
+ "@1password/sdk": "^0.4.0",
148
+ "@aws-sdk/client-ec2": "^3.992.0",
149
+ "@aws-sdk/client-ecs": "^3.992.0",
150
+ "@aws-sdk/client-glue": "^3.992.0",
151
+ "@aws-sdk/client-lambda": "^3.992.0",
152
+ "@aws-sdk/client-s3": "^3.992.0",
153
+ "@aws-sdk/client-ses": "^3.992.0",
154
+ "@aws-sdk/client-sqs": "^3.992.0",
155
+ "@aws-sdk/client-ssm": "^3.992.0",
156
+ "@aws-sdk/lib-storage": "^3.992.0",
163
157
  "@aws-sdk/s3-request-presigner": "^3.992.0",
164
- "@babel/core": "7.29.0",
165
- "@babel/preset-env": "7.29.0",
166
- "@babel/preset-flow": "7.27.1",
167
- "@babel/preset-typescript": "7.28.5",
168
- "@google-cloud/bigquery": "^8.1.1",
169
- "@google-cloud/common": "^6.0.0",
170
- "@google-cloud/storage": "^7.19.0",
171
- "@googleapis/sheets": "^13.0.1",
172
- "@planetscale/database": "^1.19.0",
173
- "@prisma/adapter-mariadb": "^7.4.0",
174
- "@prisma/adapter-pg": "^7.4.0",
175
- "@prisma/adapter-planetscale": "^7.4.0",
176
- "@prisma/client": "^7.4.0",
177
- "@types/babel__core": "^7.20.5",
178
- "@types/crypto-js": "^4.2.2",
179
- "@types/fs-extra": "11.0.4",
180
- "@types/jest": "30.0.0",
181
- "@types/lodash": "^4.17.23",
182
- "@types/luxon": "3.7.1",
183
- "@types/node": "^24.10.13",
184
- "@types/react": "^19.2.14",
185
- "babel-jest": "30.2.0",
186
- "crypto-js": "^4.2.0",
187
- "dotenv": "^17.3.1",
188
- "fs-extra": "11.3.3",
189
- "google-ads-api": "^23.0.0",
190
- "googleapis-common": "^8.0.0",
191
- "jest": "30.2.0",
192
- "next": "^16.1.6",
193
- "node-fetch": "3.3.2",
194
- "react": "^19.2.4",
195
- "react-intersection-observer": "^10.0.2",
196
- "stream-chain": "^3.4.0",
197
- "stream-json": "^1.9.1",
198
- "swr": "^2.4.0",
199
- "ts-node": "10.9.2",
200
- "tslib": "2.8.1",
201
- "typescript": "^5.9.3"
158
+ "@babel/core": "7.29.0",
159
+ "@babel/preset-env": "7.29.0",
160
+ "@babel/preset-flow": "7.27.1",
161
+ "@babel/preset-typescript": "7.28.5",
162
+ "@google-cloud/bigquery": "^8.1.1",
163
+ "@google-cloud/common": "^6.0.0",
164
+ "@google-cloud/storage": "^7.19.0",
165
+ "@googleapis/sheets": "^13.0.1",
166
+ "@planetscale/database": "^1.19.0",
167
+ "@prisma/adapter-mariadb": "^7.4.0",
168
+ "@prisma/adapter-pg": "^7.4.0",
169
+ "@prisma/adapter-planetscale": "^7.4.0",
170
+ "@prisma/client": "^7.4.0",
171
+ "@types/babel__core": "^7.20.5",
172
+ "@types/crypto-js": "^4.2.2",
173
+ "@types/fs-extra": "11.0.4",
174
+ "@types/jest": "30.0.0",
175
+ "@types/lodash": "^4.17.23",
176
+ "@types/luxon": "3.7.1",
177
+ "@types/node": "^24.10.13",
178
+ "@types/react": "^19.2.14",
179
+ "babel-jest": "30.2.0",
180
+ "crypto-js": "^4.2.0",
181
+ "dotenv": "^17.3.1",
182
+ "fs-extra": "11.3.3",
183
+ "google-ads-api": "^23.0.0",
184
+ "googleapis-common": "^8.0.0",
185
+ "jest": "30.2.0",
186
+ "next": "^16.1.6",
187
+ "node-fetch": "3.3.2",
188
+ "react": "^19.2.4",
189
+ "react-intersection-observer": "^10.0.2",
190
+ "stream-chain": "^3.4.0",
191
+ "stream-json": "^1.9.1",
192
+ "swr": "^2.4.0",
193
+ "ts-node": "10.9.2",
194
+ "tslib": "2.8.1",
195
+ "typescript": "^5.9.3"
196
+ },
197
+ "exports": {
198
+ ".": {
199
+ "types": "./index.d.ts",
200
+ "import": "./index.js",
201
+ "require": "./index.js",
202
+ "default": "./index.js"
203
+ },
204
+ "./_class": {
205
+ "types": "./_class/index.d.ts",
206
+ "import": "./_class/index.js",
207
+ "require": "./_class/index.js",
208
+ "default": "./_class/index.js"
209
+ },
210
+ "./adverity": {
211
+ "types": "./adverity/index.d.ts",
212
+ "import": "./adverity/index.js",
213
+ "require": "./adverity/index.js",
214
+ "default": "./adverity/index.js"
215
+ },
216
+ "./api": {
217
+ "types": "./api/index.d.ts",
218
+ "import": "./api/index.js",
219
+ "require": "./api/index.js",
220
+ "default": "./api/index.js"
221
+ },
222
+ "./array": {
223
+ "types": "./array/index.d.ts",
224
+ "import": "./array/index.js",
225
+ "require": "./array/index.js",
226
+ "default": "./array/index.js"
227
+ },
228
+ "./atInternet": {
229
+ "types": "./atInternet/index.d.ts",
230
+ "import": "./atInternet/index.js",
231
+ "require": "./atInternet/index.js",
232
+ "default": "./atInternet/index.js"
233
+ },
234
+ "./axios": {
235
+ "types": "./axios/index.d.ts",
236
+ "import": "./axios/index.js",
237
+ "require": "./axios/index.js",
238
+ "default": "./axios/index.js"
239
+ },
240
+ "./boolean": {
241
+ "types": "./boolean/index.d.ts",
242
+ "import": "./boolean/index.js",
243
+ "require": "./boolean/index.js",
244
+ "default": "./boolean/index.js"
245
+ },
246
+ "./crud": {
247
+ "types": "./crud/index.d.ts",
248
+ "import": "./crud/index.js",
249
+ "require": "./crud/index.js",
250
+ "default": "./crud/index.js"
251
+ },
252
+ "./crypto": {
253
+ "types": "./crypto/index.d.ts",
254
+ "import": "./crypto/index.js",
255
+ "require": "./crypto/index.js",
256
+ "default": "./crypto/index.js"
257
+ },
258
+ "./date": {
259
+ "types": "./date/index.d.ts",
260
+ "import": "./date/index.js",
261
+ "require": "./date/index.js",
262
+ "default": "./date/index.js"
263
+ },
264
+ "./environment": {
265
+ "types": "./environment/index.d.ts",
266
+ "import": "./environment/index.js",
267
+ "require": "./environment/index.js",
268
+ "default": "./environment/index.js"
269
+ },
270
+ "./file": {
271
+ "types": "./file/index.d.ts",
272
+ "import": "./file/index.js",
273
+ "require": "./file/index.js",
274
+ "default": "./file/index.js"
275
+ },
276
+ "./geo": {
277
+ "types": "./geo/index.d.ts",
278
+ "import": "./geo/index.js",
279
+ "require": "./geo/index.js",
280
+ "default": "./geo/index.js"
281
+ },
282
+ "./json": {
283
+ "types": "./json/index.d.ts",
284
+ "import": "./json/index.js",
285
+ "require": "./json/index.js",
286
+ "default": "./json/index.js"
287
+ },
288
+ "./nextAuth": {
289
+ "types": "./nextAuth/index.d.ts",
290
+ "import": "./nextAuth/index.js",
291
+ "require": "./nextAuth/index.js",
292
+ "default": "./nextAuth/index.js"
293
+ },
294
+ "./nextJs": {
295
+ "types": "./nextJs/index.d.ts",
296
+ "import": "./nextJs/index.js",
297
+ "require": "./nextJs/index.js",
298
+ "default": "./nextJs/index.js"
299
+ },
300
+ "./number": {
301
+ "types": "./number/index.d.ts",
302
+ "import": "./number/index.js",
303
+ "require": "./number/index.js",
304
+ "default": "./number/index.js"
305
+ },
306
+ "./object": {
307
+ "types": "./object/index.d.ts",
308
+ "import": "./object/index.js",
309
+ "require": "./object/index.js",
310
+ "default": "./object/index.js"
311
+ },
312
+ "./sorting": {
313
+ "types": "./sorting/index.d.ts",
314
+ "import": "./sorting/index.js",
315
+ "require": "./sorting/index.js",
316
+ "default": "./sorting/index.js"
317
+ },
318
+ "./string": {
319
+ "types": "./string/index.d.ts",
320
+ "import": "./string/index.js",
321
+ "require": "./string/index.js",
322
+ "default": "./string/index.js"
323
+ },
324
+ "./swr": {
325
+ "types": "./swr/index.d.ts",
326
+ "import": "./swr/index.js",
327
+ "require": "./swr/index.js",
328
+ "default": "./swr/index.js"
329
+ },
330
+ "./url": {
331
+ "types": "./url/index.d.ts",
332
+ "import": "./url/index.js",
333
+ "require": "./url/index.js",
334
+ "default": "./url/index.js"
335
+ },
336
+ "./util": {
337
+ "types": "./util/index.d.ts",
338
+ "import": "./util/index.js",
339
+ "require": "./util/index.js",
340
+ "default": "./util/index.js"
341
+ },
342
+ "./webWorker": {
343
+ "types": "./webWorker/index.d.ts",
344
+ "import": "./webWorker/index.js",
345
+ "require": "./webWorker/index.js",
346
+ "default": "./webWorker/index.js"
347
+ }
202
348
  }
203
349
  }
@@ -0,0 +1,54 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { fileURLToPath } from 'url';
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ const projectRoot = path.join(__dirname, '..');
9
+ const packageJsonPath = path.join(projectRoot, 'package.json');
10
+
11
+ // Read package.json
12
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
+
14
+ // Find all directories in the project root (excluding specific ones)
15
+ const excludeDirs = ['node_modules', 'scripts', 'jest', 'src', '.git', '.github', '.idea'];
16
+ const entries = fs.readdirSync(projectRoot, {withFileTypes: true});
17
+
18
+ // Build exports object
19
+ const exports = {
20
+ '.': {
21
+ types: './index.d.ts',
22
+ import: './index.js',
23
+ require: './index.js',
24
+ default: './index.js'
25
+ }
26
+ };
27
+
28
+ // Add all directories that have an index.js file
29
+ entries.forEach(entry =>
30
+ {
31
+ if(entry.isDirectory() && !excludeDirs.includes(entry.name) && !entry.name.startsWith('.'))
32
+ {
33
+ const indexJsPath = path.join(projectRoot, entry.name, 'index.js');
34
+ const indexDtsPath = path.join(projectRoot, entry.name, 'index.d.ts');
35
+
36
+ if(fs.existsSync(indexJsPath))
37
+ {
38
+ exports[`./${entry.name}`] = {
39
+ types: `./${entry.name}/index.d.ts`,
40
+ import: `./${entry.name}/index.js`,
41
+ require: `./${entry.name}/index.js`,
42
+ default: `./${entry.name}/index.js`
43
+ };
44
+ }
45
+ }
46
+ });
47
+
48
+ // Update package.json with new exports
49
+ packageJson.exports = exports;
50
+
51
+ // Write back to package.json
52
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, '\t') + '\n', 'utf8');
53
+
54
+ console.log(`Generated exports for ${Object.keys(exports).length} entries`);