Giles  Goodwin

Giles Goodwin

1599562740

How We Auto-Generate Documentation, JavaScript Style

We’ve spent the last few months building the new version of our shopping cart.

When we started working on it, we knew this would also mean changes in other areas of our product.

Documentation was one of them.

It meant a few specific and much-needed upgrades:

  • Improving navigation between docs versions
  • Rethinking content arborescence
  • Automating documentation generation as much as possible

We also wanted to stay true to what we preach; using the JAMstack! That meant choosing the right JavaScript tools to generate our documentation.

We ended up picking Nuxt for static documentation generation, Sanity.io to manage content, and Netlify for automated deployment. I’ll explain why later on.

In the end, it was a great opportunity to significantly enhance our docs UX for both users and our development team.

In this post, I want to show you how we did it and how you can replicate it.

Disclaimer: Keep in mind this is an ongoing beta of the v3.0 for development and testing purpose only.

Our documentation generation (a bit of context)

context

Our old doc was built with custom Node.js and needed server-side rendering on each new page load. We often forgot to document new fixes and simple features. There was also the unfortunate errors and typos from time to time. In short, documentation could often become a pain in the a**. I’m sure some of you can relate to this.

So, for our new documentation, we fixed ourselves a few goals. It had to:

  • Be deployed as a fully static site
  • Be hosted on a fast CDN
  • Use Vue.js on the frontend (as it’s our team’s go-to framework)
  • Make editing content easier for the whole team—not only devs!
  • Ensure all our Javascript API’s methods and theme’s overridable components get properly documented

This combination of criteria added up to an obvious choice of stack: a Vue-powered static site generator attached to a headless CMS.

As automation fans, we didn’t want to manage the documentation of our theme’s components and the Javascript API independently. The documentation data would need to be generated at build time from the code and JSDoc comments.

This would require a fair amount of additional work but, in the long run, ensure documentation that’s always up-to-date and validated at the same time we review features’ pull requests.

This also added the constraint of choosing a headless CMS with a powerful API to update content.

Why Sanity as a headless CMS?

sanity-documentation

There are many, many headless CMSs. I suggest doing a thorough research and measure the pros and the cons before choosing one. In our case, there are a few criteria that made the balance lean in favor of Sanity.io:

  • Great out-of-the-box editing experience
  • Fully hosted—no need to manage this in our infrastructure
  • Open source and customizable
  • Excellent API for both querying & writing
  • Webhooks allowing us to rebuild the doc after content edits

Starting a Sanity project is straightforward. In a newly created repo, run sanity init.

Then, define a few document types and, if your heart feels like it, create some custom components to tailor editing to your specific needs. Even if you embark on a customization spree, this won’t prevent you to from deploying your CMS on Sanity—that’s where it truly shines, because high customizability is quite a rare trait in hosted solutions.

Sanity’s API was also a breath of fresh air.

GROQ, their querying language, is a welcome addition to the ecosystem. Think GraphQL, without always being required to be explicit about all the fields you want in a query (or being able to query polymorphic data without feeling like the Labours of Hercules).

Furthermore, modifications can be scoped in a transaction which allows us to batch updates to multiple documents from our theme and SDK build process. Combine this with webhooks, and it ensures we only trigger documentation deploys once for many changes from our theme and SDK repositories.

#nuxt

What is GEEK

Buddha Community

How We Auto-Generate Documentation, JavaScript Style
anita maity

anita maity

1619614811

Random Password Generator Using JavaScript, HTML & CSS

Random Password Generator is a program that automatically generates a password randomly. Those generated passwords are mix with numbers, alphabets, symbols, and punctuations. This type of program helps the user to create a strong password.

Step By Step Tutorial :https://cutt.ly/ZbiDeyL

#password generator #random password generator #python password generator #random password generator javascript #html #javascript

Vincent Lab

Vincent Lab

1605177756

JavaScript Password Generator

In this video, I will be showing you how to build a password generator in JavaScript.

#password generator #random password generator #password #javascript #javascript project #javascript fun project

Vincent Lab

Vincent Lab

1605099909

JavaScript Password Generator - Part 2

In this video, I will be showing you how to build a password generator in JavaScript

#password generator #random password generator #javascript #js #javascript fun project #javascript project

Rahul Jangid

1622207074

What is JavaScript - Stackfindover - Blog

Who invented JavaScript, how it works, as we have given information about Programming language in our previous article ( What is PHP ), but today we will talk about what is JavaScript, why JavaScript is used The Answers to all such questions and much other information about JavaScript, you are going to get here today. Hope this information will work for you.

Who invented JavaScript?

JavaScript language was invented by Brendan Eich in 1995. JavaScript is inspired by Java Programming Language. The first name of JavaScript was Mocha which was named by Marc Andreessen, Marc Andreessen is the founder of Netscape and in the same year Mocha was renamed LiveScript, and later in December 1995, it was renamed JavaScript which is still in trend.

What is JavaScript?

JavaScript is a client-side scripting language used with HTML (Hypertext Markup Language). JavaScript is an Interpreted / Oriented language called JS in programming language JavaScript code can be run on any normal web browser. To run the code of JavaScript, we have to enable JavaScript of Web Browser. But some web browsers already have JavaScript enabled.

Today almost all websites are using it as web technology, mind is that there is maximum scope in JavaScript in the coming time, so if you want to become a programmer, then you can be very beneficial to learn JavaScript.

JavaScript Hello World Program

In JavaScript, ‘document.write‘ is used to represent a string on a browser.

<script type="text/javascript">
	document.write("Hello World!");
</script>

How to comment JavaScript code?

  • For single line comment in JavaScript we have to use // (double slashes)
  • For multiple line comments we have to use / * – – * /
<script type="text/javascript">

//single line comment

/* document.write("Hello"); */

</script>

Advantages and Disadvantages of JavaScript

#javascript #javascript code #javascript hello world #what is javascript #who invented javascript

Hire Dedicated JavaScript Developers -Hire JavaScript Developers

It is said that a digital resource a business has must be interactive in nature, so the website or the business app should be interactive. How do you make the app interactive? With the use of JavaScript.

Does your business need an interactive website or app?

Hire Dedicated JavaScript Developer from WebClues Infotech as the developer we offer is highly skilled and expert in what they do. Our developers are collaborative in nature and work with complete transparency with the customers.

The technology used to develop the overall app by the developers from WebClues Infotech is at par with the latest available technology.

Get your business app with JavaScript

For more inquiry click here https://bit.ly/31eZyDZ

Book Free Interview: https://bit.ly/3dDShFg

#hire dedicated javascript developers #hire javascript developers #top javascript developers for hire #hire javascript developer #hire a freelancer for javascript developer #hire the best javascript developers