Code Monkey home page Code Monkey logo

fe-cli's Introduction

Gold Frontend CLI ๐Ÿ‘พ

npm version Maintainability

This CLI enables you to create and maintain projects using facades.

A facade is a part of an application providing some functionality. The goal is to easily setup a project using multiple facades and being able to udpate them individually.

Setup

Dependencies

Node v10, yarn, git, curl, unzip

"Installation"

We've got good news for you: There is no need to download yet another global package ๐ŸŽ‰

Because fe-cli does not have any npm dependencies it's really fast to download.

One thing you have to configure however is your local .goldclirc file. It must be located in your home directory and must contain a registry link.

For the Gold Facades this would be:

.goldclirc

{
    "registry": "https://bitbucket.org/!api/2.0/snippets/goldinteractive/LenKoB/files/registry.json"
}

Commands

The CLI has one main command:

  • setup - to initialize or update a project

setup

This command initializes a project using the given facade. Check out the registry to see the available facades.

In order to set up the sackmesser facade (sm):

npx gold-cli setup sm

If you want to set the working directory, pass it as second argument: npx gold-cli setup sm new-project-directory

Structure

Registry

A registry is an object containing children using this structure:

property required example description
name โž– sackmesser the full name for the given facade
url โœ… https://github.com/Goldinteractive/Sackmesser/archive/release.zip a url where you can find the zip.
auth โœ… basic or none how to fetch the url
workspace โž– anyDirectory/evenNested when the zip is extracted, where is the actual source of the repository?

Note that the key of the given child represents the name one has to pass to the CLI.

In order to run setup xyz one has to configure the registry as:

{
    "xyz": { name, url, auth, workspace }
}

A more specific example:

{
    "sm": {
      name: 'sackmesser',
      url: 'https://github.com/Goldinteractive/Sackmesser/archive/release.zip',
      auth: 'none'
    },
    "bp": {
      name: 'blueprint',
      url: 'https://bitbucket.org/goldinteractive/craft-blueprint/get/master.zip',
      auth: 'basic', // <- prompt for username and password 
      workspace: 'src' // <- location where the actual project is within the repo
    },
    "em": {
        ...
    }
}

Manifest

The manifest represents the meta information of a project as well as a facade (Facades act as projects as well)

This is a quick overview of the different properties. See the sections below for more detailed information.

property required type info
id โœ… string unique id matching the registry key
extends โž– string See extension section
blackList (โž–) regex array See copy section
whiteList (โž–) regex array See copy section
preserveList (โž–) regex array See copy section

The following sections explain the different parts of a manifest.

Extension

A project can use multiple facades, in order to set it up correctly apply them in the logical order and it will generate the corresponding extends configuration for you.

{
    extends: ["sm", "bp", "em"]
}

Copy

A facade must configure the assets which shall be copied upon setup.

The entries of the lists are treated as regex! So make sure to escape where required.

All files are tested against these lists, so the file /package.json will be checked as package.json

If you want to copy a root directory, you can use the ^ syntax. So e.g. to copy the frontend use ^frontend as regex.

{
    // XOR (only one of both)
    "whiteList" | "blackList": ["regex"],

    // optional -> copy only if it does not exist yet
    "preserveList": ["regex"]
}

Development

Execute local version

There is a npm script to run the cli locally: npm run main setup xyz ...

Run tests

This project uses Jest for unit testing, simply run: yarn run test.

Publish version

It's not required to run any build process before publishing.

Just be sure to run the tests before publishing.

This package is published using:

yarn publish

git push --tags

Note that the last published version will automatically be used by all consumers. So be careful when publishing.

fe-cli's People

Contributors

dependabot[bot] avatar stuckisimon 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.