├── .gitignore
├── .travis.yml
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── docs
├── docs
│ ├── configuration-index.md
│ ├── configuration-jest.md
│ ├── configuration-noderize.md
│ ├── configuration-prettier.md
│ ├── create.md
│ ├── examples.md
│ ├── features-flow.md
│ ├── features-formatting.md
│ ├── features-index.md
│ ├── features-linting.md
│ ├── features-modern.md
│ ├── features-testing.md
│ ├── features-typescript.md
│ ├── guides-firebase-functions.md
│ ├── guides-google-functions.md
│ ├── guides-heroku.md
│ ├── guides-migrate.md
│ ├── guides-publishing.md
│ ├── guides.md
│ ├── introduction.md
│ ├── scripts.md
│ ├── tutorials-cli.md
│ ├── tutorials-express.md
│ └── tutorials-index.md
└── website
│ ├── .gitignore
│ ├── blog
│ └── 2018-02-09-path-to-v1.0.md
│ ├── core
│ └── Footer.js
│ ├── i18n
│ └── en.json
│ ├── package.json
│ ├── pages
│ └── en
│ │ ├── index.js
│ │ └── users.js-disabled
│ ├── sidebars.json
│ ├── siteConfig.js
│ ├── static
│ ├── css
│ │ └── custom.css
│ └── img
│ │ ├── docs
│ │ ├── guides-google-functions.png
│ │ ├── tutorials-cli-fibonacci.png
│ │ ├── tutorials-cli-greet.png
│ │ ├── tutorials-express-1.png
│ │ ├── tutorials-express-2.png
│ │ └── tutorials-express-3.png
│ │ ├── download.svg
│ │ ├── favicon
│ │ └── favicon.ico
│ │ ├── fighter-jet.svg
│ │ ├── icon.png
│ │ ├── icon.svg
│ │ ├── icon_text.svg
│ │ └── wrench.svg
│ └── yarn.lock
├── examples
├── .gitignore
├── basic-cli
│ ├── .gitignore
│ ├── README.md
│ ├── img
│ │ ├── demo-fibonacci.png
│ │ └── demo-greet.png
│ ├── package.json
│ └── src
│ │ ├── fibonacci.js
│ │ ├── greet.js
│ │ └── index.js
├── basic-express
│ ├── .gitignore
│ ├── README.md
│ ├── img
│ │ ├── demo-1.png
│ │ ├── demo-2.png
│ │ └── demo-3.png
│ ├── package.json
│ └── src
│ │ └── index.js
├── basic-tests
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ └── src
│ │ ├── add.test.ts
│ │ ├── add.ts
│ │ ├── index.js
│ │ ├── sub.js
│ │ └── sub.test.js
├── basic-typescript
│ ├── .gitignore
│ ├── package.json
│ └── src
│ │ └── index.ts
└── chat-socket-react
│ ├── README.md
│ ├── img
│ └── demo.png
│ ├── server
│ ├── .gitignore
│ ├── package.json
│ └── src
│ │ ├── animals.json
│ │ ├── colors.json
│ │ ├── index.js
│ │ └── name.js
│ └── web
│ ├── .gitignore
│ ├── package.json
│ ├── public
│ ├── favicon.ico
│ ├── index.html
│ └── manifest.json
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── List.js
│ ├── MessageBox.js
│ ├── MessagesList.js
│ ├── UserIcon.js
│ ├── UsersList.js
│ ├── index.js
│ └── registerServiceWorker.js
├── lerna.json
├── package.json
├── packages
├── create
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ ├── src
│ │ ├── index.js
│ │ └── run.js
│ └── template
│ │ ├── gitignore
│ │ ├── package.json
│ │ └── src
│ │ └── index.js
├── runtime
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ └── package.json
└── scripts
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ └── src
│ ├── copy.js
│ ├── createBabelConfig.js
│ ├── index.js
│ ├── jestTransformer.js
│ ├── options.js
│ ├── scripts
│ ├── build.js
│ ├── clean.js
│ ├── format.js
│ ├── lint.js
│ ├── start.js
│ ├── test.js
│ └── watch.js
│ ├── tsconfig.json
│ ├── utils
│ ├── logger.js
│ └── path.js
│ └── webpack.js
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | logs
2 | *.log
3 | npm-debug.log*
4 | yarn-debug.log*
5 | yarn-error.log*
6 | coverage
7 | dist
8 | node_modules
9 | *.tgz
10 | .yarn-integrity
11 | .env
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - node
4 | - stable
5 | cache: yarn
6 |
7 | script:
8 | - (cd packages/scripts && yarn) && (cd packages/create && yarn)
9 | - yarn lerna bootstrap
10 | - (cd packages/scripts && yarn prepare && yarn test)
11 | - yarn lerna link
12 | - (cd packages/create && yarn prepare && yarn test)
13 |
14 | stages:
15 | - test
16 | - name: deploy
17 | if: repo = Cretezy/Noderize
18 |
19 | jobs:
20 | include:
21 | # Deploy site always
22 | - stage: deploy
23 | env: DEPLOY=website
24 | install: skip
25 | script: skip
26 | before_deploy:
27 | # Set Git info
28 | - git config --global user.email "36317094+Noderize-bot@users.noreply.github.com"
29 | - git config --global user.name "Noderize Bot"
30 | - echo "machine github.com login Noderize-bot password $GITHUB_TOKEN" > ~/.netrc
31 | deploy:
32 | provider: script
33 | skip_cleanup: true
34 | script: (cd docs/website && yarn && GIT_USER=Noderize-bot yarn publish-gh-pages)
35 | on:
36 | all_branches: true
37 | # Deploy to npm on tags
38 | - stage: deploy
39 | env: DEPLOY=npm
40 | script: skip
41 | before_deploy:
42 | # Publish using $NPM_TOKEN
43 | - npm i -g ci-publish
44 | deploy:
45 | provider: script
46 | skip_cleanup: true
47 | script: yarn lerna boostrap && (cd packages/scripts && ci-publish) && (cd packages/runtime && ci-publish) && yarn lerna link && (cd packages/create && ci-publish)
48 | on:
49 | tags: true
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 |
3 | Thank you for your interest in contributing to Noderize! This file explains how to contribute, and general guidelines for the community.
4 |
5 | We're looking for any positive contribution that can help the project and it's users'. This means answering questions and filing PRs, or simply using Noderize!
6 |
7 | Noderize supports quite a lot of features, but we don't want to become a kitchen sink of features either. We aim to support to majority of use cases, for the majority of people.
8 |
9 | ## Ground Rules
10 |
11 | * Ensure cross-platform compatibility for every change that's accepted. Try to maintain backwards compatibility as much as possible.
12 | * Ensure the changes are useful to you, and the community.
13 | * Check for overlapping PR or features. Don't code twice if not needed, DRY.
14 | * Create issues for any major changes and enhancements that you wish to make. Discuss things transparently and get community feedback.
15 | * Keep PR to one per feature. Break up multiple changes into smaller PRs.
16 | * Be welcoming to newcomers and encourage diverse new contributors from all backgrounds.
17 |
18 | ## Your First Contribution
19 |
20 | Unsure where to begin contributing to Noderize? You can start by looking through the beginner and help-wanted issues.
21 |
22 | * [Beginner issues](https://github.com/Cretezy/Noderize/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22good+first+issue%22) - issues which should only require a few lines of code, and a test or two.
23 | * [Help wanted issues](https://github.com/Cretezy/Noderize/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22help+wanted%22) - issues which should be a bit more involved than beginner issues.
24 |
25 | > Working on your first PR? You can learn how from this (*free*) video series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
26 |
27 | # Getting started
28 |
29 | * Create your own fork of the code. This is the "Fork" button on GitHub.
30 | * Clone the repo to your computer and setup the repo:
31 | * You will need `node` install, with [`yarn`](https://yarnpkg.com).
32 | * `cd` into the cloned project and run `lerna bootstrap`. This will install dependencies.
33 | * `cd` into `packages/scripts` and run `yarn prepack`. This will bootstrap the Noderize scripts.
34 | * Make your changes!
35 | * You can run `yarn build` in the `packages/script` directory to build your changes.
36 | * Use `lerna link` to relink the new built version.
37 | * You can then test out the changes with the `packages/create` package. Run `yarn build` there to use your modified scripts.
38 | * Optionally, write tests for your changes.
39 | * Before making a commit, make sure to run `yarn format` in your modified package to format the code to the project's style.
40 | * When commiting, write the commit message in the format: `(package): changes, other change; (other-package): more changes`.
41 | * Use `(package)` for the scope (with `package` being either: `scripts`, `create`, `runtime`, `docs`, `*`, or other)
42 | * Write your changes, seperated with a comma (`,`).
43 | * If modifying multiple packages, seperate them with a semi-column (`;`).
44 | * Look at the commit history (`git log`) for a better idea of this format.
45 | * Push, and make a pull request!
46 |
47 | # How to report a bug
48 |
49 | If you find a major security vulnerability, do *NOT* open an issue. Email `charles@cretezy.com` instead.
50 |
51 | When filing an issue, make sure to answer these questions:
52 |
53 | * What version of Noderize and Node are you using?
54 | * What operating system are you using? Are you using any special setup?
55 | * What did you do?
56 | * What did you expect to see?
57 | * What did you see instead?
58 |
59 | # How to suggest a feature or enhancement
60 |
61 | First of all, make sure the feature doesn't already exist! Give [the docs](https://noderize.js.org) a thorough look.
62 |
63 | Check for PRs or issues with your suggestion. The search box is your friend!
64 |
65 | If you can't find anything, open an issue with a detailed, but consist explanation for your suggestion.
66 | Explain how it is useful to you and others, and what value it brings.
67 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Charles Crete
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Noderize lets you create Node apps in less than 30 seconds.
5 |
6 |
7 | Documentation
8 |
9 |
10 |
11 |
12 | It aims to get out of your way and not require any configuration until you need it, while supporting loads of features.
13 |
14 | ```bash
15 | yarn create noderize
16 | ```
17 |
18 | or
19 |
20 | ```bash
21 | npx create-noderize
22 | ```
23 |
24 | Visit our [documentation](https://noderize.js.org/docs/introduction.html) for more information!
25 |
26 | > Inspired by [`create-react-app`](https://github.com/facebook/create-react-app)
27 |
28 | [](https://travis-ci.org/Cretezy/Noderize)
29 |
--------------------------------------------------------------------------------
/docs/docs/configuration-index.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: configuration
3 | title: Configuration
4 | sidebar_label: Index
5 | ---
6 |
7 | Noderize gets out of your way and does not require any configuration until you need it.
8 |
9 | ## Index
10 |
11 | * [Noderize](configuration-noderize.md)
12 | * [Prettier](configuration-prettier.md)
13 | * [Jest](configuration-jest.md)
14 |
--------------------------------------------------------------------------------
/docs/docs/configuration-jest.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: configuration-jest
3 | title: Configuration: Jest
4 | sidebar_label: Jest
5 | ---
6 |
7 | You may configure [Jest](https://facebook.github.io/jest) as you [normally would](https://facebook.github.io/jest/docs/en/configuration.html).
8 |
9 | You may pass arguments to Jest when using the `test` script:
10 |
11 | ```bash
12 | yarn test --ci
13 | # or
14 | npm test --ci
15 | ```
16 |
17 | > Note: To use Noderize's build options, you must set them to file configs.
--------------------------------------------------------------------------------
/docs/docs/configuration-noderize.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: configuration-noderize
3 | title: Configuration: Noderize
4 | sidebar_label: Noderize
5 | ---
6 |
7 | Noderize's options can be configured in a few ways:
8 |
9 | * A `noderize` key in your `package.json` file (recommended):
10 |
11 | ```json
12 | {
13 | "...": "...",
14 | "noderize": {
15 | "minify": true
16 | }
17 | }
18 | ```
19 |
20 | * A `.noderizerc` file, written in JSON/YAML/JS, with optional extensions: `.json`/`.yml`/`.yaml`/`.js`:
21 |
22 | * JSON:
23 |
24 | ```json
25 | {
26 | "minify": true
27 | }
28 | ```
29 |
30 | * YAML:
31 |
32 | ```yml
33 | minify: true
34 | ```
35 |
36 | * JS:
37 | ```js
38 | module.exports = {
39 | minify: true
40 | };
41 | ```
42 |
43 | * A `noderize.config.js` file that exports an object (like the `.noderizerc` JS example above).
44 |
45 | * Command line arguments:
46 |
47 | * Every configuration options can be passed as arguments to the `build`/`watch`/`start`/etc command.
48 |
49 | * `yarn build --minify`
50 |
51 | * When passing objects as argument, provide a JSON string.
52 |
53 | * `yarn build --targets '{"node": true}'`.
54 |
55 | * When passing arrays as argument, simply pass it multiple times.
56 |
57 | * `yarn build --languages javascript --languages typescript`.
58 |
59 | **All configuration options are optional with Noderize. Only configure if required.**
60 |
61 | See more details in [scripts](scripts.md).
62 |
63 | ## Index
64 |
65 |
66 |
67 | ## Build Options
68 |
69 | ### `bundles`
70 |
71 | [array] Default: `[ { "entry": "index.js", "output": "index.js" } ]`
72 |
73 | Array of bundles to be built. Entry files will be taken from `src`, and output will be placed in `dist`.
74 |
75 | Example of 2 bundles:
76 |
77 | ```json
78 | "bundles": [
79 | {
80 | "entry": "index.js",
81 | "output": "index.js"
82 | },
83 | {
84 | "entry": ["~myExternalDependency", "secondBundle.ts"],
85 | "output": "secondBundle.js"
86 | }
87 | ]
88 | ```
89 |
90 | The `entry` field may be an array of multiple files. To use an external entry file, prefix it with `~`.
91 |
92 | If bundles are not set and only using the `typescript` [`language`](#languages), the default bundle entry is set to `index.ts`.
93 |
94 | ### `static`
95 |
96 | [object] Default: _none_
97 |
98 | Static files/directories to be copied.
99 |
100 | Input is sourced from `src` and output placed into `dist`
101 |
102 | Example (will copy the `templates` directory from `src/templates` to `dist/templates`):
103 |
104 | ```json
105 | "static": {
106 | "templates": "templates"
107 | }
108 | ```
109 |
110 | ### `runtime`
111 |
112 | [string] Default: `noderize` if `noderize-runtime` is dependency, else `include`
113 |
114 | Which runtime to use.
115 |
116 | * `noderize`: Use the Noderize runtime dependency (external Babel runtime)
117 | * This requires `noderize-runtime` as dependency
118 | * `include`: Includes the Babel runtime in your bundle
119 | * Will increase your file size.
120 | * `polyfill`: Includes the Babel polyfill in your bundle
121 | * This will dramatically increase your bundle size
122 | * Do not use in libraries. Instead, use `noderize` for smaller file size
123 | * `none`: Don't include a runtime.
124 | * This is useful if you are compiling for a recent engine (Node 8+ for instance)
125 | * This will be just under `noderize`'s file size, but no features are polyfille/transformed
126 | * Only use this if you know what you are doing
127 |
128 | ### `shebang`
129 |
130 | [boolean] Default: if `bin` field in `package.json` is set
131 |
132 | Adds a shebang to top of built file. Useful for building CLI apps.
133 |
134 | You can omit this as it will infer if this is a CLI app by checking if the `bin` field in `package.json` is set.
135 |
136 | > Note: If this option is activated, it will apply the shebang to all your bundles
137 |
138 | ### `targets`
139 |
140 | [object] Default: `{ "node": true }`
141 |
142 | Specify a [Babel target](https://babeljs.io/docs/plugins/preset-env/#targets) to compile to.
143 |
144 | Default to current Node version. You may want to compile to standard ES5 if your app is a library by using `{}`.
145 |
146 | This is overridden per environment with [`env`](#env) option.
147 |
148 | ### `target`
149 |
150 | [string] Default: `node`
151 |
152 | Specify a target. Options are:
153 |
154 | * `node`
155 | * `web`
156 |
157 | ### `globals`
158 |
159 | [object] Default: _none_
160 |
161 | Set a globals.
162 |
163 | Example:
164 |
165 | ```json
166 | "globals": {
167 | "$": "jquery"
168 | }
169 | ```
170 |
171 | ### `sourcemap`
172 |
173 | [boolean] Default: `true`
174 |
175 | Generate source maps.
176 |
177 | This is overridden in production with [`env`](#env) option.
178 |
179 | ### `includeExternal`
180 |
181 | [boolean] Default: `false`
182 |
183 | Include all your dependencies in your bundle. This will make your file size a lot larger.
184 |
185 | ### `minify`
186 |
187 | [boolean] Default: `false`
188 |
189 | Minifies (compress) your app.
190 |
191 | ### `languages`
192 |
193 | [string|array] Default: `javascript`
194 |
195 | Array of languages to be used.
196 |
197 | Languages available:
198 |
199 | * `javascript`
200 | * `typescript`
201 |
202 | ### `name`
203 |
204 | [string] Default: `name` field in `package.json`
205 |
206 | Name of exported library (for CommonJS1 (old) and IIFE). Only useful for libraries.
207 |
208 | ### `babel`
209 |
210 | [object] Default: _none_
211 |
212 | Additional Babel plugins and presets.
213 |
214 | For instance, to add the React preset for creating a React library:
215 |
216 | ```json
217 | "babel": {
218 | "presets": ["@babel/preset-react"]
219 | }
220 | ```
221 |
222 | ### `buildThreads`
223 |
224 | [number] Default: `3`
225 |
226 | Amount of build threads to use. Minimum of 1.
227 |
228 | ### `srcDirectory`
229 |
230 | [string] Default: `src`
231 |
232 | Directory of source code.
233 |
234 | ### `distDirectory`
235 |
236 | [string] Default: `dist`
237 |
238 | Directory of output code.
239 |
240 | > Note: The [`clean` script](scripts.md#clean) will delete this directory when ran.
241 |
242 | ## Run Options
243 |
244 | ### `runOnWatch`
245 |
246 | [boolean] Default: `true`
247 |
248 | Enable running the app while watching. Might be useful to disable if you are working on a CLI app.
249 |
250 | ### `startFile`
251 |
252 | [string] Default: `main` field in `package.json`, or first output in [`bundles`](#bundles).
253 |
254 | File to run when using `start` or `watch` command.
255 |
256 | This is relative to your project root. Add `dist/` before.
257 |
258 | ### `inspect`
259 |
260 | [boolean] Default: `false`
261 |
262 | Start the [Node debugger](https://nodejs.org/api/debugger.html) with Noderize.
263 |
264 | ### `inspectChrome`
265 |
266 | [number] Default: _none_
267 |
268 | Start the [Chrome DevTools (Node) debugger](https://nodejs.org/api/debugger.html#debugger_v8_inspector_integration_for_node_js) with Noderize.
269 |
270 | Number given will be used as port to listen on.
271 |
272 | ## Other Options
273 |
274 | ### `env`
275 |
276 | [object] Default: See below
277 |
278 | Provide environment-specific variables.
279 |
280 | Default:
281 |
282 | ```json
283 | "env": {
284 | "production": {
285 | "sourcemap": false,
286 | "target": {}
287 | }
288 | }
289 | ```
290 |
291 | Example of adding other options:
292 |
293 | ```json
294 | "env": {
295 | "production": {
296 | "minify": true
297 | },
298 | "test": {
299 | "debug": true
300 | }
301 | }
302 | ```
303 |
304 | Useful when building a production build with `yarn build --env production`.
305 |
306 | Resolving is done in this order:
307 |
308 | * If in testing, use `test`
309 | * Try `--env` argument
310 | * Try `NODE_ENV` environment variable
311 | * Use `development`
312 |
313 | > Note: Is it not recommened to use the `development` environment. Instead, set the values to the root config.
314 |
315 | ### `debug`
316 |
317 | [boolean] Default: `false`
318 |
319 | * Prints configuration at start
320 | * Shows warnings in builds
321 |
--------------------------------------------------------------------------------
/docs/docs/configuration-prettier.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: configuration-prettier
3 | title: Configuration: Prettier
4 | sidebar_label: Prettier
5 | ---
6 |
7 | You may configure [Prettier](https://prettier.io) as you [normally would](https://prettier.io/docs/en/configuration.html).
8 |
9 | You may pass arguments to Prettier when using the `format` script:
10 |
11 | ```bash
12 | yarn format --use-tabs
13 | # or
14 | npm run format --use-tabs
15 | ```
16 |
--------------------------------------------------------------------------------
/docs/docs/create.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: create
3 | title: Create Noderize App
4 | sidebar_label: Create
5 | ---
6 |
7 | In the [introduction](introduction.md), we saw how to create a Noderize app using the `create-noderize` package.
8 |
9 | It is recommended you use the single-use script from the [introduction](introduction.md) as it will always be up-to-date. However, you can optionally install the command globally with:
10 |
11 | ```bash
12 | yarn global add create-noderize
13 | # or
14 | npm install -g create-noderize
15 |
16 | # then
17 | create-noderize
18 | ```
19 |
20 | Some arguments can be passed to this script to modify its behavior.
21 |
22 | ## Index
23 |
24 |
25 |
26 | ## Arguments
27 |
28 | ### `--typescript`
29 |
30 | This will set up a TypeScript project by:
31 |
32 | * Setting the [`language`](configuration-noderize.md#languages) option to `typescript`
33 | * Renaming `src/index.js` to `src/index.ts`
34 |
35 | ### `--forceNpm` & `---forceYarn`
36 |
37 | By default, Noderize uses Yarn if available. You may force the use of Yarn or npm.
38 |
--------------------------------------------------------------------------------
/docs/docs/examples.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: examples
3 | title: Examples
4 | ---
5 |
6 | See [examples](https://github.com/Cretezy/Noderize/tree/master/examples) of using Noderize.
7 |
8 | ## Index
9 |
10 | * [Basic Express](https://github.com/Cretezy/Noderize/tree/master/examples/basic-express) ([tutorial](tutorials-express.md))
11 |
12 | Example of basic server using Express.
13 |
14 | * [Basic TypeScript](https://github.com/Cretezy/Noderize/tree/master/examples/basic-typescript)
15 |
16 | Example of basic TypeScript project.
17 |
18 | * [Basic Tests](https://github.com/Cretezy/Noderize/tree/master/examples/basic-tests)
19 |
20 | Example of basic tests in JavaScript and TypeScript.
21 |
22 | * [Chat Socket React](https://github.com/Cretezy/Noderize/tree/master/examples/chat-socket-react)
23 |
24 | Example of a more complete app using React and Socket.IO for an example chat server.
25 |
--------------------------------------------------------------------------------
/docs/docs/features-flow.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-flow
3 | title: Feature: Flow
4 | sidebar_label: Flow
5 | ---
6 |
7 | [Flow](https://flow.org/) is a static type checker that adds types to JavaScript.
8 |
9 | Flow is built-in to Noderize. You simply have to add the `flow-bin` command to your project to start using it:
10 |
11 | ```bash
12 | yarn add -D flow-bin
13 | # or
14 | npm install -D flow-bin
15 | ```
16 |
17 | Then add a `scripts.flow` to `package.json` set to `flow` (optional if using Yarn, but nonetheless recommended):
18 |
19 | ```json
20 | "scripts": {
21 | "...": "...",
22 | "flow": "flow"
23 | }
24 | ```
25 |
26 | Then initialize Flow with:
27 |
28 | ```bash
29 | yarn flow init
30 | # or
31 | npm run flow init
32 | ```
33 |
34 | You may now start using Flow!
35 |
--------------------------------------------------------------------------------
/docs/docs/features-formatting.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-formatting
3 | title: Feature: Code Formatting
4 | sidebar_label: Code Formatting
5 | ---
6 |
7 | You may automatically format your code using:
8 |
9 | ```bash
10 | yarn format
11 | # or
12 | npm run format
13 | ```
14 |
15 | Formatting is code with [Prettier](https://prettier.io) and can be [configured](configuration-prettier.md).
16 |
--------------------------------------------------------------------------------
/docs/docs/features-index.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features
3 | title: Features
4 | sidebar_label: Index
5 | ---
6 |
7 | Noderize supports loads of exciting features.
8 |
9 | ## Index
10 |
11 | * [Modern JavaScript](features-modern.md)
12 | * [Flow](features-flow.md)
13 | * [TypeScript](features-typescript.md)
14 | * [Code Formatting](features-formatting.md)
15 | * [Testing](features-testing.md)
16 | * [Linting](features-linting.md)
17 |
--------------------------------------------------------------------------------
/docs/docs/features-linting.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-linting
3 | title: Feature: Linting
4 | sidebar_label: Linting
5 | ---
6 |
7 | To start using linting in Noderize, you can configure it using:
8 |
9 | ```bash
10 | yarn lint --init
11 | # or
12 | npm run lint --init
13 | ```
14 |
15 | Then use it with:
16 |
17 | ```bash
18 | yarn lint
19 | # or
20 | npm run lint
21 | ```
22 |
23 | > If running a version lower than v0.5.0, please upgrade, and add the `lint` script in your `package.json`:
24 | >
25 | > `"lint": "noderize-scripts lint"`
26 |
27 | Code linting is done using [ESlint](https://eslint.org).
28 |
--------------------------------------------------------------------------------
/docs/docs/features-modern.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-modern
3 | title: Feature: Modern JavaScript
4 | sidebar_label: Modern JavaScript
5 | ---
6 |
7 | Noderize enables the use of modern JavaScript out-of-the-box with Babel:
8 |
9 | * ES6, ES7, ES8.
10 | * Stage 3: Object rest/spread, async generator functions
11 | * Stage 2: Dynamic import, class properties
12 | * Decorators (stage 2 experimental)
13 |
--------------------------------------------------------------------------------
/docs/docs/features-testing.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-testing
3 | title: Feature: Testing
4 | sidebar_label: Testing
5 | ---
6 |
7 | You may test your code using:
8 |
9 | ```bash
10 | yarn test
11 | # or
12 | npm test
13 | ```
14 |
15 | Test is done with [Jest](https://facebook.github.io/jest) and can be [configured](configuration-jest.md).
16 |
--------------------------------------------------------------------------------
/docs/docs/features-typescript.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: features-typescript
3 | title: Feature: TypeScript
4 | sidebar_label: TypeScript
5 | ---
6 |
7 | TypeScript support is built in to Noderize.
8 |
9 | Simply set/add `typescript` to the [`languages`](configuration-noderize.md#languages) option.
10 |
11 | If you are not using JavaScript, you may want to remove the `javascript` languages for better build times.
12 |
13 | [See example](https://github.com/Cretezy/noderize/tree/master/examples/basic-typescript).
14 |
15 | ## Entry
16 |
17 | When only using the `typescript` [`language`](configuration-noderize.md#languages) option, the [`bundles`](configuration-noderize.md#bundles) option is automatically set to enter at `src/index.ts`.
18 |
19 | If you are also using other languages but want your entry file to be a TypeScript file, simply set the [`bundles`](configuration-noderize.md#bundles) option to enter `src/index.ts`.
20 |
21 | ## Features
22 |
23 | * Decorators
24 |
--------------------------------------------------------------------------------
/docs/docs/guides-firebase-functions.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides-firebase-functions
3 | title: Guide: Firebase Cloud Functions
4 | sidebar_label: Firebase Cloud Functions
5 | ---
6 |
7 | To deploy Firebase Cloud Functions, we must:
8 |
9 | * Create a Firebase project
10 | * Create a Noderize app
11 | * Configure
12 |
13 | ## Requirements
14 |
15 | You must set up the [Firebase CLI](https://github.com/firebase/firebase-tools) before setting up Functions.
16 |
17 | Quick Firebase CLI setup:
18 |
19 | ```bash
20 | yarn global add firebase-tools
21 | # or
22 | npm install -g firebase-tools
23 |
24 | # then
25 | firebase login
26 | ```
27 |
28 | ## Project Setup
29 |
30 | Create a directory to be used as your project root (for Firebase). Set up Firebase using `firebase init`, and **do not** select the Functions options when creating.
31 |
32 | Next, [create](create.md) a Noderize project inside your project root called `functions`.
33 |
34 | > Note: You may change the directory name (defaults to `functions`) with the `functions.source` key in `firebase.json`.
35 |
36 | ## Setup
37 |
38 | You will need to add the Firebase-specific dependencies and scripts.
39 |
40 | First, add the dependencies:
41 |
42 | ```bash
43 | yarn add firebase-admin firebase-functions
44 | # or
45 | npm install firebase-admin firebase-functions
46 | ```
47 |
48 | Next, add these scripts to your `package.json`:
49 |
50 | ```json
51 | {
52 | "scripts": {
53 | "...": "...",
54 | "prepack": "noderize-scripts clean && noderize-scripts build --env production",
55 | "preserve": "npm run build",
56 | "serve": "firebase serve --only functions",
57 | "predeploy": "npm run prepack",
58 | "deploy": "firebase deploy --only functions",
59 | "preshell": "npm run build",
60 | "shell": "firebase experimental:functions:shell",
61 | "logs": "firebase functions:log"
62 | }
63 | }
64 | ```
65 |
66 | This will allow you to use the `serve`, `deploy`, `logs`, and `shell` command from Firebase.
67 |
68 | Done!
69 |
70 | ## Demo
71 |
72 | Replace `src/index.js` by:
73 |
74 | ```js
75 | import { https } from "firebase-functions";
76 |
77 | export const test = https.onRequest((req, res) => {
78 | res.send("Hello world!");
79 | });
80 | ```
81 |
82 | Then run `yarn serve` or `npm run serve`. You will see it build, then serve the function. Clicking the function link will show `Hello world!`.
83 |
--------------------------------------------------------------------------------
/docs/docs/guides-google-functions.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides-google-functions
3 | title: Guide: Google Cloud Functions
4 | sidebar_label: Google Cloud Functions
5 | ---
6 |
7 | Deploy Google Cloud Functions is extremely simple with Noderize.
8 |
9 | You will need a Google Cloud account with billing and the Cloud Functions API enabled,
10 | and the [Google Cloud SDK](https://cloud.google.com/sdk/docs) installed.
11 |
12 | First, [create](create.md) a Noderize project and `cd` into it.
13 |
14 | Next, create a `.gcloudignore` file in the root of your project with the follow content:
15 |
16 | ```
17 | .gcloudignore
18 | .git
19 | .gitignore
20 | node_modules
21 | #!include:.gitignore
22 |
23 | !dist
24 | src
25 | ```
26 |
27 | Then, add a Function in your `src/index.js`:
28 |
29 | ```js
30 | export function helloWorld (req, res) {
31 | res.send('Hello World!');
32 | }
33 | ```
34 |
35 | [Build](scripts.md#build) your app with `yarn build` or `npm run build`,
36 | then deploy with `gcloud beta functions deploy helloWorld --trigger-http`
37 |
38 | This will take a minute or two, then output the app description.
39 |
40 | Open the link under `httpsTrigger.url`, and you will see:
41 |
42 | 
43 |
--------------------------------------------------------------------------------
/docs/docs/guides-heroku.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides-heroku
3 | title: Guide: Heroku
4 | sidebar_label: Heroku
5 | ---
6 |
7 | Deploying to Heroku is very simple:
8 |
9 | * Be in a Git repo (optional, `git init`)
10 | * Create a Heroku app using `heroku create [name]`
11 | * Move `@noderize/scripts` from `devDependencies` to `dependencies` in your `package.json`.
12 | * Add `heroku-postbuild` script in `package.json`:
13 | ```json
14 | {
15 | "scripts": {
16 | "...": "...",
17 | "heroku-postbuild": "noderize-scripts build --env production"
18 | }
19 | }
20 | ```
21 | * Deploy like normal (if in a Git repo, commit and push with `git push heroku master`)!
22 |
23 | This method also works for [Dokku](http://dokku.viewdocs.io/dokku/).
24 |
--------------------------------------------------------------------------------
/docs/docs/guides-migrate.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides-migrate
3 | title: Guide: Migrate
4 | sidebar_label: Migrate
5 | ---
6 |
7 | You can use Noderize with an existing project.
8 |
9 | * Move all your source into `src` or any [configured directory](configuration-noderize.md#srcdirectory).
10 | * Add `@noderize/scripts` and `@noderize/runtime` to your project:
11 | ```bash
12 | yarn add @noderize/runtime
13 | yarn add -D @noderize/scripts
14 | # or
15 | npm install @noderize/runtime
16 | npm install -D @noderize/scripts
17 | ```
18 | * Add your Noderize scripts (from the [template](https://github.com/Cretezy/Noderize/blob/master/packages/create/template/package.json)) and set `main`:
19 | ```json
20 | {
21 | "...": "...",
22 | "main": "dist/index.js"
23 | "scripts": {
24 | "watch": "noderize-scripts watch",
25 | "build": "noderize-scripts build",
26 | "start": "noderize-scripts start",
27 | "format": "noderize-scripts format",
28 | "test": "noderize-scripts test",
29 | "clean": "noderize-scripts clean"
30 | }
31 | }
32 | ```
33 | * If your entry is not at `src/index.js` (or whichever your source directory is, you will need to configure [`bundles`](configuration-noderize.md#bundles) (for building) and [`startFile`](configuration-noderize.md#startfile) (for `watch`/`start`).
34 |
35 | Try it out! Use the `build` command to see if it compiles.
36 |
37 | If everything works, you can throw away all your other tools' configuration!
38 |
--------------------------------------------------------------------------------
/docs/docs/guides-publishing.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides-publishing
3 | title: Guide: Publishing
4 | sidebar_label: Publishing
5 | ---
6 |
7 | Noderize allows you to publish your module on npm with no additional step.
8 |
9 | Make sure to remove `"private": true` from your `package.json`.
10 |
11 | You simply have to build then publish to the registry:
12 |
13 | ```bash
14 | yarn build --env production
15 | yarn publish
16 | # or
17 | npm run build --env production
18 | npm publish
19 | ```
20 |
21 | When publishing to npm, you want to:
22 |
23 | * `clean`: Clean the output directory of any leftover files that you don't wish to publish.
24 | * `build`: Build your app/library. Prefer using the production [`env`](configuration-noderize.md#env) for cleaner publishing code.
25 | * `publish`: Use npm or Yarn to publish to the registry.
26 |
27 | If you want to preview what your package will look like instead, use the `pack` command (`yarn pack` or `npm pack`). This will create a `.tgz` file which is identical to what is published.
28 |
29 | ## Files
30 |
31 | By default, npm/Yarn will include these [files](https://docs.npmjs.com/files/package.json#files):
32 |
33 | * package.json
34 | * README
35 | * CHANGES / CHANGELOG / HISTORY
36 | * LICENSE / LICENCE
37 | * NOTICE
38 | * The file in the "main" field
39 |
40 | When using multiple bundles and/or static files, we must indicate that the whole `dist` folder should be published (and optionally include `src` for human-readable code). Add to your `package.json`:
41 |
42 | ```json
43 | "files": ["src", "dist"],
44 | ```
45 |
46 | ## Automatic Cleaning & Building
47 |
48 | To automate cleaning and building before publishing, you want to add the `prepack` script to your `package.json` like so:
49 |
50 | ```json
51 | "scripts": {
52 | "...": "...",
53 | "prepack": "noderize-scripts clean && noderize-scripts build --env production"
54 | }
55 | ```
56 |
57 | When using `yarn publish` or `npm publish`, it will first clean, then build, then publish.
58 |
59 | ## Fat bundle
60 |
61 | To generate a "fat bundle" with all your code and dependencies included, set [`includeExternal`](configuration-noderize.md#includeexternal) to `true`.
62 |
63 | This will add all the code in your output bundle, resulting in a large size, but making it portable.
64 |
65 | This is not recommended and should never be used when publishing to npm.
66 |
--------------------------------------------------------------------------------
/docs/docs/guides.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: guides
3 | title: Guides
4 | sidebar_label: Index
5 | ---
6 |
7 | Guides for Noderize.
8 |
9 | ## Index
10 |
11 | * [Migrate](guides-migrate.md)
12 | * [Publishing](guides-publishing.md)
13 | * [Heroku](guides-heroku.md)
14 | * [Firebase Cloud Functions](guides-firebase-functions.md)
15 | * [Google Cloud Functions](guides-google-functions.md)
16 |
--------------------------------------------------------------------------------
/docs/docs/introduction.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: introduction
3 | title: Introduction
4 | ---
5 |
6 | Noderize lets you create Node apps in less than 30 seconds.
7 |
8 | The role of Noderize is to replace your build configuration for a batteries-included experience, focused on features and flexibility.
9 |
10 | It aims to get out of your way and not require any [configuration](configuration-index.md) until you need it, making it very simple to get started in a few seconds.
11 |
12 | Try it out for yourself:
13 |
14 | ```bash
15 | yarn create noderize
16 | # or
17 | npx create-noderize
18 | ```
19 |
20 | [See more `create-noderize` options](create.md).
21 |
22 | (Noderize requires Node 8+).
23 |
24 | ## Develop
25 |
26 | Once you have created your Noderize project, simply `cd` into it and you can run it for development using the `watch` script:
27 |
28 | ```bash
29 | yarn watch
30 | # or
31 | npm run watch
32 | ```
33 |
34 | This will continuously rebuild your app and rerun your app as you code!
35 |
36 | ## Build & Start
37 |
38 | You can build your app using the `build` script:
39 |
40 | ```bash
41 | yarn build
42 | # or
43 | npm run build
44 | ```
45 |
46 | This will build your app to `dist/index.js` (this output is optionally [configurable](configuration-noderize.md#output)).
47 |
48 | You can then run your file using the `start` script (for source map support) or using Node directly:
49 |
50 | ```bash
51 | yarn start
52 | # or
53 | npm start
54 | # or (no source map)
55 | node dist/index.js
56 | ```
57 |
58 | ## Additional Features
59 |
60 | Noderize is packed with [features](features-index.md) such as [modern JavaScript support](features-modern.md) and [TypeScript support](features-typescript.md).
61 |
62 | [Code formatting](features-formatting.md) ([`format` script](scripts.md#format)) and [testing](features-testing.md) ([`test` script](scripts.md#test)) is built-in and lets you get working on your high-quality code distraction-free.
63 |
--------------------------------------------------------------------------------
/docs/docs/scripts.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: scripts
3 | title: Noderize Scripts
4 | sidebar_label: Scripts
5 | ---
6 |
7 | Noderize comes with commands ("scripts") built-in. These scripts are automatically added to your `package.json` `scripts` field when using [`create-noderize`](create.md):
8 |
9 | ```json
10 | "scripts": {
11 | "watch": "noderize-scripts watch",
12 | "build": "noderize-scripts build",
13 | "start": "noderize-scripts start",
14 | "format": "noderize-scripts format",
15 | "test": "noderize-scripts test"
16 | }
17 | ```
18 |
19 | These scripts depend on `@noderize/scripts`.
20 |
21 | You can run Noderize's command like so:
22 |
23 | ```bash
24 | yarn