Gathering detailed insights and metrics for hashdo-cli
Gathering detailed insights and metrics for hashdo-cli
Gathering detailed insights and metrics for hashdo-cli
Gathering detailed insights and metrics for hashdo-cli
npm install hashdo-cli
Typescript
Module System
Min. Node Version
Node Version
NPM Version
30.8
Supply Chain
63.9
Quality
68.6
Maintenance
25
Vulnerability
90.1
License
JavaScript (82.17%)
HTML (16.82%)
CSS (1.01%)
Total Downloads
40,628
Last Day
2
Last Week
47
Last Month
298
Last Year
1,390
1 Stars
77 Commits
4 Watching
1 Branches
4 Contributors
Latest Version
0.1.78
Package Id
hashdo-cli@0.1.78
Size
18.19 kB
NPM Version
3.10.10
Node Version
6.11.0
Cumulative downloads
Total Downloads
Last day
100%
2
Compared to previous day
Last week
-44.7%
47
Compared to previous week
Last month
1,762.5%
298
Compared to previous month
Last year
-10.4%
1,390
Compared to previous year
#Do is framework for creating stateful interaction cards that can be embedded in mobile applications or viewed in a browser. The CLI provides tooling for generating and testing cards that can be deployed with the #Do framework.
This package is a combination of a CLI (command-line interface) to create packs and cards as well as web application that models how cards will be made available to users through the browser or native mobile application.
Install #Do CLI using NPM
npm install hashdo-cli -g
You will now have a global CLI application that you launch with hashdo
.
Create a new card pack. A pack is a collection or category of cards. Grouping makes it easier for users to find cards types they are looking for.
hashdo create pack
This will launch the card pack template generator. Provide a pack name or just accept the defaults to generate the necessary package.
A card pack is also an NPM package so this is what you would publish to NPM.
Create a new card.
hashdo create card
This will launch the card template generator. You can select the view engine and preprocessor you are most comfortable for development. A card will be added to the selected pack
Launch the #Do web application to test your new card.
A test harness is provided to easily enter values for your input fields and see how your card will be rendered.
hashdo serve
By default the web server port is 4000. If something on your system is already using this port, then provide an alternate port to the serve
command.
hashdo serve --port 8080
State support on the client is necessary if there is any user interaction on your card. This interaction will change the state
which you can check and render differently the next time the card is requested.
Client state support is enabled on your card by adding this.clientStateSupport = true
as a property on your card.
Let's use a rating card as an example.
1// In your card JS code. 2getCardData: function (inputs, state, callback) { 3 if (!state.rating) { 4 // Create a view model that allows user interaction. 5 var viewModel = { 6 readonly: false 7 }; 8 9 // Pass any values you want to be accessible from the client. 10 var clientLocals = { 11 mySystemRatingId: inputs.ratingId 12 }; 13 14 callback(null, viewModel, clientLocals); 15 } 16}
If there is no previous state
the user has the opportunity to set the rating. This interaction needs to be saved as state
on the client/browser.
1// In your client JS code (main.js). 2card.onReady = function () { 3 var $card = $('#' + locals.card.id); 4 5 card.state.onChange = function (val) { 6 if (val.cardId !== locals.card.id) { 7 // Set anything you need on the client once the state is saved. 8 } 9 }; 10 11 // Save the state to your system, then save it to the card. 12 $.post('http://myratingsystemapi.com/rate', { 13 id: locals.mySystemRatingId, 14 rating: rating 15 }, 16 function (response) { 17 if (response.status === 200) { 18 // Will trigger the card onChange event. 19 card.state.save({ 20 rating: rating 21 }); 22 } 23 }); 24}
Next time the same card is requested, you can display it in read-only mode since there is already a rating and no need to load the client script.
1// In your card JS code. 2getCardData: function (inputs, state, callback) { 3 ... 4 if (state.rating > 0) { 5 // Use variables in the view model to generate you HTML from a template. 6 var viewModel = { 7 readonly: true 8 }; 9 10 callback(null, viewModel); 11 } 12}
This simplistic example should give you a good idea of how the pieces fit together. Using this technique, a single card could have multiple views and states that it could be in. Instead of a simple one step rating, this could easily be converted into a full step-by-step survey.
The custom backend for your card may have a long running process or workflow that will eventually complete and need to update the card's state, this is where Web Hooks come in.
For example, if you used a card to order a pizza, at some point the card would be in a "order in progress" state. When the pizza is actually delivered, there needs to be a non-interactive call that updates the card state to display is complete.
The call to the web hook must be a POST
to https://domain/webhook/myPackName/myCardName/
. The POST
can contain any custom JSON payload in the body which will be passed to your web hook function.
1webHook: function (payload, callback) { 2 if (payload.status === 'delivered') { 3 callback(null, 4 // URL parameters that would access this card. 5 { orderNumber: payload.orderNum }, 6 // New state to persist. 7 { total: payload.address, 8 status: 'paid and delivered' 9 }); 10 } 11 else { 12 callback(); 13 } 14}
The design and layout principles of a card are important to deliver the intended content to the user. Cards should be designed in such a way that they display important information and it should be immediately obvious how to interact with it.
Built-in default style classes are made available to quickly create great looking cards.
Apply this class to containers that have lists.
Apply this class to any custom anchor tags.
Inner/center content. Text content should be placed inside <p>
tags here.
Card header styles.
Card footer styles.
Apply to elements that need to be animated.
Pulse animation, useful to attract attention to input or interactions.
To avoid conflicts with other CSS on the page, any custom CSS should be applied at the highest level in your HTML content. A good practice is to use your pack and card name as top-level class names to easily create a selector that will only apply to your card content.
1<div class="hdc myPackName myCardName"> 2 <div class="hdc-hdr"> 3 <div class="hdc-title">Header text...</div> 4 </div> 5 <div class="hdc-content"> 6 <div class="hdc-inner"> 7 Your awesome card content! 8 </div> 9 </div> 10 <div class="hdc-footer"> 11 <p>Footer text...</p> 12 </div> 13</div>
You can now prefix .myPackName.myCardName
too all your custom selectors and be quite confident that you won't have any conflicts.
You are of course free to design your card in any way you see fit. Draw inspiration from Google's card guidelines and get started created your own unique cards.
Copyright 2015 (c). All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More