ospatil / generator-node-typescript Goto Github PK
View Code? Open in Web Editor NEWA minimal Yeoman Generator for creating NodeJS packages using TypeScript
License: MIT License
A minimal Yeoman Generator for creating NodeJS packages using TypeScript
License: MIT License
jest is not mature and tend to get rid of debug info which will make it very hard for debugging and maintenance
Currently we are struggling for debug info get killed by jest.
Hi,
there is a _vscode folder commited at https://github.com/ospatil/generator-node-typescript/tree/master/generators/app/templates/_vscode
Shouldn't this folder not be added to .gitignore?
When ESLint has feature parity with TSLint, TNS should migrate completely to ESLint with a breaking version change.
Additionally, documentation should be added to help people migrate from TSLint to ESLint, or an auto-tool can be included to aid in migration.
References:
Hi @ospatil
I find myself using this scaffolding more and more, so I was wondering whether it's possible to have a "Generator-Node-Typescript" package within the VsCode extension ecosystem as well?
I'm new to the editor but so far I've loved the TypeScript and the VsCode :)
I just refreshed my generator and watch:test
is hanging.
2 tests passed
greeter-spec.ts
to ... new Greeter("tester");
CTRL+c
in test windowCTRL+c
in test window againthis is one of my favorite generators!
Thank you for this generator. Do you use VS Code to debug? Mind sharing your .vscode files?
What do you think about upgrading to TypeScript 2.3 and using the --strict option? I ::heart:: strict code!
Hi,
I've generated a project lately and experienced some issues when running the package.json
test script. I had to add single quotes '
around the regex in order to make mocha work and dive recursively into deeper directories:
"test": "npm run build && mocha --compilers ts:ts-node/register --recursive 'src/**/*.spec.ts'"
So, basically src/**/*.spec.ts
becomes 'src/**/*.spec.ts'
.
Just saying in case anybody experiences this too!
Is it possible to write the jasmine tests in typescript as well? Currently, only a javascript sample is given?
It bugs me that output directory is called lib when I'm not building a library.
lib stand for library
dist stand for distribution
I'm ready to PR if you're sharing my thoughts. I need #39 to be done first though.
Seeing this in the console, can replace with prepare
instead I think. Thanks!
npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
A .npmignore
file would remove unnecessary files from npm:
src/
__test__/
And some other ones too :)
it seems subdirectories are not recognized?
After generating all the files, use yarn for installing dependencies, instead of npm.
If no yarn found, let's fallback to npm.
Hey, the command for the node def changed.
From typings install node --ambient --save
to typings install dt~node --global --save
I am running
nyc --reporter=text --reporter=html node_modules/.bin/_mocha --compilers ts:ts-node/register
and the result is
------------|----------|----------|----------|----------|----------------|
File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines |
------------|----------|----------|----------|----------|----------------|
All files | 0 | 100 | 0 | 0 | |
greeter.js | 0 | 100 | 0 | 0 |2,3,5,7,8,10,12 |
index.js | 0 | 100 | 100 | 0 | 2,3,4 |
------------|----------|----------|----------|----------|----------------|
thoughts?
Your package looks very useful. I especially like that you claim to be integrated into VS Code.
There is a link on your NPM page that takes me to RunKit. When I then try to run the sample code in RunKit, it throws an exception stating it can't find the module.
On my windows, i have several TypeScript installations manually or automatically(by Visual Studio) installed. I have also installed nodejs global module 'tsc' (typescript).
Problem is when you have tsc.exe in "c:\Program Files (x86)\Microsoft SDKs\TypeScript\1.5\tsc.exe" together with nodejs global module 'tsc' your gulp task _build
will invoke tsc.exe (from program files) not nodejs version 'tsc'.
For fix, change: exec('tsc')
to exec('tsc.cmd')
within file gulpfile.js
.
Hi there,
First of all really nice module.
This is not a real issue, I just recently used this generator to kickstart a small node module and I quickly added a Travis config and Coveralls to it. If you think that it is a good ideia I will be happy to make a PR with the changes, let me know which code coverage tool you would like to add (Coveralls/Codecov/etc...).
Ty
In readme.md
it says:
test Runs the Jasmine test specs [build]
But it is not actually Jasmine
, it is mocha
, isn't it.
Apparently, since version 20 of ts-jest it is required to add additional configuration to get correct coverage report. Namely, mapCoverage should be set to true.
kulshekhar/ts-jest#200
Hello,
I am trying to import the module built by the "gulp build" command but it fails.
My Typescript version is 1.8.10.
This is what I have done :
mkdir my-new-project \
&& cd $_ \
&& yo node-typescript \
&& gulp build \
&& cd ..
mkdir my-requiring-project \
&& cd $_ \
&& mkdir node_modules \
&& cp -r ../my-new-project ./node_modules \
&& echo "import MyNewProject = require('my-new-project')" >> index.ts
tsc index.ts
This is the error :
index.ts(1,31): error TS2656: Exported external package typings file '~/dev/nodejs/projects/my-requiring-project/node_modules/my-new-project/lib/my-new-project.d.ts' is not a module. Please contact the package author to update the package definition.
Could you help me to find a way to import the created module into a new project? Any help would be greatly appreciated.
When external typings are installed using npm i @types/xxx --save
, the intellisense in Visual Studio Code does not find the declaration files and therefore intellisense does not work correctly.
This can be fixed by creating a new file .vscode/settings.json
and specifying the setting typescript.tsdk
with the value node_modules/typescript/lib/
.
It would be nice if this settings file and the required setting would be generated automatically by the yeoman generator.
Contents of the .vscode/settings.json
should be:
{
"typescript.tsdk": "node_modules/typescript/lib/"
}
See microsoft/vscode#9972 for more information.
First off - awesome generator, thanks for all of your efforts.
Everything works perfectly, except the ability to debug the test file(s).
Here is what I saw when I launch test 'Debug test' with the greeter-spec.ts file open in the editor:
Cannot launch program 'd:\VSTS-DevOps\genSample\node_modules\.bin\jest'; setting the 'outDir' or 'outFiles' attribute might help.
So after several iterations & looking around at similar issues, this is the launch.json section that's working for me:
{
"type": "node",
"request": "launch",
"name": "Debug test-v4 works-single-selected file",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"--findRelatedTests",
"${relativeFile}",
"--env",
"jest-environment-node-debug",
"--runInBand"
],
"console": "integratedTerminal"
}
I tried various combinations of program = .../.bin/jest.cmd, .../jest/bin/jest.js yada yada- but did not hit on anything until the runtimeArgs vs program & args options setup.
Interested in your take, or if anyone else ran into something similar...
working env: Windows 10, TS 2.4.2, node 8.2.1, vs code latest.
As per the npm docs, prepare
runs both after install and before npm publish
. I personally can't think of any situations I'd want to build the module after each install, but if that's intentional then that's cool, it's not much effort when generating a new project to change. However, if this is not the intended behavior then it would be nice to have the default be to use the prepublishOnly
npm script instead to only run builds before npm publish
, and not after installs.
I just ran the standard you generator with all defaults. when I run the test task in vs code it does not find any tests
Using TypeScript
Version 2.2.1
Warning: Could not find any test files matching pattern: 'test/**/*-spec.ts'
No test files found
I just tool the "'" out of npm run build && mocha --compilers ts:ts-node/register --recursive test/**/*-spec.ts lline and it works.
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.