Selaa lähdekoodia

Removed gulp and finalised structure

Jonathan 8 vuotta sitten
vanhempi
sitoutus
165a00a8cd

+ 8 - 0
.gitignore

@@ -3,3 +3,11 @@ Thumbs.db
 *.swp
 *.swp
 .idea/
 .idea/
 .vagrant/
 .vagrant/
+
+# Back End
+backend/node_modules/
+backend/config/default.json
+
+# Front End
+frontend/node_modules/
+frontend/build/

+ 5 - 5
README.md

@@ -13,8 +13,8 @@ Once you've installed the required tools:
 
 
 1. `git clone https://github.com/MusareNode/MusareNode.git`
 1. `git clone https://github.com/MusareNode/MusareNode.git`
 2. `cd MusareNode`
 2. `cd MusareNode`
-3. `cp backend/config/template.json backend/config/default.json` 
- 
+3. `cp backend/config/template.json backend/config/default.json`
+
   > The `secret` key can be whatever. It's used by express's session module. The `apis.youtube.key` value can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started).
   > The `secret` key can be whatever. It's used by express's session module. The `apis.youtube.key` value can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started).
 
 
 4. `vagrant up`
 4. `vagrant up`
@@ -43,7 +43,7 @@ You can view logs at the following locations:
 
 
 ### Development
 ### Development
 
 
-Please refer to `frontend/README.md` and `backend/README.md`.
+`sudo service musare start`
 
 
 ### FAQ
 ### FAQ
 
 
@@ -53,5 +53,5 @@ This will pull down the Ubuntu 14.04 vagrant box and setup a virtualbox machine
 ##### What does `vagrant ssh` and `vagrant mosh` do?
 ##### What does `vagrant ssh` and `vagrant mosh` do?
 Vagrant automagically generates and inserts a openssh keypair for you. This doesn't really have any security (as it doesn't really need to be since it's only for development). This allows you to access your machine in a very convenient way. The second command, `vagrant mosh`, is actually just a vagrant plugin. Mosh is a replacement for SSH, and if you haven't checked it out before, you really should! :)
 Vagrant automagically generates and inserts a openssh keypair for you. This doesn't really have any security (as it doesn't really need to be since it's only for development). This allows you to access your machine in a very convenient way. The second command, `vagrant mosh`, is actually just a vagrant plugin. Mosh is a replacement for SSH, and if you haven't checked it out before, you really should! :)
 
 
-##### Why use Vagrant? I can run NodeJS and RethinkDB locally
-The reason for using vagrant is simple. It gives every developer the same local development server. This removes any inconsistencies across different dev enviroments (Windows vs macOS vs Linux). It also ensures that your changes are running on an enviroment that exactly matches the production server.
+##### Why use Vagrant? I can run NodeJS and mongoDB locally
+The reason for using vagrant is simple. It gives every developer the same local development server. This removes any inconsistencies across different dev enviroments (Windows vs macOS vs Linux). It also ensures that your changes are running on an environment that exactly matches the production server.

+ 0 - 3
backend/.gitignore

@@ -1,3 +0,0 @@
-node_modules/
-config/default.json
-

+ 0 - 9
backend/README.md

@@ -1,9 +0,0 @@
-# Musare Backend
-
-Make sure to `vagrant ssh` into your vagrant machine first, and `cd /musare/backend` before calling any of these commands.
-
-``` bash
-# Start application
-sudo node app.js
-```
-

+ 2 - 0
backend/app.js

@@ -5,6 +5,8 @@ const path = require('path'),
       fs   = require('fs'),
       fs   = require('fs'),
       os   = require('os');
       os   = require('os');
 
 
+process.env.NODE_CONFIG_DIR = process.cwd() + '/backend/config';
+
 // npm modules
 // npm modules
 const express          = require('express'),
 const express          = require('express'),
       session          = require('express-session'),
       session          = require('express-session'),

+ 0 - 22
backend/gulpfile.js

@@ -1,22 +0,0 @@
-'use strict';
-
-const gulp = require('gulp');
-const sass = require('gulp-sass');
-const nodemon = require('gulp-nodemon');
-
-gulp.task('sass', () => {
-	return gulp.src('./src/sass/**/*.scss')
-		.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
-		.pipe(gulp.dest('./public/css'));
-});
-
-gulp.task('start', () => {
-	nodemon({
-		script: 'src/app.js',
-		ext: 'js'
-	});
-});
-
-gulp.task('default', ['start'], () => {
-	gulp.watch('./src/sass/**/*.scss', ['sass']);
-});

+ 0 - 5
backend/package.json

@@ -19,10 +19,5 @@
 		"passport.socketio": "^3.6.2",
 		"passport.socketio": "^3.6.2",
 		"request": "^2.74.0",
 		"request": "^2.74.0",
 		"socket.io": "^1.4.8"
 		"socket.io": "^1.4.8"
-	},
-	"devDependencies": {
-		"gulp": "^3.9.1",
-		"gulp-nodemon": "^2.1.0",
-		"gulp-sass": "^2.3.2"
 	}
 	}
 }
 }

+ 1 - 1
backend/schemas/station.js

@@ -30,5 +30,5 @@ module.exports = function(mongoose) {
 		owner: { type: String }
 		owner: { type: String }
     });
     });
 
 
-    return mongoose.model('station', userSchema);
+    return mongoose.model('station', stationSchema);
 };
 };

+ 7 - 5
bootstrap.sh

@@ -32,7 +32,7 @@ fi
 
 
 # setup a service for mongodb
 # setup a service for mongodb
 if [ -f /etc/init/mongodb.conf ]; then
 if [ -f /etc/init/mongodb.conf ]; then
-	echo "Skipping up mongodb service"
+	echo "Skipping mongodb service"
 else
 else
 	echo "Setting up mongoDB service"
 	echo "Setting up mongoDB service"
 	sudo tee -a /etc/init/mongodb.conf > /dev/null <<EOF
 	sudo tee -a /etc/init/mongodb.conf > /dev/null <<EOF
@@ -56,7 +56,7 @@ fi
 
 
 # setup a service for Musare
 # setup a service for Musare
 if [ -f /etc/init/musare.conf ]; then
 if [ -f /etc/init/musare.conf ]; then
-	echo "Skipping up musare service"
+	echo "Skipping musare service"
 else
 else
 	echo "Setting up musare service"
 	echo "Setting up musare service"
 	sudo tee -a /etc/init/musare.conf > /dev/null <<EOF
 	sudo tee -a /etc/init/musare.conf > /dev/null <<EOF
@@ -73,7 +73,7 @@ script
 	until mountpoint -q /musare; do sleep 1; done
 	until mountpoint -q /musare; do sleep 1; done
 	echo \$\$ > /var/run/musare.pid
 	echo \$\$ > /var/run/musare.pid
 	cd /musare
 	cd /musare
-	exec gulp
+	nodemon -L backend/app.js ; cd frontend && npm run development-watch
 end script
 end script
 
 
 pre-start script
 pre-start script
@@ -97,9 +97,11 @@ cd ../
 
 
 cd frontend
 cd frontend
 rm -rf node_modules/
 rm -rf node_modules/
-npm install
+npm install --no-bin-links
+npm run development-watch
 cd ../
 cd ../
 
 
-sudo npm install -g gulp-cli
+sudo npm install -g nodemon
+sudo npm install -g webpack
 
 
 sudo mkdir -p /data/db
 sudo mkdir -p /data/db

+ 0 - 3
frontend/.gitignore

@@ -1,3 +0,0 @@
-node_modules/
-build/
-

+ 0 - 15
frontend/README.md

@@ -1,15 +0,0 @@
-# Musare Frontend
-
-Make sure to `vagrant ssh` into your vagrant machine first, and `cd /musare/frontend` before calling any of these commands.
-
-``` bash
-# Generate development build
-npm run development
-
-# Generate production build
-npm run production
-
-# Automatically rebuild the project when files change
-npm run development-watch
-```
-

+ 1 - 1
frontend/build/index.html

@@ -6,6 +6,6 @@
 </head>
 </head>
 <body>
 <body>
 	<app></app>
 	<app></app>
-	<script src="build.js"></script>
+	<script src="bundle.js"></script>
 </body>
 </body>
 </html>
 </html>

+ 1 - 2
frontend/components/App.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
 	<div class="app">
 	<div class="app">
-		Hello world! :)
+		Musare ;)
 	</div>
 	</div>
 </template>
 </template>
 
 
@@ -26,4 +26,3 @@
 		background-color: #ff0000;
 		background-color: #ff0000;
 	}
 	}
 </style>
 </style>
-

+ 3 - 3
frontend/main.js

@@ -1,5 +1,6 @@
-import Vue from 'vue'
-import App from './components/App.vue'
+import Vue from 'vue';
+import App from './components/App.vue';
+require('./sass/main.scss');
 
 
 new Vue({
 new Vue({
 	el: 'body',
 	el: 'body',
@@ -7,4 +8,3 @@ new Vue({
 		app: App
 		app: App
 	}
 	}
 });
 });
-

+ 30 - 28
frontend/package.json

@@ -1,30 +1,32 @@
 {
 {
-	"name": "musare-frontend",
-	"version": "0.0.0",
-	"description": "A modern, open-source, collaborative music app https://musare.com",
-	"main": "main.js",
-	"author": "Musare Team",
-	"repository": "https://github.com/Musare/MusareNode",
-	"scripts": {
-		"development": "webpack",
-		"development-watch": "webpack --watch --watch-poll",
-		"production": "webpack -p"
-	},
-	"devDependencies": {
-		"babel-core": "^6.14.0",
-		"babel-loader": "^6.2.5",
-		"babel-plugin-transform-runtime": "^6.15.0",
-		"babel-preset-es2015": "^6.14.0",
-		"babel-runtime": "^6.11.6",
-		"css-loader": "^0.25.0",
-		"vue-hot-reload-api": "^2.0.6",
-		"vue-html-loader": "^1.2.3",
-		"vue-loader": "^8.5.2",
-		"vue-style-loader": "^1.0.0",
-		"webpack": "^1.13.2",
-		"webpack-dev-server": "^1.15.1"
-	},
-	"dependencies": {
-		"vue": "^1.0.26"
-	}
+  "name": "musare-frontend",
+  "version": "0.0.0",
+  "description": "A modern, open-source, collaborative music app https://musare.com",
+  "main": "main.js",
+  "author": "Musare Team",
+  "repository": "https://github.com/Musare/MusareNode",
+  "scripts": {
+    "development": "webpack",
+    "development-watch": "webpack --watch --watch-poll",
+    "production": "webpack -p"
+  },
+  "devDependencies": {
+    "babel-core": "^6.14.0",
+    "babel-loader": "^6.2.5",
+    "babel-plugin-transform-runtime": "^6.15.0",
+    "babel-preset-es2015": "^6.14.0",
+    "babel-runtime": "^6.11.6",
+    "css-loader": "^0.25.0",
+    "node-sass": "^3.9.3",
+    "sass-loader": "^4.0.2",
+    "vue-hot-reload-api": "^2.0.6",
+    "vue-html-loader": "^1.2.3",
+    "vue-loader": "^8.5.2",
+    "vue-style-loader": "^1.0.0",
+    "webpack": "^1.13.2",
+    "webpack-dev-server": "^1.15.1"
+  },
+  "dependencies": {
+    "vue": "^1.0.26"
+  }
 }
 }

+ 3 - 0
frontend/sass/main.scss

@@ -0,0 +1,3 @@
+body {
+	background-color: pink;
+}

+ 8 - 5
frontend/webpack.config.js

@@ -5,20 +5,23 @@ module.exports = {
 	// where to place the compiled bundle
 	// where to place the compiled bundle
 	output: {
 	output: {
 		path: __dirname + '/build/',
 		path: __dirname + '/build/',
-		filename: 'build.js'
+		filename: 'bundle.js'
 	},
 	},
 	module: {
 	module: {
 		// `loaders` is an array of loaders to use.
 		// `loaders` is an array of loaders to use.
-		// here we are only configuring vue-loader
 		loaders: [
 		loaders: [
 			{
 			{
 				test: /\.vue$/, // a regex for matching all files that end in `.vue`
 				test: /\.vue$/, // a regex for matching all files that end in `.vue`
 				loader: 'vue'   // loader to use for matched files,
 				loader: 'vue'   // loader to use for matched files,
 			},
 			},
 			{
 			{
-				test: /\.js$/,
-				loader: 'babel',
-				exclude: /node_modules/
+				test: /\.js$/,          // a regex for matching all files that end in `.js`
+				loader: 'babel',        // loader to use for matched files,
+				exclude: /node_modules/ // excludes the folder `node_modules`
+			},
+			{
+				test: /\.scss$/,                 // a regex for matching all files that end in `.scss`
+				loader: "css-loader!sass-loader" // loader to use for matched files,
 			}
 			}
 		]
 		]
 	},
 	},