mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +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
|
||||
.idea
|
||||
test/unit/coverage
|
||||
.coveralls.yml
|
||||
dist
|
||||
.coveralls.yml
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "vue-select",
|
||||
"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": [
|
||||
"Jeff Sagal <sagalbot@gmail.com>"
|
||||
],
|
||||
|
||||
+2
-36
@@ -6,26 +6,17 @@ var path = require('path')
|
||||
var config = require('../config')
|
||||
var ora = require('ora')
|
||||
var webpack = require('webpack')
|
||||
var ghpages = require('gh-pages')
|
||||
var webpackConfig = require('./webpack.prod.conf')
|
||||
var umdConfig = require('./webpack.umd.conf')
|
||||
|
||||
console.log(
|
||||
' 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...')
|
||||
var spinner = ora('building UMD module...')
|
||||
spinner.start()
|
||||
|
||||
var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
|
||||
rm('-rf', assetsPath)
|
||||
mkdir('-p', assetsPath)
|
||||
cp('-R', 'static/', assetsPath)
|
||||
|
||||
/**
|
||||
* Build the /dist/ folder (demo site)
|
||||
* Build the /dist/ folder
|
||||
*/
|
||||
webpack(webpackConfig, function (err, stats) {
|
||||
spinner.stop()
|
||||
@@ -37,29 +28,4 @@ webpack(webpackConfig, function (err, stats) {
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\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 = {
|
||||
entry: {
|
||||
app: './docs/main.js'
|
||||
app: './src/dev.js'
|
||||
},
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
|
||||
+31
-80
@@ -1,81 +1,32 @@
|
||||
var path = require('path')
|
||||
var config = require('../config')
|
||||
var utils = require('./utils')
|
||||
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
|
||||
const webpack = require('webpack')
|
||||
const base = require('./webpack.base.conf')
|
||||
const config = require('../config')
|
||||
|
||||
module.exports = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
loaders: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, extract: true })
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? '#source-map' : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
vue: {
|
||||
loaders: utils.cssLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true
|
||||
})
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin({
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
}),
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
// extract css into its own file
|
||||
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']
|
||||
})
|
||||
]
|
||||
})
|
||||
base.entry = {
|
||||
lib: './src/index.js'
|
||||
}
|
||||
|
||||
base.output = {
|
||||
path: config.build.assetsRoot,
|
||||
publicPath: config.build.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,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 = {
|
||||
build: {
|
||||
env: require('./prod.env'),
|
||||
index: path.resolve(__dirname, '../dist/index.html'),
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: '',
|
||||
assetsPublicPath: ( process.argv.indexOf('publish') > 1 ) ? '//sagalbot.github.io/vue-select/' : '/',
|
||||
assetsPublicPath: '/',
|
||||
productionSourceMap: true
|
||||
},
|
||||
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",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.2",
|
||||
"description": "A Vue.js project",
|
||||
"author": "Jeff Sagal <sagalbot@gmail.com>",
|
||||
"private": false,
|
||||
"main": "src/components/Select.vue",
|
||||
"main": "dist/vue-select.js",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"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 scroll from './mixins/pointerScroll.js'
|
||||
import pointer from './mixins/typeAheadPointer.js'
|
||||
import mixins from './mixins/index'
|
||||
|
||||
module.exports = {
|
||||
component: VueSelect,
|
||||
mixins: {
|
||||
scroll, pointer
|
||||
}
|
||||
}
|
||||
export default VueSelect
|
||||
export { VueSelect, mixins }
|
||||
|
||||
@@ -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