Permalink
Browse files

angualr-api

  • Loading branch information...
0 parents commit 08803d9130485fd250c9940cfcf03fe99b223825 @Walnuthetao committed Nov 17, 2016
Showing with 12,339 additions and 0 deletions.
  1. +5 −0 .babelrc
  2. +9 −0 .editorconfig
  3. +4 −0 .gitignore
  4. +12 −0 .idea/angular-api.iml
  5. +7 −0 .idea/jsLibraryMappings.xml
  6. +16 −0 .idea/misc.xml
  7. +8 −0 .idea/modules.xml
  8. +692 −0 .idea/workspace.xml
  9. +18 −0 README.md
  10. +36 −0 build/build.js
  11. +45 −0 build/check-versions.js
  12. +9 −0 build/dev-client.js
  13. +72 −0 build/dev-server.js
  14. +61 −0 build/utils.js
  15. +77 −0 build/webpack.base.conf.js
  16. +34 −0 build/webpack.dev.conf.js
  17. +98 −0 build/webpack.prod.conf.js
  18. +6 −0 config/dev.env.js
  19. +32 −0 config/index.js
  20. +3 −0 config/prod.env.js
  21. +24 −0 index.html
  22. +50 −0 package.json
  23. +28 −0 src/App.vue
  24. +587 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap-theme.css
  25. +1 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap-theme.css.map
  26. +5 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap-theme.min.css
  27. +6,800 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap.css
  28. +1 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap.css.map
  29. +5 −0 src/assets/bootstrap-3.3.5-dist/css/bootstrap.min.css
  30. BIN src/assets/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.eot
  31. +288 −0 src/assets/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.svg
  32. BIN src/assets/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.ttf
  33. BIN src/assets/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff
  34. BIN src/assets/bootstrap-3.3.5-dist/fonts/glyphicons-halflings-regular.woff2
  35. +2,363 −0 src/assets/bootstrap-3.3.5-dist/js/bootstrap.js
  36. +7 −0 src/assets/bootstrap-3.3.5-dist/js/bootstrap.min.js
  37. +13 −0 src/assets/bootstrap-3.3.5-dist/js/npm.js
  38. +293 −0 src/assets/css/code.css
  39. +263 −0 src/assets/js/data.js
  40. BIN src/assets/logo.png
  41. +53 −0 src/components/Hello.vue
  42. +119 −0 src/components/bind.vue
  43. +83 −0 src/components/home.vue
  44. +81 −0 src/components/main.vue
  45. +31 −0 src/main.js
  46. 0 static/.gitkeep
  47. BIN static/imgs/lis.jpg
  48. BIN static/imgs/list.jpg
@@ -0,0 +1,5 @@
+{
+ "presets": ["es2015", "stage-2"],
+ "plugins": ["transform-runtime"],
+ "comments": false
+}
@@ -0,0 +1,9 @@
+root = true
+
+[*]
+charset = utf-8
+indent_style = space
+indent_size = 2
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
@@ -0,0 +1,4 @@
+.DS_Store
+node_modules/
+dist/
+npm-debug.log
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+ <component name="NewModuleRootManager">
+ <content url="file://$MODULE_DIR$">
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ </component>
+</module>
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="JavaScriptLibraryMappings">
+ <file url="file://$PROJECT_DIR$" libraries="{angular-api/node_modules}" />
+ <includedPredefinedLibrary name="ECMAScript 6" />
+ </component>
+</project>
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="JavaScriptSettings">
+ <option name="languageLevel" value="ES6" />
+ </component>
+ <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+ <OptionsSetting value="true" id="Add" />
+ <OptionsSetting value="true" id="Remove" />
+ <OptionsSetting value="true" id="Checkout" />
+ <OptionsSetting value="true" id="Update" />
+ <OptionsSetting value="true" id="Status" />
+ <OptionsSetting value="true" id="Edit" />
+ <ConfirmationsSetting value="0" id="Add" />
+ <ConfirmationsSetting value="0" id="Remove" />
+ </component>
+</project>
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/angular-api.iml" filepath="$PROJECT_DIR$/.idea/angular-api.iml" />
+ </modules>
+ </component>
+</project>
Oops, something went wrong.
@@ -0,0 +1,18 @@
+# angular
+
+> angular
+
+## Build Setup
+
+``` bash
+# install dependencies
+npm install
+
+# serve with hot reload at localhost:8080
+npm run dev
+
+# build for production with minification
+npm run build
+```
+
+For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
@@ -0,0 +1,36 @@
+// https://github.com/shelljs/shelljs
+require('./check-versions')()
+require('shelljs/global')
+env.NODE_ENV = 'production'
+
+var path = require('path')
+var config = require('../config')
+var ora = require('ora')
+var webpack = require('webpack')
+var webpackConfig = require('./webpack.prod.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...')
+spinner.start()
+
+var assetsPath = path.join(config.build.assetsRoot, config.build.assetsSubDirectory)
+rm('-rf', assetsPath)
+mkdir('-p', assetsPath)
+cp('-R', 'static/*', assetsPath)
+
+webpack(webpackConfig, 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')
+})
@@ -0,0 +1,45 @@
+var semver = require('semver')
+var chalk = require('chalk')
+var packageConfig = require('../package.json')
+var exec = function (cmd) {
+ return require('child_process')
+ .execSync(cmd).toString().trim()
+}
+
+var versionRequirements = [
+ {
+ name: 'node',
+ currentVersion: semver.clean(process.version),
+ versionRequirement: packageConfig.engines.node
+ },
+ {
+ name: 'npm',
+ currentVersion: exec('npm --version'),
+ versionRequirement: packageConfig.engines.npm
+ }
+]
+
+module.exports = function () {
+ var warnings = []
+ for (var i = 0; i < versionRequirements.length; i++) {
+ var mod = versionRequirements[i]
+ if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
+ warnings.push(mod.name + ': ' +
+ chalk.red(mod.currentVersion) + ' should be ' +
+ chalk.green(mod.versionRequirement)
+ )
+ }
+ }
+
+ if (warnings.length) {
+ console.log('')
+ console.log(chalk.yellow('To use this template, you must update following to modules:'))
+ console.log()
+ for (var i = 0; i < warnings.length; i++) {
+ var warning = warnings[i]
+ console.log(' ' + warning)
+ }
+ console.log()
+ process.exit(1)
+ }
+}
@@ -0,0 +1,9 @@
+/* eslint-disable */
+require('eventsource-polyfill')
+var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
+
+hotClient.subscribe(function (event) {
+ if (event.action === 'reload') {
+ window.location.reload()
+ }
+})
@@ -0,0 +1,72 @@
+require('./check-versions')()
+var config = require('../config')
+if (!process.env.NODE_ENV) process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
+var path = require('path')
+var express = require('express')
+var webpack = require('webpack')
+var opn = require('opn')
+var proxyMiddleware = require('http-proxy-middleware')
+var webpackConfig = require('./webpack.dev.conf')
+
+// default port where dev server listens for incoming traffic
+var port = process.env.PORT || config.dev.port
+// Define HTTP proxies to your custom API backend
+// https://github.com/chimurai/http-proxy-middleware
+var proxyTable = config.dev.proxyTable
+
+var app = express()
+var compiler = webpack(webpackConfig)
+
+var devMiddleware = require('webpack-dev-middleware')(compiler, {
+ publicPath: webpackConfig.output.publicPath,
+ stats: {
+ colors: true,
+ chunks: false
+ }
+})
+
+var hotMiddleware = require('webpack-hot-middleware')(compiler)
+// force page reload when html-webpack-plugin template changes
+compiler.plugin('compilation', function (compilation) {
+ compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
+ hotMiddleware.publish({ action: 'reload' })
+ cb()
+ })
+})
+
+// proxy api requests
+Object.keys(proxyTable).forEach(function (context) {
+ var options = proxyTable[context]
+ if (typeof options === 'string') {
+ options = { target: options }
+ }
+ app.use(proxyMiddleware(context, options))
+})
+
+// handle fallback for HTML5 history API
+app.use(require('connect-history-api-fallback')())
+
+// serve webpack bundle output
+app.use(devMiddleware)
+
+// enable hot-reload and state-preserving
+// compilation error display
+app.use(hotMiddleware)
+
+// serve pure static assets
+var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
+app.use(staticPath, express.static('./static'))
+
+module.exports = app.listen(port, function (err) {
+ if (err) {
+ console.log(err)
+ return
+ }
+ var uri = 'http://localhost:' + port
+ console.log('Listening at ' + uri + '\n')
+
+ // when env is testing, don't need open it
+ if (process.env.NODE_ENV !== 'testing') {
+ opn(uri)
+ }
+})
@@ -0,0 +1,61 @@
+var path = require('path')
+var config = require('../config')
+var ExtractTextPlugin = require('extract-text-webpack-plugin')
+
+exports.assetsPath = function (_path) {
+ var assetsSubDirectory = process.env.NODE_ENV === 'production'
+ ? config.build.assetsSubDirectory
+ : config.dev.assetsSubDirectory
+ return path.posix.join(assetsSubDirectory, _path)
+}
+
+exports.cssLoaders = function (options) {
+ options = options || {}
+ // generate loader string to be used with extract text plugin
+ function generateLoaders (loaders) {
+ var sourceLoader = loaders.map(function (loader) {
+ var extraParamChar
+ if (/\?/.test(loader)) {
+ loader = loader.replace(/\?/, '-loader?')
+ extraParamChar = '&'
+ } else {
+ loader = loader + '-loader'
+ extraParamChar = '?'
+ }
+ return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '')
+ }).join('!')
+
+ // Extract CSS when that option is specified
+ // (which is the case during production build)
+ if (options.extract) {
+ return ExtractTextPlugin.extract('vue-style-loader', sourceLoader)
+ } else {
+ return ['vue-style-loader', sourceLoader].join('!')
+ }
+ }
+
+ // http://vuejs.github.io/vue-loader/en/configurations/extract-css.html
+ return {
+ css: generateLoaders(['css']),
+ postcss: generateLoaders(['css']),
+ less: generateLoaders(['css', 'less']),
+ sass: generateLoaders(['css', 'sass?indentedSyntax']),
+ scss: generateLoaders(['css', 'sass']),
+ stylus: generateLoaders(['css', 'stylus']),
+ styl: generateLoaders(['css', 'stylus'])
+ }
+}
+
+// Generate loaders for standalone style files (outside of .vue)
+exports.styleLoaders = function (options) {
+ var output = []
+ var loaders = exports.cssLoaders(options)
+ for (var extension in loaders) {
+ var loader = loaders[extension]
+ output.push({
+ test: new RegExp('\\.' + extension + '$'),
+ loader: loader
+ })
+ }
+ return output
+}
@@ -0,0 +1,77 @@
+var path = require('path')
+var config = require('../config')
+var utils = require('./utils')
+var projectRoot = path.resolve(__dirname, '../')
+
+var env = process.env.NODE_ENV
+// check env & config/index.js to decide weither to enable CSS Sourcemaps for the
+// various preprocessor loaders added to vue-loader at the end of this file
+var cssSourceMapDev = (env === 'development' && config.dev.cssSourceMap)
+var cssSourceMapProd = (env === 'production' && config.build.productionSourceMap)
+var useCssSourceMap = cssSourceMapDev || cssSourceMapProd
+
+module.exports = {
+ entry: {
+ app: './src/main.js'
+ },
+ output: {
+ path: config.build.assetsRoot,
+ publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath,
+ filename: '[name].js'
+ },
+ resolve: {
+ extensions: ['', '.js', '.vue'],
+ fallback: [path.join(__dirname, '../node_modules')],
+ alias: {
+ 'vue$': 'vue/dist/vue',
+ 'src': path.resolve(__dirname, '../src'),
+ 'assets': path.resolve(__dirname, '../src/assets'),
+ 'components': path.resolve(__dirname, '../src/components')
+ }
+ },
+ resolveLoader: {
+ fallback: [path.join(__dirname, '../node_modules')]
+ },
+ module: {
+ loaders: [
+ {
+ test: /\.vue$/,
+ loader: 'vue'
+ },
+ {
+ test: /\.js$/,
+ loader: 'babel',
+ include: projectRoot,
+ exclude: /node_modules/
+ },
+ {
+ test: /\.json$/,
+ loader: 'json'
+ },
+ {
+ test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
+ loader: 'url',
+ query: {
+ limit: 10000,
+ name: utils.assetsPath('img/[name].[hash:7].[ext]')
+ }
+ },
+ {
+ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
+ loader: 'url',
+ query: {
+ limit: 10000,
+ name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
+ }
+ }
+ ]
+ },
+ vue: {
+ loaders: utils.cssLoaders({ sourceMap: useCssSourceMap }),
+ postcss: [
+ require('autoprefixer')({
+ browsers: ['last 2 versions']
+ })
+ ]
+ }
+}
Oops, something went wrong.

0 comments on commit 08803d9

Please sign in to comment.