Coder Social home page Coder Social logo

_generator-typings's People

Contributors

blakeembrey avatar demurgos avatar fank avatar greenkeeper[bot] avatar greenkeeperio-bot avatar matheo avatar nevir avatar olsondev avatar unional 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

Watchers

 avatar  avatar  avatar  avatar  avatar

_generator-typings's Issues

Add noImplicitAny in tsconfig.json

Hi,
Would it be possible to add the noImplicitAny compiler options to tsconfig.json ?

It would help to ensure that no type is forgotten when we write the typings.

Otherwise, the typings' implicit any cause warnings for users choosing to use this option in their main project - and its quite frustrating when warnings are triggered by dependencies.

Enable greenkeeper

@blakeembrey , can you enable greenkeeper for this project too? I can't do it:

greenkeeper enable
๐ŸŒด  info enable The GitHub slug is: typings/generator-typings
๐ŸŒด  ERR! enable Couldnโ€™t enable a repository with this slug.
๐ŸŒด  ERR! enable If you want to try your free private repository make sure to grant the necessary rights by running greenkeeper login --force --private
๐ŸŒด  ERR! enable You have to have a plan for more than one private repository. To verify run greenkeeper whoami
๐ŸŒด  ERR! enable If you have just recently created this repository try running greenkeeper sync
๐ŸŒด  ERR! enable You need admin access to a repository to enable it.
๐ŸŒด  ERR! enable If you think this error really shouldnโ€™t appear let us look into it with greenkeeper support

Improve update

  • read destinationPath package.json for info, or
  • save generator.config.

Wrong repository name during generation

yo version: 1.8.5
generator-typings version: 1.0.13


Hi,
After answering some questions of the generator:

? https://github.com/<organization>/typed-* demurgos
? https://github.com/demurgos/typed-* typed-
? npm install <package name>? gulp-util

I get a recap to confirm the information, but it uses a wrong repo name:

Based on your configured template, ...
repository: typings/gulp-util

And if I confirm, it tries to create the repo with my account but fails due to a permissions error.

Here are the full logs:

     _-----_     โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    |       |    โ”‚      Welcome to the      โ”‚
    |--(o)--|    โ”‚    sensational typings   โ”‚
   `---------ยด   โ”‚        generator!        โ”‚
    ( _ยดU`_ )    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
    /___A___\   /
     |  ~  |     
   __'.___.'__   
 ยด   `  |ยฐ ยด Y ` 

Seems like this is the first time you use this generator.
Let's quickly setup the template...
? Your username on GitHub demurgos
? https://github.com/<organization>/typed-* demurgos
? https://github.com/demurgos/typed-* typed-
? Your test framework of choice blue-tape
? Your browser test harness tape-run + jspm
? Which license do you want to use? MIT
? Your signature in the license: Copyright (c) 2016 <signature> Demurgos
Got it! The template is saved.

I'll be creating the typings repository under the gulp-util folder

To begin, I need to know a little bit about the source you are typings for.
? Where can I get it from? NPM
? npm install <package name>? gulp-util
gathering info from npm...
? How can the package be used? (Press <space> to select, <a> to toggle all, <i> to inverse selection)CommonJS Module
? Where can the package be used? (Press <space> to select, <a> to toggle all, <i> to inverse selection)Native NodeJS

Good, now about the typings itself...
Based on your configured template, ...
repository: typings/gulp-util
Github username: demurgos                                                                                          
license: MIT                                                                                                       
license signature: Demurgos                                                                                        
test framework: blue-tape                                                                                                                                                                                                                  
? Does it look good to you? Yes
Username for 'https://github.com': demurgos                                                                                                                                                                                                
Password for 'https://[email protected]':                                                                                                                                                                                                
Cloning into '/home/csamborski/projects/typings/gulp-util'...                                                                                                                                                                              
remote: Repository not found.                                                                                                                                                                                                              
fatal: repository 'https://github.com/typings/gulp-util.git/' not found                                                                                                                                                                    

events.js:165                                                                                                                                                                                                                              
      throw err;                                                                                                                                                                                                                           
      ^                                                                                                                                                                                                                                    

Error: Uncaught, unspecified "error" event. (Cloning into '/home/csamborski/projects/typings/gulp-util'...                                                                                                                                 
remote: Repository not found.                                                                                                                                                                                                              
fatal: repository 'https://github.com/typings/gulp-util.git/' not found                                                                                                                                                                    
)                                                                                                                                                                                                                                          
    at constructor.emit (events.js:163:17)                                                                                                                                                                                                 
    at Immediate.<anonymous> (/usr/lib/node_modules/generator-typings/node_modules/yeoman-generator/lib/base.js:446:16)                                                                                                                    
    at runCallback (timers.js:574:20)                                                                                                                                                                                                      
    at tryOnImmediate (timers.js:554:5)                                                                                                                                                                                                    
    at processImmediate [as _immediateCallback] (timers.js:533:5)     

Spawn `npm install` at the end?

Actually I can run start npm install (for Windows) and return the control to user so that user can start working.

This way the user aren't blocked and doesn't need to call npm install.

Reduce scaffolding time

Currently it does a lot in downloading and installing packages. In my system it takes close to 1 minutes to complete. Is there a way to make it faster?

  • Is typescript absolutely needed?
  • Is typings absolutely needed? I would assume all typings author have it installed globally. @blakeembrey want to lock in a version?
  • When tslint with extends support released, can we skip the local copy?

cli

Make generator-typings into a cli command.

Is generator-typings good as a cli command? Or some other names?

write-typings, typed-writer, etc.

Simplify commands

{
  "scripts": {
    "build": "typings bundle -o out",
    "lint": "tslint \"**/*.ts\" -e \"source/**\" -e \"out/**\"",
    // `cd` to get around --project limitation running ts-node in NPM script
    "test": "cd test && ts-node test.ts && echo run source tests", 
    "watch": "onchange \"**/*.ts\" -i -e \"out/**\" -- npm -s run lint+build+test",
    "publish": "npm -s run lint+build+test && echo publish to typings/registry",
    "lint+build+test": "npm run lint && npm run build && npm run test",
    "prepublish": "typings install"
  }
}

User will typically just:

npm run watch
# make changes to typings and tests (including source-tests)
# [ctrl+c] to kill `watch`
npm run publish

npm run publish will not invoke npm publish so it will work.

@blakeembrey what do you think?

Allow repo name and typingsName.d.ts to differ.

What is the username/repo of the package you are writing this typings for?:
Think7/typings-mongodb

Running the above results in the d.ts and all references to it being "typings-mongodb.d.ts"

The / official / mongodb.d.ts typing should be the same name as the library it provides typing for. If that happens to end up being mine, great! But i personally should not have a public repo called "mongodb" just to get the name to match.

Someone might accidentally think i was talented enough to write something much fancier (mongodb) than what's actually there (just the def)!

Mention tap-spec requirement

Hi,
Could-it be possible to mention somewhere (in the README.md or the message displayed after the generation) that npm install -g tap-spec is required to test the definitions ?

I got an error message and fixed-it immediately so it's not a big deal, but it could improve the user-experience.

(Maybe also add a note for ts-node ?)

Create fails for accounts with two-factor auth

I've tried scaffolding a typing using the generator and it's failed on the auth stage because I have two-factor enabled (or so I believe is the issue). As well, I can't get past it using --skip-install.

Any ideas?

Add npm run watch

That will watch for changes and call typings bundle . -o bundle.d.ts.

README hard to understand

I'm having some serious trouble understanding the three different setups and the differences between the examples you provide. I just want to generate typings for a random project on github. So do I really have to actually fork the repo on github to do this?

fails on Windows due to process.env.HOME being undefined

Currently running 'yo typings foo' on a Windows machine fails unless you specifically set the HOME environment variable

ยป yo typings npm-node-json-db
path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^

TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:466:7)
at Object. (C:\Users\james\AppData\Roaming\npm\node_modules\generator-typings\generators\app\createTemplateCommands.js:9:31)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)

Appears to be used in 2 places AFAICT

https://github.com/typings/generator-typings/blob/e412656ae9e847a6570564988c191d5a5d13bf26/generators/app/index.js#L19

https://github.com/typings/generator-typings/blob/e412656ae9e847a6570564988c191d5a5d13bf26/generators/app/createTemplateCommands.js#L9

AFAIK Node v4 is when the os.homedir() was added which you could use instead of you're already requiring (are you're ok requiring) v4 or later.

https://nodejs.org/api/os.html#os_os_homedir

Otherwise, you can use the os-homedir npm module as a polyfill, or even just use a simple function to check for win32 like in this SO answer

function getUserHome() {
  return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
}

Use npm instead of git submodule to fetch source

I really don't see the point of fetching the source as a git submodule instead of just using npm. Git submodule as hard to work with and confusing as hell. Seeing that most of the typings we write are for npm modules I'd rather have the original module be listed as a dependency for my module. E.g. this one.

Any reason for using git submodules then?

Dependency issue - Error: Cannot find module 'inquirer'

I tried running this generator and immediately ran into a dependency problem. I'm really surprised I'm the only one! I was able to keep going after running npm install inquirer.

yo typings some-repo
readline.js:925
            throw err;
            ^

Error: Cannot find module 'inquirer'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/marcysutton/Sites/Organization/some-module/node_modules/generator-typings/generators/app/index.js:5:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)

Generate a .gitignore file

Having run the generator and then npm install, I see a lot of files in node_modules & typings that should probably be ignored. I'm guessing you (@unional) added the .gitignore manually for the env-electron initial commit?

Add publish command

Since github is huge, I don't want to add it as a devDependencies for each generated typings repository.

Instead, will create a command to do that job, and just npm script to invoke it.

This command will:

Title: GT: Add / typings

Typings URL: <typings repo url>
Test written and passed: <number of passed tests> // Command will fail if there are failed tests
Code Coverage: <code coverage %> // Don't know if this is possible

Source test

Current source test is a manual process.

Would be great to create source test for some basic scenarios.

Specific scenarios will be determined and spilted into different issues in the future.

Add source-pr command

Which will automatically:

  • create a fork from the source
  • Add all typings to the source
  • modify package.json to add typings property
  • create a PR as follow:

Title: Add typings to the repo

Hi,

I have created <typing repo url> to add TypeScript support for your package.

On the other hand if you accept this PR and release a new patch version on npm, the TypeScript compiler can resolve the typings automatically without any action from the consumer.

Would you be interested in accepting this PR?

Thanks.

Cannot run command successfully. Cannot read Property 'value' of undefined

Tried to run it "yo typings:beta", but it won't let me put in my github username and then it fails. Looks like it skips a couple prompts, this one and the organization.

readline.js:925
throw err;
^

TypeError: Cannot read property 'value' of undefined
at Prompt.getCurrentValue (/usr/local/lib/node_modules/yo/node_modules/yeoman-environment/node_modules/inquirer/lib/prompts/list.js:121:51)
at tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:63:31)
at InnerObserver.next (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:5407:43)
at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:1762:31)
at InnerObserver.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:63:31)
at AutoDetachObserverPrototype.next (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:5883:51)
at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:1762:31)
at Subject.Rx.Subject.addProperties.onNext (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:5998:19)
at Subject.tryCatcher (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:63:31)
at AutoDetachObserverPrototype.next (/usr/local/lib/node_modules/yo/node_modules/rx/dist/rx.js:5883:51)

Help appreciated!

Thanks

Can move to typings, but one item remains

@blakeembrey, typed-typings/npm-* naming is my last hesitation, as I still don't see the typings ties to any particular distributing channel.

If the source is distributed in npm, bower, jspm, NuGet, apm (atom), etc, or any combination of them, how should the repo be named?

I like the original typed-* better.

npm install -D uses repository name instead of package name

Hi,
During the generation of a project, I am asked for both the name of the repo and the name of the npm package. For my current definitions, the repo is peterolson/BigInteger.js but the npm package is big-integer (not the same name), but the generator used the the repo name to download the module - and failed.

Note: I am using the latest generator available on npm (0.14.10)

Here are the logs:

D:\projects\typed\typed-big-integer>yo typings

     _-----_
    |       |    .--------------------------.
    |--(o)--|    |      Welcome to the      |
   `---------ยด   |    sensational typings   |
    ( _ยดU`_ )    |        generator!        |
    /___A___\    '--------------------------'
     |  ~  |
   __'.___.'__
 ยด   `  |ยฐ ยด Y `

? What is the author/module of the source on github? peterolson/BigInteger.js
? Is the source installable through NPM? Yes
? Name of the package on NPM is... big-integer
? Is this module ambient? i.e. does it declare itself globally? No
? And your GitHub username is... demurgos
? Which license do you want to use? MIT
? Name to use on the license? demurgos
   create package.json
   create .vscode\settings.json
   create test\tsconfig.json
   create source-test\README.md
   create source-test\tsconfig.json
   create index.d.ts
   create tsconfig.json
   create tslint.json
   create .editorconfig
   create .travis.yml
   create .gitignore
   create .npmignore
   create typings.json
   create README.md
   create test\test.ts
   create LICENSE
Installing BigInteger.js...
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-D" "--save-exact" "BigInteger.js"
npm ERR! node v5.1.0
npm ERR! npm  v3.3.12
npm ERR! code E404

npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/BigInteger.js
npm ERR! 404
npm ERR! 404 'BigInteger.js' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404
npm ERR! 404  1. name can no longer contain capital letters
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\projects\typed\typed-big-integer\npm-debug.log
Downloading peterolson/BigInteger.js...
Initialized empty Git repository in D:/projects/typed/typed-big-integer/.git/
Cloning into 'source'...
remote: Counting objects: 872, done.
rRemote: Total 872 (delta 0), reused 0 (delta 0), pack-reused 872
Receiving objects: 100% (872/872), 433.34 KiB | 346.00 KiB/s, done.
Resolving deltas:   0% (0/538)
Resolving deltas: 100% (538/538), done.
Checking connectivity... done.
warning: LF will be replaced by CRLF in .gitmodules.
The file will have its original line endings in your working directory.

I am done! Now it is your turn!

If DefinitelyTyped has a definition for the source,
 you can run tsd install <source> to download the file
 so you can easily access those definitions.
You don't need to save it though.

Run npm install to install dependencies needed. It will take about a minute.
In the meantime, you can open your editor and start writing.

When installation completes, run npm run watch.
It will automatically build and test the typings for you as you make changes.

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.