GithubHelp home page GithubHelp logo

jzeng151 / next-step Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oslabs-beta/next-step

0.0 0.0 0.0 398 KB

NextStep is a lightweight Visual Studio Code extension built on top of Next.js for improving performance and search engine optimization for web applications.

Home Page: https://www.thenextstep.io

License: MIT License

TypeScript 100.00%

next-step's Introduction

NextStep

Version Ratings

Table of Contents

About

NextStep provides Next.js developers the ability to understand the performance impact of any changes made to their application with real-time visualization of Google's web application performance metrics inside of Visual Studio Code.

NextStep consists of two parts:

Features

These two tools work together to automatically calculate web performance scores upon any refresh of a developer's Next.js application, including browser refreshes as well as hot reloading from within the IDE.

NextStep Extension provides a button in the Visual Studio Code Status Bar. When active, each refresh of the developer's app will generate a table in the Output panel of VS code displaying the latest metrics, along with the moving average of the previous 5 refreshes.

Each score is compared against Google's benchmark Core Web Vitals which are defined here. Any results falling in the "Poor" ranges will direct the user to the Next.js documentation to help identify opportunities for improvement.

The NextStep NPM Package imports the functionality to monitor the developer's Next.js application and capture Web Vitals details within the IDE.

Getting Started

  1. Download and install the NextStep VS Code Extension from the extensions marketplace.

  2. Run "npm install next-step-metrics" to install the NextStep Metrics npm package.

      npm install next-step-metrics
    
  3. In your project's "next.config.js" file, make sure fs is configured as below:

    webpack: (config, { isServer }) => {
      if (!isServer) {
        config.resolve.fallback.fs = false;
      }
      return config;
    }
    
  4. In your Next.js application's "/pages/api" folder add a file called "next-step.js" with the following code:

      import nc from "next-connect";
      import { metrics } from "next-step-metrics";
      const handler = nc().post((req, res) => {
        return metrics(req, res);
      });
      export default handler;
    
  5. In your Next.js application's "/pages/_app.js" file wrap your file with the following lines to import and export out 'reportWebVitals'. It is not necessary to import this function anywhere else in your application.

     import { reportWebVitals } from "next-step-metrics";
     export { reportWebVitals };
    
  6. Toggle NextStep to On from the VS Code status bar, and run your Next.js application script. Updated metrics will begin to appear in your Output panel every time the webpage refreshes.

Usage

  • "NextStep: ON" indicates that NextStep will capture any changes to the Next.js application's calculated Web Vitals metrics. More information on Google's definitions and benchmarks for Web Vitals can be found here.
  • "NextStep: OFF" indicates that NextStep is not active and will not poll for changes.

Calculated web metrics and their scores are displayed as a table in the Output panel. NOTE: FID score will not be recalculated until a user input action is taken on the page. Ie, button click or typed input field.


Additional Information

You MUST install the Next Step Metrics NPM Package to be able to use this extension. The required set up steps and troubleshooting documentation can be found in the README. NextStep is a tool specifically built for Next.js applications. Other frameworks are not supported at the moment.

Resources:


Authors

next-step's People

Contributors

syu449 avatar lucastaffo avatar shenkenny avatar horovitsg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.