Comments (12)
POC custom template
@JarvisJ I just published a POC for custom template* - [email protected]
Please check it out. I'd appreciate feedback.
How to use:
npm i scuri@next
Windows path follows - turn the slashes if mac/linux
ng g scuri:spec --name .\src\app\app.component.ts --classTemplate .\src\template\my.tmpl
the my.tmpl
file is the custom template* and
- uses a special syntax
- has some props available -
- see https://gist.github.com/gparlakov/f299011829e229c9d37cf0cb38506d97 for starter and modify to your liking
*custom class template - creates a spec for a class e.g. export class MyComponent{ ...
and not export function myFunction() {...
from scuri.
from scuri.
@JarvisJ 1.1.0-rc.1 is now live with support for config file. Care to take it for a spin?
- https://www.npmjs.com/package/scuri/v/1.1.0-rc.1
- see the Configuring section
from scuri.
Do you want to test it with SCuri code? Well there is a way. SCuri code keeps dependencies in a shared folder (maintained by VS Code) so here's how to locate that folder on a machine and install scuri@next
version
@JarvisJ FYI
from scuri.
I'd like to be able to provide a custom spec template via a config option. For people/projects who want specific boilerplate, this would be very useful.
Edit - poking around angular-schematics and the scuri code a bit, I see this isn't necessarily as straightforward as I would've hoped. Maybe custom templates is more of a feature request for the schematics project.
from scuri.
@JarvisJ thanks for the feedback. I intend to look into that. Will let you know .
from scuri.
Awesome! I tried out 1.0.8-rc.1, and it worked as expected with my custom template. Thanks!
from scuri.
Works great so far! Thanks!
Edit - and to confirm, I did test specifying the template from package.json. That works as expected.
from scuri.
It works, using my template, with the vs-code extension. The extension still doesn't work in my multiroot workspace. I describe that issue here:
gparlakov/scuri-code#4 (comment)
from scuri.
Hey there. I'm picking up where Mr. JarvisJ left off (literally, same company and product), I'm finding that it would be very helpful to be able to forEach through the declaration and buildExports like we can through the params and publicMethods, there are some places where we'd like to be able to consistently override the line-by-line generation for specific classes.
from scuri.
Hey, @Z-Newman,
I think you can do that with the params
property that's already exposed to the template.
From index.ts
Lines 173 to 184 in 969dd91
The declarations
and buildExports
are just representations of the (constructor) params
:
Lines 200 to 216 in 969dd91
Here's an example of the template using these params
https://gist.github.com/gparlakov/f299011829e229c9d37cf0cb38506d97#file-my-tmpl-L6-L9
from scuri.
from scuri.
Related Issues (20)
- classTemplate doesn't work as expected in release 1.2.0 HOT 4
- Delete the whole expression when removing dependencies HOT 1
- Add default Observable (EMPTY) and default Promise (new Promise()) values for dependency method spy return values.
- Lint on commit
- Handle properties with Promise or Observable HOT 1
- Handle update with a custom template without any custom functions
- Check for import of autoSpy when using --update on previously created spec file HOT 3
- Support inject function from angular
- Ensure jest specific mock returns are used
- Handle Arrays of deps
- Fix autoSpy import being added in the middle of other imports
- Fix adding multiple new lines when creating deps in setup method
- Combine TS Host with Tree
- Use FileVisitorCancelToken to stop after detected one or the other HOT 1
- Handle functions declared as const
- Allow for turning off the Typescript compilation dependent features as they take 5x or 10x more time
- Simplify the Observable property
- Update Scuri to support Typescript 5.0 and above HOT 1
- Don't update names of existing dependencies
- Mocking observable properties
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.
from scuri.