Git Product home page Git Product logo

lasso's Introduction

πŸ‘‹ Howdy. I'm Sam! 🀠

I build web apps for the financial industry and developer community. During the day I work at Plannr Technologies Ltd. We're building a revolutionary back-office system for the financial industry from the ground up.

My Open Source Packages

🀠 Saloon

Saloon is tool to help you build better integrations with third-party APIs. It provides you with an eloquent, standardised syntax that will scale with your team. With Saloon, you don't have to worry about the underlying HTTP Client like Guzzle and spend more time with the data that APIs give you.

You can learn more about Saloon by clicking here

πŸ”₯ XML Wrangler

XML Wrangler is a simplistic, modern PHP library designed to make reading and writing XML easy. XML Wrangler has been built with developer experience in mind - you can read any type of XML file, even with complex namespaces and even large XML files. It will also throw exceptions if the XML is invalid!

You can learn more about XML Wrangler by clicking here

🌡 Cactus (Upcoming)

Cactus is a super simple tool that allows you to create data transfer objects (or DTOs) on your local machine directly from your tests or your terminal. It is a great companion to any developer working with Saloon or XML Wrangler or just building lots of API integrations.

This is coming soon, keep an eye out on my Twitter/X profile!

πŸ‡ Lasso

Lasso is your asset "wrangler" (see what I did there). It's built for Laravel, and it automatically compiles your Webpack/Laravel Mix assets and uploads them to a Filesystem of your choice. It will then download those assets on all your web servers.

You can learn more about Lasso by clicking here

πŸ‘©β€πŸŒΎ Laravel Haystack (Retired)

Laravel Haystack is a package that allows you to have a job chain stored in the database. Since all of the jobs in the chain are in the database, memory usage is low and you can delay jobs for a long time or have long running jobs without risking using all your memory. Laravel Haystack supports every queue connection/worker out of the box. (Database, Redis/Horizon, SQS).

You can learn more about Laravel Haystack by clicking here

lasso's People

Contributors

alexanderfrodeberg avatar alexjustesen avatar cbl avatar codepotato avatar go0sedev avatar husonghua avatar io238 avatar jhnbrn90 avatar mvdnbrk avatar pusherman avatar sammyjo20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lasso's Issues

Write fails silently in Laravel 9

Example: export AWS_SECRET_ACCESS_KEY=invalid-key && php artisan lasso:publish

Output makes you think all is good when it is not.

#65 should resolve it.

Suggestion: Show filesystem name on lasso:publish

Love Lasso, and through usage I've found a couple of parts that I think could be nicer for the user.

When running php artisan lasso:publish the progress simply says "filesystem". I think it would be nicer if it showed the name of the disk that you're uploading to, too!

e.g. current setup:

Preparing to publish assets to Filesystem.

Proposed change:

Preparing to publish assets to "assets" Filesystem.

Manage Bundles During Push

Hi Sam,

Firstly, thanks for this package!

I'd like to ask what's the reasoning for managing bundles during pull rather than during push?

The reason I ask is because if history and bundles were managed during push I could distribute read-only access credentials to the majority of users, which would allow them to pull, and manage builds and pushing in the CI pipeline. Currently, if read-only credentials are used the PullJob fails at the VersioningService::appendNewVersion() step so it's not possible.

Consider versions stored in filesystem

i've always considered committing to git in the CI process to be fraught with peril. I would think the sensible default to be storing the version manifest on a remote filesystem. Perhaps possible to pull the version from that remote disk as part of the push process so that a version history could be maintained?

[question] "lasso:pull --force" command for lasso:pull

Hey @Sammyjo20

First of all, awesome stuff you're building here!

Today we've spent some time in the company experimenting with Lasso. We use Laravel Forge & Envoyer in combination with Github Actions to deploy our applications. For storing our assets, we've decided to use S3.

Laravel Envoyer is creating a new release for each deployment. So even if there is a history within your lasso folder we need every time a fresh pull from the S3 Server. Because of this reason we thought we can ignore the lasso-bundle.json.

If there is no history.json within the lasso folder the lasso:pull is working without any problems. But if there is an existing history.json in the file we receive the following error.

An exception was thrown. Reason: A valid "lasso-bundle.json" file could not be found in the Filesystem for the current environment.

Maybe we missing something but is there a way to provide something like a php artisan lasso:pull --force command, to receive always just the latest version? With ignoring the exiting lasso-bundle.json?

As a quick-fix: We've added the initial lasso-bundle.json back to the public folder.

Cheers
Sebastian

Breaks application after installation with cached config

If your application's config is cached, installing Lasso will break the application (making the config cache unable to be cleared as well).

Since Lasso always registers into the container (#23) it will break when the Filesystem helper attempts to instantiate, due to null being passed to setCloudDisk() as that's what is returned from the config() helper due to no Lasso configuration being cached (it would break on setPublicPath() as well).

A temporary fix until #23 is resolved would be to just provide defaults for the config values here, like is done already for lasso.storage.environment.

Issue: Memory limit reached in CI

Some people may experience a memory limit error during the β€œupload” phase of the β€œpublish” command. This is due to me not using a stream to store the contents of the Zip file. I will update this to use a stream which should resolve it. But I wanted to add this as a known issue!

Ignoring hidden files

When trying to ignore .DS_Store files from my computer none of these rules seem to work

'excluded_files' => ['DS_Store', '*.DS_Store', '.DS_Store']

Unable to check existence for: lasso/global/history.json

Hi,

Laravel Version ........................................................................................................................... 9.39.0
PHP Version ................................................................................................................................ 8.1.5
Composer Version ........................................................................................................................... 2.2.8
Environment ................................................................................................................................ local

I'm using Digital Ocean Space for uploading & Downloading compiled assets using Lasso.
php artisan lasso:publish command working without any error. But when using lasso:pull on deployment script, it's throwing an error.

php artisan lasso:pull

🏁 Preparing to download assets from "digitalocean" filesystem.
⏳ Reading Bundle meta file...
⏳ Downloading bundle...
βœ… Successfully downloaded bundle.
⏳ Creating backup...
βœ… Backed up.
⏳ Updating assets...

League\Flysystem\UnableToCheckDirectoryExistence

Unable to check existence for: lasso/global/history.json

at vendor/league/flysystem/src/UnableToCheckExistence.php:19
15β–• }
16β–•
17β–• public static function forLocation(string $path, Throwable $exception = null): static
18β–• {
➜ 19β–• return new static("Unable to check existence for: {$path}", 0, $exception);
20β–• }
21β–•
22β–• public function operation(): string
23β–• {

  +41 vendor frames

42 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Vite environments (modes) and lasso

Vite supports multiple environments via specifying a flag --mode {stage} during build command: https://vitejs.dev/guide/env-and-mode.html

The problem is when building on local with lasso vite for some reason ignores these .env.{stage} files. In documentation it is said that:

In addition, environment variables that already exist when Vite is executed have the highest priority and will not be overwritten by .env files. For example, when running VITE_SOME_KEY=123 vite build.

Can it be related that Lasso runs vite and passes the same environment as laravel currently have which overrides variables from .env.{stage} files?

Cross-platform problem with path separator

When publishing assets on Windows and pulling them into Linux, the asset directory structure is not properly preserved. Instead after unzipping, assets include the path with backward slashes in the filename (e.g. assets\css\bootstrap.min.css).

I assume that happens because directory separators are hard-coded as forward slash (/), but should use the PHP global constant DIRECTORY_SEPARATOR to avoid cross-platform issues with path names.

Max_bundles not working properly

I recently installed this package. It looks like the max_bundles setting is not working correctly. My setting is set to 5 bundles.

Screen Shot 2020-09-10 at 6 11 41 PM

Place assets on CDN during lasso:pull

I may be missing something really obvious and if so I apologize. The Lasso workflow is like:

  • Run lasso:publish on my local machine or in CI and a zip file is placed on a filesystem
  • Run lasso:pull on the server and it grabs that zip file and unzips it so the built assets can be served to visitors

I have a perfectly good CDN sitting around (that's where the zip file is uploaded to). Is there no way to have the JS/CSS bundles be put onto the CDN (unzipped) so my website visitors can download assets from the CDN instead of from y webserver?

Suggestion: Exclude Wildcard Filename

Kudos to this package! This is really an awesome tool for Laravel.

Is it possible to exclude filenames using wildcards? I tried using wildcards but it does not work.
image

Thanks!

Database connection error during Github CI/CD

Hello there,

I tried to compile assets during Github CI/CD. All my php unit tests run successfully but when it comes to compiling the assets using php artisan lasso:publish , it fails, see the error screenshot below.

It works on my localhost and successfully uploads the assets.

Looks like it cannot connect to the database, however php unit tests are passed in the same workflow and they do connect to the database.

Here is the part of workflow to lasso publish:

    - name: Compile & upload assets
        if: ${{ github.ref == 'refs/heads/production' && github.event_name == 'push' }}
        env:
          DROPBOX_TOKEN: ${{ secrets.DROPBOX_TOKEN }}
        run: php artisan lasso:publish --no-git

This is the error I get on github actions:

Screen Shot 2021-10-31 at 10 04 03 am

FileExistsException when Uploading asset bundle to "s3" filesystem

I have a feeling the recent update to 2.0.2 is causing the below error during publishing to s3. I'm on Laravel 8.

Uploading asset bundle to "s3" filesystem...

Illuminate\Contracts\Filesystem\FileExistsException 

File already exists at path: [path to file]/lasso-bundle.json

I rolled back to 2.0.1 and the error is gone.

Add "public/hot" directory to forbidden directories

The "hot" directory is left by Webpack in local development environments, so this should be ignored for production assets. This will need to be added to the "forbiddenDirectories" array in Sammyjo20\Lasso\Tasks\Publish\BundleJob.

Error publishing assets when using with Laravel Sail

Hello,

I ran into an error when using sail artisan lasso:publish with Laravel Sail. However, I was able to publish the assets successfully without using Sail php artisan lasso:publish on my laptop.

Wondering if there are any configurations to be added/changed when using with Sail?

Lasso version: ^1.2
Laravel: 8.70.1
PHP: 7.4.2

Screen Shot 2022-01-25 at 12 41 31 am

Error pulling assets from s3 in Laravel 9

I am facing some issues when pulling assets php artisan lasso:pull from s3 filesystem during Github CI/CD.
For some reason, it fails to check for the assets zip file existence.

This is the error message I am receiving:

🏁 Preparing to download assets from "s3" filesystem.
⏳ Reading Bundle meta file...
⏳ Downloading bundle...
   League\Flysystem\UnableToCheckDirectoryExistence 

  Unable to check existence for: lasso/global/pEaCXUnSNKBXNvP03RRT.zip

  at vendor/league/flysystem/src/UnableToCheckExistence.php:19
     15β–•     }
     16β–• 
     17β–•     public static function forLocation(string $path, Throwable $exception = null): static
     18β–•     {
  ➜  19β–•         return new static("Unable to check existence for: {$path}", 0, $exception);
     20β–•     }
     21β–• 
     22β–•     public function operation(): string
     23β–•     {

      +43 vendor frames 
  44  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()
Error: Process completed with exit code 1.

Here is my s3 config:

's3' => [
      'driver' => 's3',
      'key' => env('AWS_ACCESS_KEY_ID'),
      'secret' => env('AWS_SECRET_ACCESS_KEY'),
      'region' => env('AWS_DEFAULT_REGION'),
      'bucket' => env('AWS_BUCKET'),
      'endpoint' => env('AWS_URL'),
],

I can confirm that the file does exist in the S3 bucket using tinker and web UI.

Psy Shell v0.11.8 (PHP 8.1.12 β€” cli) by Justin Hileman
>>> Storage::disk('s3')->exists('lasso/global/pEaCXUnSNKBXNvP03RRT.zip')
=> true

Uploading Screenshot 2022-11-24 at 8.25.32 pm.png…

Write tests for Lasso

Right, we need to get some tests in here!

I was wondering how specifically is the best way to test Lasso. Would the best way to test each individual component, e.g the backing up process?

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.