Skip to content

Commit

Permalink
Started full client/fe refactor, using vue.js component instead of jQ…
Browse files Browse the repository at this point in the history
…uery/entwine
  • Loading branch information
dkliemsch committed Jun 12, 2019
1 parent b6e06f5 commit d5936fa
Show file tree
Hide file tree
Showing 27 changed files with 25,638 additions and 335 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{less,js,json}]
[*.{less,js,vue,json,yml}]
indent_size = 2

[*.md]
Expand Down
29 changes: 29 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const settings = require('./client/config/webpack.resolve').forEsLint;

module.exports = {
root: true,
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'airbnb-base',
'plugin:vue/strongly-recommended'
],
rules: {
'no-new': 0,
'comma-dangle': 0,
radix: 0,
'no-prototype-builtins': 0,
'no-restricted-globals': 0,
'no-underscore-dangle': 0,
'vue/html-closing-bracket-newline': 0,
'no-param-reassign': 0
},
globals: {
cloudinary: false
},
plugins: [
'vue'
],
settings
};
24 changes: 14 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
[1.1.4] - 2019-06-12
## [Unreleased]
### Changed
- Full client / FE refactor using vue.js component instead of jQuery/entwine

## [1.1.4] - 2019-06-12
### Added
- Possibility to chain multiple transformations
- "CropScale" method, crop to custom coordinates/gravity if available, then scale/crop to the exact dimensions.

[1.1.3] - 2019-06-03
## [1.1.3] - 2019-06-03
### Added
- Option to make Cloudinary meta data less prominent
- `root_folder` config value, allows to use a folder as root for all upload fields

### Changed
- Updated routes config to fix a interference with default admin/graphql route

[1.1.2] - 2019-05-09
## [1.1.2] - 2019-05-09
### Changed
- Proper classes for the actions/buttons

[1.1.1] - 2019-05-08
## [1.1.1] - 2019-05-08
### Added
- Save file size, width and height of the initial upload (after incoming transormation)

### Fixed
- Namespace in the field holder template

[1.1.0] - 2019-04-24
## [1.1.0] - 2019-04-24
### Changed
- Namespace update to Level51\Cloudinary

[1.0.1] - 2019-04-16
## [1.0.1] - 2019-04-16
## Changed
- Ensure that the upload controller route is defined before other admin routes

[1.0.0] - 2019-03-28
## [1.0.0] - 2019-03-28
## Changed
- Refactor for SilverStripe 4 support - see develop-ss3 branch or 0.x.x releases for SS3

[0.2.1] - 2019-03-19
## [0.2.1] - 2019-03-19
## Changed
- Trigger Cloudinary delete/destroy only if a public id is set

[0.2.0] - 2019-02-22
## [0.2.0] - 2019-02-22
## Added
- getCloudinaryUrl service function
- Methods for a few image transformations like pad, limit, scale ...
Expand All @@ -55,7 +59,7 @@
- Use the service function to get the cloudinary url within the CloudinaryImage Link() function (ensures proper credentials setup)
- privateDownloadLink if the "$asDownload" param is set to false

[0.1.0] - 2018-05-09
## [0.1.0] - 2018-05-09
## First public release
- CloudinaryImage: data object holding relevant data and provide the first manipulation methods
- CloudinaryUploadField: image uploader using the upload widget including some options like cropping, aspect ratio, upload folder name
Expand Down
2 changes: 1 addition & 1 deletion _config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Name: cloudinary
---
SilverStripe\Admin\LeftAndMain:
extra_requirements_javascript:
- https://widget.cloudinary.com/global/all.js
- https://widget.cloudinary.com/v2.0/global/all.js
Level51\Cloudinary\Cloudinary:
theme: 'white'
use_signed: true
Expand Down
110 changes: 110 additions & 0 deletions client/config/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
const { DefinePlugin } = require('webpack');
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
const resolve = require('./webpack.resolve').forWebpack;

module.exports = env => ({

entry: {
'level51-cloudinary-upload-field': ['@babel/polyfill/noConflict', 'src/cloudinaryUploadField.js']
},

output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name].js',
publicPath: '' // TODO check
},

mode: 'development',

devtool: 'source-map',

resolve,

module: {
rules: [
{
test: /\.js$/,
exclude: file => (
/node_modules/.test(file)
&& !/\.vue\.js/.test(file)
),
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import'
],
presets: [['@babel/preset-env', { modules: false }, '@babel/preset-stage-3']]
}
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [
{
loader: 'vue-style-loader'
},
{
loader: MiniCSSExtractPlugin.loader
},
{
loader: 'css-loader'
}
]
},
{
test: /\.less$/,
use: [
{
loader: 'vue-style-loader'
},
{
loader: MiniCSSExtractPlugin.loader
},
{
loader: 'css-loader'
},
{
loader: 'less-loader'
}
]
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]'
}
}
]
},

plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(env.NODE_ENV)
}
}),

new VueLoaderPlugin(),

new MiniCSSExtractPlugin({
filename: '[name].css'
})
]
});
116 changes: 116 additions & 0 deletions client/config/webpack.prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
const { DefinePlugin } = require('webpack');
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');

const resolve = require('./webpack.resolve').forWebpack;

module.exports = env => ({

entry: {
'level51-cloudinary-upload-field': ['@babel/polyfill/noConflict', 'src/cloudinaryUploadField.js']
},

output: {
path: path.resolve(__dirname, '../dist'),
filename: '[name].js',
publicPath: '' // TODO check
},

mode: 'production',

resolve,

module: {
rules: [
{
test: /\.js$/,
exclude: file => (
/node_modules/.test(file)
&& !/\.vue\.js/.test(file)
),
use: {
loader: 'babel-loader',
options: {
plugins: [
'@babel/plugin-proposal-object-rest-spread',
'@babel/plugin-syntax-dynamic-import'
],
presets: [['@babel/preset-env', { modules: false }, '@babel/preset-stage-3']]
}
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: [
{
loader: 'vue-style-loader'
},
{
loader: MiniCSSExtractPlugin.loader
},
{
loader: 'css-loader'
}
]
},
{
test: /\.less$/,
use: [
{
loader: 'vue-style-loader'
},
{
loader: MiniCSSExtractPlugin.loader
},
{
loader: 'css-loader'
},
{
loader: 'less-loader'
}
]
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]'
}
}
]
},

plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(env.NODE_ENV)
}
}),

new VueLoaderPlugin(),

new OptimizeCssAssetsPlugin(),
new MiniCSSExtractPlugin({
filename: '[name].css'
}),

new CompressionPlugin({
algorithm: 'gzip'
}),
]
});
21 changes: 21 additions & 0 deletions client/config/webpack.resolve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('path');

const alias = {
vue$: 'vue/dist/vue.common.js',
src: path.resolve(__dirname, '../src/js'),
styles: path.resolve(__dirname, '../src/styles')
};

const extensions = ['.js', '.vue', '.json', '.less'];

module.exports = {
forWebpack: { alias, extensions },
forEsLint: {
'import/resolver': {
alias: {
map: Object.keys(alias).map(key => [key, alias[key]]),
extensions
}
}
}
};
1 change: 0 additions & 1 deletion client/dist/cloudinary-upload-field.css

This file was deleted.

1 change: 0 additions & 1 deletion client/dist/cloudinary-upload-field.js

This file was deleted.

13 changes: 13 additions & 0 deletions client/dist/level51-cloudinary-upload-field.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/dist/level51-cloudinary-upload-field.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d5936fa

Please sign in to comment.