├── examples
├── .gitignore
├── basic-tests
│ ├── src
│ │ ├── sub.js
│ │ ├── add.ts
│ │ ├── add.test.ts
│ │ ├── sub.test.js
│ │ └── index.js
│ ├── README.md
│ ├── .gitignore
│ └── package.json
├── basic-typescript
│ ├── src
│ │ └── index.ts
│ ├── .gitignore
│ └── package.json
├── basic-cli
│ ├── img
│ │ ├── demo-greet.png
│ │ └── demo-fibonacci.png
│ ├── .gitignore
│ ├── README.md
│ ├── src
│ │ ├── greet.js
│ │ ├── index.js
│ │ └── fibonacci.js
│ └── package.json
├── basic-express
│ ├── img
│ │ ├── demo-1.png
│ │ ├── demo-2.png
│ │ └── demo-3.png
│ ├── .gitignore
│ ├── README.md
│ ├── src
│ │ └── index.js
│ └── package.json
└── chat-socket-react
│ ├── img
│ └── demo.png
│ ├── web
│ ├── public
│ │ ├── favicon.ico
│ │ ├── manifest.json
│ │ └── index.html
│ ├── src
│ │ ├── index.js
│ │ ├── UserIcon.js
│ │ ├── List.js
│ │ ├── UsersList.js
│ │ ├── MessageBox.js
│ │ ├── App.css
│ │ ├── MessagesList.js
│ │ ├── App.js
│ │ └── registerServiceWorker.js
│ ├── .gitignore
│ └── package.json
│ ├── server
│ ├── .gitignore
│ ├── src
│ │ ├── name.js
│ │ ├── index.js
│ │ ├── colors.json
│ │ └── animals.json
│ └── package.json
│ └── README.md
├── packages
├── create
│ ├── template
│ │ ├── src
│ │ │ └── index.js
│ │ ├── gitignore
│ │ └── package.json
│ ├── README.md
│ ├── .gitignore
│ ├── src
│ │ ├── index.js
│ │ └── run.js
│ ├── LICENSE
│ └── package.json
├── runtime
│ ├── README.md
│ ├── .gitignore
│ ├── package.json
│ └── LICENSE
└── scripts
│ ├── README.md
│ ├── .gitignore
│ ├── src
│ ├── tsconfig.json
│ ├── scripts
│ │ ├── clean.js
│ │ ├── lint.js
│ │ ├── build.js
│ │ ├── format.js
│ │ ├── start.js
│ │ ├── test.js
│ │ └── watch.js
│ ├── utils
│ │ ├── logger.js
│ │ └── path.js
│ ├── index.js
│ ├── jestTransformer.js
│ ├── createBabelConfig.js
│ ├── copy.js
│ ├── webpack.js
│ └── options.js
│ ├── LICENSE
│ └── package.json
├── docs
├── website
│ ├── .gitignore
│ ├── static
│ │ ├── img
│ │ │ ├── icon.png
│ │ │ ├── favicon
│ │ │ │ └── favicon.ico
│ │ │ ├── docs
│ │ │ │ ├── tutorials-cli-greet.png
│ │ │ │ ├── tutorials-express-1.png
│ │ │ │ ├── tutorials-express-2.png
│ │ │ │ ├── tutorials-express-3.png
│ │ │ │ ├── guides-google-functions.png
│ │ │ │ └── tutorials-cli-fibonacci.png
│ │ │ ├── fighter-jet.svg
│ │ │ ├── wrench.svg
│ │ │ ├── download.svg
│ │ │ ├── icon.svg
│ │ │ └── icon_text.svg
│ │ └── css
│ │ │ └── custom.css
│ ├── blog
│ │ └── 2018-02-09-path-to-v1.0.md
│ ├── package.json
│ ├── sidebars.json
│ ├── pages
│ │ └── en
│ │ │ ├── users.js-disabled
│ │ │ └── index.js
│ ├── siteConfig.js
│ ├── i18n
│ │ └── en.json
│ └── core
│ │ └── Footer.js
└── docs
│ ├── tutorials-index.md
│ ├── features-testing.md
│ ├── configuration-index.md
│ ├── guides.md
│ ├── features-formatting.md
│ ├── features-modern.md
│ ├── features-index.md
│ ├── configuration-prettier.md
│ ├── configuration-jest.md
│ ├── features-linting.md
│ ├── guides-heroku.md
│ ├── features-flow.md
│ ├── examples.md
│ ├── features-typescript.md
│ ├── create.md
│ ├── guides-google-functions.md
│ ├── guides-migrate.md
│ ├── introduction.md
│ ├── guides-publishing.md
│ ├── guides-firebase-functions.md
│ ├── scripts.md
│ ├── tutorials-express.md
│ ├── tutorials-cli.md
│ └── configuration-noderize.md
├── .gitignore
├── lerna.json
├── package.json
├── README.md
├── LICENSE
├── .travis.yml
└── CONTRIBUTING.md
/examples/.gitignore:
--------------------------------------------------------------------------------
1 | yarn.lock
--------------------------------------------------------------------------------
/packages/create/template/src/index.js:
--------------------------------------------------------------------------------
1 | console.log("Welcome to Noderize!");
2 |
--------------------------------------------------------------------------------
/examples/basic-tests/src/sub.js:
--------------------------------------------------------------------------------
1 | export function sub(x, y) {
2 | return x - y;
3 | }
4 |
--------------------------------------------------------------------------------
/docs/website/.gitignore:
--------------------------------------------------------------------------------
1 | translated_docs
2 | build
3 | yarn.lock
4 |
5 | i18n/*
6 | !i18n/en.json
7 |
--------------------------------------------------------------------------------
/examples/basic-typescript/src/index.ts:
--------------------------------------------------------------------------------
1 | console.log("Hello world from TypeScript in Noderize!");
2 |
--------------------------------------------------------------------------------
/examples/basic-tests/src/add.ts:
--------------------------------------------------------------------------------
1 | export function add(x: number, y: number) {
2 | return x + y;
3 | }
4 |
--------------------------------------------------------------------------------
/docs/website/static/img/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/icon.png
--------------------------------------------------------------------------------
/examples/basic-tests/README.md:
--------------------------------------------------------------------------------
1 | # Basic Tests
2 |
3 | Example of JavaScript and TypeScript working together with tests.
4 |
--------------------------------------------------------------------------------
/examples/basic-cli/img/demo-greet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/basic-cli/img/demo-greet.png
--------------------------------------------------------------------------------
/examples/basic-express/img/demo-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/basic-express/img/demo-1.png
--------------------------------------------------------------------------------
/examples/basic-express/img/demo-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/basic-express/img/demo-2.png
--------------------------------------------------------------------------------
/examples/basic-express/img/demo-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/basic-express/img/demo-3.png
--------------------------------------------------------------------------------
/examples/chat-socket-react/img/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/chat-socket-react/img/demo.png
--------------------------------------------------------------------------------
/docs/website/static/img/favicon/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/favicon/favicon.ico
--------------------------------------------------------------------------------
/examples/basic-cli/img/demo-fibonacci.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/basic-cli/img/demo-fibonacci.png
--------------------------------------------------------------------------------
/examples/basic-tests/src/add.test.ts:
--------------------------------------------------------------------------------
1 | import { add } from "./add";
2 |
3 | test("add 3 + 6 = 9", () => {
4 | expect(add(3, 6)).toBe(9);
5 | });
6 |
--------------------------------------------------------------------------------
/examples/basic-tests/src/sub.test.js:
--------------------------------------------------------------------------------
1 | import { sub } from "./sub";
2 |
3 | test("sub 9 - 6 = 3", () => {
4 | expect(sub(9, 6)).toBe(3);
5 | });
6 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/examples/chat-socket-react/web/public/favicon.ico
--------------------------------------------------------------------------------
/docs/website/static/img/docs/tutorials-cli-greet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/tutorials-cli-greet.png
--------------------------------------------------------------------------------
/docs/website/static/img/docs/tutorials-express-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/tutorials-express-1.png
--------------------------------------------------------------------------------
/docs/website/static/img/docs/tutorials-express-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/tutorials-express-2.png
--------------------------------------------------------------------------------
/docs/website/static/img/docs/tutorials-express-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/tutorials-express-3.png
--------------------------------------------------------------------------------
/docs/website/static/img/docs/guides-google-functions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/guides-google-functions.png
--------------------------------------------------------------------------------
/docs/website/static/img/docs/tutorials-cli-fibonacci.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Cretezy/Noderize/HEAD/docs/website/static/img/docs/tutorials-cli-fibonacci.png
--------------------------------------------------------------------------------
/packages/create/README.md:
--------------------------------------------------------------------------------
1 | # Create Noderize
2 |
3 | > Part of [Noderize](https://github.com/Cretezy/Noderize).
4 |
5 | > [Documentation](https://noderize.js.org).
6 |
--------------------------------------------------------------------------------
/.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
--------------------------------------------------------------------------------
/packages/runtime/README.md:
--------------------------------------------------------------------------------
1 | # Create Noderize
2 |
3 | > Part of [Noderize](https://github.com/Cretezy/Noderize).
4 |
5 | > [Documentation](https://noderize.js.org).
6 |
--------------------------------------------------------------------------------
/packages/scripts/README.md:
--------------------------------------------------------------------------------
1 | # Noderize Scripts
2 |
3 | > Part of [Noderize](https://github.com/Cretezy/Noderize).
4 |
5 | > [Documentation](https://noderize.js.org).
6 |
--------------------------------------------------------------------------------
/lerna.json:
--------------------------------------------------------------------------------
1 | {
2 | "lerna": "2.11.0",
3 | "packages": [
4 | "packages/*"
5 | ],
6 | "version": "0.7.4",
7 | "npmClient": "yarn",
8 | "useWorkspaces": true
9 | }
10 |
--------------------------------------------------------------------------------
/packages/create/.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
--------------------------------------------------------------------------------
/examples/basic-cli/.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
--------------------------------------------------------------------------------
/examples/basic-tests/src/index.js:
--------------------------------------------------------------------------------
1 | import { add } from "./add";
2 | import { sub } from "./sub";
3 |
4 | console.log(`12 + 7 = ${add(12, 7)}`);
5 | console.log(`12 - 7 = ${sub(12, 7)}`);
6 |
--------------------------------------------------------------------------------
/packages/runtime/.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
--------------------------------------------------------------------------------
/packages/scripts/.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
--------------------------------------------------------------------------------
/examples/basic-express/.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
--------------------------------------------------------------------------------
/examples/basic-tests/.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
--------------------------------------------------------------------------------
/packages/create/template/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
--------------------------------------------------------------------------------
/examples/basic-typescript/.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
--------------------------------------------------------------------------------
/examples/chat-socket-react/server/.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
--------------------------------------------------------------------------------
/examples/basic-cli/README.md:
--------------------------------------------------------------------------------
1 | # Basic CLI
2 |
3 | Basic CLI with 2 sub-commands:
4 |
5 | * `greet`
6 | * `fibonacci`
7 |
8 | 
9 |
10 | 
11 |
--------------------------------------------------------------------------------
/docs/docs/tutorials-index.md:
--------------------------------------------------------------------------------
1 | ---
2 | id: tutorials
3 | title: Tutorials
4 | sidebar_label: Index
5 | ---
6 |
7 | Tutorials on using Noderize.
8 |
9 | ## Index
10 |
11 | * [Express](tutorials-express.md)
12 | * [CLI](tutorials-cli.md)
13 |
--------------------------------------------------------------------------------
/packages/create/src/index.js:
--------------------------------------------------------------------------------
1 | import { run } from "./run";
2 | import parseArgs from "minimist";
3 |
4 | // Parse args
5 | const args = parseArgs(process.argv.slice(2));
6 | const name = args._.length > 0 ? args._[0] : null;
7 |
8 | run(name, args);
9 |
--------------------------------------------------------------------------------
/docs/website/blog/2018-02-09-path-to-v1.0.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Draft: Path to Noderize v1.0
3 | author: Charles Crete
4 | authorURL: http://twitter.com/Cretezy
5 | ---
6 |
7 | Plans for v1.0.
8 |
9 |
10 |
11 | ```js
12 | // TODO
13 | ```
14 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import App from "./App";
4 | import registerServiceWorker from "./registerServiceWorker";
5 |
6 | ReactDOM.render(, document.getElementById("root"));
7 | registerServiceWorker();
8 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/packages/scripts/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "noImplicitAny": true,
4 | "module": "commonjs",
5 | "moduleResolution": "node",
6 | "target": "es5",
7 | "lib": ["es5", "es6", "dom"],
8 | "experimentalDecorators": true
9 | },
10 | "exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts", "__tests__"]
11 | }
12 |
--------------------------------------------------------------------------------
/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/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 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/server/src/name.js:
--------------------------------------------------------------------------------
1 | import colors from "./colors.json";
2 | import animals from "./animals.json";
3 |
4 | // Generate a random name
5 | export function generateName() {
6 | const color = colors[Math.floor(Math.random() * colors.length)];
7 | const animal = animals[Math.floor(Math.random() * colors.length)];
8 | return `${color} ${animal}`;
9 | }
10 |
--------------------------------------------------------------------------------
/examples/basic-cli/src/greet.js:
--------------------------------------------------------------------------------
1 | import inquirer from "inquirer";
2 | import chalk from "chalk";
3 |
4 | export default async name => {
5 | if (name === undefined) {
6 | const answers = await inquirer.prompt([
7 | { name: "name", message: "What is your name?" }
8 | ]);
9 | name = answers.name;
10 | }
11 |
12 | console.log(`Hello ${chalk.blueBright(name)}!`);
13 | };
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/UserIcon.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | // Render a icon with the color of the user
4 | export function UserIcon({ user }) {
5 | const style = {
6 | display: "inline-block",
7 | borderRadius: "50%",
8 | width: "10px",
9 | height: "10px",
10 | backgroundColor: user.split(" ")[0]
11 | };
12 |
13 | return ;
14 | }
15 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Noderize Chat",
3 | "name": "Noderize Chat Socket Example",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "/",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/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/website/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "examples": "docusaurus-examples",
4 | "start": "docusaurus-start",
5 | "build": "docusaurus-build",
6 | "publish-gh-pages": "docusaurus-publish",
7 | "write-translations": "docusaurus-write-translations",
8 | "version": "docusaurus-version",
9 | "rename-version": "docusaurus-rename-version"
10 | },
11 | "devDependencies": {
12 | "docusaurus": "^1.0.5"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/examples/basic-express/README.md:
--------------------------------------------------------------------------------
1 | # Basic Express
2 |
3 | Example of basic server using Express.
4 |
5 | [Demo](https://noderize-basic-express.herokuapp.com).
6 |
7 | [](https://noderize-basic-express.herokuapp.com)
8 |
9 | [](https://noderize-basic-express.herokuapp.com/greet)
10 |
11 | [](https://noderize-basic-express.herokuapp.com/greet?name=Charles)
12 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/List.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { UserIcon } from "./UserIcon";
3 |
4 | // List with user icons
5 | export function List({ itemKeys, items }) {
6 | return (
7 |
8 | {items.map(({ user, item, key }) => (
9 |
10 | {item}
11 |
12 | ))}
13 |
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/packages/create/template/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.1.0",
3 | "private": true,
4 | "main": "dist/index.js",
5 | "scripts": {
6 | "watch": "noderize-scripts watch",
7 | "build": "noderize-scripts build",
8 | "start": "noderize-scripts start",
9 | "format": "noderize-scripts format",
10 | "test": "noderize-scripts test",
11 | "lint": "noderize-scripts lint",
12 | "clean": "noderize-scripts clean"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/examples/basic-express/src/index.js:
--------------------------------------------------------------------------------
1 | import express from "express";
2 |
3 | const app = express();
4 | const port = parseInt(process.env.PORT) || 3000;
5 |
6 | app.get("/", (req, res) => {
7 | res.send("Hello from Noderize!");
8 | });
9 |
10 | app.get("/greet", (req, res) => {
11 | res.send(`Hello ${req.query.name || "world"}!`);
12 | });
13 |
14 | app.listen(port, () => {
15 | console.log(`Listening at http://localhost:${port}`);
16 | });
17 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/UsersList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { List } from "./List";
3 |
4 | export class UsersList extends React.PureComponent {
5 | render() {
6 | return (
7 |
8 |
Connected users:
9 |
({
12 | user,
13 | item: user,
14 | key: user
15 | }))}
16 | />
17 |
18 | );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/README.md:
--------------------------------------------------------------------------------
1 | # Chat Socket with React
2 |
3 | A more complete example of a simply chat server with React as a front-end
4 |
5 | * [Noderize](https://noderize.js.org)
6 | * [React](https://reactjs.org/) (with [`create-react-app`](https://github.com/facebook/create-react-app)
7 | * [Socket.IO](https://socket.io)
8 |
9 | [Demo](https://noderize-chat-socket-react.surge.sh/).
10 |
11 | [](https://noderize-chat-socket-react.surge.sh/)
12 |
--------------------------------------------------------------------------------
/packages/runtime/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@noderize/runtime",
3 | "description": "Runtime to use with Noderize.",
4 | "author": "Charles Crete ",
5 | "homepage": "https://github.com/Cretezy/Noderize/tree/master/packages/runtime",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/Cretezy/Noderize.git"
9 | },
10 | "version": "0.7.5",
11 | "license": "MIT",
12 | "dependencies": {
13 | "@babel/runtime-corejs2": "^7.0.0-beta.56"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "web",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "react": "^16.2.0",
7 | "react-dom": "^16.2.0",
8 | "react-scripts": "1.1.1",
9 | "socket.io-client": "^2.0.4"
10 | },
11 | "scripts": {
12 | "start": "react-scripts start",
13 | "build": "react-scripts build",
14 | "test": "react-scripts test --env=jsdom",
15 | "eject": "react-scripts eject"
16 | },
17 | "proxy": "http://localhost:3001"
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "noderize",
3 | "description": "Create a Node app in less than 30 seconds.",
4 | "author": "Charles Crete {
11 | console.log(chalk.yellowBright("\n Command not found"));
12 | program.outputHelp();
13 | process.exit(1);
14 | });
15 |
16 | program.parse(process.argv);
17 |
18 | if (!process.argv.slice(2).length) {
19 | program.outputHelp();
20 | }
21 |
--------------------------------------------------------------------------------
/examples/basic-typescript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "basic-typescript",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "watch": "noderize-scripts watch",
7 | "test": "noderize-scripts test",
8 | "format": "noderize-scripts format",
9 | "build": "noderize-scripts build",
10 | "start": "noderize-scripts start"
11 | },
12 | "noderize": {
13 | "languages": "typescript"
14 | },
15 | "devDependencies": {
16 | "@noderize/scripts": "^0.3.11"
17 | },
18 | "dependencies": {
19 | "@noderize/runtime": "^0.3.11"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/examples/basic-tests/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "basic-tests",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "watch": "noderize-scripts watch",
7 | "test": "noderize-scripts test",
8 | "format": "noderize-scripts format",
9 | "build": "noderize-scripts build",
10 | "start": "noderize-scripts start"
11 | },
12 | "noderize": {
13 | "languages": ["javascript", "typescript"]
14 | },
15 | "devDependencies": {
16 | "@noderize/scripts": "^0.3.11"
17 | },
18 | "dependencies": {
19 | "@noderize/runtime": "^0.3.11"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/clean.js:
--------------------------------------------------------------------------------
1 | import { getOptions } from "../options";
2 | import { resolveApp } from "../utils/path";
3 | import fs from "fs-extra";
4 | import { cleanLogger as log } from "../utils/logger";
5 |
6 | export default async args => {
7 | log.start("Cleaning...");
8 |
9 | const options = getOptions(null);
10 |
11 | try {
12 | await fs.remove(resolveApp(options.distDirectory));
13 |
14 | log.success("Done cleaning!");
15 | } catch (error) {
16 | log.error("Error deleting files.");
17 | log.error(error);
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/examples/basic-cli/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "basic-cli",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "watch": "noderize-scripts watch",
7 | "test": "noderize-scripts test",
8 | "format": "noderize-scripts format",
9 | "build": "noderize-scripts build",
10 | "start": "noderize-scripts start"
11 | },
12 | "devDependencies": {
13 | "@noderize/scripts": "^0.3.11"
14 | },
15 | "dependencies": {
16 | "@noderize/runtime": "^0.3.11",
17 | "chalk": "^2.3.0",
18 | "commander": "^2.14.1",
19 | "inquirer": "^5.1.0"
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/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/website/static/img/fighter-jet.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/lint.js:
--------------------------------------------------------------------------------
1 | import { appDirectory, getBinPath } from "../utils/path";
2 | import spawn from "cross-spawn";
3 | import { lintLogger as log } from "../utils/logger";
4 |
5 | export default async (args, fullArgs) => {
6 | // TODO: add better linting support
7 | log.start("Linting...");
8 |
9 | const eslintPath = await getBinPath("eslint");
10 |
11 | const child = spawn(fullArgs[0], [eslintPath, ...args], {
12 | cwd: appDirectory,
13 | stdio: "inherit"
14 | });
15 |
16 | child.on("exit", code => {
17 | const message = "Done linting!";
18 |
19 | (code === 0 ? log.success : log.warn)(message);
20 | });
21 | };
22 |
--------------------------------------------------------------------------------
/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/website/static/img/wrench.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/packages/scripts/src/utils/logger.js:
--------------------------------------------------------------------------------
1 | import consola from "consola";
2 |
3 | export const appLogger = consola.withScope("app");
4 | export const buildLogger = consola.withScope("build");
5 | export const configLogger = consola.withScope("config");
6 | export const copyLogger = consola.withScope("copy");
7 | export const cleanLogger = consola.withScope("clean");
8 | export const formatLogger = consola.withScope("format");
9 | export const lintLogger = consola.withScope("lint");
10 | export const startLogger = consola.withScope("start");
11 | export const testLogger = consola.withScope("test");
12 | export const watchLogger = consola.withScope("watch");
13 |
14 | export function printLines(printMethod, lines, prefix = "") {
15 | lines.split("\n").forEach(line => printMethod(`${prefix}${line}`));
16 | }
17 |
--------------------------------------------------------------------------------
/packages/scripts/src/utils/path.js:
--------------------------------------------------------------------------------
1 | import fs from "fs-extra";
2 | import { resolve } from "path";
3 |
4 | export const appDirectory = fs.realpathSync(process.cwd());
5 | export const resolveApp = (...relativePath) =>
6 | resolve(appDirectory, ...relativePath);
7 |
8 | export async function getBinPath(bin) {
9 | const local = resolve(
10 | __dirname,
11 | "..", // scripts
12 | "node_modules",
13 | ".bin",
14 | bin
15 | );
16 | if (await fs.exists(local)) {
17 | return local;
18 | }
19 |
20 | const global = resolve(
21 | __dirname,
22 | "..", // scripts
23 | "..", // @noderize
24 | "..", // node_modules
25 | ".bin",
26 | bin
27 | );
28 |
29 | if (await fs.exists(global)) {
30 | return global;
31 | }
32 |
33 | return null;
34 | }
35 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/MessageBox.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export class MessageBox extends React.PureComponent {
4 | state = {
5 | text: ""
6 | };
7 |
8 | onSubmit = event => {
9 | event.preventDefault();
10 |
11 | const { text } = this.state;
12 | // Don't send empty message
13 | if (text) {
14 | // Send
15 | this.props.onSend(text);
16 | // Reset
17 | this.setState({ text: "" });
18 | }
19 | };
20 |
21 | onTextChange = event => {
22 | this.setState({ text: event.target.value });
23 | };
24 |
25 | render() {
26 | return (
27 |
28 |
32 |
33 | );
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/docs/website/sidebars.json:
--------------------------------------------------------------------------------
1 | {
2 | "docs": {
3 | "Get Started": [
4 | "introduction",
5 | "create",
6 | "scripts",
7 | "examples"
8 | ],
9 | "Configuration": [
10 | "configuration",
11 | "configuration-noderize",
12 | "configuration-prettier",
13 | "configuration-jest"
14 | ],
15 | "Features": [
16 | "features",
17 | "features-modern",
18 | "features-flow",
19 | "features-typescript",
20 | "features-formatting",
21 | "features-testing",
22 | "features-linting"
23 | ],
24 | "Guides": [
25 | "guides",
26 | "guides-migrate",
27 | "guides-publishing",
28 | "guides-heroku",
29 | "guides-firebase-functions",
30 | "guides-google-functions"
31 | ],
32 | "Tutorials": [
33 | "tutorials",
34 | "tutorials-express",
35 | "tutorials-cli"
36 | ]
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/App.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | margin: 25px 5px;
3 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
4 | height: 100vh;
5 | }
6 |
7 | #app {
8 | max-width: 700px;
9 | width: 100%;
10 | margin: 0 auto;
11 | }
12 |
13 | #messages {
14 | height: 500px;
15 | overflow-y: auto;
16 | }
17 |
18 | #sidebar {
19 | grid-area: sidebar;
20 | border-bottom: #2e2e2e solid 1px;
21 | }
22 |
23 | #content {
24 | grid-area: content;
25 | }
26 |
27 | #grid {
28 | display: grid;
29 | grid-gap: 20px;
30 | grid-template-areas: "sidebar" "content"
31 | }
32 |
33 | @media (min-width: 700px) {
34 | #grid {
35 | grid-template-columns: 3fr 1fr;
36 | grid-template-areas: "content sidebar"
37 | }
38 |
39 | #sidebar {
40 | border-bottom: none;
41 | }
42 | }
--------------------------------------------------------------------------------
/packages/scripts/src/index.js:
--------------------------------------------------------------------------------
1 | import build from "./scripts/build";
2 | import start from "./scripts/start";
3 | import test from "./scripts/test";
4 | import watch from "./scripts/watch";
5 | import format from "./scripts/format";
6 | import clean from "./scripts/clean";
7 | import lint from "./scripts/lint";
8 | import { appLogger as log } from "./utils/logger";
9 | import packageJson from "../package.json";
10 |
11 | const commands = {
12 | build,
13 | test,
14 | watch,
15 | format,
16 | start,
17 | clean,
18 | lint
19 | };
20 |
21 | const args = process.argv.slice(2);
22 |
23 | const script = args.shift();
24 |
25 | log.info(`Noderize version ${packageJson.version}`);
26 |
27 | if (!Object.keys(commands).includes(script)) {
28 | log.warn(`Unknown script.`);
29 | process.exit(1);
30 | } else {
31 | commands[script](args, process.argv);
32 | }
33 |
--------------------------------------------------------------------------------
/docs/website/static/img/download.svg:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/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/website/static/css/custom.css:
--------------------------------------------------------------------------------
1 | .mainContainer .wrapper a,
2 | .inner .projectIntro a {
3 | text-decoration: underline;
4 | text-decoration-color: #abbdcd !important;
5 | }
6 |
7 | .mainContainer .wrapper a:hover,
8 | .mainContainer .wrapper a:focus,
9 | .inner .projectIntro a:hover,
10 | .inner .projectIntro a:focus {
11 | text-decoration: underline;
12 | text-decoration-color: #343a40 !important;
13 | }
14 |
15 | #feature .blockImage > img {
16 | height: 40px;
17 | }
18 |
19 | @media only screen and (min-device-width: 360px) and (max-device-width: 736px) {
20 | }
21 |
22 | @media only screen and (min-width: 736px) {
23 | #feature .blockImage > img {
24 | height: 50px;
25 | }
26 | }
27 |
28 | @media only screen and (max-width: 1023px) {
29 | }
30 |
31 | @media only screen and (min-width: 1400px) {
32 | }
33 |
34 | @media only screen and (min-width: 1500px) {
35 | }
36 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/MessagesList.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { List } from "./List";
3 |
4 | export class MessagesList extends React.PureComponent {
5 | list;
6 |
7 | render() {
8 | return (
9 |
10 |
Messages:
11 |
(this.list = ref)}>
12 | {
15 | let message;
16 | switch (type) {
17 | case "join":
18 | case "leave":
19 | message = `${user} ${type === "join" ? "joined" : "left"}!`;
20 | break;
21 | case "message":
22 | const { text } = data;
23 | message = `${user}: ${text}`;
24 | break;
25 | }
26 | return { key: id, user, item: message };
27 | })}
28 | />
29 |
30 |
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/packages/scripts/src/jestTransformer.js:
--------------------------------------------------------------------------------
1 | import { createTransformer } from "babel-jest";
2 |
3 | import createBabelConfig from "./createBabelConfig";
4 | import typescript from "typescript";
5 | import tsConfig from "./tsconfig.json";
6 | import { getOptions } from "./options";
7 |
8 | const options = getOptions(null, "test");
9 |
10 | export function process(src, path, ...rest) {
11 | const isTypeScript = path.endsWith(".ts");
12 | const isJavaScript = path.endsWith(".js");
13 |
14 | if (isTypeScript && options.languages.typescript) {
15 | src = typescript.transpile(src, tsConfig.compilerOptions, path, []);
16 | }
17 |
18 | if (isJavaScript || isTypeScript) {
19 | // Must use a temporary file name if TypeScript.
20 | const fileName = isJavaScript ? path : "file.js";
21 |
22 | src = createTransformer({
23 | ...createBabelConfig(options)
24 | }).process(src, fileName, ...rest);
25 | }
26 |
27 | return src;
28 | }
29 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/packages/scripts/src/createBabelConfig.js:
--------------------------------------------------------------------------------
1 | export default ({
2 | targets,
3 | babel: { presets = [], plugins = [] },
4 | runtime = "include"
5 | } = {}) => ({
6 | presets: [
7 | [
8 | "@babel/preset-env",
9 | {
10 | targets
11 | }
12 | ],
13 |
14 | "@babel/preset-flow",
15 | ...presets
16 | ],
17 | plugins: [
18 | ["@babel/plugin-proposal-decorators", { legacy: true }],
19 | "@babel/plugin-proposal-function-sent",
20 | "@babel/plugin-proposal-export-namespace-from",
21 | "@babel/plugin-proposal-numeric-separator",
22 | "@babel/plugin-proposal-throw-expressions",
23 | "@babel/plugin-syntax-dynamic-import",
24 | "@babel/plugin-syntax-import-meta",
25 | ["@babel/plugin-proposal-class-properties", { loose: false }],
26 | "@babel/plugin-proposal-json-strings",
27 | (runtime === "noderize" || runtime === "include") && [
28 | "@babel/plugin-transform-runtime",
29 | { corejs: 2 }
30 | ],
31 | ...plugins
32 | ].filter(Boolean)
33 | });
34 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/build.js:
--------------------------------------------------------------------------------
1 | import { getOptions } from "../options";
2 | import { getCompiler, printStats } from "../webpack";
3 | import { copyAll } from "../copy";
4 | import { buildLogger as log } from "../utils/logger";
5 |
6 | export default async args => {
7 | log.start("Building...");
8 | console.log();
9 |
10 | const options = getOptions(args);
11 |
12 | const compiler = await getCompiler(options);
13 |
14 | try {
15 | const stats = await new Promise((resolve, reject) => {
16 | compiler.run((err, stats) => {
17 | if (err) {
18 | reject(err);
19 | } else {
20 | resolve(stats);
21 | }
22 | });
23 | });
24 |
25 | printStats(stats, options);
26 | console.log();
27 |
28 | // Copy
29 | if (Object.keys(options.static).length > 0) {
30 | await copyAll(options.static, options);
31 | console.log();
32 | }
33 |
34 | log.success("Done building!");
35 | } catch (error) {
36 | log.error("Error building.");
37 | log.error(error);
38 | }
39 | };
40 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/format.js:
--------------------------------------------------------------------------------
1 | import path from "path";
2 | import { getOptions } from "../options";
3 | import { appDirectory, getBinPath } from "../utils/path";
4 | import spawn from "cross-spawn";
5 | import { formatLogger as log } from "../utils/logger";
6 |
7 | export default async (args, fullArgs) => {
8 | log.start("Formatting...");
9 |
10 | const options = getOptions(null);
11 |
12 | const srcPrefixed = ["**/*.ts", "**/*.js", "**/*.json"].map(file =>
13 | path.join(options.srcDirectory, file)
14 | );
15 | const files = [...srcPrefixed, "package.json"];
16 |
17 | const prettierPath = await getBinPath("prettier");
18 |
19 | const child = spawn(
20 | fullArgs[0],
21 | [prettierPath, "--write", ...files, ...args],
22 | {
23 | cwd: appDirectory,
24 | stdio: "inherit"
25 | }
26 | );
27 |
28 | child.on("exit", code => {
29 | const message = "Done formatting!";
30 |
31 | (code === 0 ? log.success : log.warn)(message);
32 | // Exit Noderize process with Jest exit code
33 | process.exit(code);
34 | });
35 | };
36 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/packages/create/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.
--------------------------------------------------------------------------------
/packages/runtime/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.
--------------------------------------------------------------------------------
/packages/scripts/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.
--------------------------------------------------------------------------------
/packages/create/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create-noderize",
3 | "description": "Create a Node app in less than 30 seconds.",
4 | "author": "Charles Crete ",
5 | "homepage": "https://github.com/Cretezy/Noderize/tree/master/packages/create",
6 | "repository": {
7 | "type": "git",
8 | "url": "https://github.com/Cretezy/Noderize.git"
9 | },
10 | "version": "0.7.5",
11 | "license": "MIT",
12 | "bin": "dist/index.js",
13 | "files": [
14 | "src",
15 | "dist",
16 | "template"
17 | ],
18 | "scripts": {
19 | "watch": "noderize-scripts watch",
20 | "build": "noderize-scripts build",
21 | "start": "noderize-scripts start",
22 | "format": "noderize-scripts format",
23 | "test": "noderize-scripts test",
24 | "lint": "noderize-scripts lint",
25 | "clean": "noderize-scripts clean",
26 | "prepare": "npm run clean && npm run build -- --env production"
27 | },
28 | "dependencies": {
29 | "@noderize/runtime": "^0.7.5",
30 | "consola": "^1.3.0",
31 | "fs-extra": "^7.0.0",
32 | "minimist": "^1.2.0"
33 | },
34 | "devDependencies": {
35 | "@noderize/scripts": "^0.7.5",
36 | "source-map-support": "^0.5.5"
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/packages/scripts/src/copy.js:
--------------------------------------------------------------------------------
1 | import { resolveApp } from "./utils/path";
2 | import fs from "fs-extra";
3 | import { copyLogger as log } from "./utils/logger";
4 |
5 | export async function copyAll(files, options) {
6 | await Promise.all(
7 | Object.keys(files).map(async source => {
8 | const destination = files[source];
9 |
10 | await copyFile(source, destination, options);
11 | })
12 | );
13 | }
14 |
15 | export async function copyFile(source, destination, options) {
16 | try {
17 | await fs.copy(
18 | resolveApp(options.srcDirectory, source),
19 | resolveApp(options.distDirectory, destination)
20 | );
21 |
22 | log.info(
23 | `Copied ${options.srcDirectory}/${source} to ${
24 | options.distDirectory
25 | }/${destination}!`
26 | );
27 | } catch (error) {
28 | if (error.code === "ENOENT") {
29 | log.error(`Could not find ${options.srcDirectory}/${source}.`);
30 | } else {
31 | log.error(
32 | `Error copying ${options.srcDirectory}/${source} to ${
33 | options.distDirectory
34 | }/${destination}.`
35 | );
36 | log.error(error);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/examples/basic-cli/src/fibonacci.js:
--------------------------------------------------------------------------------
1 | import inquirer from "inquirer";
2 | import chalk from "chalk";
3 |
4 | export default async n => {
5 | if (n === undefined) {
6 | const answers = await inquirer.prompt([
7 | {
8 | name: "n",
9 | message: "N?",
10 | validate(value) {
11 | if (/^\d+$/.test(value)) {
12 | // Is a number
13 | return true;
14 | } else {
15 | // Error message
16 | return "Value of n is not a positive integer.";
17 | }
18 | }
19 | }
20 | ]);
21 | n = answers.n;
22 | }
23 |
24 | n = parseInt(n);
25 |
26 | if (isNaN(n) || n < 1) {
27 | console.log(chalk.yellowBright("Value of n is not a positive integer."));
28 | process.exit(1);
29 | }
30 |
31 | const value = fibonacci(n);
32 | console.log(
33 | `Fibonacci for n=${chalk.blueBright(n)} = ${chalk.blueBright(value)}!`
34 | );
35 | };
36 |
37 | // High performance fibonacci from https://medium.com/developers-writing/fibonacci-sequence-algorithm-in-javascript-b253dc7e320e
38 | function fibonacci(num, memo = {}) {
39 | if (memo[num]) return memo[num];
40 | if (num <= 1) return 1;
41 |
42 | return (memo[num] = fibonacci(num - 1, memo) + fibonacci(num - 2, memo));
43 | }
44 |
--------------------------------------------------------------------------------
/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-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 |
--------------------------------------------------------------------------------
/.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
--------------------------------------------------------------------------------
/docs/website/pages/en/users.js-disabled:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | const React = require('react');
9 |
10 | const CompLibrary = require('../../core/CompLibrary.js');
11 | const Container = CompLibrary.Container;
12 |
13 | const siteConfig = require(process.cwd() + '/siteConfig.js');
14 |
15 | class Users extends React.Component {
16 | render() {
17 | const showcase = siteConfig.users.map((user, i) => {
18 | return (
19 |
20 |
21 |
22 | );
23 | });
24 |
25 | return (
26 |
27 |
28 |
29 |
30 |
Who's Using This?
31 |
This project is used by many folks
32 |
33 |
{showcase}
34 |
Are you using this project?
35 |
38 | Add your company
39 |
40 |
41 |
42 |
43 | );
44 | }
45 | }
46 |
47 | module.exports = Users;
48 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/start.js:
--------------------------------------------------------------------------------
1 | import spawn from "cross-spawn";
2 | import { getOptions } from "../options";
3 | import { appDirectory } from "../utils/path";
4 | import fs from "fs-extra";
5 | import { startLogger as log } from "../utils/logger";
6 |
7 | export default async args => {
8 | await start(getOptions(args));
9 | };
10 |
11 | export async function start(options, nodePath = process.argv[0]) {
12 | log.start("Starting...");
13 | console.log(); // Padding
14 |
15 | const startFileExists = await fs.exists(options.startFile);
16 | if (!startFileExists) {
17 | log.error("Start file does not exists.");
18 | return;
19 | }
20 |
21 | const args = [options.startFile, ...options.args._];
22 | const execArgv = ["-r", "source-map-support/register"];
23 |
24 | // Enable V8 debugger
25 | if (options.inspect) {
26 | args.unshift("inspect");
27 | }
28 | // Enable Chrome DevTools debugger
29 | if (options.inspectChrome) {
30 | execArgv.push(`--inspect=${options.inspectChrome}`);
31 | }
32 |
33 | const child = spawn(nodePath, [...execArgv, ...args], {
34 | cwd: appDirectory,
35 | stdio: "inherit"
36 | });
37 |
38 | child.on("exit", (code, signal) => {
39 | if (code !== null) {
40 | console.log(); // Padding
41 | if (code === 0) {
42 | log.success("Exited gracefully!");
43 | } else {
44 | log.warn(
45 | `Exited with code ${code} ${signal ? `and signal ${signal}` : ""}`
46 | );
47 | }
48 | }
49 | });
50 |
51 | return child;
52 | }
53 |
--------------------------------------------------------------------------------
/docs/website/siteConfig.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2017-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | /* List of projects/orgs using your project for the users page */
9 | // const users = [
10 | // {
11 | // caption: 'User1',
12 | // image: '/test-site/img/docusaurus.svg',
13 | // infoLink: 'https://www.facebook.com',
14 | // pinned: true,
15 | // },
16 | // ];
17 |
18 | const siteConfig = {
19 | title: "Noderize",
20 | tagline: " Create a Node app in less than 30 seconds.",
21 | url: "https://noderize.js.org",
22 | baseUrl: "/",
23 | headerLinks: [
24 | { doc: "introduction", label: "Docs" },
25 | // { blog: true, label: "Blog" },
26 | { href: "https://github.com/Cretezy/Noderize", label: "GitHub" }
27 | ],
28 | // users,
29 | headerIcon: "img/icon.svg",
30 | footerIcon: "img/icon.svg",
31 | favicon: "img/favicon/favicon.ico",
32 | colors: {
33 | primaryColor: "#3d434b",
34 | secondaryColor: "#fed766"
35 | },
36 |
37 | copyright: `Copyright © ${new Date().getFullYear()} Charles Crete`,
38 | organizationName: "Cretezy",
39 | projectName: "Noderize",
40 |
41 | highlight: {
42 | // Highlight.js theme to use for syntax highlighting in code blocks
43 | theme: "default"
44 | },
45 |
46 | scripts: ["https://buttons.github.io/buttons.js"],
47 | repoUrl: "https://github.com/Cretezy/Noderize",
48 | cname: "noderize.js.org",
49 | algolia: {
50 | apiKey: "ca0d50cdf7792b2eeaf3807f2a81cdde",
51 | indexName: "noderize"
52 | },
53 | };
54 |
55 | module.exports = siteConfig;
56 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/server/src/index.js:
--------------------------------------------------------------------------------
1 | import { Server } from "http";
2 | import socketio from "socket.io";
3 | import uuid from "uuid";
4 | import { generateName } from "./name";
5 |
6 | const port = parseInt(process.env.PORT) || 3001;
7 | const http = Server();
8 | const io = socketio(http);
9 |
10 | const users = [];
11 |
12 | io.on("connection", socket => {
13 | // Get unique name
14 | let name;
15 | do {
16 | name = generateName();
17 | } while (users.includes(name));
18 |
19 | console.log(`${name} joined!`);
20 |
21 | // Send name to user
22 | socket.emit("setName", name);
23 |
24 | // Add user to user list
25 | users.push(name);
26 | // Update clients
27 | updateUserList();
28 | sendMessage({
29 | type: "join",
30 | user: name
31 | });
32 |
33 | socket.on("disconnect", () => {
34 | console.log(`${name} left!`);
35 | // Remove user from user list
36 | users.splice(users.indexOf(name), 1);
37 |
38 | // Update clients
39 | updateUserList();
40 | sendMessage({
41 | type: "leave",
42 | user: name
43 | });
44 | });
45 |
46 | socket.on("message", text => {
47 | // Send message to all users
48 | sendMessage({
49 | type: "message",
50 | user: name,
51 | data: { text }
52 | });
53 | });
54 | });
55 |
56 | function updateUserList() {
57 | // Update all user's local users list
58 | io.emit("updateUserList", users);
59 | }
60 |
61 | function sendMessage(message) {
62 | // Send message to all users (add unique id)
63 | io.emit("message", {
64 | ...message,
65 | id: uuid()
66 | });
67 | }
68 |
69 | http.listen(port, function() {
70 | console.log(`Listening on :${port}`);
71 | });
72 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
22 | Noderize Chat Socket Example
23 |
24 |
25 |
28 |
29 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/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/website/static/img/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
30 |
--------------------------------------------------------------------------------
/examples/chat-socket-react/web/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from "react";
2 | import socketio from "socket.io-client";
3 | import "./App.css";
4 | import { UsersList } from "./UsersList";
5 | import { MessagesList } from "./MessagesList";
6 | import { MessageBox } from "./MessageBox";
7 | import { UserIcon } from "./UserIcon";
8 |
9 | class App extends Component {
10 | initialState = {
11 | name: null,
12 | users: [],
13 | messages: []
14 | };
15 |
16 | state = this.initialState;
17 |
18 | messagesList;
19 |
20 | componentDidMount() {
21 | // Setup socket
22 | this.socket = socketio();
23 |
24 | this.socket.on("disconnect", () => {
25 | // Reset state
26 | this.setState(this.initialState);
27 | });
28 |
29 | // Recieve name from server
30 | this.socket.on("setName", name => {
31 | this.setState({ name });
32 | });
33 |
34 | // Update local user list when other users join/leave
35 | this.socket.on("updateUserList", users => {
36 | this.setState({ users });
37 | });
38 |
39 | // Receive a message
40 | this.socket.on("message", message => {
41 | this.setState(
42 | state => ({ messages: [...state.messages, message] }),
43 | () => {
44 | // Scroll to bottom of messages list after rerender
45 | const { list } = this.messagesList;
46 | list.scrollTop = list.scrollHeight;
47 | }
48 | );
49 | });
50 | }
51 |
52 | sendMessage = message => {
53 | this.socket.emit("message", message);
54 | };
55 |
56 | render() {
57 | if (this.state.name) {
58 | return (
59 |
60 |
61 | Connected! You are: {" "}
62 | {this.state.name}
63 |
64 |
65 |
68 |
69 | (this.messagesList = ref)}
72 | />
73 |
74 |
75 |
76 |
77 | );
78 | } else {
79 | return (
80 |
83 | );
84 | }
85 | }
86 | }
87 |
88 | export default App;
89 |
--------------------------------------------------------------------------------
/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-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 |
--------------------------------------------------------------------------------
/packages/scripts/src/scripts/test.js:
--------------------------------------------------------------------------------
1 | import path from "path";
2 | import { appDirectory, getBinPath } from "../utils/path";
3 | import { execSync } from "child_process";
4 | import spawn from "cross-spawn";
5 | import { getOptions } from "../options";
6 | import cosmiconfig from "cosmiconfig";
7 | import merge from "lodash.merge";
8 | import { testLogger as log } from "../utils/logger";
9 |
10 | export default async (args, fullArgs) => {
11 | log.start("Testing...");
12 |
13 | const options = getOptions(null, "test");
14 |
15 | let jestConfig = {};
16 | try {
17 | // Load jest config
18 | const results = await cosmiconfig("jest").search();
19 |
20 | if (results) {
21 | jestConfig = results.config;
22 | }
23 | } catch (error) {
24 | log.error("Could not read Jest configuration.");
25 | log.error(error);
26 | }
27 |
28 | let isInGit;
29 | try {
30 | execSync("git rev-parse --is-inside-work-tree 2>/dev/null", {
31 | encoding: "utf8"
32 | });
33 | isInGit = true;
34 | } catch (error) {
35 | isInGit = false;
36 | }
37 |
38 | // Watch by default (when not in CI)
39 | if (
40 | !(
41 | process.env.CI ||
42 | args.includes("--ci") ||
43 | args.includes("--watchAll") ||
44 | args.includes("--watch") ||
45 | args.includes("--coverage")
46 | )
47 | ) {
48 | args.push(isInGit ? "--watch" : "--watchAll");
49 | }
50 |
51 | const extensions = [
52 | "js", // Must use js for Jest itself
53 | options.languages.typescript && "ts"
54 | ].filter(Boolean);
55 |
56 | const config = merge(
57 | {
58 | rootDir: appDirectory,
59 | roots: [`/${options.srcDirectory}`],
60 | transform: {},
61 | setupFiles: [],
62 | moduleFileExtensions: [...extensions, "json"],
63 | testRegex: `(.*__tests__.*|.*\\.(test|spec))\\.(${extensions.join("|")})$`
64 | },
65 | jestConfig
66 | );
67 |
68 | // Force add transformer
69 | config.transform[`^.+\\.(${extensions.join("|")})$`] = path.resolve(
70 | __dirname,
71 | "jestTransformer.js"
72 | );
73 |
74 | args.push("--config", JSON.stringify(config));
75 |
76 | const jestPath = await getBinPath("jest");
77 |
78 | // Run Jest
79 | const child = spawn(fullArgs[0], [jestPath, ...args], {
80 | cwd: appDirectory,
81 | stdio: "inherit"
82 | });
83 |
84 | // Exit Noderize process with Jest exit code
85 | child.on("exit", code => {
86 | process.exit(code);
87 | });
88 | };
89 |
--------------------------------------------------------------------------------
/docs/website/i18n/en.json:
--------------------------------------------------------------------------------
1 | {
2 | "_comment": "This file is auto-generated by write-translations.js",
3 | "localized-strings": {
4 | "next": "Next",
5 | "previous": "Previous",
6 | "tagline": " Create a Node app in less than 30 seconds.",
7 | "configuration": "Configuration",
8 | "Index": "Index",
9 | "configuration-jest": "Configuration: Jest",
10 | "Jest": "Jest",
11 | "configuration-noderize": "Configuration: Noderize",
12 | "Noderize": "Noderize",
13 | "configuration-prettier": "Configuration: Prettier",
14 | "Prettier": "Prettier",
15 | "create": "Create Noderize App",
16 | "Create": "Create",
17 | "examples": "Examples",
18 | "features-flow": "Feature: Flow",
19 | "Flow": "Flow",
20 | "features-formatting": "Feature: Code Formatting",
21 | "Code Formatting": "Code Formatting",
22 | "features": "Features",
23 | "features-linting": "Feature: Linting",
24 | "Linting": "Linting",
25 | "features-modern": "Feature: Modern JavaScript",
26 | "Modern JavaScript": "Modern JavaScript",
27 | "features-testing": "Feature: Testing",
28 | "Testing": "Testing",
29 | "features-typescript": "Feature: TypeScript",
30 | "TypeScript": "TypeScript",
31 | "guides-firebase-functions": "Guide: Firebase Cloud Functions",
32 | "Firebase Cloud Functions": "Firebase Cloud Functions",
33 | "guides-google-functions": "Guide: Google Cloud Functions",
34 | "Google Cloud Functions": "Google Cloud Functions",
35 | "guides-heroku": "Guide: Heroku",
36 | "Heroku": "Heroku",
37 | "guides-migrate": "Guide: Migrate",
38 | "Migrate": "Migrate",
39 | "guides-publishing": "Guide: Publishing",
40 | "Publishing": "Publishing",
41 | "guides": "Guides",
42 | "introduction": "Introduction",
43 | "scripts": "Noderize Scripts",
44 | "Scripts": "Scripts",
45 | "tutorials-cli": "Tutorial: CLI",
46 | "CLI": "CLI",
47 | "tutorials-express": "Tutorial: Express",
48 | "Express": "Express",
49 | "tutorials": "Tutorials",
50 | "Docs": "Docs",
51 | "GitHub": "GitHub",
52 | "Get Started": "Get Started",
53 | "Configuration": "Configuration",
54 | "Features": "Features",
55 | "Guides": "Guides",
56 | "Tutorials": "Tutorials"
57 | },
58 | "pages-strings": {
59 | "Help Translate|recruit community translators for your project": "Help Translate",
60 | "Edit this Doc|recruitment message asking to edit the doc source": "Edit",
61 | "Translate this Doc|recruitment message asking to translate the docs": "Translate"
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/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