Skip to content

Fix: support npm workspaces#74

Draft
asabil wants to merge 2 commits intofrida:mainfrom
kopera:fix/support-npm-workspaces
Draft

Fix: support npm workspaces#74
asabil wants to merge 2 commits intofrida:mainfrom
kopera:fix/support-npm-workspaces

Conversation

@asabil
Copy link

@asabil asabil commented May 10, 2023

No description provided.

@asabil
Copy link
Author

asabil commented May 10, 2023

Not ready to merge yet, due to the function assetNameFromFilePath which makes assumptions about the location of node_modules/

    function assetNameFromFilePath(path: string): string {
        if (path.startsWith(compilerRoot)) {
            return path.substring(compilerRoot.length);
        }

        if (path.startsWith(projectRoot)) {
            return path.substring(projectRoot.length);
        }

        throw new Error(`unexpected file path: ${path}`);
    }

Would something like this fix it?

    function assetNameFromFilePath(path: string): string {
        if (path.startsWith(compilerRoot)) {
            return path.substring(compilerRoot.length);
        }

        if (path.startsWith(projectRoot)) {
            return path.substring(projectRoot.length);
        }

        if (path.includes("node_modules/")) {
            return path.replace(/.+node_modules\//, "");
        }

        throw new Error(`unexpected file path: ${path}`);
    }

@oleavr oleavr force-pushed the main branch 2 times, most recently from 2f6c2bd to bbf2e19 Compare May 22, 2025 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments