Coder Social home page Coder Social logo

Comments (13)

lholmquist avatar lholmquist commented on June 22, 2024 1

while it is probably good to explicitly set the .npm-init.js location, by default, it will look for ~/.npm-init.js

from entente.

helio-frota avatar helio-frota commented on June 22, 2024 1

~/.npm-init.js

const fs = require('fs');

const content = `{ 
  "extends": "semistandard"
}`
fs.writeFileSync('.eslintrc.json', content);
fs.mkdirSync('test');

module.exports = {
  name: prompt('name', basename || package.name),
  version: '0.0.1',
  description: prompt(s => s),
  main: prompt('entry point', 'index.js', ep => fs.writeFileSync(ep, '')),
  author: 'Red Hat, Inc.',
  license: 'Apache-2.0',
  scripts: {
    test: 'tape test/*.js | tap-spec',
    lint: 'eslint test/*.js index.js',
    prepublish: 'nsp check',
    coverage: 'istanbul cover tape test/*.js'
  },
  repository: {
    type: 'git',
    url: 'git://github.com/USER/' + basename + '.git'
  },
  files: [
    'package.json',
    'README.md',
    'LICENSE',
    'index.js'
  ],
  bugs: {url: 'https://github.com/USER/' + basename + '/issues'},
  homepage: 'https://github.com/USER/' + basename,
  keywords: prompt(s => s.split(/\s+/)),
  devDependencies: {
    eslint: '*',
    'eslint-config-semistandard': '*',
    'eslint-config-standard': '*',
    'eslint-plugin-promise': '*',
    'eslint-plugin-react': '*',
    'eslint-plugin-standard': '*',
    istanbul: '*',
    nsp: '*',
    'tap-spec': '*',
    tape: '*'
  },
  cleanup: function (cb) {
    cb(null, undefined);
  }
};

run npm init

result:

{
  "name": "tempa",         <------------ question with default
  "version": "0.0.1",
  "description": "asdasd", <------------ question
  "main": "index.js",      <------------ question
  "author": "Red Hat, Inc.",
  "license": "Apache-2.0",
  "scripts": {               
    "test": "tape test/*.js | tap-spec", <------------- change to best fit
    "lint": "eslint test/*.js index.js", <------------- change to best fit
    "prepublish": "nsp check",
    "coverage": "istanbul cover tape test/*.js" <------------- change to best fit
  },
  "repository": {
    "type": "git",
    "url": "git://github.com/USER/tempa.git"  <------------ change your USER
  },
  "files": [                  <------------- change to best fit
    "package.json",
    "README.md",
    "LICENSE",
    "index.js"
  ],
  "bugs": {
    "url": "https://github.com/USER/tempa/issues"   <------------ change your USER
  },
  "homepage": "https://github.com/USER/tempa",      <------------ change your USER
  "keywords": [                           <------------ question           
    "aa",
    "bb",
    "cc"
  ],
  "devDependencies": {
    "eslint": "^3.3.1",
    "eslint-config-semistandard": "^7.0.0-beta.0",
    "eslint-config-standard": "^6.0.0",
    "eslint-plugin-promise": "^2.0.1",
    "eslint-plugin-react": "^6.1.2",
    "eslint-plugin-standard": "^2.0.0",
    "istanbul": "^0.4.5",
    "nsp": "^2.6.1",
    "tap-spec": "^4.1.1",
    "tape": "^4.5.1"
  }
}

from entente.

lance avatar lance commented on June 22, 2024 1

Landed - thanks!

from entente.

lholmquist avatar lholmquist commented on June 22, 2024

@helio-frota ooooh, i like this

from entente.

lance avatar lance commented on June 22, 2024

+1

On Mon, Sep 19, 2016 at 1:50 PM Lucas Holmquist [email protected]
wrote:

@helio-frota https://github.com/helio-frota ooooh, i like this


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#28 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAA-UBiaFXsVczc4Lb7Ea7qDA-rN8Gvtks5qrstUgaJpZM4JytMX
.

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

Thanks for the feedback folks.
But when I use this, I miss 2 things:

creation of ' index.js [ or the specified entry point ]'
creation of ' .eslintrc.json '

  1. npm init
    1.1. Answer the questions
  2. npm install
  3. touch index.js < ----- can be automatic, empty file
  4. open the project directory on vscode

so when execute npm run lint we get this error:
ESLint couldn't find a configuration file.

Maybe is good to create an empty 'test' directory to avoid :

a) 'mkdir test'
b) creation of 'tests' <-- using plural

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

Updated, with this ^

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

Any improvement feel free to update.

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

done ?
Also I'm using this :]
for simple tests I remove "author": "Red Hat, Inc.",

from entente.

balunasj avatar balunasj commented on June 22, 2024

@lance Is going to test this with his next OpenShift test project, and then we can find it's final resting place.

from entente.

lance avatar lance commented on June 22, 2024

@helio-frota I have some feedback on some stuff in the file itself. Can you open a PR on this repository with a single file npm-init.js in the root of the repository so we can discuss?

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

@lance ok!

from entente.

helio-frota avatar helio-frota commented on June 22, 2024

@lance #43

from entente.

Related Issues (20)

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.