Giter Club home page Giter Club logo

nod's Introduction

nod

NPM version Build Status Coverage Status

NodeJS module generator/boilerplate.

Features

  • Babel - Write next generation JavaScript today.
  • Jest - JavaScript testing framework used by Facebook.
  • ESLint - Make sure you are writing a quality code.
  • Prettier - Enforces a consistent style by parsing your code and re-printing it.
  • Flow - A static type checker for JavaScript used heavily within Facebook.
  • Travis CI - Automate tests and linting for every push or pull request.
  • Documentation - A documentation system so good, you'll actually write documentation.
  • Standard Version - Automate versioning and CHANGELOG generation.

Install

The easiest way to use nod is through the Yeoman Generator.

$ npm install -g yo generator-nod
$ yo nod

If you don't want to use the generator, you can also download or git clone this repo

$ git clone https://github.com/diegohaz/nod my-module
$ cd my-module
$ rm -rf .git
$ npm install # or yarn

Just make sure to edit package.json, README.md and LICENSE files accordingly with your module's info.

Commands

$ npm test # run tests with Jest
$ npm run coverage # run tests with coverage and open it on browser
$ npm run lint # lint code
$ npm run docs # generate docs
$ npm run build # generate docs and transpile code

Publish

$ npm release
$ npm publish

It'll automatically run test, lint, docs, build, generate CHANGELOG.md, and push commits and tags to the remote repository.

Removing stuff

Flow
  1. Remove .flowconfig file.

  2. Remove flow from package.json:

      "scripts": {
    -   "flow": "flow check",
    -   "flowbuild": "flow-copy-source src dist",
    -   "prebuild": "npm run docs && npm run clean && npm run flowbuild",
    +   "prebuild": "npm run docs && npm run clean",
      },
      "devDependencies": {
    -   "@babel/preset-flow": "^7.0.0",
    -   "eslint-plugin-flowtype": "^2.50.0",
    -   "eslint-plugin-flowtype-errors": "^3.5.1",
    -   "flow-bin": "^0.81.0",
    -   "flow-copy-source": "^2.0.2",
      }
  3. Remove flow from .babelrc:

      "presets": [
    -   "@babel/preset-flow"
      ]
  4. Remove flow from .eslintrc:

      "extends": [
    -   "plugin:flowtype/recommended",
    -   "prettier/flowtype"
      ],
      "plugins": [
    -   "flowtype",
    -   "flowtype-errors"
      ],
      "rules": {
    -   "flowtype-errors/show-errors": "error"
      }
  5. Run yarn.

Documentation
  1. Remove documentation from package.json:

      "scripts": {
    -   "docs": "documentation readme src --section=API",
    -   "postdocs": "git add README.md",
    -   "prebuild": "npm run docs && npm run clean",
    +   "prebuild": "npm run clean",
      },
      "devDependencies": {
    -   "documentation": "^8.0.0",
      }
  2. Run yarn.

Adding stuff

TypeScript
  1. Install dependencies:

    yarn add -D @babel/preset-typescript @types/jest @typescript-eslint/eslint-plugin @typescript-eslint/parser typescript
  2. Update package.json:

    + "types": "dist/ts/src",
      "scripts": {
    +   "type-check": "tsc --noEmit",
    -   "lint": "eslint .",
    +   "lint": "eslint . --ext js,ts,tsx",
    -   "build": "babel src -d dist",
    +   "build": "tsc --emitDeclarationOnly && babel src -d dist -x .js,.ts,.tsx",
      },
      "lint-staged": {
    -   "*.js": [
    +   "*.{js,ts,tsx}": [
    -     "eslint --fix",
    +     "eslint --fix --ext js,ts,tsx",
          "git add"
        ]
      }
  3. Create tsconfig.json

    {
      "compilerOptions": {
        "outDir": "dist/ts",
        "target": "esnext",
        "module": "esnext",
        "moduleResolution": "node",
        "jsx": "react",
        "strict": true,
        "declaration": true,
        "noFallthroughCasesInSwitch": true,
        "noImplicitReturns": true,
        "noUnusedLocals": true,
        "noUnusedParameters": true,
        "stripInternal": true
      }
    }
  4. Update .babelrc:

      "presets": [
    +   "@babel/preset-typescript"
      ]
  5. Update .eslintrc with these settings:

      "settings": {
        "import/resolver": {
          "node": {
            "extensions": [".js", ".jsx", ".ts", ".tsx"]
          }
        }
      },
      "overrides": [
        {
          "files": ["**/*.ts", "**/*.tsx"],
          "parser": "@typescript-eslint/parser",
          "parserOptions": {
            "project": "./tsconfig.json"
          },
          "plugins": [
            "@typescript-eslint"
          ],
          "rules": {
            "no-undef": "off",
            "no-unused-vars": "off",
            "no-restricted-globals": "off"
          }
        }
      ]

API

Table of Contents

sayHello

This function says hello.

Parameters

  • name string Some name to say hello for. (optional, default "Haz")

Returns string The hello.

License

MIT © Diego Haz

nod's People

Contributors

dependabot[bot] avatar diegohaz avatar greenkeeper[bot] avatar mischah avatar ndelvalle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nod's Issues

An in-range update of eslint-config-airbnb-base is breaking the build 🚨

Version 11.1.2 of eslint-config-airbnb-base just got published.

Branch Build failing 🚨
Dependency eslint-config-airbnb-base
Current Version 11.1.1
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-config-airbnb-base is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of eslint-plugin-import is breaking the build 🚨

Version 2.4.0 of eslint-plugin-import just got published.

Branch Build failing 🚨
Dependency eslint-plugin-import
Current Version 2.3.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As eslint-plugin-import is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 10 commits.

  • 44ca158 update utils changelog
  • a3728d7 bump eslint-module-utils to v2.1.0
  • 3e29169 bump v2.4.0
  • ea9c92c Merge pull request #737 from kevin940726/master
  • 8f9b403 fix typos, enforce type of array of strings in allow option
  • 95315e0 update CHANGELOG.md
  • 28e1623 eslint-module-utils: filePath in parserOptions (#840)
  • 2f690b4 update CI to build on Node 6+7 (#846)
  • 7d41745 write doc, add two more tests
  • dedfb11 add allow glob for rule no-unassigned-import, fix #671

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Eu poderia usar este para React Native?

Poderia? Estou pensando em me aprofundar nessa coisa de criar módulos, pois tem muita coisa que não dá pra fazer ainda com módulos de terceiros. Por exemplo, queria usar o Firebase Auth UI - Mas só tem pra nativo, estou com documentação separada pra estudar como implementar código nativo com RN.

Mas ter um gerador de módulo seria interessante. Ajudaria muito.

Abraço!

An in-range update of babel-eslint is breaking the build 🚨

Version 7.2.1 of babel-eslint just got published.

Branch Build failing 🚨
Dependency babel-eslint
Current Version 7.2.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-eslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Commits

The new version differs by 6 commits .

  • 3cda62e 7.2.1
  • 5626de1 Remove left over eslint 2 estraverse code (#452)
  • b5fb53b Fix type param and interface declaration scoping (#449)
  • f1cee0f Remove lodash dependency (#450)
  • eb05812 Format non-regression errors for legibility (#451)
  • 7972a05 Update README.md with codeFrame option (#448)

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

An in-range update of babel-preset-env is breaking the build 🚨

Version 1.3.0 of babel-preset-env just got published.

Branch Build failing 🚨
Dependency babel-preset-env
Current Version 1.2.2
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As babel-preset-env is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪


Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details
Release Notes v1.3.0

v1.3.0 (2017-03-30)

🐛 Bug Fix

We now properly check for Symbol.species support in ArrayBuffer and include the
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related
errors on IE9.

💅 Polish

We've simplified things by adding electron as a target instead of doing a bunch of
things at runtime. Electron targets should now also be displayed in the debug output.

If you are targeting the node environment exclusively, the always-included web polyfills
(like dom.iterable, and a few others) will now no longer be included.

📝 Documentation

🏠 Internal

  • npmignore: Add related to build data and codecov. (#216) (@yavorsky)
Commits

The new version differs by 8 commits .

  • 8b2dc4f 1.3.0
  • 6ebf857 Update changelog
  • 046f326 Add check for ArrayBuffer[Symbol.species] (#233)
  • aead61c Fill data with electron as a target. (#229)
  • 48a329b separate default builtins for platforms (#226)
  • a4d585c remove deprecated projects (#223) [skip ci]
  • 88cbe17 Merge pull request #216 from babel/update-npmignore
  • cf94af3 npmignore: Add related to build data and codecov.

See the full diff.

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Error on `npm install -g generator-nod`

Hi thanks for this amazing repo!

Ran into the following error while trying to install the generator. I think it's related to: nodegit/nodegit#1347

Can anybody confirm? Thanks!

  • macOS 10.13.2
  • node 8.7.0
  • npm 5.5.1
➜  ~ npm install -g generator-nod

> [email protected] install /usr/local/lib/node_modules/generator-nod/node_modules/nodegit
> node lifecycleScripts/preinstall && node lifecycleScripts/install

[nodegit] Running pre-install script
[nodegit] Configuring libssh2.
{ Error: Command failed: /usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/openssl/openssl
/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:271:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/openssl/openssl' }
/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

[nodegit] ERROR - Could not finish preinstall
{ Error: Command failed: /usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/openssl/openssl
/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing: Unknown `--is-lightweight' option
Try `/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
configure: error: No crypto library found!
Try --with-libssl-prefix=PATH
 or --with-libgcrypt-prefix=PATH
 or --with-wincng on Windows

    at ChildProcess.exithandler (child_process.js:271:12)
    at emitTwo (events.js:125:13)
    at ChildProcess.emit (events.js:213:7)
    at maybeClose (internal/child_process.js:927:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
  killed: false,
  code: 1,
  signal: null,
  cmd: '/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/libssh2/configure --with-libssl-prefix=/usr/local/lib/node_modules/generator-nod/node_modules/nodegit/vendor/openssl/openssl' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node lifecycleScripts/preinstall && node lifecycleScripts/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2017-12-25T09_46_12_726Z-debug.log

Error: Cannot find module '../build/Debug/nodegit.node'

I get the following error when I try to yo nod.

Error: Cannot find module '../build/Debug/nodegit.node'

Here is the full text of the error;

module.js:472
    throw err;
    ^

Error: Cannot find module '../build/Debug/nodegit.node'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/davidfekke/Documents/node/projects/samplemod/node_modules/nodegit/dist/nodegit.js:18:12)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.