Giter Site home page Giter Site logo

Comments (3)

Chemaclass avatar Chemaclass commented on June 9, 2024 1

The issue is that the current main.php that we generate when running the phel build command is missing the autoload from vendor, therefore it doesn't know where to find the dependency classes. E.g:

Uncaught Error: Class "Phel\Lang\Registry" not found in ./temp/cli-skeleton/out/phel/core.php:3

An alternative solution for now: you can create a script yourself similar to what I did here: https://github.com/Chemaclass/phel-snake/blob/main/play.php

<?php declare(strict_types=1);

require_once __DIR__ . "/vendor/autoload.php";

$compiledFile = __DIR__ . "/out/phel_snake/main.php";
if (!file_exists($compiledFile)) {
    echo 'Building the project...';
    exec('vendor/bin/phel build --no-cache');
}

require_once $compiledFile;

With this script you are requiring the vendor/autoload file and then calling your "main built entry point". So, instead of running the php out/cli_skeleton/main.php you would run php main.php, having something similar in your main.php as I have in the play.php. Does it make sense for you?


That said, this is an interesting observation that might need a rethink to avoid this work around all the time, and rather be something integrated as part of the "build" command. Therefore, we can agree that this is not a bug, but a "feature" that I will take a deeper look. Thanks for reporting it, @bentxt !

from phel-lang.

Chemaclass avatar Chemaclass commented on June 9, 2024

@bentxt I created a PR (#607) automating the creation of this template, so this will be part of the build command.

from phel-lang.

Chemaclass avatar Chemaclass commented on June 9, 2024

Already merged in the main branch. Here you have a demo:

Screen.Recording.2023-06-23.at.15.50.12.mov

from phel-lang.

Related Issues (20)

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.