0.1.0 • Published 4 years ago

gold-cli v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

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:

propertyrequiredexampledescription
namesackmesserthe full name for the given facade
urlhttps://github.com/Goldinteractive/Sackmesser/archive/release.zipa url where you can find the zip.
authbasic or nonehow to fetch the url
workspaceanyDirectory/evenNestedwhen 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.

propertyrequiredtypeinfo
idstringunique id matching the registry key
extendsstringSee extension section
blackList(➖)regex arraySee copy section
whiteList(➖)regex arraySee copy section
preserveList(➖)regex arraySee 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.

0.1.0

4 years ago

0.0.2-beta.6

5 years ago

0.0.2-beta.5

5 years ago

0.0.2-beta.4

6 years ago

0.0.2-beta.3

6 years ago

0.0.2-beta.2

6 years ago

0.0.2-beta.1

6 years ago

0.0.2-beta.0

6 years ago

0.0.1-alpha.8

6 years ago

0.0.2-alpha.1

6 years ago

0.0.2-alpha.0

6 years ago

0.0.1-alpha.0

6 years ago

0.0.1

6 years ago

1.0.0

6 years ago

0.0.0-alpha.6

6 years ago

0.0.0-alpha.0

6 years ago