├── _editorconfig ├── _choo.yaml ├── app.js ├── views └── home.js ├── _package.json ├── models └── app.js ├── README.md └── _gitignore /_editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | -------------------------------------------------------------------------------- /_choo.yaml: -------------------------------------------------------------------------------- 1 | projectName: <%= projectName %> 2 | template: 3 | name: choo-cli 4 | source: choo-cli 5 | required: 6 | - _choo.yaml 7 | - _editorconfig 8 | - _gitignore 9 | - _package.json 10 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | const choo = require('choo') 2 | const app = choo() 3 | 4 | app.model(require('./models/app')) 5 | 6 | app.router((route) => [ 7 | route('/', require('./views/home')) 8 | ]) 9 | 10 | const tree = app.start() 11 | 12 | document.body.appendChild(tree) 13 | -------------------------------------------------------------------------------- /views/home.js: -------------------------------------------------------------------------------- 1 | const html = require('choo/html') 2 | 3 | module.exports = (state, prev, send) => html` 4 |
5 |

Hello, World!

6 |

If you are seeing this, then the generator works!

7 |

Demo

8 |

${state.title}

9 | send('update', { value: e.target.value })} /> 12 |
13 | ` 14 | -------------------------------------------------------------------------------- /_package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "<%= projectName %>", 3 | "version": "0.0.0", 4 | "description": "Created with choo-cli", 5 | "license": "MIT", 6 | "scripts": { 7 | "start": "budo ./app.js --pushstate --open -- -g es2040", 8 | "lint": "standard --verbose | snazzy", 9 | "test": "npm run lint" 10 | }, 11 | "dependencies": { 12 | "choo": "^3.2.0" 13 | }, 14 | "devDependencies": { 15 | "browserify": "^13.0.1", 16 | "budo": "8.3.0", 17 | "es2040": "1.2.2", 18 | "standard": "^7.1.2", 19 | "snazzy": "^4.0.0" 20 | }, 21 | "standard": { 22 | "ignore": [ 23 | "scripts" 24 | ] 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /models/app.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | state: { 3 | /* initial values of state inside the model */ 4 | // title: 'Set the title' 5 | }, 6 | reducers: { 7 | /* synchronous operations that modify state. Triggered by actions. Signature of (data, state). */ 8 | update: (action, state) => ({ title: action.value }) 9 | }, 10 | effects: { 11 | // asynchronous operations that don't modify state directly. 12 | // Triggered by actions, can call actions. Signature of (data, state, send, done) 13 | /* 14 | myEffect: (data, state, send, done) => { 15 | // do stuff 16 | } 17 | */ 18 | }, 19 | subscriptions: [ 20 | // asynchronous read-only operations that don't modify state directly. 21 | // Can call actions. Signature of (send, done). 22 | /* 23 | (send, done) => { 24 | // do stuff 25 | } 26 | */ 27 | ] 28 | } 29 | 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # <%= projectName %> [![built with choo v3](https://img.shields.io/badge/built%20with%20choo-v3-ffc3e4.svg?style=flat-square)](https://github.com/yoshuawuyts/choo) 2 | 3 | You can use choo-cli to generate pieces of your project as you are developing. 4 | For example you can generate 5 | 6 | Pages 7 | ```bash 8 | $ choo generate page my-page 9 | ``` 10 | 11 | Models 12 | ```bash 13 | $ choo generate model my-model 14 | ``` 15 | 16 | Elements 17 | ```bash 18 | $ choo generate element my-element 19 | ``` 20 | 21 | ## npm scripts 22 | 23 | Choo-cli was made for generating choo projects and code, and leverages npm scripts 24 | for certain project task. So in our project a set of npm scripts have already 25 | been generated that perform various tasks such as testing/serving/building/etc. 26 | 27 | At any time you can review the complete list of `npm scripts` available by viewing 28 | [package.json](./package.json) or by running the following command: 29 | 30 | ``` 31 | $ npm run 32 | ``` 33 | 34 | Here is complete list the the commands and their function 35 | - start - start dev server at [localhost:8080](https://localhost:8080) 36 | - build - builds your project to deploy to a server 37 | - test - runs unit tests, for now it will just run linting. 38 | - lint - runs eslint against your code 39 | 40 | So for example you can run `npm start` to start a dev server. You can now see your 41 | app running at [localhost:8080](https://localhost:8080) 42 | -------------------------------------------------------------------------------- /_gitignore: -------------------------------------------------------------------------------- 1 | # generated gitignore file 2 | 3 | # Logs 4 | logs 5 | *.log 6 | npm-debug.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # node-waf configuration 27 | .lock-wscript 28 | 29 | # Compiled binary addons (http://nodejs.org/api/addons.html) 30 | build/Release 31 | dist 32 | 33 | # Dependency directories 34 | node_modules 35 | jspm_packages 36 | 37 | # Optional npm cache directory 38 | .npm 39 | 40 | # Optional REPL history 41 | .node_repl_history 42 | 43 | # Mac OSX 44 | *.DS_Store 45 | .AppleDouble 46 | .LSOverride 47 | 48 | # Icon must end with two \r 49 | Icon 50 | 51 | 52 | # Thumbnails 53 | ._* 54 | 55 | # Files that might appear in the root of a volume 56 | .DocumentRevisions-V100 57 | .fseventsd 58 | .Spotlight-V100 59 | .TemporaryItems 60 | .Trashes 61 | .VolumeIcon.icns 62 | .com.apple.timemachine.donotpresent 63 | 64 | # Directories potentially created on remote AFP share 65 | .AppleDB 66 | .AppleDesktop 67 | Network Trash Folder 68 | Temporary Items 69 | .apdisk 70 | 71 | 72 | # Linux 73 | 74 | # temporary files which can be created if a process still has a handle open of a deleted file 75 | .fuse_hidden* 76 | 77 | # KDE directory preferences 78 | .directory 79 | 80 | # Linux trash folder which might appear on any partition or disk 81 | .Trash-* 82 | 83 | # Windows 84 | 85 | # Windows image file caches 86 | Thumbs.db 87 | ehthumbs.db 88 | 89 | # Folder config file 90 | Desktop.ini 91 | 92 | # Recycle Bin used on file shares 93 | $RECYCLE.BIN/ 94 | 95 | # Windows Installer files 96 | *.cab 97 | *.msi 98 | *.msm 99 | *.msp 100 | 101 | # Windows shortcuts 102 | *.lnk 103 | 104 | # VS Code 105 | .vscode 106 | 107 | #IntelliJ 108 | 109 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm 110 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 111 | 112 | # User-specific stuff: 113 | .idea/workspace.xml 114 | .idea/tasks.xml 115 | .idea/dictionaries 116 | .idea/vcs.xml 117 | .idea/jsLibraryMappings.xml 118 | 119 | # Sensitive or high-churn files: 120 | .idea/dataSources.ids 121 | .idea/dataSources.xml 122 | .idea/dataSources.local.xml 123 | .idea/sqlDataSources.xml 124 | .idea/dynamic.xml 125 | .idea/uiDesigner.xml 126 | 127 | # Gradle: 128 | .idea/gradle.xml 129 | .idea/libraries 130 | 131 | # Mongo Explorer plugin: 132 | .idea/mongoSettings.xml 133 | 134 | ## File-based project format: 135 | *.iws 136 | 137 | ## Plugin-specific files: 138 | 139 | # IntelliJ 140 | /out/ 141 | 142 | # mpeltonen/sbt-idea plugin 143 | .idea_modules/ 144 | 145 | # JIRA plugin 146 | atlassian-ide-plugin.xml 147 | 148 | # Crashlytics plugin (for Android Studio and IntelliJ) 149 | com_crashlytics_export_strings.xml 150 | crashlytics.properties 151 | crashlytics-build.properties 152 | fabric.properties 153 | 154 | # misc 155 | 156 | node_modules 157 | temp 158 | npm-debug.log 159 | .vscode 160 | .idea 161 | .history 162 | --------------------------------------------------------------------------------