mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
- create transpiled umd module
- breaking changes for requireJS - /umd/vue-select moved to /dist/vue-select
This commit is contained in:
+1
-2
@@ -3,5 +3,4 @@ node_modules
|
|||||||
npm-debug.log
|
npm-debug.log
|
||||||
.idea
|
.idea
|
||||||
test/unit/coverage
|
test/unit/coverage
|
||||||
.coveralls.yml
|
.coveralls.yml
|
||||||
dist
|
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-select",
|
"name": "vue-select",
|
||||||
"description": "A native Vue.js select component that provides similar functionality to Select2/Chosen without the overhead of jQuery.",
|
"description": "A native Vue.js select component that provides similar functionality to Select2/Chosen without the overhead of jQuery.",
|
||||||
"main": "umd/vue-select.js",
|
"main": "dist/vue-select.js",
|
||||||
"authors": [
|
"authors": [
|
||||||
"Jeff Sagal <sagalbot@gmail.com>"
|
"Jeff Sagal <sagalbot@gmail.com>"
|
||||||
],
|
],
|
||||||
|
|||||||
+2
-36
@@ -6,26 +6,17 @@ var path = require('path')
|
|||||||
var config = require('../config')
|
var config = require('../config')
|
||||||
var ora = require('ora')
|
var ora = require('ora')
|
||||||
var webpack = require('webpack')
|
var webpack = require('webpack')
|
||||||
var ghpages = require('gh-pages')
|
|
||||||
var webpackConfig = require('./webpack.prod.conf')
|
var webpackConfig = require('./webpack.prod.conf')
|
||||||
var umdConfig = require('./webpack.umd.conf')
|
|
||||||
|
|
||||||
console.log(
|
var spinner = ora('building UMD module...')
|
||||||
' Tip:\n' +
|
|
||||||
' Built files are meant to be served over an HTTP server.\n' +
|
|
||||||
' Opening index.html over file:// won\'t work.\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
var spinner = ora('building for production...')
|
|
||||||
spinner.start()
|
spinner.start()
|
||||||
|
|
||||||
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
|
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
|
||||||
rm('-rf', assetsPath)
|
rm('-rf', assetsPath)
|
||||||
mkdir('-p', assetsPath)
|
mkdir('-p', assetsPath)
|
||||||
cp('-R', 'static/', assetsPath)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the /dist/ folder (demo site)
|
* Build the /dist/ folder
|
||||||
*/
|
*/
|
||||||
webpack(webpackConfig, function (err, stats) {
|
webpack(webpackConfig, function (err, stats) {
|
||||||
spinner.stop()
|
spinner.stop()
|
||||||
@@ -37,29 +28,4 @@ webpack(webpackConfig, function (err, stats) {
|
|||||||
chunks: false,
|
chunks: false,
|
||||||
chunkModules: false
|
chunkModules: false
|
||||||
}) + '\n')
|
}) + '\n')
|
||||||
|
|
||||||
// $ npm run build publish
|
|
||||||
// This will publish /dist/ to the gh-pages
|
|
||||||
if (( process.argv.indexOf('publish') > 1 )) {
|
|
||||||
spinner = ora('Publishing to GitHub Pages...').start()
|
|
||||||
ghpages.publish(path.join(__dirname, '../dist'), function (err) {
|
|
||||||
spinner.stop()
|
|
||||||
if (err) throw err
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Build the UMD module @ /umd/vue-select.js.
|
|
||||||
*/
|
|
||||||
webpack(umdConfig, function (err, stats) {
|
|
||||||
spinner.stop()
|
|
||||||
if (err) throw err
|
|
||||||
process.stdout.write(stats.toString({
|
|
||||||
colors: true,
|
|
||||||
modules: false,
|
|
||||||
children: false,
|
|
||||||
chunks: false,
|
|
||||||
chunkModules: false
|
|
||||||
}) + '\n')
|
|
||||||
})
|
})
|
||||||
@@ -5,7 +5,7 @@ var projectRoot = path.resolve(__dirname, '../')
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
app: './docs/main.js'
|
app: './src/dev.js'
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
path: config.build.assetsRoot,
|
path: config.build.assetsRoot,
|
||||||
|
|||||||
+31
-80
@@ -1,81 +1,32 @@
|
|||||||
var path = require('path')
|
const webpack = require('webpack')
|
||||||
var config = require('../config')
|
const base = require('./webpack.base.conf')
|
||||||
var utils = require('./utils')
|
const config = require('../config')
|
||||||
var webpack = require('webpack')
|
|
||||||
var merge = require('webpack-merge')
|
|
||||||
var baseWebpackConfig = require('./webpack.base.conf')
|
|
||||||
var ExtractTextPlugin = require('extract-text-webpack-plugin')
|
|
||||||
var HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
||||||
var env = process.env.NODE_ENV === 'testing'
|
|
||||||
? require('../config/test.env')
|
|
||||||
: config.build.env
|
|
||||||
|
|
||||||
module.exports = merge(baseWebpackConfig, {
|
base.entry = {
|
||||||
module: {
|
lib: './src/index.js'
|
||||||
loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true })
|
}
|
||||||
},
|
|
||||||
devtool: config.build.productionSourceMap ? '#source-map' : false,
|
base.output = {
|
||||||
output: {
|
path: config.build.assetsRoot,
|
||||||
path: config.build.assetsRoot,
|
publicPath: config.build.assetsPublicPath,
|
||||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
filename: 'vue-select.js',
|
||||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
library: 'VueSelect',
|
||||||
},
|
libraryTarget: 'umd'
|
||||||
vue: {
|
}
|
||||||
loaders: utils.cssLoaders({
|
|
||||||
sourceMap: config.build.productionSourceMap,
|
var webpackConfig = Object.assign({}, base)
|
||||||
extract: true
|
|
||||||
})
|
webpackConfig.devtool = '#source-map'
|
||||||
},
|
webpackConfig.plugins = (webpackConfig.plugins || []).concat([
|
||||||
plugins: [
|
new webpack.DefinePlugin({
|
||||||
// http://vuejs.github.io/vue-loader/workflow/production.html
|
'process.env': {
|
||||||
new webpack.DefinePlugin({
|
NODE_ENV: '"production"'
|
||||||
'process.env': env
|
}
|
||||||
}),
|
}),
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: { warnings: false }
|
||||||
warnings: false
|
}),
|
||||||
}
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
}),
|
])
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
// extract css into its own file
|
module.exports = webpackConfig
|
||||||
new ExtractTextPlugin(utils.assetsPath('css/[name].[contenthash].css')),
|
|
||||||
// generate dist index.html with correct asset hash for caching.
|
|
||||||
// you can customize output by editing /index.html
|
|
||||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
filename: process.env.NODE_ENV === 'testing'
|
|
||||||
? 'index.html'
|
|
||||||
: config.build.index,
|
|
||||||
template: 'index.html',
|
|
||||||
inject: true,
|
|
||||||
minify: {
|
|
||||||
removeComments: true,
|
|
||||||
collapseWhitespace: true,
|
|
||||||
removeAttributeQuotes: true
|
|
||||||
// more options:
|
|
||||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
|
||||||
},
|
|
||||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
|
||||||
chunksSortMode: 'dependency'
|
|
||||||
}),
|
|
||||||
// split vendor js into its own file
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'vendor',
|
|
||||||
minChunks: function (module, count) {
|
|
||||||
// any required modules inside node_modules are extracted to vendor
|
|
||||||
return (
|
|
||||||
module.resource &&
|
|
||||||
module.resource.indexOf(
|
|
||||||
path.join(__dirname, '../node_modules')
|
|
||||||
) === 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
// extract webpack runtime and module manifest to its own file in order to
|
|
||||||
// prevent vendor hash from being updated whenever app bundle is updated
|
|
||||||
new webpack.optimize.CommonsChunkPlugin({
|
|
||||||
name: 'manifest',
|
|
||||||
chunks: ['vendor']
|
|
||||||
})
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
const webpack = require('webpack')
|
|
||||||
const base = require('./webpack.base.conf')
|
|
||||||
const config = require('../config')
|
|
||||||
|
|
||||||
base.entry = {
|
|
||||||
lib: './src/index.js'
|
|
||||||
}
|
|
||||||
|
|
||||||
base.output = {
|
|
||||||
path: config.umd.assetsRoot,
|
|
||||||
publicPath: config.umd.assetsPublicPath,
|
|
||||||
filename: 'vue-select.js',
|
|
||||||
library: 'VueSelect',
|
|
||||||
libraryTarget: 'umd'
|
|
||||||
}
|
|
||||||
|
|
||||||
var webpackConfig = Object.assign({}, base)
|
|
||||||
|
|
||||||
webpackConfig.devtool = '#source-map'
|
|
||||||
webpackConfig.plugins = (webpackConfig.plugins || []).concat([
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env': {
|
|
||||||
NODE_ENV: '"production"'
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
|
||||||
compress: { warnings: false }
|
|
||||||
}),
|
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
])
|
|
||||||
|
|
||||||
module.exports = webpackConfig
|
|
||||||
+1
-2
@@ -4,10 +4,9 @@ var path = require('path')
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
build: {
|
build: {
|
||||||
env: require('./prod.env'),
|
env: require('./prod.env'),
|
||||||
index: path.resolve(__dirname, '../dist/index.html'),
|
|
||||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||||
assetsSubDirectory: '',
|
assetsSubDirectory: '',
|
||||||
assetsPublicPath: ( process.argv.indexOf('publish') > 1 ) ? '//sagalbot.github.io/vue-select/' : '/',
|
assetsPublicPath: '/',
|
||||||
productionSourceMap: true
|
productionSourceMap: true
|
||||||
},
|
},
|
||||||
dev: {
|
dev: {
|
||||||
|
|||||||
Vendored
+2
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-select",
|
"name": "vue-select",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"description": "A Vue.js project",
|
"description": "A Vue.js project",
|
||||||
"author": "Jeff Sagal <sagalbot@gmail.com>",
|
"author": "Jeff Sagal <sagalbot@gmail.com>",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "src/components/Select.vue",
|
"main": "dist/vue-select.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node build/dev-server.js",
|
"dev": "node build/dev-server.js",
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import vSelect from '../src/components/Select.vue'
|
||||||
|
|
||||||
|
Vue.component('v-select', vSelect)
|
||||||
|
|
||||||
|
Vue.config.debug = true
|
||||||
|
Vue.config.devtools = true
|
||||||
|
|
||||||
|
/* eslint-disable no-new */
|
||||||
|
new Vue({
|
||||||
|
el: 'body'
|
||||||
|
})
|
||||||
+3
-8
@@ -1,10 +1,5 @@
|
|||||||
import VueSelect from './components/Select.vue'
|
import VueSelect from './components/Select.vue'
|
||||||
import scroll from './mixins/pointerScroll.js'
|
import mixins from './mixins/index'
|
||||||
import pointer from './mixins/typeAheadPointer.js'
|
|
||||||
|
|
||||||
module.exports = {
|
export default VueSelect
|
||||||
component: VueSelect,
|
export { VueSelect, mixins }
|
||||||
mixins: {
|
|
||||||
scroll, pointer
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import ajax from './ajax'
|
||||||
|
import pointer from './typeAheadPointer'
|
||||||
|
import pointerScroll from './pointerScroll'
|
||||||
|
|
||||||
|
export default { ajax, pointer, pointerScroll }
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user