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

@korodrogerie/update-koro-plugin

v1.3.0

Published

Updates Koro Plugins with Github Actions

Downloads

14

Readme

Update KoRo plugin CLI

NPM npm (scoped) node version npm

Automatically updates a KoRo Shopware 6 plugin. Updates may include GitHub Actions pipelines to unifiy our workflows throughout the plugins we're using.

Usage

npx @korodrogerie/update-koro-plugin <plugin-name>

Advanced usage

The CLI script has an additional optional parameter which allows providing the package name which should be installed.

In this case the CLI script just installs the selected package.

npx @korodrogerie/update-koro-plugin <plugin-name> --package <package-name>

Packages

The CLI scripts is using a package approach to update KoRo plugins. Inside the directory packages you're finding a packages.json meta data file which defines the name of the package, the path to it and additionally Bash commands which will be executed after the files were copied over.

A typical package inside the packages.json has the following syntax:

[{
    "name": "My package name",
    "path": "path/to/your/package",
    "install": [
        "echo 'Installation complete'"
    ]
}]

Template files inside packages

This tool supports template file (e.g. file extension is .hbs, Handlebar template). This is a useful approach when you need to dynamically set certain values inside your files to the plugin name for example. The template files are getting the following installation context:

const installContext = {
    root,
    pluginName,
    packageName,
    pluginNameSnakeCase: camelToSnakeCase(pluginName)
}

Here's an example on how a package.json.hbs file can look like as an example:

{
    "private": true,
    "name": "{{pluginNameSnakeCase}}",
    "version": "0.0.1",
    "repository": {
        "type": "git",
        "url": "git+https://github.com/KoRoHandelsGmbH/{{pluginName}}.git"
    },
    "bugs": {
        "url": "https://github.com/KoRoHandelsGmbH/{{pluginName}}/issues"
    },
    "homepage": "https://github.com/KoRoHandelsGmbH/{{pluginName}}#readme"
}

Patch files

With the support of git patches, we can also apply patches to certain files to change their content. It is especially useful for files which are already exist and you need to insert certain information to it.

Here's the workflow on how to create a patch file.

  1. Do your changes to the files in a package you wanna change
  2. Run git diff > my-changes.patch
  3. Rename file from my-changes.patch to my-changes.patch.hbs
  4. Open my-changes.patch.hbs and remove any absolute paths with relative ones
  5. If template variables are used for certain terms for example the plugin name, please replace them with the corresponding variable which should be available in the installation context mentioned above.

When you're running the update-koro-plugin scriupt it automatically picks up the patch file, renders the Handlebars template and applies the patch to the plugin.

How it works under the hood

To render the files this CLI script copies the files in a temporarily directory (inside /tmp/), Handlebars renders the file content and writes back the content inside the temporarily directory. Next up the file gets renamed to its original name and gets copied to its destination path within the plugin. Last but not least the previously created temporarily directory will be removed.

Each package including their Bash commands will be installed installed and executed independently. Please note here that this CLI scripts is working with overrides which means if you want to update a certain file you have to provide the content from previous packages. Another way around this restriction is using Bash commands to add additional content to certain files.

License

Licensed under MIT

Copyright (c) 2020-present KoRo Handels GmbH