@seivad/sync

Sync all of our packages with Composer, Git, NPM, etc...

Usage no npm install needed!

<script type="module">
  import seivadSync from 'https://cdn.skypack.dev/@seivad/sync';
</script>

README

Sync Package

This package simplifies updating and syncing projects within your directories.

Simply provide a list of the directories you want to be automatically synchronized.

Currently supports the following:

  • NPM
  • Composer
  • Laravel / Artisan

Clone the package locally

Pull in the package locally to make adjustments / edits:

git@gitlab.com:universaltechnology/SnapTrack/packages/sync.git

You can provide a custom projects.json file by saving this file in your user directory and running the following flag:

sync -p Sites/projects.json

Example projects.json File

[
    {
        "folder": "Sites/snaptrack/assets",
        "steps": ["npm", "composer", "artisan"]
    },
    {
        "folder": "Sites/snaptrack/auth",
        "steps": ["npm", "composer", "artisan"]
    }
]

Update Projects To Sync

To update the projects.json file after installing locally, navigate to the following folder directory to edit the file:

/usr/local/lib/node_modules/sync/projects.json

Note Do not forget to remove the final trailing comma to make this a valid JSON document, if you leave the final comma after the last object, it will throw an error.

Updates

To pull in updates of the globally installed package, run the following:

npm install -g @seivad/sync

Steps

Step Options Available

  • composer
  • artisan
  • npm

Order

Currently the options will run in the following order

  • composer
  • artisan
  • npm

Install the sync helper globally

To be able to run the sync helper from any directory, please install globally using the command below:

From the package

npm install -g .

From NPM Repository

npm install -g @seivad/sync

Run the Sync Helper

Examples include:

Defaults to local development environment and staging branch

node . 

or provide the specific development environment and branch you require

node . --branch master --env production

or if installed globally:

sync --projects Sites/projects.json

Composer

The Composer step will run the following command

  • composer update

Artisan

The Artisan (Laravel) step will run the following commands

  • php artisan migrate --force --no-interaction
  • php artisan config:clear
  • php artisan route:clear
  • php artisan cache:clear
  • php artisan queue:restart

NPM

The NPM step will run the following commands

  • npm install
  • npm run {environment; defaults to local}