Skip to content

Commit

Permalink
Nova 1.0.0 stable on master
Browse files Browse the repository at this point in the history
  • Loading branch information
xavxyz committed Feb 2, 2017
2 parents 9193de0 + cf0f8b8 commit 4baa939
Show file tree
Hide file tree
Showing 193 changed files with 2,238 additions and 2,137 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ bundle.tar.gz
jsdoc-conf.json
jsdoc.json
packages/nova-router/.npm
npm-debug.log
2 changes: 0 additions & 2 deletions .meteor/versions
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Come check-in in the [Telescope Slack channel](http://slack.telescopeapp.org/). 👋

- Completely new features should be shipped as external packages with their own repos (see [3rd party packages](https://github.com/TelescopeJS/Telescope#third-party-plugins)). Don't hesitate to come by the [Slack channel](http://slack.telescopeapp.org/) to speak about it.
- Completely new features should be shipped as external packages with their own repos (see [3rd party packages](http://nova-docs.telescopeapp.org/plugins.html)). Don't hesitate to come by the [Slack channel](http://slack.telescopeapp.org/) to speak about it.

- We don't have test at the moment, and Travis integration is broken. If you know how to fix it, you are welcome (see [#1253](https://github.com/TelescopeJS/Telescope/issues/1253)!

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

This is the Apollo/GraphQL version of Telescope Nova. [You can find the documentation here](http://nova-docs.telescopeapp.org/).

The fastest way to get started is:
```sh
npm install
npm start
```

### Other Versions

You can find the older, non-Apollo version of Telescope Nova on the [nova-classic](https://github.com/TelescopeJS/Telescope/tree/nova-classic) branch.
Expand Down
4 changes: 2 additions & 2 deletions license.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016 Telescope Nova
Copyright (c) 2017 Telescope Nova

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
25 changes: 0 additions & 25 deletions npm-debug.log.14739240

This file was deleted.

25 changes: 0 additions & 25 deletions npm-debug.log.748773427

This file was deleted.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
"npm": "^3.0"
},
"scripts": {
"prestart": "sh prestart_nova.sh",
"start": "meteor --settings settings.json",
"lint": "eslint --cache --ext .jsx,js packages"
},
"dependencies": {
"apollo-client": "^0.7.3",
"analytics-node": "^2.1.1",
"apollo-client": "^0.8.1",
"babel-runtime": "^6.18.0",
"bcrypt": "^0.8.7",
"body-parser": "^1.15.2",
Expand Down Expand Up @@ -44,7 +47,7 @@
"optics-agent": "^1.0.5",
"react": "^15.4.1",
"react-addons-pure-render-mixin": "^15.4.1",
"react-apollo": "^0.8.1",
"react-apollo": "^0.9.0",
"react-bootstrap": "^0.30.7",
"react-bootstrap-datetimepicker": "0.0.22",
"react-cookie": "^0.4.6",
Expand Down
12 changes: 6 additions & 6 deletions packages/_react-router-ssr/lib/client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@ const ReactRouterSSR = {
clientOptions = {};
}

let history = browserHistory;

if(typeof clientOptions.historyHook === 'function') {
history = clientOptions.historyHook(history);
}

Meteor.startup(function() {
const rootElementName = clientOptions.rootElement || 'react-app';
const rootElementType = clientOptions.rootElementType || 'div';
Expand Down Expand Up @@ -47,6 +41,12 @@ const ReactRouterSSR = {
});
}

let history = browserHistory;

if(typeof clientOptions.historyHook === 'function') {
history = clientOptions.historyHook(history);
}

let app = (
<Router
history={history}
Expand Down
11 changes: 7 additions & 4 deletions packages/_react-router-ssr/lib/server.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ ReactRouterSSR.Run = function(routes, clientOptions, serverOptions) {
let history = createMemoryHistory(req.url);

if (typeof serverOptions.historyHook === 'function') {
history = serverOptions.historyHook(history);
history = serverOptions.historyHook(req, res, history);
}

ReactRouterMatch({ history, routes, location: req.url }, Meteor.bindEnvironment((err, redirectLocation, renderProps) => {
Expand Down Expand Up @@ -194,6 +194,7 @@ function generateSSRData(clientOptions, serverOptions, req, res, renderProps) {

global.__STYLE_COLLECTOR_MODULES__ = [];
global.__STYLE_COLLECTOR__ = '';
req.css = '';

renderProps = {
...renderProps,
Expand All @@ -203,9 +204,9 @@ function generateSSRData(clientOptions, serverOptions, req, res, renderProps) {
// fetchComponentData(serverOptions, renderProps);
let app = <RouterContext {...renderProps} />;

if (typeof clientOptions.wrapperHook === 'function') {
if (typeof serverOptions.wrapperHook === 'function') {
const loginToken = req.cookies['meteor_login_token'];
app = clientOptions.wrapperHook(app, loginToken);
app = serverOptions.wrapperHook(req, res, app, loginToken);
}

if (serverOptions.preRender) {
Expand All @@ -221,14 +222,16 @@ function generateSSRData(clientOptions, serverOptions, req, res, renderProps) {
css = global.__STYLE_COLLECTOR__;

if (typeof serverOptions.dehydrateHook === 'function') {
const data = serverOptions.dehydrateHook();
const data = serverOptions.dehydrateHook(req, res);
InjectData.pushData(res, 'dehydrated-initial-data', JSON.stringify(data));
}

if (serverOptions.postRender) {
serverOptions.postRender(req, res);
}

css = css + req.css;

// I'm pretty sure this could be avoided in a more elegant way?
const context = FastRender.frContext.get();
const data = context.getData();
Expand Down
54 changes: 1 addition & 53 deletions packages/customization-demo/lib/components/CustomPostsItem.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Components, getRawComponent, replaceComponent } from 'meteor/nova:lib';
import { Components, getRawComponent, replaceComponent } from 'meteor/nova:core';
import React, { PropTypes, Component } from 'react';
import { FormattedMessage, FormattedRelative } from 'react-intl';
import { Link } from 'react-router';
import Posts from "meteor/nova:posts";
import gql from 'graphql-tag';

class CustomPostsItem extends getRawComponent('PostsItem') {

Expand Down Expand Up @@ -60,55 +59,4 @@ class CustomPostsItem extends getRawComponent('PostsItem') {
}
}

CustomPostsItem.propTypes = {
currentUser: React.PropTypes.object,
post: React.PropTypes.object.isRequired
};

CustomPostsItem.fragment = gql`
fragment CustomPostsItemFragment on Post {
_id
title
url
slug
thumbnailUrl
baseScore
postedAt
sticky
status
categories {
# ...minimumCategoryInfo
_id
name
slug
}
commentCount
commenters {
# ...avatarUserInfo
_id
displayName
emailHash
slug
}
upvoters {
_id
}
downvoters {
_id
}
upvotes # should be asked only for admins?
score # should be asked only for admins?
viewCount # should be asked only for admins?
clickCount # should be asked only for admins?
user {
# ...avatarUserInfo
_id
displayName
emailHash
slug
}
color
}
`;

replaceComponent('PostsItem', CustomPostsItem);
9 changes: 9 additions & 0 deletions packages/customization-demo/lib/fragments.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { extendFragment } from 'meteor/nova:core';

extendFragment('PostsList', `
color # new custom property!
`);

extendFragment('PostsPage', `
color # new custom property!
`);
1 change: 1 addition & 0 deletions packages/customization-demo/lib/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import "./emails.js"
import "./custom_fields.js"
import "./i18n.js"
import "./groups.js"
import "./fragments.js"

// custom components
import "./components/CustomLogo.jsx";
Expand Down
3 changes: 1 addition & 2 deletions packages/framework-demo/lib/components/MoviesItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Wrapped with the "withCurrentUser" container.

import React, { PropTypes, Component } from 'react';
import { Button } from 'react-bootstrap';
import { ModalTrigger } from 'meteor/nova:core';
import { Components, registerComponent, withCurrentUser } from 'meteor/nova:core';
import { Components, registerComponent, withCurrentUser, ModalTrigger } from 'meteor/nova:core';
import Movies from '../collection.js';

class MoviesItem extends Component {
Expand Down
4 changes: 2 additions & 2 deletions packages/framework-demo/lib/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Each mutation has:
*/

import { newMutation, editMutation, removeMutation } from 'meteor/nova:core';
import { newMutation, editMutation, removeMutation, Utils } from 'meteor/nova:core';
import Users from 'meteor/nova:users';

const performCheck = (mutation, user, document) => {
if (!mutation.check(user, document)) throw new Error(`Sorry, you don't have the rights to perform the mutation ${mutation.name} on document _id = ${document._id}`);
if (!mutation.check(user, document)) throw new Error(Utils.encodeIntlError({id: `app.mutation_not_allowed`, value: `"${mutation.name}" on _id "${document._id}"`}));
}

const mutations = {
Expand Down
1 change: 0 additions & 1 deletion packages/framework-demo/lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ A SimpleSchema-compatible JSON schema
*/

import Users from 'meteor/nova:users';
import { GraphQLSchema } from 'meteor/nova:core';

// define schema
const schema = {
Expand Down
2 changes: 1 addition & 1 deletion packages/nova-apollo/lib/export.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphQLSchema } from 'meteor/nova:lib';
import { GraphQLSchema } from 'meteor/nova:core';

import { makeExecutableSchema } from 'graphql-tools';

Expand Down
2 changes: 1 addition & 1 deletion packages/nova-apollo/lib/schema.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GraphQLSchema } from 'meteor/nova:lib';
import { GraphQLSchema } from 'meteor/nova:core';

const generateTypeDefs = () => [`
Expand Down
2 changes: 1 addition & 1 deletion packages/nova-apollo/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { _ } from 'meteor/underscore';

import Users from 'meteor/nova:users';

import { GraphQLSchema } from 'meteor/nova:lib';
import { GraphQLSchema } from 'meteor/nova:core';

import OpticsAgent from 'optics-agent'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import React, { PropTypes, Component } from 'react';
import { intlShape } from 'react-intl';
import { Components, registerComponent, getRawComponent } from 'meteor/nova:lib';
import { Components, registerComponent, getFragment, withMessages } from 'meteor/nova:core';
import Categories from "meteor/nova:categories";
import { withMessages } from 'meteor/nova:core';

const CategoriesEditForm = (props, context) => {

return (
<div className="categories-edit-form">
<div className="categories-edit-form-admin">
<div className="categories-edit-form-id">ID: {props.category._id}</div>
</div>
<Components.SmartForm
collection={Categories}
documentId={props.category._id}
mutationFragment={getRawComponent('CategoriesList').fragment}
mutationFragment={getFragment('CategoriesList')}
successCallback={category => {
props.closeCallback();
props.closeModal();
props.flash(context.intl.formatMessage({id: 'categories.edit_success'}, {name: category.name}), "success");
}}
removeSuccessCallback={({documentId, documentTitle}) => {
props.closeCallback();
props.closeModal();
props.flash(context.intl.formatMessage({id: 'categories.delete_success'}, {name: documentTitle}), "success");
// context.events.track("category deleted", {_id: documentId});
}}
Expand All @@ -30,7 +32,7 @@ const CategoriesEditForm = (props, context) => {

CategoriesEditForm.propTypes = {
category: React.PropTypes.object.isRequired,
closeCallback: React.PropTypes.func,
closeModal: React.PropTypes.func,
flash: React.PropTypes.func,
}

Expand Down
Loading

0 comments on commit 4baa939

Please sign in to comment.