webiny-js icon indicating copy to clipboard operation
webiny-js copied to clipboard

plugins in createWebsiteApp is not registered when `yarn webiny deploy --build false`

Open taifok opened this issue 3 years ago • 5 comments

Version

v5.30.0

What is the expected behavior?

I think the plugins should be registered no matter the packages is rebuild or not but the plugins defined is ignored when --build false

Additional information

I found this behavior is caused by the following lines.

https://github.com/webiny/webiny-js/blob/bb1e201410cee41ca68aa5ef5b8f12770a20248c/packages/cli-plugin-deploy-pulumi/commands/deploy.js#L7

https://github.com/webiny/webiny-js/blob/bb1e201410cee41ca68aa5ef5b8f12770a20248c/packages/cli-plugin-deploy-pulumi/utils/createPulumiCommand.js#L44-L56

Possible solution

I think just move the register statement out of createProjectApplicationWorkspaceParam checking should be fine.

        if (createProjectApplicationWorkspaceParam !== false) {
            if (projectApplication.type === "v5-workspaces") {
                await createProjectApplicationWorkspace({
                    projectApplication,
                    context,
                    inputs,
                    env: inputs.env
                });
            }
        }

        if (projectApplication.type === "v5-workspaces") {
            // Check if there are any plugins that need to be registered.
            if (projectApplication.config.plugins) {
                context.plugins.register(projectApplication.config.plugins);
            }
        }

taifok avatar Aug 29 '22 15:08 taifok

@taifok We're aware of this issue, but at this point in time, whenever you add something to webiny.application.ts, you must run it with a build step, so just remove the --build=false. That flag not only affects the actual app bundle itself, but also the underlying workspaces and plugins. This will be improved in the future, but for now, just remove the --build flag.

Pavel910 avatar Aug 29 '22 15:08 Pavel910

@Pavel910 Thanks for quick reply.

I am actually finding a way to build the apps/website with --profile. Is there any way to pass this param when yarn webiny deploy?

taifok avatar Aug 29 '22 15:08 taifok

@taifok what is --profile? is it like AWS_PROFILE, or ... ?

Pavel910 avatar Aug 29 '22 15:08 Pavel910

@Pavel910 I want webpack to build apps/website with react-profiling build to debug my app. and found this can be done by running yarn webiny ws run build --folder apps/website --profile --env dev

https://github.com/webiny/webiny-js/blob/bb1e201410cee41ca68aa5ef5b8f12770a20248c/packages/project-utils/bundling/app/config/webpack.config.js#L74

taifok avatar Aug 29 '22 15:08 taifok

@taifok Ah got it. Hmm, I don't think it's possible right now, but you can set it in the website's package.json, like this: CleanShot 2022-08-29 at 17 28 53@2x

That should be then picked up by process.argv.includes("--profile").

Pavel910 avatar Aug 29 '22 15:08 Pavel910