types / _generator-typings Goto Github PK
View Code? Open in Web Editor NEWYeoman generator for https://github.com/typings/typings
License: MIT License
Yeoman generator for https://github.com/typings/typings
License: MIT License
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.
@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
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)
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
.
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?
typescript
absolutely needed?typings
absolutely needed? I would assume all typings author have it installed globally. @blakeembrey want to lock in a version?tslint
with extends
support released, can we skip the local copy?Make generator-typings
into a cli command.
Is generator-typings
good as a cli command? Or some other names?
write-typings
, typed-writer
, etc.
I'd love to write some tests for my typings but I'm sort of at a loss as to what and how I should be testing.
{
"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?
Originally slated for 1.0.
https://github.com/typings/generator-typings/blob/master/test/git.spec.js#L77
sometimes fail with repositoryName
= fa873oifapd8fehvfae...
(the tmp folder) instead of generator-typings-blank-repo-for-test
.
Logic seems fine, don't know why it is failing sometimes. Will monitor and see if it happens in real life.
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)!
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
?)
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?
That will watch for changes and call typings bundle . -o bundle.d.ts
.
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?
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
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'];
}
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?
Ended up Duplicate identifier.
The test code and the build code tsconfig.json
need to be separated (again). ๐ญ
due to this:
yeoman/yeoman-test#15
Also, can this be specified in the README?
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)
I just ran into cmderdev/cmder#700 from running this generator. The root of the issue is package.json is missing a "name"
and "version"
. After I manually added those, new Cmder instances could be cd
'd into my directory.
Obviously this isn't your issue, but I am curious if "name"
and "version"
could be defaulted?
Need to build on change.
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?
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:
<source>/<packageName>.json
Title: GT: Add
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
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.
Which will automatically:
package.json
to add typings
propertyTitle: 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.
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
@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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.