Skip to content

Commit

Permalink
[update] remove docker and update code
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiodxa committed May 15, 2017
1 parent 2fbed76 commit fe6ccb9
Show file tree
Hide file tree
Showing 16 changed files with 708 additions and 319 deletions.
8 changes: 1 addition & 7 deletions project/components/Detail.js → components/Detail.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import React from 'react';
import Markdown from '@platzi/react-markdown';


function Detail(props) {
return (
<section>
<article>
<Markdown
id="markdown"
content={props.content}
/>
<Markdown id="markdown" content={props.content} />
<a href={`https://github.com/PlatziDev/${props.name}`} target="_blank">
<i className="fa fa-github" />
</a>
Expand Down Expand Up @@ -57,5 +52,4 @@ function Detail(props) {
);
}


export default Detail;
8 changes: 2 additions & 6 deletions project/components/Repository.js → components/Repository.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
import React from 'react';
import Link from 'next/link';


function Repository(props) {
return (
<article className="row">
<h2 className="col-xs-12 col-sm-4 col-md-3">
<Link
prefetch
href={{
pathname: '/repo',
query: {
name: props.name,
},
}}
as={`/repo/${props.name}`}
target="_blank"
rel="nofollow"
>
<a>{props.name}</a>
</Link>
Expand Down Expand Up @@ -76,8 +73,7 @@ function Repository(props) {
}
`}</style>
</article>
)
);
}


export default Repository;
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import Repository from './Repository';


function RepositoryList(props) {
return (
<section id="repos">
{props.list
.sortBy(repo => repo.stargazers_count)
.reverse()
.map(repo => <Repository {...repo} key={repo.id} />)
.toArray()
}
.toArray()}
<style jsx>{`
section {
margin: 0 auto 2rem;
Expand All @@ -20,5 +18,4 @@ function RepositoryList(props) {
);
}


export default RepositoryList;
4 changes: 1 addition & 3 deletions project/constants.js → constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@ exports.NODE_ENV = process.env.NODE_ENV || 'development'; // the app enviroment
exports.PORT = process.env.PORT || '3000'; // the docker port
exports.HOST = process.env.HOST || 'localhost'; // the docker host

exports.P_PROT = process.env.P_PROT || 'http'; // the public protocol
exports.P_HOST = process.env.P_HOST || 'localhost'; // the public host
exports.P_PORT = process.env.P_PORT || '3000'; // the public port
exports.URL = process.env.URL || 'http://localhost:3000'; // the public url
7 changes: 0 additions & 7 deletions docker/dev/Dockerfile

This file was deleted.

15 changes: 0 additions & 15 deletions docker/dev/docker-compose.yml

This file was deleted.

11 changes: 11 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "platzi-oss",
"alias": "platzi-oss.now.sh",
"env": {
"NODE_ENV": "production",
"PORT": "3000",
"HOST": "localhost",
"URL": "https://oss.platzi.com"
},
"type": "npm"
}
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
"description": "The Platzi Open Source Software published packages.",
"main": "server.js",
"scripts": {
"dev": "node .",
"build": "next build",
"start": "cd ./project && node ./server.js",
"prestart:prod": "npm run build",
"start:prod": "NODE_ENV=production PORT=8000 HOST=0.0.0.0 P_PROT=https P_HOST=oss.platzi.com P_PORT=80 node server.js"
"start": "node ."
},
"repository": {
"type": "git",
Expand All @@ -24,6 +23,7 @@
"bugs": {
"url": "https://github.com/PlatziDev/oss/issues"
},
"private": true,
"homepage": "https://oss.platzi.com/",
"dependencies": {
"@platzi/react-markdown": "1.0.2",
Expand All @@ -32,8 +32,11 @@
"immutable": "3.8.1",
"isomorphic-fetch": "2.2.1",
"lru-cache": "4.0.2",
"next": "beta",
"next": "^2.3.1",
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"devDependencies": {
"nodemon": "^1.11.0"
}
}
1 change: 0 additions & 1 deletion project/pages/_document.js → pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ class PlatziOSS extends Document {
}
}


export default PlatziOSS;
6 changes: 3 additions & 3 deletions project/pages/index.js → pages/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Head from 'next/head';
import Link from 'next/link';
import React, { Component } from 'react';
import { Component } from 'react';
import { List as list } from 'immutable';
import 'isomorphic-fetch';

import RepositoryList from '../components/RepositoryList';

import { P_PROT, P_HOST, P_PORT } from '../constants';
import { URL } from '../constants';

class Home extends Component {
static async getInitialProps() {
const response = await fetch(`${P_PROT}://${P_HOST}:${P_PORT}/api/repos`);
const response = await fetch(`${URL}/api/repos`);
const repos = await response.json();
return { repos };
}
Expand Down
10 changes: 5 additions & 5 deletions project/pages/repo.js → pages/repo.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import Head from 'next/head';
import Link from 'next/prefetch';
import React, { Component } from 'react';
import Link from 'next/link';
import { Component } from 'react';
import { atob } from 'abab';
import 'isomorphic-fetch';

import Detail from '../components/Detail';

import { P_PROT, P_HOST, P_PORT } from '../constants';
import { URL } from '../constants';

class Repo extends Component {
static async getInitialProps(context) {
const response = await fetch(`${P_PROT}://${P_HOST}:${P_PORT}/api/repos/${context.query.name}`);
const response = await fetch(`${URL}/api/repos/${context.query.name}`);
const { content } = await response.json();
return { content, name: context.query.name };
}
Expand All @@ -28,7 +28,7 @@ class Repo extends Component {

<header>
<figure>
<Link href="/">
<Link href="/" prefetch>
<img alt="Platzi" src="/static/logo.svg" height="72" width="230" />
</Link>
</figure>
Expand Down
2 changes: 0 additions & 2 deletions run-prod.sh

This file was deleted.

1 change: 0 additions & 1 deletion project/server.js → server.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ app.prepare()

/**
* Render the list of repos (if is not dev use cache)
* @type {[type]}
*/
server.get('/', (req, res) => {
const params = Object.assign(req.query, req.params);
Expand Down
29 changes: 0 additions & 29 deletions start.sh

This file was deleted.

File renamed without changes
Loading

0 comments on commit fe6ccb9

Please sign in to comment.