Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGrandon committed May 29, 2018
1 parent ce67d1e commit 550afbe
Show file tree
Hide file tree
Showing 16 changed files with 1,388 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
yarn-error.log

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) 2017 Uber Technologies, Inc.

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.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
# create-fusionjs
# Create Fusion.js App

Creates a Fusion.js application using the command line.

## Usage

```
yarn create fusion-app <appName>
```

## Documentation

Read Fusion.js documentation and learn how to get help at: https://fusionjs.com
43 changes: 43 additions & 0 deletions bin/cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env node

const path = require('path');
const chalk = require('chalk');
const scaffold = require('fusion-scaffolder');

const projectName = process.argv[2];

if (!projectName) {
console.log(`${chalk.red('Could not create application.')}
Please specify the project directory:
${chalk.cyan('yarn create fusion-app')} ${chalk.green('<project-directory>')}
Example:
${chalk.cyan('yarn create fusion-app')} ${chalk.green('my-fusionjs-app')}
`);
process.exit(1);
}

console.log(`
Creating a new Fusion.js app in: ${chalk.green(
`${process.cwd()}/${projectName}`
)}
`);

scaffold({
path: './templates/basic',
cwd: path.join(__dirname, '..'),
projectPath: path.join(process.cwd(), projectName),
project: projectName,
})
.then(() => {
console.log(`
${chalk.green.bold(`Success! You have created a Fusion.js project.`)}
Start your Fusion.js app with:
${chalk.cyan(`cd ${projectName} && yarn dev`)}
`);
})
.catch(e => {
console.log('Error starting your application', e);
});
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "create-fusion-app",
"version": "0.0.1",
"main": "index.js",
"license": "MIT",
"bin": {
"create-fusion-app": "bin/cli.js"
},
"dependencies": {
"chalk": "^2.4.1",
"fusion-scaffolder": "https://github.com/kevingrandon/fusion-scaffolder"
}
}
3 changes: 3 additions & 0 deletions templates/basic/content/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.fusion
node_modules

5 changes: 5 additions & 0 deletions templates/basic/content/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Fusion.js application

Welcome to your Fusion.js application. Get started by running the application with `yarn dev` in a terminal.

Visit our documentation at: https://fusionjs.com
23 changes: 23 additions & 0 deletions templates/basic/content/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "fusion-boilerplate",
"version": "1.0.0",
"main": "index.js",
"dependencies": {
"fusion-cli": "^1.6.0",
"fusion-core": "^1.3.1",
"fusion-plugin-react-router": "^1.1.1",
"fusion-plugin-styletron-react": "^2.4.1",
"fusion-react": "^1.0.5",
"fusion-react-async": "^1.2.2",
"fusion-tokens": "^1.0.3",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"styletron": "^3.0.4"
},
"scripts": {
"dev": "fusion dev",
"test": "fusion test",
"build": "fusion build",
"start": "fusion start"
}
}
18 changes: 18 additions & 0 deletions templates/basic/content/src/components/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { Component } from 'react';

import {Router, Route, Link, Switch, NotFound} from 'fusion-plugin-react-router';

export default class Header extends Component {
render() {
return (
<header>
<h1>Welcome to Fusion.js</h1>
<ul>
<li><Link to="/">Home</Link></li>
<li><Link to="/styles">Styles</Link></li>
<li><Link to="/404">404</Link></li>
</ul>
</header>
);
}
}
17 changes: 17 additions & 0 deletions templates/basic/content/src/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react';
import App from 'fusion-react';
import Router from 'fusion-plugin-react-router';
import UniversalEvents, {
UniversalEventsToken,
} from 'fusion-plugin-universal-events';
import Styletron from 'fusion-plugin-styletron-react';

import root from './root.js';

export default () => {
const app = new App(root);
app.register(Styletron);
app.register(Router);
app.register(UniversalEventsToken, UniversalEvents);
return app;
};
4 changes: 4 additions & 0 deletions templates/basic/content/src/pages/home.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import React from 'react';

const Home = () => <div>Hello world</div>;
export default Home;
6 changes: 6 additions & 0 deletions templates/basic/content/src/pages/pageNotFound.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';

import {NotFound} from 'fusion-plugin-react-router';

const PageNotFound = () => <NotFound><div>404</div></NotFound>;
export default PageNotFound;
7 changes: 7 additions & 0 deletions templates/basic/content/src/pages/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react';

import {styled} from 'fusion-plugin-styletron-react';

const Panel = styled('div', {background: 'silver'});
const Styles = () => <Panel>Styled component</Panel>;
export default Styles;
20 changes: 20 additions & 0 deletions templates/basic/content/src/root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';

import {Router, Route, Switch} from 'fusion-plugin-react-router';

import Header from './components/header.js';
import Home from './pages/home.js';
import PageNotFound from './pages/pageNotFound.js';
import Styles from './pages/styles.js';

const root = (
<div>
<Header />
<Switch>
<Route exact path="/" component={Home} />
<Route exact path="/styles" component={Styles} />
<Route component={PageNotFound} />
</Switch>
</div>
);
export default root;
5 changes: 5 additions & 0 deletions templates/basic/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @flow

module.exports = async function getContext(ctx /*: any*/) {
return ctx;
};
Loading

0 comments on commit 550afbe

Please sign in to comment.