This repository has been archived by the owner on Jan 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3f468ba
Showing
28 changed files
with
1,061 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": ["es2015", "stage-2"], | ||
"plugins": ["transform-runtime"], | ||
"comments": false, | ||
"env": { | ||
"test": { | ||
"plugins": ["istanbul"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
node_modules/ | ||
dist/ | ||
npm-debug.log | ||
debug.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
language: node_js | ||
cache: | ||
directories: | ||
- node_modules | ||
notifications: | ||
email: false | ||
node_js: | ||
- '7' | ||
- '6' | ||
- '4' | ||
before_script: | ||
- npm prune | ||
after_success: | ||
- npm run semantic-release | ||
branches: | ||
except: | ||
- /^v\d+\.\d+\.\d+$/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# How to contribute | ||
Thank you for checking out our project! :star2: :sunny: :deciduous_tree: :earth_americas: | ||
|
||
Please visit the [contribution guide](https://github.com/SenseNet/sensenet/blob/master/CONTRIBUTING.md) in our main repository for advices on how to help the community. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Todo App example with SN7, Vue.js and Redux | ||
|
||
[![Build status](https://img.shields.io/travis/SenseNet/sn-vue-redux-todo-app.svg?style=flat)](https://travis-ci.org/SenseNet/sn-vue-redux-todo-app) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b09d599538fa49e9bb1cb92df4042ada)](https://www.codacy.com/app/herflis33/sn-vue-redux-todo-app?utm_source=github.com&utm_medium=referral&utm_content=SenseNet/sn-react-redux-todo-app&utm_campaign=Badge_Grade) | ||
[![License](https://img.shields.io/github/license/SenseNet/sn-vue-redux-todo-app.svg?style=flat)](https://github.com/SenseNet/sn-client-js/LICENSE.txt) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat)](https://github.com/semantic-release/semantic-release) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat)](http://commitizen.github.io/cz-cli/) | ||
|
||
This example is simple todo app built with Vue+Redux upon Sense/Net ECM which has been prepared to demonstrate how to use the new Sense/Net ECM related libraries [sn-client-js](https://github.com/SenseNet/sn-client-js) | ||
and [sn-redux](https://github.com/SenseNet/sn-redux). | ||
|
||
## Quick start | ||
|
||
``` | ||
$ git clone https://github.com/SenseNet/sn-vue-redux-todo-app.git | ||
$ cd sn-vue-redux-todo-app | ||
$ npm install | ||
$ npm run dev | ||
``` | ||
|
||
## Settings | ||
|
||
To use this example you'll need a Sense/Net ECM portal. To connect the app with the portal set your site's url as the app's siteUrl | ||
|
||
``` | ||
import { SetSiteUrl } from 'sn-client-js'; | ||
SetSiteUrl('https://mysite.com'); | ||
``` | ||
|
||
Go to your portal's Portal.setting (/Root/System/Settings/Portal.settings) and check the allowed origins. To get the app working you have to add the app's domain as an allowed origin so that the app can send requests to the | ||
portal and get or set data. | ||
|
||
``` | ||
{ | ||
AllowedOriginDomains: [ "localhost:13505" ] | ||
} | ||
``` | ||
|
||
For further information about CORS in Sense/Net ECM check [this](http://wiki.sensenet.com/Cross-origin_resource_sharing) article. | ||
|
||
The example app uses one of the built-in TaskList Content in the default Sense/Net ECM install (/workspaces/Project/budapestprojectworkspace/Tasks). If you removed this Content and its children tasks earlier | ||
or want to try with another TaskList change the value of the ```rootUrl``` variable in ```AddTodo.vue``` and ```App.vue``` to the chosen list's path. | ||
|
||
The example app demonstrates not only how to fetching data but also Content creation and delete. The app doesn't provide authentication because of it's simplicity so you have to make some permission changes | ||
in your Sense/Net ECM portal to let Visitor users adding and removing tasks from the chosen parent list. | ||
If you are not familiar with Sense/Net's permission system check the following wiki articles: | ||
* [Sense/Net ECM Permission System](http://wiki.sensenet.com/Permission_System) | ||
* [How to set permissions on a content in Sense/Net ECM](http://wiki.sensenet.com/How_to_set_permissions_on_a_content) | ||
|
||
## Related documents | ||
|
||
* [sn-client-js API reference](http://www.sensenet.com/documentation/sn-client-js/index.html) | ||
* [sn-redux API reference](http://www.sensenet.com/documentation/sn-redux/index.html) | ||
* [Redux](https://github.com/reactjs/redux) | ||
* [Getting Started with Redux](https://egghead.io/courses/getting-started-with-redux) | ||
* [Vue.js](https://vuejs.org/) | ||
|
||
## 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Oops, something went wrong.