Join the conversation of the Platform Development tribe on Part-up
- Clone this repository
- Ensure meteor & node are installed
- Copy the file
config/development/env.sh.dist
toconfig/development/env.sh
- Run
npm start
(in the root folder of the app) - App running at: http://localhost:3000/
- If you want to contribute to Part-up please read CONTRIBUTING.md
- If you want to do something with an icon, be sure that imagemagick is installed (OS X:
brew install imagemagick
). - If you want developer credentials (for an AWS bucket / Social login etc..) install ansible:
brew install ansible
and decryptconfig/development/env.sh-encrypted
toconfig/development/env.sh
.
We use ESLint and Prettier for code formatting to maintain the same code style across the app.
Here's a vscode Settings.json
example to make them work well together and will format the code on save:
{
"editor.detectIndentation": false,
"editor.formatOnSave": true,
"editor.insertSpaces": true,
"editor.tabSize": 2,
"eslint.autoFixOnSave": true,
"files.eol": "\n",
"files.trimTrailingWhitespace": true,
}
All of our meteor code can be found in the app
directory. In here we are working with local meteor packages inside the packages
directory.
There are three main packages,
- partup-client-base client helpers;
- partup-lib shared between client and server;
- partup-server server code.
if you need to create a new package please check this guide
The front-end consists of blaze templates of which many are a package itself, these start with partup-client-
. Any functionality that is not directly tied to a template and can be seen as helper functionality lives in the partup-client-base
package which is only exposed to the client.
We export all pages as a single package partup-client-pages. A page can contain components with page-specific functionality and make use of multiple widgets. A page, in fact, only represents a composition. Therefore, the scss file should only contain position defenitions of the inside components. Pages are directly bound to routes and should handle any navigation functionality. Pages are also responsible for handling state (e.g. subscriptions) and pass handlers to components that live outside the page package.
A widget only provides functionality to fulfill a single responsibility. They contain all the functionality required and don't depend on logic of on any other part of the application. Widgets may manage their own state in a limited way, where they should recieve as much data as possible from the page they live in. Widgets are stand-alone packages. The scss file should only contain component composition rules.
The whole app is made up of small styled components. These components are not functional by themselves and only provide styling like buttons, inputs, titles, paragraphs and menus. Each component should be defined as a scss class prefixed with “pu-”, for example “pu-button”. Be aware not to define any styling dealing with the position of the component inside its parent or relative to its siblings.
We use SimpleSchema to define our data structure. The schema can be found in the partup-lib
package, this is because the client also uses it for validation. Any rules about the model is defined here.
Collections in meteor are used both server and client side. However, the client should only read from these whilst the server uses these to query mongo. For this, we have created helper methods to be used by the server. Data returned from mongo will be transformed into a model, this model may also have extra functionality. When you need to access a collection from the client you first need to subscribe to it. We do this via publications, these can be found in partup-server
.
When a mutation of data needs to be stored on the server you can call a meteor method. In this we define every mutation allowed for a collection.
We have page routes for navigation in partup-lib
and routes to send data via POST requests in partup-server
.
Please take a look as this epic: https://github.com/part-up/part-up/issues/528 There is a specific chapter written about how to test a meteor application like part-up.com.
Refer to CONTRIBUTING.md for more information about the tests we write.
We have fixture data to test part-up locally in partup-server
.
- the following users are created automatically (all with password "user"):
npm run test:watch
npm run test:e2e
meteor run --test
cd devops
./devops provision <environment> all --tags=app
(provide the SHA hash of the commit to be deployed, make sure it is build by Jenkins upfront)
- Connecting:
mongo "<host>/<database>" -u "<user>" -p "<password>"
- Dumping:
mongodump "<host>" --db "<database>" -u "<user>" -p "<password>" -o \
date +%s`` - Restoring:
mongorestore "<host>" --db "<database>" -u "<user>" -p "<password>"
- Restoring Meteor LoginServiceConfiguration:
mongorestore "<host>" --db "<database>" -u "<user>" -p "<password>" -c "meteor_accounts_loginServiceConfiguration" <bson file from dump>
- Emptying all Collections (run in mongo shell):
db.getCollectionNames().forEach(function(collectionName) { db[collectionName].remove({}); });
- Make user (super)admin:
db.users.update({ '_id': '<insertuseridhere>' }, { $set: { 'roles': ['admin'] } })
- Find faulty / wrongly uploaded pictures:
db.getCollection('cfs.images.filerecord').find({'copies':{$exists:false}})
- Overwrite the language of a specific part-up:
db.getCollection('partups').find({'_id':'<<partupid>>'},{$set: {'language':'nl'}});
- regular mongo dump command
- unpack bson
for f in *.bson; do bsondump "$f" > "$f.json"; done
cat users.bson.json | sed 's/accessToken" : "[^"]*"/accessToken" : ""/g' > users.bson-clean.json
cat users.bson-clean.json | sed 's/hashedToken" : "[^"]*"/hashedToken" : ""/g' > users.bson-clean-2.json
cat users.bson-clean-2.json | sed 's/bcrypt" : "[^"]*"/bcrypt" : ""/g' > users.bson-clean-3.json
cat users.bson-clean-3.json | sed 's/token" : "[^"]*"/token" : ""/g' > users.bson-clean-4.json
Add new keys using the i18n convention to the main locale /part-up/app/i18n/phraseapp.en.i18n.json and commit them to your branch.
After merging the PR for your branch, Ralph Boeije will import the new keys to Phraseapp and add the translations to the other locales.
Copyright (C) 2017 Part-up
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. You can find it at /part-up/LICENSE and the supplement at /part-up/License supplement