Merge pull request #2593 from makowskid/pnpm-support

Adding pnpm support
This commit is contained in:
Shao Yu-Lung (Allen) 2020-05-21 09:13:56 +08:00 committed by GitHub
commit cca6bead21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 0 deletions

View File

@ -1870,6 +1870,23 @@ To install NVM and NodeJS in the Workspace container
<br>
<a name="Install-PNPM"></a>
## Install PNPM
pnpm uses hard links and symlinks to save one version of a module only ever once on a disk. When using npm or Yarn for example, if you have 100 projects using the same version of lodash, you will have 100 copies of lodash on disk. With pnpm, lodash will be saved in a single place on the disk and a hard link will put it into the node_modules where it should be installed.
As a result, you save gigabytes of space on your disk and you have a lot faster installations! If you'd like more details about the unique node_modules structure that pnpm creates and why it works fine with the Node.js ecosystem.
More info here: https://pnpm.js.org/en/motivation
1 - Open the `.env` file
2 - Search for the `WORKSPACE_INSTALL_NODE` and `WORKSPACE_INSTALL_PNPM` argument under the Workspace Container and set it to `true`
3 - Re-build the container `docker-compose build workspace`

View File

@ -87,6 +87,7 @@ services:
- NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR} - NVM_NODEJS_ORG_MIRROR=${WORKSPACE_NVM_NODEJS_ORG_MIRROR}
- INSTALL_NODE=${WORKSPACE_INSTALL_NODE} - INSTALL_NODE=${WORKSPACE_INSTALL_NODE}
- NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY} - NPM_REGISTRY=${WORKSPACE_NPM_REGISTRY}
- INSTALL_PNPM=${WORKSPACE_INSTALL_PNPM}
- INSTALL_YARN=${WORKSPACE_INSTALL_YARN} - INSTALL_YARN=${WORKSPACE_INSTALL_YARN}
- INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP} - INSTALL_NPM_GULP=${WORKSPACE_INSTALL_NPM_GULP}
- INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER} - INSTALL_NPM_BOWER=${WORKSPACE_INSTALL_NPM_BOWER}

View File

@ -98,6 +98,7 @@ WORKSPACE_NVM_NODEJS_ORG_MIRROR=
WORKSPACE_INSTALL_NODE=true WORKSPACE_INSTALL_NODE=true
WORKSPACE_NODE_VERSION=node WORKSPACE_NODE_VERSION=node
WORKSPACE_NPM_REGISTRY= WORKSPACE_NPM_REGISTRY=
WORKSPACE_INSTALL_PNPM=false
WORKSPACE_INSTALL_YARN=true WORKSPACE_INSTALL_YARN=true
WORKSPACE_YARN_VERSION=latest WORKSPACE_YARN_VERSION=latest
WORKSPACE_INSTALL_NPM_GULP=true WORKSPACE_INSTALL_NPM_GULP=true

View File

@ -723,6 +723,20 @@ RUN if [ ${NPM_REGISTRY} ]; then \
. ~/.bashrc && npm config set registry ${NPM_REGISTRY} \ . ~/.bashrc && npm config set registry ${NPM_REGISTRY} \
;fi ;fi
###########################################################################
# PNPM:
###########################################################################
USER laradock
ARG INSTALL_PNPM=false
RUN if [ ${INSTALL_PNPM} = true ]; then \
npx pnpm add -g pnpm \
;fi
########################################################################### ###########################################################################
# YARN: # YARN:
########################################################################### ###########################################################################