Manage frontend dependencies for backend Python projects
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Michel Roux 4880a75e12 Merge pull request 'Update dependency mypy to ^0.950' (#10) from renovate/mypy-0.x into main 3 weeks ago
.github/workflows Merge pull request 'Update actions/setup-python action to v3' (#6) from renovate/actions-setup-python-3.x into main 1 month ago
src/frontman remove unecessary condition 1 year ago
test remove unecessary condition 1 year ago
.drone.yml add drone tests 1 month ago
.flake8 refactor, add github actions 1 year ago
.gitignore refactor, add github actions 1 year ago
README.md refactor, add github actions 1 year ago
poetry.lock Update dependency mypy to ^0.950 3 weeks ago
pyproject.toml Update dependency mypy to ^0.950 3 weeks ago
renovate.json Add renovate.json 1 month ago

README.md

FrontMan - Frontend Library Manager

Tool to help manage frontend dependencies (javascript, css)

Inspired by AspNet Library Manager

Installation

pip install frontman

Usage

  1. Create the manifest file frontman.json
{
  "provider": "jsdelivr",
  "destination": "assets",
  "packages": [
    {
      "name": "jquery",
      "version": "3.5.1",
      "provider": "cdnjs",
      "files": [
        {
          "name": "jquery.min.js",
          "destination": "jquery"
        }
      ]
    },
    {
      "name": "@popperjs/core",
      "version": "2.6.0",
      "path": "dist/umd",
      "destination":"popper",
      "files": [
        {
          "name": "popper.min.js",
          "rename": "popper.js"
        }
      ]
    },
    {
      "name": "bootstrap",
      "version": "4.6.0",
      "path": "dist",
      "destination": "bootstrap",
      "files": [
        "js/bootstrap.min.js",
        "css/bootstrap.min.css"
      ]
    }
  ]
}
  1. Execute FrontMan
frontman install

You should see an output like this:

OK   https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js -> assets/jquery/jquery.min.js
OK   https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js -> assets/popper/popper.js
OK   https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js -> assets/bootstrap/js/bootstrap.min.js
OK   https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css -> assets/bootstrap/css/bootstrap.min.css

Force package download

By default, files that already have been downloaded will be skipped. To force download these files, use the --force (or -f) flag:

frontman install --force

Manifest Format

provider: The server we will download the files from. It can be cdnjs, jsdelivr or unpkg.

destination: Directory where the files will be downloaded.

packages: List of packaged to be downloaded.

Each package item have the following format:

name: Name of the package, according to the chosen provider.

version: Version of the package.

path (Optional): The provider may serve the files in a sub path (eg. "dist"). Setting this option will strip the path from the downloaded file path.

destination (Optional): Directory inside the top level destination where the files from this package will be downloaded.

provider (Optional): Provider to use for this package.

files: List of files to download for this package.

The files can be specified as string containing the path to the file. The path specified here will be present in the final destination (eg. "js/bootstrap.min.js" will be downloaded to "{destination}/js/bootstrap.min.js")

Files can also be specified as objects with the following format:

name: Name of the file to download.

destination: Directory to be appended to the previous destination.

rename: Change the name of the downloaded file.