Thursday, 29 August 2019

Trying to share code from Hyperapp with Bit.dev

I'm trying to share my code from my front (hyperapp) to my admin (hyperapp to) to make "preview" button.

The setup of these projects was made by an other dev, so i had to learn hyperapp workflow on the job, i'm not expert. From what i know he was inspired by Facebook React conf.

All my usefull code is in src/ folder, and there is many dependencies so i have to export all (api, constants, utils, etc..).

Here is my bit configuration (that work, it export code correctly):

    "bit": {
        "env": {
            "compiler": "bit.envs/compilers/react@1.0.2"
        },
        "packageManager": "yarn",
        "packageManagerArgs": [
            "--production",
            "--no-optional"
        ],
        "packageManagerProcessOptions": {
            "shell": true
        },
        "resolveModules": {
            "modulesDirectories": [
                "src"
            ]
        },
        "dist": {
            "entry": "src",
            "target": "dist"
        }
    }

So, the code is "correctly" exported to bit.dev, but, when i import it from my admin with

"@bit/adrienbelair.betterise-web.modules": "^0.3.0",

i get the following error after running yarn:

yarn install

ls: Command failed.
Exit code: 1
Command: node .bit.postinstall.js
...
Error: ENOTDIR: not a directory, mkdir 'node_modules/utils/HOA'

Yes, if i look into node_module, utils is a file, and not a directory All these are auto-generated, i dont understand what am i doing wrong?

Second thing, probably from this above error, when i try to import a component (even if there is an error, vendor are downloaded and at their place), i get:

import { Advice } from '@bit/adrienbelair.betterise-web.modules/dist/modules';

./node_modules/@bit/adrienbelair.betterise-web.api/controlleur.js
Module not found: Can't resolve 'api' in '/Users/prinzivalle/Web/betterise/admin-front/node_modules/@bit/adrienbelair.betterise-web.api'

From this line (if i look into node_module, where the error is thrown):

import { User, Cardline } from 'api';

I know, its a very specific case, mine, but i dont find any forum or explicit tutorial. Only some little component export with not a lot of dependencies. I made my code with a little knowledge of Hyperapp/React and without thinking about sharing it one day..

Thank for reading.



from Trying to share code from Hyperapp with Bit.dev

No comments:

Post a Comment