Skip to content
This repository has been archived by the owner on Apr 13, 2020. It is now read-only.

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelWitke authored and SamuelWitke committed Apr 22, 2018
0 parents commit 647dd4b
Show file tree
Hide file tree
Showing 151 changed files with 13,940 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .auth.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
firebase: {
"type": "service_account",
"project_id": "partypeople-b736d",
"private_key_id": process.env.Private_Key_Id,
"private_key": process.env.Private_Key_Id ? process.env.PRIVATEKEY.replace(/\\n/g, '\n') : "",
"client_email": "firebase-adminsdk-3smir@partypeople-b736d.iam.gserviceaccount.com",
"client_id": process.env.client_id,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-3smir%40partypeople-b736d.iam.gserviceaccount.com"
},
firebaseClient: {
apiKey: ""+process.env.apiKey,
authDomain: "partypeople-b736d.firebaseapp.com",
databaseURL: "https://partypeople-b736d.firebaseio.com",
projectId: "partypeople-b736d",
storageBucket: "partypeople-b736d.appspot.com",
}
}
console.log(process.env.apiKey)
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.log
**/*.log
.DS_Store
**/.DS_Store
**/dist
**/node_modules
coverage
.env
./src/.config.js
.redis-labs.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Samuel Witke

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Partify [Demo](https://partifystart.herokuapp.com/#/)

Partify is a free open source Spotify-powered app that lets your guests choose which music should be played using their smartphones to submit and vote on songs.

### How To install and run locally
```
This project requires redis so if you don't have it
sudo apt install redis-server
Get Api keys for Spotify and firebase
yarn install
yarn start:dev || yarn start || yarn run:dev
```

### Steps
```
1. Make an account
2. Host a project name on a device
3. Connect to project name
4. Add songs to queue
5. Vote on songs to play next
6. Repeat steps 4&5
```

#### Possible due to
#### react-redux-firebase https://github.com/prescottprue/react-redux-firebase
#### kue https://github.com/Automattic/kue
#### Spotify API
2 changes: 2 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
runtime: nodejs
env: flex
57 changes: 57 additions & 0 deletions bin/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const webpack = require('webpack')
const debug = require('debug')('app:bin:compile')
const webpackConfig = require('../config/webpack.config')
const project = require('../config/project.config')

// Wrapper around webpack to promisify its compiler and supply friendly logging
const webpackCompiler = webpackConfig =>
new Promise((resolve, reject) => {
const compiler = webpack(webpackConfig)

compiler.run((err, stats) => {
if (err) {
debug('Webpack compiler encountered a fatal error.', err)
return reject(err)
}

const jsonStats = stats.toJson()
debug('Webpack compile completed.')
debug(stats.toString(project.compiler_stats))

if (jsonStats.errors.length > 0) {
debug('Webpack compiler encountered errors.')
debug(jsonStats.errors.join('\n'))
return reject(new Error('Webpack compiler encountered errors'))
} else if (jsonStats.warnings.length > 0) {
debug('Webpack compiler encountered warnings.')
debug(jsonStats.warnings.join('\n'))
} else {
debug('No errors or warnings encountered.')
}
resolve(jsonStats)
})
})

const compile = () => {
debug('Starting compiler.')
return (
Promise.resolve()
.then(() => webpackCompiler(webpackConfig))
// .then(stats => {
// if (stats.warnings.length && project.compiler_fail_on_warning) {
// throw new Error('Config set to fail on warning, exiting with status code "1".')
// }
// debug('Copying static assets to dist folder.')
// fs.copySync(project.paths.public(), project.paths.dist())
// })
.then(() => {
debug('Compilation completed successfully.')
})
.catch(err => {
debug('Compiler encountered an error.', err)
process.exit(1)
})
)
}

compile()
66 changes: 66 additions & 0 deletions build/karma.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
const argv = require('yargs').argv
const webpackConfig = require('./webpack.config')

const TEST_BUNDLER = './tests/test-bundler.js'

webpackConfig.module.rules.push({
enforce: 'post',
test: /\.js$/,
loader: 'istanbul-instrumenter-loader',
query: {
esModules: true
},
exclude: /(tests|node_modules|\.spec\.js$)/
})

const karmaConfig = {
basePath: '../',
browsers: ['PhantomJS'],
singleRun: !argv.watch,
coverageIstanbulReporter: {
reports: argv.watch
? ['text-summary']
: ['html', 'lcovonly', 'text-summary'],
dir: 'coverage',
fixWebpackSourcePaths: true,
skipFilesWithNoCoverage: false
},
files: [
{
pattern: TEST_BUNDLER,
watched: false,
served: true,
included: true
}
],
frameworks: ['mocha'],
reporters: ['mocha', 'coverage-istanbul'],
preprocessors: {
[TEST_BUNDLER]: ['webpack']
},
logLevel: 'WARN',
browserConsoleLogOptions: {
terminal: true,
format: '%b %T: %m',
level: ''
},
webpack: {
entry: TEST_BUNDLER,
devtool: 'cheap-module-source-map',
module: webpackConfig.module,
plugins: webpackConfig.plugins,
resolve: webpackConfig.resolve,
node: webpackConfig.node,
externals: {
'react/addons': 'react',
'react/lib/ExecutionEnvironment': 'react',
'react/lib/ReactContext': 'react'
}
},
webpackMiddleware: {
stats: 'errors-only',
noInfo: true
}
}

module.exports = cfg => cfg.set(karmaConfig)
27 changes: 27 additions & 0 deletions build/lib/logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* eslint-disable no-console */
const chalk = require('chalk')
const figures = require('figures')

// Need to support Node versions that don't support spreading function arguments
const spread = fn =>
function() {
return fn([].slice.call(arguments))
}

exports.log = console.log.bind(console)

exports.error = spread(messages => {
console.error(chalk.red.apply(chalk, [figures.cross].concat(messages)))
})

exports.info = spread(messages => {
console.info(chalk.cyan.apply(chalk, [figures.info].concat(messages)))
})

exports.success = spread(messages => {
console.log(chalk.green.apply(chalk, [figures.tick].concat(messages)))
})

exports.warn = spread(messages => {
console.warn(chalk.yellow.apply(chalk, [figures.warning].concat(messages)))
})
58 changes: 58 additions & 0 deletions build/scripts/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const fs = require('fs-extra')
const path = require('path')
const chalk = require('chalk')
const webpack = require('webpack')
const logger = require('../lib/logger')
const webpackConfig = require('../webpack.config')
const project = require('../../project.config')

const runWebpackCompiler = webpackConfig =>
new Promise((resolve, reject) => {
webpack(webpackConfig).run((err, stats) => {
if (err) {
logger.error('Webpack compiler encountered a fatal error.', err)
return reject(err)
}

const jsonStats = stats.toJson()
if (jsonStats.errors.length > 0) {
logger.error('Webpack compiler encountered errors.')
logger.log(jsonStats.errors.join('\n'))
return reject(new Error('Webpack compiler encountered errors'))
} else if (jsonStats.warnings.length > 0) {
logger.warn('Webpack compiler encountered warnings.')
logger.log(jsonStats.warnings.join('\n'))
}
resolve(stats)
})
})

const compile = () =>
Promise.resolve()
.then(() => logger.info('Starting compiler...'))
.then(() =>
logger.info('Target application environment: ' + chalk.bold(project.env))
)
.then(() => runWebpackCompiler(webpackConfig))
.then(stats => {
logger.info(`Copying static assets from ./public to ./${project.outDir}.`)
fs.copySync(
path.resolve(project.basePath, 'public'),
path.resolve(project.basePath, project.outDir)
)
return stats
})
.then(stats => {
if (project.verbose) {
logger.log(
stats.toString({
colors: true,
chunks: false
})
)
}
logger.success(`Compiler finished successfully! See ./${project.outDir}.`)
})
.catch(err => logger.error('Compiler encountered errors.', err))

compile()
9 changes: 9 additions & 0 deletions build/scripts/start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const logger = require('../lib/logger')
//const ip = require('ip');

logger.info('Starting server...')

const PORT = process.env.PORT || 3000;
require('../../server/main').listen(PORT, () => {
logger.success('Server is running at ',PORT)
})
Loading

0 comments on commit 647dd4b

Please sign in to comment.