npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

grapesjs-cli

v4.1.3

Published

GrapesJS CLI tool for the plugin development

Downloads

3,335

Readme

GrapesJS CLI

npm

grapesjs-cli

A simple CLI library for helping in GrapesJS plugin development.

The goal of this package is to avoid the hassle of setting up all the dependencies and configurations for the plugin development by centralizing and speeding up the necessary steps during the process.

  • Fast project scaffolding
  • No need to touch Babel and Webpack configurations

Plugin from 0 to 100

Create a production-ready plugin in a few simple steps.

  • Create a folder for your plugin and init some preliminary steps
mkdir grapesjs-my-plugin
cd grapesjs-my-plugin
npm init -y
git init
  • Install the package
npm i -D grapesjs-cli
  • Init your plugin project by following few steps
npx grapesjs-cli init

You can also skip all the questions with -y option or pass all the answers via options (to see all available options run npx grapesjs-cli init --help)

npx grapesjs-cli init -y --user=YOUR-GITHUB-USERNAME
  • The command will scaffold the src directory and a bunch of other files inside your project. The src/index.js will be the entry point of your plugin. Before starting developing your plugin run the development server and open the printed URL (eg. the default is http://localhost:8080)
npx grapesjs-cli serve

If you need a custom port use the -p option

npx grapesjs-cli serve -p 8081

Under the hood we use webpack-dev-server and you can pass its option via CLI in this way

npx grapesjs-cli serve --devServer='{"https": true}'
  • Once the development is finished you can build your plugin and generate the minified file ready for production
grapesjs-cli build
  • Before publishing your package remember to complete your README.md file with all the available options, components, blocks and so on. For a better user engagement create a simple live demo by using services like JSFiddle CodeSandbox CodePen and link it in your README. To help you in this process we'll print all the necessary HTML/CSS/JS in your README, so it will be just a matter of copy-pasting on some of those services.

Customization

Customize webpack config

If you need to customize the webpack configuration, you can create webpack.config.js file in the root dir of your project and export a function, which should return the new configuration object. Check the example below.

// YOUR-PROJECT-DIR/webpack.config.js

// config is the default configuration
export default ({ config }) => {
    // This is how you can distinguish the `build` command from the `serve`
    const isBuild = config.mode === 'production';

    return {
        ...config,
        module: {
            rules: [ { /* extra rule */ }, ...config.module.rules ],
        },
    };
}

Generic CLI usage

Show all available commands

grapesjs-cli

Show available options for a command

grapesjs-cli COMMAND --help

Run the command

grapesjs-cli COMMAND --OPT1 --OPT2=VALUE

License

MIT