From 0b75d3715c4c7496ec4a9a728305873ae6432277 Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sun, 3 Jun 2018 19:05:31 -0400 Subject: [PATCH 01/10] Add create-x0 package --- create-x0/cli.js | 34 +++++++++++++++++++++++++++++++ create-x0/package.json | 14 +++++++++++++ examples/basic/README.md | 2 +- examples/basic/package.json | 4 ++-- examples/basic/{ => src}/index.js | 0 5 files changed, 51 insertions(+), 3 deletions(-) create mode 100755 create-x0/cli.js create mode 100644 create-x0/package.json rename examples/basic/{ => src}/index.js (100%) diff --git a/create-x0/cli.js b/create-x0/cli.js new file mode 100755 index 0000000..95c29b6 --- /dev/null +++ b/create-x0/cli.js @@ -0,0 +1,34 @@ +#!/usr/bin/env node +const path = require('path') +const init = require('initit') +const chalk = require('chalk') + +const [ name ] = process.argv.slice(2) +const template = 'c8r/x0/examples/basic' + +if (!name) { + console.log('name is required: $ create-x0 my-project') + process.exit(1) +} + +console.log('Creating x0 project ', chalk.green(name)) +console.log() + +init({ + name, + template, +}) + .then(res => { + console.log( + chalk.green( + 'Successfully created new x0 project' + ) + ) + process.exit(0) + }) + .catch(err => { + console.log( + chalk.red(err) + ) + process.exit(1) + }) diff --git a/create-x0/package.json b/create-x0/package.json new file mode 100644 index 0000000..776add5 --- /dev/null +++ b/create-x0/package.json @@ -0,0 +1,14 @@ +{ + "name": "create-x0", + "version": "1.0.0", + "description": "Create an x0 starter project", + "bin": { + "create-x0": "./cli.js" + }, + "keywords": [], + "author": "Brent Jackson", + "license": "MIT", + "dependencies": { + "initit": "^1.0.0-2" + } +} diff --git a/examples/basic/README.md b/examples/basic/README.md index c3e009f..4572d74 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -11,7 +11,7 @@ npm install npm start ``` -Editing `index.js` will live update in the development server. +Editing `src/index.js` will live update in the development server. ## Static Build diff --git a/examples/basic/package.json b/examples/basic/package.json index c63bd92..ff91f16 100644 --- a/examples/basic/package.json +++ b/examples/basic/package.json @@ -2,8 +2,8 @@ "name": "x0-basic-example", "private": true, "scripts": { - "start": "x0 . -o", - "build": "x0 build ." + "start": "x0 src -o", + "build": "x0 build src" }, "dependencies": { "@compositor/x0": "^5.0.0" diff --git a/examples/basic/index.js b/examples/basic/src/index.js similarity index 100% rename from examples/basic/index.js rename to examples/basic/src/index.js From febac06a05ce3e329b0298e1bba9211415218b1d Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sun, 3 Jun 2018 19:05:51 -0400 Subject: [PATCH 02/10] Ignore subpackage --- .npmignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.npmignore b/.npmignore index c755bc6..90ffae2 100644 --- a/.npmignore +++ b/.npmignore @@ -8,3 +8,4 @@ examples demo dist .travis.yml +create-x0 From fdae78ab152763968293de18ed34d3fad9d6e91f Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sun, 3 Jun 2018 19:07:46 -0400 Subject: [PATCH 03/10] create-x0 prerelease --- create-x0/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/create-x0/package.json b/create-x0/package.json index 776add5..d678f8f 100644 --- a/create-x0/package.json +++ b/create-x0/package.json @@ -1,6 +1,6 @@ { "name": "create-x0", - "version": "1.0.0", + "version": "1.0.0-0", "description": "Create an x0 starter project", "bin": { "create-x0": "./cli.js" From e7f513f882c75b120d67c5fdb65fa67b21214052 Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Sun, 3 Jun 2018 19:10:01 -0400 Subject: [PATCH 04/10] create-x0: add dependency --- create-x0/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/create-x0/package.json b/create-x0/package.json index d678f8f..ee2d2e1 100644 --- a/create-x0/package.json +++ b/create-x0/package.json @@ -1,6 +1,6 @@ { "name": "create-x0", - "version": "1.0.0-0", + "version": "1.0.0-1", "description": "Create an x0 starter project", "bin": { "create-x0": "./cli.js" @@ -9,6 +9,7 @@ "author": "Brent Jackson", "license": "MIT", "dependencies": { + "chalk": "^2.4.1", "initit": "^1.0.0-2" } } From 66728d6860893835c00b8063600e060204ae15fa Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Thu, 21 Jun 2018 18:15:34 -0400 Subject: [PATCH 05/10] Add getting started section --- README.md | 43 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b2922a6..f358797 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,46 @@ Read more about x0 in our [blog post](https://compositor.io/blog/x0-making-react \* Custom [webpack configuration](#webpack) is required for components that rely on webpack-based features +## Getting Started + +x0 renders a directory of React components, automatically handling routing based on filename. +Create a `docs` folder and add and `index.js` file. + +```jsx +// index.js +import React from 'react' + +export default class extends React.Component { + render () { + return ( +

Hello

+ ) + } +} +``` + +Start a development server by running: + +```sh +x0 docs --open +``` + +To add more pages, add a new component for each route. For example, create an about page: + +```jsx +// about.js +import React from 'react' + +export default props => +

About

+``` + +The about page should now render when navigating to . ## Isolated development environment ```sh -x0 components +x0 docs ``` Options: @@ -47,7 +82,7 @@ Options: ``` ```sh -x0 components -op 8080 +x0 docs -op 8080 ``` @@ -56,13 +91,13 @@ x0 components -op 8080 Export static HTML and client-side bundle ```sh -x0 build components +x0 build docs ``` Export static HTML without bundle ```sh -x0 build components --static +x0 build docs --static ``` Options From 956e1239f66b5e836055d40aada871f015aa01db Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Thu, 21 Jun 2018 18:17:47 -0400 Subject: [PATCH 06/10] Typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f358797..49a235e 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Read more about x0 in our [blog post](https://compositor.io/blog/x0-making-react ## Getting Started x0 renders a directory of React components, automatically handling routing based on filename. -Create a `docs` folder and add and `index.js` file. +Create a `docs` folder and add an `index.js` file. ```jsx // index.js From e73f1af769a4d99bddc97995cc9c775a7d08938d Mon Sep 17 00:00:00 2001 From: Brent Jackson Date: Mon, 25 Jun 2018 18:31:13 -0400 Subject: [PATCH 07/10] Adjust code fence styles --- src/scope.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/scope.js b/src/scope.js index 3e3bbfd..de44527 100644 --- a/src/scope.js +++ b/src/scope.js @@ -56,6 +56,8 @@ export const code = ({ return (

From 53cf4c47a4be23c957fb91a521317b0631b553a0 Mon Sep 17 00:00:00 2001
From: Brent Jackson 
Date: Mon, 25 Jun 2018 18:32:30 -0400
Subject: [PATCH 08/10] Clean up test

---
 test/components.js | 2 --
 1 file changed, 2 deletions(-)

diff --git a/test/components.js b/test/components.js
index 70472ef..adffd77 100644
--- a/test/components.js
+++ b/test/components.js
@@ -20,7 +20,6 @@ import {
 
 browserEnv()
 
-// make sure this doesn't conflict with webpack tests
 global.DIRNAME = 'beep'
 
 const renderJSON = el => render(el).toJSON()
@@ -221,7 +220,6 @@ test('SidebarLayout renders', t => {
   )
   t.snapshot(json)
 })
-// console.log(require('util').inspect(json, { depth: null }))
 
 const blacklist = {
   pre: true

From e68ab498f4c70df669823f9b1a86e6f60cff013b Mon Sep 17 00:00:00 2001
From: Brent Jackson 
Date: Mon, 25 Jun 2018 18:41:11 -0400
Subject: [PATCH 09/10] Update snapshots

---
 test/snapshots/build.js.md        |   6 ------
 test/snapshots/build.js.snap      | Bin 411 -> 369 bytes
 test/snapshots/components.js.md   |   2 +-
 test/snapshots/components.js.snap | Bin 3178 -> 3175 bytes
 4 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/test/snapshots/build.js.md b/test/snapshots/build.js.md
index cc35734..cab9150 100644
--- a/test/snapshots/build.js.md
+++ b/test/snapshots/build.js.md
@@ -9,9 +9,3 @@ Generated by [AVA](https://ava.li).
 > Snapshot 1
 
     'x0

Hello

' - -## static uses getInitialProps method - -> Snapshot 1 - - 'x0

Hello

' diff --git a/test/snapshots/build.js.snap b/test/snapshots/build.js.snap index 527463b8fd0f6cbfbfc6b07053fafe8c3de5f988..5034be3005887df6142de11a676db1956590cfda 100644 GIT binary patch literal 369 zcmV-%0gnDbRzV06!vfVVH>clf4Rvv)&-~kws z5T*eMZn%&C{qHAT6a+ySoCUAR?#tWo^L_Ghclz`k2H)}M%OKd^^x;;pGjL(LH$9(R z-d-F>m8)f*R=`A_*5FvgD`qUXj4WJ956O?JSPdCz5SDXo9ErGA4wQE-QMf7-&>#o8 z8HT9PA(PZ{CLv4yBW9q$FsIEQ#zfb1ZPANSJMwmiPD0*}(zx$Z>pEZdSA}k=#RpWg zaiNU>L%p&twCGkfGc#1<(NXECv}85PZfra2pr#8PTBaSp+%3q8mQ6Gy400000000y1 zk-tvEFc8L5Kp-(8My3!kp_;T4s3c)%kq|tn7T@H&hm^Y1*?t2dh_&X*G)~vqaX#!q96l9-6W+- zg9*K!X_GDQOBFPO(CZ@%x>6a>O{6d&tZRVGq#=VoCP1c583h`ooalsd2&=yl9T1?X zk?IGdF0-!GXhnBev37%oLo}=ee(?&l$!%F5#d1hAUZCjIVyPG?VwG_$Sw70B>Y%7q zw%e9U+B8F+*L1E8WTb~>O@$^J6t>5KU*H12_%*}6i!Ah%l*TLCgj20UPbVZEVn2;t z*23e)iJhj^Xb(7-He9s?YyQ4 Snapshot 1
 
 ## scope.h1 renders
diff --git a/test/snapshots/components.js.snap b/test/snapshots/components.js.snap
index fa75fd07313b2fcfa501e7debc9f9b00a82c5abd..99c7e2b700f79b3d056a3e099a2a103234426df9 100644
GIT binary patch
literal 3175
zcmV-t44CslRzVB9pY7Ex9_
zt}kF=kMAR_ReY@+*0fgY+8%m$<_nYXy|=!)?3QJGxB`pP+-V3s{p*q?SLHlc
z;n=ye<{+Lq4U5uy0QT(N*PM0fe>3aZl~=sH_I?VB(y5ms^uOI3+t#wr=UsIz_xUHQ
zJr810`Y2%U`r?k8X1{fDZ{d^;x70beU{QL-bcC)a&$jHlW!_g$E_kfqrkR(Uuqb^V
zusv!%{mh~r2Oh5Y<-Az`{Clw|T}B{u_o+wQAB#LO&^6fDb$e&?Su9H51WYT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0hlz-7Mz`bjLV;v_JmHz$0NZ<)N2*
zoi4)PLUn{Hh@nvRxNQ|aYsTv~`X8obn7x7Oc8cmJI_PL~g9cApp+TqQiNV8p$H^6O
z;lfR|-gbhr+8nK9#vwG~j`Tb{q4{tl$rCgeBOO{eZMY{R?orO4)ZD#}8YiW}lQw9u
zQu4&elWuk#7brO`T{dfHt5d^A@Kw;j1Ly;+13aUNWi|b=n6}Rrni<$a^L%(|iS)hr
Q3J(|jKj-;#w3{ga07mg3cK`qY


From b04748d13f7014411a07c3657f47d71b0a08ee2c Mon Sep 17 00:00:00 2001
From: Brent Jackson 
Date: Mon, 25 Jun 2018 18:48:37 -0400
Subject: [PATCH 10/10] 6.0.0

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index df4460e..f2a3325 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@compositor/x0",
-  "version": "6.0.0-4",
+  "version": "6.0.0",
   "description": "Document & develop React components without breaking a sweat",
   "main": "index.js",
   "bin": {