The arrows also suggest potential opportunities for less confusing file structures. That's great! As I get into contributing to Preact I can do a breadth first scan of the top level stuff while keeping track of those files I have visited/should visit! The "terminal dependencies" like constants, util, options, and vnode also stand out as items that are frequently imported which themselves have no dependencies. render, component, render-queue, clone-element, and h are top level imports, and vdom is an important submodule. This is slightly messier, but can still be followed. Pretty handy for a first glance! But what does it look like for a non-trivial project? Visual code spelunking Here you can see that index.js is the highest level file, followed by scheduler.js and reconciler.js, while swyxjs.js seems like one of those "utils" files that is imported by everybody without importing anything else (it is). Here's dependency-cruiser run on the reactive-react project I recently released at React Rally: Then, in the folder of any project you care about, you can run:ĭepcruise -exclude "^node_modules" -output-type dot src | dot -T svg > dependencygraph.svgĪssuming the core of your code lives in the src sub folder and you have Graphviz dot installed (it comes installed in Netlify's buildbot so no fears about that). You can install dependency-cruiser globally with npm i -g dependency-cruiser. If you're diving into a series of caves, wouldn't it be nice to have a map? This is what I call Visual Internal Documentation, and dependency-cruiser is a great way to create and automate this! Getting Started with dependency-cruiser I think visualizing projects is really important when you want to do some code spelunking - diving into large codebases you don't know anything about. Recently Bret Comnes pointed me to Sander Verweij's dependency-cruiser project, which describes itself like this: While time is of course scarce, I am always interested in simple ideas for making open source documentation easier, since it has a domino effect further down on whether people feel welcome to get involved. Run `npm install` to install dependenciesĪny time I see that I usually think of the after credits scene from Finding Nemo: Most CONTRIBUTING.md's read something like this: 1. Whatever deficiencies we perceive in open source documentation (there isn't enough of it, for starters) is magnified 10x when it comes to documenting how it works for folks who want to contribute. Most documentation in open source is user facing. If you're not familiar with what this is, check out our Academy articleĪutomatic chart updates: How to publish charts with external data sources. Now you can paste that link into step 1: Upload Data in Datawrapper after selecting Make sure that your Google Sheet is set so that You can now go back to your Google Sheet and turn on sharing by clicking the Here, we've selected the update to run every hour. You can then chose how often you want it to run. Then find the timer icon on the left and click Triggers:ĪutoUpdateJSON as the function to run and choose the event source as Var data = ImportJSON(url, "/", "noInherit,noTruncate,noPrefixHeaders", new Date().getTime()) Var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName) Enter the name of the Sheet that you'd like the JSON to be imported into here: gs file by clicking on the + button, then copy & paste the following script and save the file as autoUpdate.gs: ImportJSON.gs can be download from this GitHub page. If you want to set up these script files in your pre-existing Google sheet, you could also do so by opening Google Apps Script in your existing sheet (Tools > Script editor), then adding these. (Note: If you can't open this Apps Script page and you're logged into multiple Google accounts, you may want to log out from all except the one you're using.) Add scripts to your pre-existing Google sheet ImportJSON which contains two script files called Make a copy to copy both the Google Sheet and the script. Once you're on the Google sheet, from the top menu, go But simply give it a try, especially if it looks similar to the JSON structure in the image above.īefore we dive in, create a copy of our pre-prepared Google sheet & scripts by clicking here □ CLICK HERE Note that JSON data can be very differently structured, so this might not work with a specific JSON you want to read. We prepared an example sheet on Google Sheet using this data, so all you have to do is replace the URL with the JSON data you want to use for your data. Mathdroid on the number of COVID-19 cases:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |