react-file-drop
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "react-file-drop", | ||
"author": "https://sarink.net", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "React component for Gmail or Facbook -like drag and drop file uploader. Drag files anywhere onto the window to highlight a 'drop area' of the page", | ||
"main": "dist/FileDrop.bundle.js", | ||
"main": "src/FileDrop/FileDrop", | ||
"scripts": { | ||
"start:dev": "webpack-dev-server", | ||
"build:prod": "NODE_ENV=production webpack -p", | ||
"lint": "tslint --project .", | ||
"build:filedrop": "tsc --project src/FileDrop", | ||
"build:demo": "NODE_ENV=production webpack -p", | ||
"lint": "tslint --project src", | ||
"lint:watch": "SHELL=/bin/bash chokidar webpack.config.* tslint.json tsconfig.json ./**/*.ts ./**/*.tsx -c \"npm run lint\" --initial --verbose", | ||
@@ -55,7 +56,4 @@ "lint:fix": "tslint --project . --fix" | ||
"@types/react-dom": "^16.0.3", | ||
"@types/react-hot-loader": "^3.0.6", | ||
"@types/webpack": "^3.8.1", | ||
"@types/webpack-dev-server": "^2.9.2", | ||
"babel-core": "^6.26.0", | ||
"babel-loader": "^7.1.2", | ||
"chokidar": "^1.7.0", | ||
@@ -65,7 +63,5 @@ "chokidar-cli": "^1.2.0", | ||
"css-loader": "^0.28.7", | ||
"extract-text-webpack-plugin": "^3.0.2", | ||
"html-webpack-plugin": "^3.2.0", | ||
"react": "^16.3.1", | ||
"react-dom": "^16.3.1", | ||
"react-hot-loader": "^4.0.1", | ||
"source-map-loader": "^0.2.3", | ||
@@ -72,0 +68,0 @@ "style-loader": "^0.19.0", |
@@ -7,3 +7,3 @@ # react-file-drop | ||
## Demo/Example | ||
http://sarink.github.io/react-file-drop/dist/demo.html - A very simple demo with example code and sample CSS | ||
http://sarink.github.io/react-file-drop/dist/Demo - A very simple demo with example code and sample CSS | ||
@@ -49,8 +49,4 @@ ## By default, there are no styles! You must include some CSS if you want to see anything! | ||
##### dropEffect - String "copy" || "move" || "link" || "none" (default: "copy") | ||
Learn more about [HTML5 dropEffects](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer#dropEffect.28.29) <br/> | ||
Not available in IE :( | ||
Learn more about [HTML5 dropEffects](https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer#dropEffect.28.29). Not available in IE :( | ||
##### targetAlwaysVisible - Boolean (default: false) | ||
If you'd like the ``file-drop-target`` div to always be visible (otherwise, it's only visible when the user begins dragging over the ``frame``) | ||
##### frame - document || HTMLElement (default: document) | ||
@@ -57,0 +53,0 @@ This is the "scope" or frame that the user must drag some file(s) over to kick things off. |
@@ -7,3 +7,2 @@ /* eslint-disable import/no-commonjs */ | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const ExtractTextPlugin = require('extract-text-webpack-plugin'); | ||
const webpack = require('webpack'); | ||
@@ -14,43 +13,9 @@ | ||
const distDirName = 'dist'; | ||
const distDirName = path.join('dist', 'Demo'); | ||
const demoDirName = path.join('src', 'Demo'); | ||
const sharedPlugins = [ | ||
new webpack.DefinePlugin({ | ||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), | ||
}), | ||
new HtmlWebpackPlugin({ | ||
filename: 'demo.html', | ||
chunks: ['demo'], | ||
template: './demo.html', | ||
inject: true, | ||
}), | ||
new CleanWebpackPlugin(path.resolve(__dirname, distDirName)), | ||
]; | ||
const prodPlugins = [ | ||
...sharedPlugins, | ||
new ExtractTextPlugin('[name]-[hash:6].bundle.css'), | ||
]; | ||
const devPlugins = [ | ||
...sharedPlugins, | ||
new webpack.HotModuleReplacementPlugin(), | ||
new webpack.NamedModulesPlugin(), | ||
]; | ||
const prodEntry = { demo: ['demo.tsx'], FileDrop: ['FileDrop.tsx'] }; | ||
const devEntry = { ...prodEntry }; | ||
const rhlBabelLoader = { | ||
loader: 'babel-loader', | ||
options: { | ||
plugins: ['react-hot-loader/babel'], | ||
}, | ||
}; | ||
const tsLoader = 'ts-loader'; | ||
const cssLoader = 'css-loader'; | ||
const styleLoader = 'style-loader'; | ||
module.exports = { | ||
context: path.resolve(__dirname), | ||
entry: isProd ? prodEntry : devEntry, | ||
entry: { Demo: [path.join(demoDirName, 'Demo.tsx')] }, | ||
@@ -60,3 +25,3 @@ output: { | ||
path: path.resolve(__dirname, distDirName), // Local disk directory to store all your output files (Absolute path) | ||
filename: '[name].bundle.js', | ||
filename: '[name]-[hash:6].bundle.js', | ||
}, | ||
@@ -69,8 +34,8 @@ | ||
exclude: [path.resolve(__dirname, 'node_modules')], | ||
use: isProd ? [tsLoader] : [rhlBabelLoader, tsLoader], | ||
use: 'ts-loader', | ||
}, | ||
{ | ||
test: /\.css$/, | ||
include: [path.resolve(__dirname, '')], | ||
use: isProd ? ExtractTextPlugin.extract({ use: [cssLoader], fallback: styleLoader }) : [styleLoader, cssLoader], | ||
include: [path.resolve(__dirname, demoDirName)], | ||
use: ['style-loader', 'css-loader'], | ||
}, | ||
@@ -88,2 +53,12 @@ ], | ||
plugins: [ | ||
isProd ? new CleanWebpackPlugin(path.resolve(__dirname, distDirName)) : new webpack.HotModuleReplacementPlugin(), | ||
new webpack.NamedModulesPlugin(), | ||
new HtmlWebpackPlugin({ | ||
filename: 'index.html', | ||
template: path.join(demoDirName, 'index.html'), | ||
inject: true, | ||
}), | ||
], | ||
devServer: { | ||
@@ -93,3 +68,3 @@ publicPath: '/', // URL path where the webpack files are served from | ||
host: '0.0.0.0', | ||
port: process.env.PORT, // set in docker-compose.yml | ||
port: process.env.PORT, // Set in docker-compose.yml | ||
disableHostCheck: true, | ||
@@ -105,5 +80,3 @@ hot: true, | ||
}, | ||
plugins: isProd ? prodPlugins : devPlugins, | ||
}; | ||
/* eslint-enable import/no-commonjs */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
157323
21
1125
3
76