fooman / venia-ui-override-resolver

19 stars 5 forks source link

Overrides issue concerning to the docker instance #4

Closed coresh closed 3 years ago

coresh commented 3 years ago

Strange behavior.

The reason:

create-pwa instance -> overrides -> worked properly.

But,

the docker instance -> overrides -> is not worked.

the docker instance -> supposed -> with appended

yarn add @fooman/venia-ui-override-resolver

docker instance: https://github.com/magento/pwa-studio/blob/develop/dev.dockerfile

Thank you

fooman commented 3 years ago

@coresh I'll make this clearer in the description that the use case is for create-pwa. The docker environment just copies over the packages here https://github.com/magento/pwa-studio/blob/develop/dev.dockerfile#L24. So you are really just working with a cloned copy of the pwa-studio repo on the host. As such I suggest creating a branch with your changes and this would work better than using overrides.

coresh commented 3 years ago

Re:

As such I suggest creating a branch with your changes

Exactly.

branch is used -> appended -> COPY .git ./.git:

##############################################################
# This file is intended to be used with ./docker-compose.yml #
##############################################################

FROM node:12.16.3-alpine as build
# working directory
WORKDIR /usr/src/app

# global environment setup : yarn + dependencies needed to support node-gyp
RUN apk --no-cache --virtual add \
    python \
    make \
    g++ \
    git \
    libseccomp \
    yarn

# set env variable for CI
ENV CI=true

# copy root dependency files and configs needed for install
COPY package.json yarn.lock babel.config.js magento-compatibility.js ./
COPY scripts/monorepo-introduction.js ./scripts/monorepo-introduction.js

# copy over the packages
COPY packages ./packages
COPY .git ./.git

# run yarn again to reestablish workspace symlinks
# RUN yarn install --frozen-lockfile
RUN yarn install --frozen-lockfile \

&& yarn upgrade \
&& yarn add --ignore-workspace-root-check --dev less-loader less \
&& yarn add --ignore-workspace-root-check @fooman/venia-ui-override-resolver \
# && yarn add nodemon --dev \
# build the app
&& yarn run build

# MULTI-STAGE BUILD
FROM node:12.16.3-alpine
RUN apk --no-cache --virtual add \
    vim
# working directory
WORKDIR /usr/src/app
# node:alpine comes with a configured user and group
RUN chown -R node:node /usr/src/app
# copy build from previous stage
COPY --from=build /usr/src/app .
USER node
# command to run application
CMD [ "yarn", "workspace", "@magento/venia-concept", "run", "watch"]

Re:

I suggest creating a branch

Correct suggestion.

But,

additionally -> override-support -> preferred.

The reason:

docker + override-support -> provides with flexibility.

Thank you

fooman commented 3 years ago

I suggest taking a look at this line then https://github.com/fooman/venia-ui-override-resolver/blob/master/intercept.js#L18 that is where the node_modules folder is defined as the source to check. Changing this to point to packages should theoretically do the trick.

coresh commented 3 years ago

Re:

I suggest taking a look at this line then

Correct.

Solutions:

Variant 1:

https://github.com/fooman/venia-ui-override-resolver/blob/master/intercept.js#L18

Can be appended conditions.

Variant 2:

https://github.com/magento/pwa-studio/blob/develop/dev.dockerfile

Can be appended:

COPY node_modules ./node_modules

Thank you