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

@masonite/slab-cli

v2.0.1

Published

A local development tool for Masonite websites.

Downloads

27

Readme

Slab CLI

CircleCI

Introduction

Slab CLI is a local web development tool for Masonite websites.

Slab CLI gives you the ability easily replicate a website from a target remote environment and have it available locally on a *.slab domain. You can also create new local projects based on defined project types (WordPress, WordPress Multisite, Laravel, Node, etc). Both projects and project types are user defined, making Slab CLI flexible enough any type of project.

Install

npm install -g @masonite/slab-cli

Requirements

  • Docker
  • Node 8
  • 2 Restful Endpoints defining projects and project types. (See Creating Endpoints)

Usage

Profiles

Slab CLI is profile based, allowing you to switch between multiple configurations for different teams. Slab CLI requires at least profile to be created. On macOS, profiles configs are located within ~/.slab/profiles/.

Commands

create

Create a new local project.

clone

Clone an existing project defined by the projects endpoint.

list

List all available local projects for the current profile.

ssh

SSH into a project's docker container as the root user.

profile

Change profiles, create a new profile, or remove an existing profile.

open

Opens a project in the default browser when anywhere inside of an existing project.

remove

Remove a local project and it's volumes.

doctor

Fixes Slab CLI stuff related to paths and domains.

--help

Outputs a list of available commands.

--profile

Outputs the current profile name.

--version

Outputs the current version of Slab CLI.

Creating Endpoints

Slab CLI requires 2 endpoints that define available projects and project types. These endpoints must be created and hosted somewhere by the user. It is recommended to locally host the projects endpoint on your machine or from inside a local network.

Template Strings

Slab CLI has a built in templating engine that will convert certain template strings into their corresponding project based values.

|Template String|Description| |---|---| | {{email}} | The profile's email. This can be used for creating a default user upon site creation. | | {{uuid}} | Each command ran in Slab CLI has a unique identifier. This should be utilized when defining commands to sync content from a remote environment. | | {{project_path}} | The local project's absolute path. | | {{project_slug}} | The local project's unique slug. | | {{project_port_1}} | The local project's port. When cloning a project or creating a new project, Slab CLI assigns an available port to a project. Currently only 1 port is used per project however future version's of Slab CLI may include support for multiple ports.| | {{project_url}} | The local project's url. This is the full url that includes http and the project's port number. You can create an http-less domain by using {{project_slug}}.slab:{{project_port_1}} |

Project Types

The project types endpoint defines the available project types. The example shows a single WordPress install and a WordPress multisite install.

[
	{
		"name": "wordpress",
		"project_repo": "[email protected]:masonitedoors/wordpress-unfinished-slab.git",
		"cmd_before_containers_init": "composer install",
		"cmd_after_containers_init": "sleep 8; docker exec --user=root {{project_slug}} bash -c 'cd /var/www/html; wp config create --dbname=wp --dbuser=web --dbpass=web --skip-check --allow-root; wp db create --allow-root; wp core install --url={{project_url}} --title={{project_slug}} --admin_user=slab --admin_password=slab --admin_email={{email}} --skip-email --allow-root; wp rewrite structure '/%postname%/' --hard --allow-root'",
		"containers": [
			{
				"image": "masonitedoors/lamp",
				"expose": "{{project_port_1}}:80",
				"volumes": [
					"{{project_path}}/html:/var/www/html"
				]
			}
		],
		"files": [
			{
				"filename": ".htaccess",
				"location": "{{project_path}}/html",
				"contents": "# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /\nRewriteRule ^index\\.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /index.php [L]\n</IfModule>\n# END WordPress"
			},
			{
				"filename": "wp-cli.yml",
				"location": "{{project_path}}/html",
				"contents": "apache_modules:\n  - mod_rewrite"
			}
		]
	},
	{
		"name": "wordpress-multisite",
		"project_repo": "[email protected]:masonitedoors/wordpress-unfinished-slab.git",
		"cmd_before_containers_init": "composer install",
		"cmd_after_containers_init": "sleep 8; docker exec --user=root {{project_slug}} bash -c 'cd /var/www/html; wp config create --dbname=wp --dbuser=web --dbpass=web --skip-check --allow-root; wp db create --allow-root; wp core multisite-install --subdomains --url={{project_url}} --title={{project_slug}} --admin_user=slab --admin_password=slab --admin_email={{email}} --skip-email --allow-root;'",
		"containers": [
			{
				"image": "masonitedoors/lamp",
				"expose": "{{project_port_1}}:80",
				"volumes": [
					"{{project_path}}/html:/var/www/html"
				]
			}
		],
		"files": [
			{
				"filename": ".htaccess",
				"location": "{{project_path}}/html",
				"contents": "RewriteEngine On\nRewriteBase /\nRewriteRule ^index\\.php$ - [L]\n\n# add a trailing slash to /wp-admin\nRewriteRule ^wp-admin$ wp-admin/ [R=301,L]\n\nRewriteCond %{REQUEST_FILENAME} -f [OR]\nRewriteCond %{REQUEST_FILENAME} -d\nRewriteRule ^ - [L]\nRewriteRule ^(wp-(content|admin|includes).*) $1 [L]\nRewriteRule ^(.*\\.php)$ $1 [L]\nRewriteRule . index.php [L]"
			},
			{
				"filename": "wp-cli.yml",
				"location": "{{project_path}}/html",
				"contents": "apache_modules:\n  - mod_rewrite"
			}
		]
	}
]

Projects

The projects endpoint defines the projects that available to clone using Slab CLI. These are pre-existing websites that live on a remote webserver. Note that in order to use a project, its type must be previously defined in the project types endpoint.

[
	{
		"name": "Project A",
		"slug": "project-a",
		"type": "wordpress",
		"repo": {
			"dev": "[email protected]:masonitedoors/wordpress-unfinished-slab.git"
		},
		"env": [
			{
				"name": "prd",
				"cmd_sync_content": ""
			},
			{
				"name": "dev",
				"cmd_sync_content": ""
			}
		]
	}
]

License

Slab CLI is open-sourced software licensed under the MIT license