coon-js / delorean

Transpiles modern ECMAScript to ES5 for Sencha CMD.
https://www.conjoon.org/docs/api/misc/@coon-js/delorean
MIT License
5 stars 3 forks source link

Question: Any chance to copy relative paths #3

Open OliverFischer opened 1 year ago

OliverFischer commented 1 year ago

Hi, first of all thx for this project.

I have a simple question, our classpath contains relative paths to folders outside the app for reusing modules in different apps:

"classpath": [
        "app",
        "../../ccs/core",
        "../../ccs/auth",
        "../../ccs/ms",
        "../../ccs/cdp",
        "../../ccs/cs",
        "../../ccs/as"
    ],

Is there any chance to get these copied (deloran only copies the overrides and the app part):

...copying source: /Users/Shared/devel/aicgroup-marketing-studio-monorepo/ui/ccs/sencha-extjs/ais-ccm-cloud-platform/app
...copying source: /Users/Shared/devel/aicgroup-marketing-studio-monorepo/ui/ccs/sencha-extjs/ais-ccm-cloud-platform/overrides

Thx in advance

Olli

OliverFischer commented 1 year ago

Another approach could be symlinking the files under the src folder, but when using fs-extra, we need to add another option in the copySync function allowing fs-extra to dereference the files:

const moveProjectFiles = function () {
        ...
        // check if origin exists, then copy
        if (fs.pathExistsSync(origin)) {
            log(chalk.yellow(`...copying source: ${origin}`));
            fs.removeSync(`${target}`);
            // CHANGE START
            fs.copySync(`${origin}`, `${target}`,{
                dereference: true
            });
            // CHANGE END
        }
    });
};
ThorstenSuckow commented 1 year ago

Hey @OliverFischer, thanks for reaching out! There is an externals-configuration that can be used with external projects that need to be considered during the build, but I'm not sure if it applies to your use case - have you already looked into this?

OliverFischer commented 1 year ago

Hi @ThorstenSuckow , i read the docs and the externals functionality is based on real cmd - packages. In our case, we simply used the directory for a logical grouping of folders not being real sencha packages and symlinked them into the app (or better symlinked some of them into our core package and some into the app directory).

So, everything works fine with my proposed second solution, if we tell fs-extra to dereference the content behind the folders, the app build is sccessful. By now I simply forked your project and added the options section to the copy part of moveProjectFiles, but if you're interested I could submit a PR.