generator-ko's People
Forkers
mattlaver milimetric sitefactory-au robertjustjones jstclair lowema docnoe sunxboy petapetapeta vintharas techmuch jbnicolai rodolfotorres gbexciteholidays torunmustafa sshay77 nenitiko atxeira brianweet aniliht tonystrafford csson zigoriok eastrage schuster19uk chiyiangel pschimbin systemutvecklare eriksvaleng fuhongwei041 khaled-ansary nmocruz bromgrevgenerator-ko's Issues
serve:src looks for external js files in src/app folder
When running task gulp serve:src
I get the following errors that indicate som path configuration not being correct. The gulp serve:dist
task works as expected. My guess is that is has to do with paths in require.config.js not beeing caught?!
Edit:
Problem had to do with '/' not working on Windows
Note, I'm running on Windows and had to replace '/' with '' in the transpilationConfig.skip section. But that should not affect this problem because it works as expected for serve:dist
.
C:\dev\demo>gulp serve:src
[11:46:33] Using gulpfile C:\dev\demo\gulpfile.js
[11:46:33] Starting 'serve:src'...
[11:46:33] Finished 'serve:src' after 18 ms
[11:46:33] Server started http://localhost:8080
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\jquery.js'
at Error (native)
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\bootstrap.js'
at Error (native)
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\knockout.js'
at Error (native)
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\knockout-projections.js'
at Error (native)
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\crossroads.js'
at Error (native)
Error: ENOENT: no such file or directory, open 'C:\dev\demo\src\app\hasher.js'
at Error (native)
Grunt version of the gulp config
Hi, Is there a grunt version of the scaffolding's gulp config file available?
Out of the box: build fails on VS2015 - path too long
TO REPRO
Use yo ko to scaffold a new project
Open in VS 2015 as a Website
In Solution Explorer, select the globe icon (root of the site)
Press F5 to start with debugging
Watch progress in the Output window
RESULT
Building directory '/node_modules/gulp/node_modules/gulp-util/node_modules/dateformat/node_modules/meow/node_modules/read-pkg-up/node_modules/read-pkg/node_modules/load-json-file/node_modules/graceful-fs/'.
: Build (web): The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Validation Complete
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
EXPECTED
Out of the box I'd expect the blank unaltered template to work.
'js:babel' gulp task throws an error
[13:51:42] Starting 'js:babel'...
[BABEL] Note: The code generator has deoptimised the styling of "src/bower_modules/jquery/dist/jquery.js" as it exceeds the max of "100KB".
[BABEL] Note: The code generator has deoptimised the styling of "src/bower_modules/jquery/dist/jquery.slim.js" as it exceeds the max of "100KB".
stream.js:74
throw er; // Unhandled stream error in pipe.
^
Consider accepting PR: #16
Knockout Version Mismatch reported by Bower
On running the generator, bower generates the message below. Entering option '!2' allows the installation to continue and the result appears to work fine.
Unable to find a suitable version for knockout, please choose one:
1) knockout#~3.1.0 which resolved to 3.1.0 and is required by knockout-projections#1.1.0
2) knockout#~3.2.0-alpha which resolved to 3.2.0 and is required by {application name} Prefix the choice with ! to persist it to bower.json
Out of the box: Typescript errors on Windows (aka. update TypeScript)
On Windows I get this on a clean install (on Linux it works):
C:\Users\Grovespaz\Documents\Code\test-project>gulp ts
[19:37:59] Using gulpfile ~\Documents\Code\test-project\gulpfile.js
[19:37:59] Starting 'ts'...
[19:38:00] Compiling TypeScript files using tsc version 1.0.1.0
[19:38:02] [tsc] > C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:965
[19:38:02] [tsc] > throw new Error("Debug Failure. False expression: " + message
[19:38:02] [tsc] > ^
[19:38:02] [tsc] > Error: Debug Failure. False expression: Should not use a released bitvector
[19:38:02] [tsc] > at Function.Debug.assert (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescrip
t\bin\tsc.js:965:23)
[19:38:02] [tsc] > at BitVectorImpl.valueAt (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescrip
t\bin\tsc.js:755:34)
[19:38:02] [tsc] > at BitMatrixImpl.valueAt (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescrip
t\bin\tsc.js:881:31)
[19:38:02] [tsc] > at PullTypeSymbol._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeReferenceRecurse (C:\Users\Grovespaz\Doc
uments\Code\test-project\node_modules\typescript\bin\tsc.js:38026:74)
[19:38:02] [tsc] > at PullInstantiatedTypeReferenceSymbol.PullTypeSymbol._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeR
eferenceStructure (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:38084:56)
[19:38:02] [tsc] > at PullInstantiatedTypeReferenceSymbol.PullTypeSymbol._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeR
eferenceWorker (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:38057:70)
[19:38:02] [tsc] > at PullInstantiatedTypeReferenceSymbol.PullTypeSymbol._wrapsSomeTypeParameterIntoInfinitelyExpandingTypeR
eferenceRecurse (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:38036:62)
[19:38:02] [tsc] > at PullInstantiatedTypeReferenceSymbol.PullTypeSymbol.wrapsSomeTypeParameterIntoInfinitelyExpandingTypeRe
ference (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:38020:66)
[19:38:02] [tsc] > at PullInstantiatedTypeReferenceSymbol.getGenerativeTypeClassification (C:\Users\Grovespaz\Documents\Code\b
itgate.bitbook.frontend\node_modules\typescript\bin\tsc.js:56587:30)
[19:38:02] [tsc] > at PullTypeEnclosingTypeWalker.getGenerativeClassification (C:\Users\Grovespaz\Documents\Code\bitgate.bitbo
ok.frontend\node_modules\typescript\bin\tsc.js:38846:36)
[19:38:02] [tsc] > at PullTypeResolutionContext.oneOfClassificationsIsInfinitelyExpanding (C:\Users\Grovespaz\Documents\Code\b
itgate.bitbook.frontend\node_modules\typescript\bin\tsc.js:39598:71)
[19:38:02] [tsc] > at PullTypeResolver.typesAreIdenticalInEnclosingTypes (C:\Users\Grovespaz\Documents\Code\bitgate.bitbook.fr
ontend\node_modules\typescript\bin\tsc.js:47714:29)
[19:38:02] [tsc] > at PullTypeResolver.signatureTypeParametersParametersAndReturnTypesAreIdentical (C:\Users\Grovespaz\Document
s\Code\test-project\node_modules\typescript\bin\tsc.js:48034:55)
[19:38:02] [tsc] > at PullTypeResolver.signaturesAreIdenticalWorker (C:\Users\Grovespaz\Documents\Code\bitgate.bitbook.fronten
d\node_modules\typescript\bin\tsc.js:48005:75)
[19:38:02] [tsc] > at PullTypeResolver.signaturesAreIdentical (C:\Users\Grovespaz\Documents\Code\test-project\node
_modules\typescript\bin\tsc.js:47976:40)
[19:38:02] [tsc] > at PullTypeResolver.signaturesAreIdenticalWithNewEnclosingTypes (C:\Users\Grovespaz\Documents\Code\bitgate.
bitbook.frontend\node_modules\typescript\bin\tsc.js:47957:47)
[19:38:02] [tsc] > at PullTypeResolver.typeCheckFunctionOverloads (C:\Users\Grovespaz\Documents\Code\test-project\
node_modules\typescript\bin\tsc.js:49414:30)
[19:38:02] [tsc] > at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.js:42863:23
[19:38:02] [tsc] > at Function.PullTypeResolver.typeCheck (C:\Users\Grovespaz\Documents\Code\test-project\node_mod
ules\typescript\bin\tsc.js:49358:21)
[19:38:02] [tsc] > at TypeScriptCompiler.getSemanticDiagnostics (C:\Users\Grovespaz\Documents\Code\test-project\no
de_modules\typescript\bin\tsc.js:55508:41)
[19:38:02] [tsc] > at CompilerIterator.moveNextSemanticsPhase (C:\Users\Grovespaz\Documents\Code\test-project\node
_modules\typescript\bin\tsc.js:56137:45)
[19:38:02] [tsc] > at CompilerIterator.moveNextInternal (C:\Users\Grovespaz\Documents\Code\test-project\node_modul
es\typescript\bin\tsc.js:56087:33)
[19:38:02] [tsc] > at CompilerIterator.moveNext (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\types
cript\bin\tsc.js:56062:25)
[19:38:02] [tsc] > at BatchCompiler.compile (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescrip
t\bin\tsc.js:62412:20)
[19:38:02] [tsc] > at BatchCompiler.batchCompile (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\type
script\bin\tsc.js:62251:22)
[19:38:02] [tsc] > at TypeScript (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\bin\tsc.j
s:62928:11)
[19:38:02] [tsc] > at Object.<anonymous> (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\b
in\tsc.js:62929:3)
[19:38:02] [tsc] > at Module._compile (module.js:460:26)
[19:38:02] [tsc] > at Object.Module._extensions..js (module.js:478:10)
[19:38:02] [tsc] > at Module.load (module.js:355:32)
[19:38:02] [tsc] > at Function.Module._load (module.js:310:12)
[19:38:02] [tsc] > at Module.require (module.js:365:17)
[19:38:02] [tsc] > at require (module.js:384:17)
[19:38:02] [tsc] > at Object.<anonymous> (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\typescript\b
in\tsc:2:1)
[19:38:02] [tsc] > at Module._compile (module.js:460:26)
[19:38:02] [tsc] > at Object.Module._extensions..js (module.js:478:10)
[19:38:02] [tsc] > at Module.load (module.js:355:32)
[19:38:02] [tsc] > at Function.Module._load (module.js:310:12)
[19:38:02] [tsc] > at Function.Module.runMain (module.js:501:10)
[19:38:02] [tsc] > at startup (node.js:129:16)
[19:38:02] [tsc] > at node.js:814:3
[19:38:02] Failed to compile TypeScript: Error: tsc command has exited with code:1
events.js:85
throw er; // Unhandled 'error' event
^
Error: Failed to compile: tsc command has exited with code:1
at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\index.js:51:33
at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\lib\compiler.js:283:8
at Array.forEach (native)
at Function.Compiler._allAborted (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\lib\compile
r.js:282:13)
at Function.Compiler.abortAll (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\lib\compiler.j
s:260:14)
at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\index.js:50:20
at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\lib\compiler.js:109:7
at Transform.<anonymous> (C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\lib\compiler.js:204
:5)
at Transform.emit (events.js:129:20)
at C:\Users\Grovespaz\Documents\Code\test-project\node_modules\gulp-tsc\node_modules\through2\node_modules\readabl
e-stream\lib\_stream_readable.js:965:16
Deprecation warning for gulp-clean
When the generator is executed, a warning message is logged saying gulp-clean is deprecated and instead, gulp-rimraf should be used.
npm WARN deprecated [email protected]: use gulp-rimraf instead
Ditch bower
Updating bootstrap compaint about popperjs, which won't support bower very long.
Why is the Typescript option removed?
In commit 355035a the support for Typescript has been removed. I was just curious as of why this has been removed.
Wouldn't it be more prudent to simply extend the ko generator with other options, like ES2015 and Babel, and also reintroduce the Typescript again? I'm more than happy to work on a PR to add Typescript back, if that's desirable.
Components in ASP.NET 5 Projects
Hello,
I was wondering how you would recommend structuring the components folder in an ASP.NET 5 project when using TypeScript (or ES6 with Babel). The default ASP.NET 5 template places static files (the HTML files) into the wwwroot folder, and files that need to be compiled (ES6 JS files with Babel or TS files) into the src folder. Using their template, would you separate the static files from the compiled files or would you put them together and use a gulp task to copy the html files to the wwwroot folder?
Keeps the ViewModel and Template files together in one folder, but I will need to use gulp to copy the html files without modifying them at all
- wwwroot
- components
- test-component
- test-component.ts
- test-component.html
- test-component
- components
vs
Keeps the logical separation of static and compiled files, but adds complexity to the project structure since component ViewModels and Templates would be located in different folders
- wwwroot
- components
- test-component
- test-component.html
- test-component
- components
- components
- test-component
- test-component.ts
- test-component
Thanks,
Chris
Multiple viewmodels per page
Hi Steve,
not an issue, just wondering, how to achieve multiple viewmodels per page w/o breaking the clear pattern.
Thanks for that wonderful lesson regarding "best ko practices"
JS Script Cache Invalidation
@SteveSanderson, would you consider adding support for JS script cache invalidation?
I was wondering if instead of calculating the MD5 using the filename in the 'js' task:
gulp.task('js', function () {
return rjs(requireJsOptimizerConfig)
.pipe(uglify({ preserveComments: 'some' }))
.pipe(md5())
.pipe(gulp.dest('./dist/'));
});
we could do something similar using the file contents for hashing.
Thanks in advance
Compatibility with newest Yo-Version
Nvm.
Unexpected token import
Hi,
I have run the generator successfully. Now, when I run http-server for src on the cmd I get an error
Unexpected token import in startup.js. Same problem in Chrome 50 and Firefox on win10
Out of the box: Uncaught Error: Script error for: knockout
jared@firefly quickwiki $ karma start
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 40.0.2214 (Mac OS X 10.10.2)]: Connected on socket 2XXlTo0dHr8OlpCRsSI9 with id 63325759
Chrome 40.0.2214 (Mac OS X 10.10.2) ERROR: 'There is no timestamp for /base/src/bower_modules/knockout/dist/knockout.js!'
Chrome 40.0.2214 (Mac OS X 10.10.2) ERROR: 'There is no timestamp for /base/src/bower_modules/requirejs-text/text.js!'
WARN [web-server]: 404: /base/src/bower_modules/knockout/dist/knockout.js
WARN [web-server]: 404: /base/src/bower_modules/requirejs-text/text.js
Chrome 40.0.2214 (Mac OS X 10.10.2) ERROR
Uncaught Error: Script error for: knockout
http://requirejs.org/docs/errors.html#scripterror
at /Users/jared/Code/quickwiki/node_modules/requirejs/require.js:141
yeoman with knockout spits .js files with typescript content
I used yeoman a few months ago when I started to build an SPA app with knockout. It scaffold the project and also asked me before if I want a javascript or typescript. Now when I'm using the same command, I get the initial questions from yeoman i.e. name of project, unit tests etc' but no if I want a javascript or typescript. On top of that the project that I get is .js files with typescript inside
create gulp task serve the ./dist folder
There's no way to run the generator and start developing, because there's no task to serve files, and watch for changes etc
Missing var or comma in gulpfile.js
Line 9 ends with a semicolon, so the next variable declared, requireJsOptimizerConfig, should have var in front of it
var requireJsOptimizerConfig = merge(requireJsRuntimeConfig, {
Or simply change the semicolon to a comma
var requireJsRuntimeConfig = vm.runInNewContext(fs.readFileSync('src/app/require.config.js') + '; require;'),
Sorry for not opening a pull-request with the changed file, but I haven't installed git on my new computer yet ^^
Update to use npm
Hi.
I'm learning knockout and I'm using this generator, but it's has some problems.
The first is #17 that has problems with slashes, so I did the steps to correct this (install slash and use on babel function) and it works.
The second is that bower needs to be replaced by npm or another manager, I don't know why bower will die, but it needs to be replaced, needing to change the gulp file.
The third is that some packages have changed it's name (like knockout-projections).
I'm starting to learn js/node and I don't know how to correct this and make a pull-request.
Thanks.
KO generator doesn't give me an option to choose language
Hi Steve,
In your demo, while generating the scaffolding using Yoemen, there was an option to choose Language option; either javascript or Typescript. But when I generate the ko, it doesn't provide me any language option. It generates typescript by default. Can you please let me know why this happens?
Option for using other loader tools like Browserify or Component instead of AMD
It would be really nice
Add a gulp watch for development
It's difficult to integrate serve:src with a express backend.
Gulp js task fails ("exceeds the max of 100KB")
C:\Users\Hans\web\knockout\hans\tvguide-frontend> gulp
[17:25:19] Using gulpfile ~\web\knockout\hans\tvguide-frontend\gulpfile.js
[17:25:19] Starting 'html'...
[17:25:19] Starting 'js:babel'...
[17:25:19] Starting 'css'...
[17:25:20] Finished 'html' after 1.18 s
[17:25:20] Finished 'css' after 1.55 s
[BABEL] Note: The code generator has deoptimised the styling of "src/bower_modules/jquery/dist/jquery.js" as it exceeds the max of "100KB".
[BABEL] Note: The code generator has deoptimised the styling of "src/bower_modules/knockout/dist/knockout.debug.js" as it exceeds the max of "100KB".
stream.js:74
throw er; // Unhandled stream error in pipe.
^
SyntaxError: src/bower_modules/jquery/src/intro.js: Unexpected token (45:0)
43 | // you try to trace through "use strict" call chains. (#13335)
44 | //"use strict";
45 |
| ^
at Parser.pp.raise (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\location.js:24:13)
at Parser.pp.unexpected (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\util.js:82:8)
at Parser.pp.parseExprAtom (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:425:12)
at Parser.parseExprAtom (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\plugins\jsx\index.js:412:22)
at Parser.pp.parseExprSubscripts (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:236:19)
at Parser.pp.parseMaybeUnary (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:217:19)
at Parser.pp.parseExprOps (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:163:19)
at Parser.pp.parseMaybeConditional (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:145:19)
at Parser.pp.parseMaybeAssign (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:112:19)
at Parser.pp.parseExpression (C:\Users\Hans\web\knockout\hans\tvguide-frontend\node_modules\babylon\lib\parser\expression.js:79:19)
Babel not works correctly
if (!babelCore.canCompile(pathname)) return callback();
returns error:
stream.js:94
throw er; // Unhandled stream error in pipe.
^
TypeError: undefined is not a function
at babelTranspile (...\gulpfile.js:134
:20)
add a link to the video you gave about large scale SPA.
i think you should add this link http://blog.stevensanderson.com/2014/06/11/architecting-large-single-page-applications-with-knockout-js/ to the README file.
a part of that talk was a tutorial for generator-ko.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.