This repository has been archived by the owner on Apr 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
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
SamuelWitke
authored and
SamuelWitke
committed
Apr 22, 2018
0 parents
commit 647dd4b
Showing
151 changed files
with
13,940 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,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) |
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 @@ | ||
*.log | ||
**/*.log | ||
.DS_Store | ||
**/.DS_Store | ||
**/dist | ||
**/node_modules | ||
coverage | ||
.env | ||
./src/.config.js | ||
.redis-labs.js |
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,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. |
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,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 |
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,2 @@ | ||
runtime: nodejs | ||
env: flex |
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,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() |
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,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) |
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,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))) | ||
}) |
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,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() |
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 @@ | ||
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) | ||
}) |
Oops, something went wrong.