Skip to content

Commit ef88c2a

Browse files
committed
refactor: @aptre/react-dropzone fork and esbuild
Signed-off-by: Christian Stewart <christian@aperture.us>
1 parent 4bbb571 commit ef88c2a

File tree

9 files changed

+515
-470
lines changed

9 files changed

+515
-470
lines changed

.github/renovate.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
":semanticPrefixFixDepsChoreOthers",
5+
":ignoreModulesAndTests",
6+
"group:all",
7+
"workarounds:all"
8+
],
9+
"branchConcurrentLimit": 0,
10+
"ignorePaths": [
11+
"hack"
12+
],
13+
"packageRules": [{
14+
"matchManagers": ["gomod"],
15+
"matchDepTypes": ["replace"],
16+
"enabled": false
17+
}]
18+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [ "aperture" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "aperture" ]
9+
schedule:
10+
- cron: '41 13 * * 6'
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
analyze:
17+
name: Analyze
18+
runs-on: ubuntu-latest
19+
permissions:
20+
actions: read
21+
contents: read
22+
security-events: write
23+
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
language: [ 'javascript' ]
28+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
29+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
30+
31+
steps:
32+
- name: Harden Runner
33+
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
34+
with:
35+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
36+
37+
- name: Checkout repository
38+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
49+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
50+
# queries: security-extended,security-and-quality
51+
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60+
61+
# If the Autobuild fails above, remove it and uncomment the following three lines.
62+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63+
64+
# - run: |
65+
# echo "Run, Build Application using script"
66+
# ./location_of_script_within_repo/buildscript.sh
67+
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@b374143c1149a9115d881581d29b8390bbcbb59c # v3.22.11
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
4+
#
5+
# Source repository: https://github.com/actions/dependency-review-action
6+
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
7+
name: 'Dependency Review'
8+
on: [pull_request]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
dependency-review:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Harden Runner
18+
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
19+
with:
20+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
21+
22+
- name: 'Checkout Repository'
23+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
24+
- name: 'Dependency Review'
25+
uses: actions/dependency-review-action@01bc87099ba56df1e897b6874784491ea6309bc4 # v3.1.4

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ "aperture" ]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [ "aperture" ]
9+
10+
# Builds images for target boards.
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
integration:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
node: [18.x, 21.x]
20+
timeout-minutes: 10
21+
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@eb238b55efaa70779f274895e782ed17c84f2895 # v2.6.1
24+
with:
25+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
26+
27+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
28+
- name: Setup Node.JS ${{ matrix.node }}
29+
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
30+
with:
31+
node-version: ${{ matrix.node }}
32+
cache: 'yarn'
33+
- name: Yarn install
34+
run: yarn install
35+
# - name: Depcheck
36+
# run: yarn run deps
37+
- name: Build Javascript
38+
run: yarn run build
39+
# - name: Test Js
40+
# run: yarn run test
41+
# - name: Lint Javascript
42+
# run: yarn run lint

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
The MIT License (MIT)
22

3+
Copyright (c) 2023 Aperture Robotics, LLC.
34
Copyright (c) 2018 Param Aggarwal
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -19,4 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1920
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2021
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2122
SOFTWARE.
22-

README.md

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,21 @@
11
# react-dropzone-esm
22

3-
`react-dropzone-esm` is a fork of [react-dropzone](https://github.com/react-dropzone/react-dropzone).
4-
The purpose of the fork is to provide a version of `react-dropzone` that is compatible with
5-
modern frameworks which use ES modules (Remix v2, newer versions of Next.js, Vite).
6-
7-
The package provides esm and cjs bundles. It is compatible both with modern build tools
8-
like Remix v2 and with older tools like Webpack 4.
3+
`react-dropzone` is a fork of [react-dropzone](https://github.com/react-dropzone/react-dropzone).
94

105
## Installation
116

127
With yarn:
138

149
```bash
15-
yarn add react-dropzone-esm
10+
yarn add @aptre/react-dropzone
1611
```
1712

1813
With npm:
1914

2015
```bash
21-
npm install react-dropzone-esm
16+
npm install @aptre/react-dropzone
2217
```
2318

24-
## Differences from react-dropzone
25-
26-
- ESM and CJS bundles
27-
- Properly configured `package.json` exports
28-
- ESM bundle is shipped with `.mjs` extension
29-
- Unused files are removed from the published package (docs, logos, etc.)
30-
31-
Note that it is not planned to fix any bugs or add new features to this package.
32-
The only purpose of this package is to provide a version of `react-dropzone` that
33-
is compatible with modern frameworks. Source code of `react-dropzone` library is not modified
34-
in any way.
35-
3619
## Documentation
3720

38-
Documentation was removed from the forked package to simplify maintenance. [Please refer to the original package for documentation](https://react-dropzone.js.org/).
21+
[Please refer to the upstream package for documentation](https://react-dropzone.js.org/).

package.json

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
{
2-
"name": "react-dropzone-esm",
2+
"name": "@aptre/react-dropzone",
33
"description": "Simple HTML5 drag-drop zone with React.js",
4-
"version": "15.0.1",
4+
"version": "1.0.0",
55
"types": "./types/react-dropzone.d.ts",
6-
"main": "./dist/cjs/index.js",
76
"module": "./dist/esm/index.mjs",
87
"exports": {
98
".": {
@@ -19,11 +18,9 @@
1918
},
2019
"sideEffects": false,
2120
"scripts": {
22-
"clean": "rm -rf ./dist",
23-
"build": "npm run clean && rollup -c rollup.config.mjs",
24-
"release:patch": "npm run build && npm version patch && yarn publish && git push",
25-
"release:minor": "npm run build && npm version minor && yarn publish && git push",
26-
"release:major": "npm run build && npm version major && yarn publish && git push"
21+
"clean": "rimraf ./dist",
22+
"build": "npm run clean && esbuild --bundle --external:react --external:react-dom --format=esm --target=es2022 --platform=browser --outfile=./dist/index.mjs ./src/index.jsx",
23+
"build:min": "npm run build -- --minify"
2724
},
2825
"keywords": [
2926
"react-component",
@@ -34,13 +31,12 @@
3431
],
3532
"repository": {
3633
"type": "git",
37-
"url": "https://github.com/rtivital/react-dropzone-esm.git"
34+
"url": "git+https://github.com/apertureerobotics/react-dropzone.git"
3835
},
3936
"bugs": {
40-
"url": "https://github.com/rtivital/react-dropzone-esm/issues"
37+
"url": "https://github.com/aperturerobotics/react-dropzone/issues"
4138
},
42-
"homepage": "https://github.com/rtivital/react-dropzone-esm",
43-
"author": "Vitaly Rtishchev <rtivital@gmail.com>",
39+
"homepage": "https://github.com/apertureerobotics/react-dropzone",
4440
"contributors": [
4541
"Andrey Okonetchnikov <andrey@okonet.ru> (http://okonet.ru)",
4642
"Mike Olson <me@mwolson.org>",
@@ -57,19 +53,13 @@
5753
"prop-types": "^15.8.1"
5854
},
5955
"devDependencies": {
60-
"rollup": "^3.29.4",
61-
"rollup-plugin-banner2": "^1.2.2",
62-
"rollup-plugin-esbuild": "^6.0.2",
63-
"rollup-plugin-node-externals": "^6.1.1",
64-
"@rollup/plugin-commonjs": "^25.0.4",
65-
"@rollup/plugin-node-resolve": "^15.2.1",
66-
"@rollup/plugin-replace": "^5.0.2",
6756
"@types/react": "^18.2.24",
6857
"@types/react-dom": "^18.2.8",
69-
"esbuild": "^0.19.4",
58+
"esbuild": "^0.19.11",
7059
"prettier": "^3.0.3",
7160
"react": "^18.2.0",
7261
"react-dom": "^18.2.0",
62+
"rimraf": "^5.0.5",
7363
"typescript": "^5.2.2"
7464
},
7565
"engines": {

rollup.config.mjs

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

0 commit comments

Comments
 (0)