Skip to content

Commit 0ec6985

Browse files
committed
Update all deps, ESM & CJS build
1 parent c189c1d commit 0ec6985

File tree

17 files changed

+9211
-17649
lines changed

17 files changed

+9211
-17649
lines changed

.babelrc

Lines changed: 0 additions & 12 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 131 deletions
This file was deleted.

.github/workflows/CI.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ jobs:
1515
strategy:
1616
matrix:
1717
node-version:
18-
- 14
19-
- 16
20-
- 18
2118
- 20
19+
- 22
2220
command:
2321
- lint
2422
- test
@@ -30,6 +28,6 @@ jobs:
3028
with:
3129
node-version: ${{ matrix.node-version }}
3230
- run: |
33-
yarn install
31+
npm install
3432
- run: |
35-
yarn ${{ matrix.command }}
33+
npm ${{ matrix.command }}

.npmignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
src
22
test
3-
webpack.config.babel.js
43
.env
54
.env.sample
6-
.travis.yml
5+
.circleci
6+
.gitignore
7+
esbuild.js
8+
eslint.config.mjs

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: node_js
22
node_js:
3-
- 10
4-
- 14
3+
- 22
54
cache:
65
directories:
76
- node_modules

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ s3Options: {
2929

3030
##### Require `webpack-s3-plugin`
3131
```javascript
32-
var S3Plugin = require('webpack-s3-plugin')
32+
// Supports ESM & CJS
33+
const S3Plugin = require('webpack-s3-plugin')
34+
import S3Plugin from 'webpack-s3-plugin'
3335
```
3436

3537
##### With exclude

esbuild.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import esbuild from 'esbuild'
2+
import {nodeExternalsPlugin} from 'esbuild-node-externals'
3+
import {rm} from 'fs/promises'
4+
5+
try {
6+
// Delete the dist directory before building
7+
await rm('./dist', {recursive: true, force: true})
8+
} catch (error) {
9+
// Ignore errors if directory doesn't exist
10+
if (error.code !== 'ENOENT') {
11+
// eslint-disable-next-line no-console
12+
console.error('Error cleaning up build files:', error)
13+
}
14+
}
15+
16+
const opts = {
17+
entryPoints:['./src/s3_plugin.js'],
18+
bundle: true,
19+
platform: 'node',
20+
target: 'node20',
21+
}
22+
23+
const builds = [
24+
{
25+
outfile: 'dist/s3_plugin.cjs',
26+
format: 'cjs',
27+
plugins: [nodeExternalsPlugin({
28+
// mime module is ESM only so we need to include it for CJS bundle to work
29+
allowList: [/mime.*/]
30+
})],
31+
},
32+
{
33+
outfile: 'dist/s3_plugin.mjs',
34+
format: 'esm',
35+
plugins: [nodeExternalsPlugin()],
36+
}
37+
]
38+
39+
for (const build of builds) {
40+
esbuild.build({
41+
...opts,
42+
...build
43+
}).catch(() => process.exit(1))
44+
}

0 commit comments

Comments
 (0)