Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created February 13, 2020 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/0710cd9a86e76aca6271fa94d78328c7 to your computer and use it in GitHub Desktop.
Save isaacs/0710cd9a86e76aca6271fa94d78328c7 to your computer and use it in GitHub Desktop.
  1. Add a Workspace class (subclass of Node) in Arborist
  2. all packages in workspace get symlinked to workspace ./node_modules
  3. app packages in ws get deps symlinked to ws ./node_modules if present
  4. deps are hoisted, possibly to ws root, and if so, symlinked to package/nm
  5. nested workspaces get the ws deps from ws parent if possible
  6. if a package is a part of 2 workspaces simultaneously, it's a footgun (or is it?) -- ok to just skip any nested workspace packages that are already included in a root workspace, and vice versa. churn is not so bad, and unavoidable.
  7. Proposed restriction: workspace packages must be contained by workspace folder
.
├── .package.json.swp
├── .README.md.swp
├── apps
│  ├── x
│  │  └── node_modules
│  │     ├── bar -> ../../../node_modules/bar
│  │     ├── baz -> ../../../node_modules/baz
│  │     └── foo -> ../../../node_modules/foo
│  ├── y
│  │  └── node_modules
│  │     ├── bar -> ../../../node_modules/bar
│  │     ├── baz -> ../../../node_modules/baz
│  │     └── foo -> ../../../node_modules/foo
│  └── z
│     └── node_modules
│        ├── bar -> ../../../node_modules/bar
│        ├── baz -> ../../../node_modules/baz
│        └── foo -> ../../../node_modules/foo
├── node_modules
│  ├── bar -> ../packages/bar
│  ├── baz -> ../packages/baz
│  ├── foo -> ../packages/foo
│  ├── x -> ../apps/x
│  ├── y -> ../apps/y
│  └── z -> ../apps/z
├── package.json
├── packages
│  ├── bar
│  │  └── node_modules
│  │     ├── baz -> ../../../node_modules/baz
│  │     └── foo -> ../../../node_modules/foo
│  ├── baz
│  │  └── node_modules
│  │     ├── bar -> ../../../node_modules/bar
│  │     └── foo -> ../../../node_modules/foo
│  └── foo
│     └── node_modules
│        ├── bar -> ../../../node_modules/bar
│        └── baz -> ../../../node_modules/baz
├── plugins
│  ├── .package.json.swp
│  ├── a
│  │  └── node_modules
│  │     ├── baz -> ../../node_modules/baz
│  │     └── foo -> ../../node_modules/foo
│  ├── b
│  │  └── node_modules
│  │     ├── baz -> ../../node_modules/baz
│  │     └── foo -> ../../node_modules/foo
│  ├── c
│  │  └── node_modules
│  │     ├── baz -> ../../node_modules/baz
│  │     └── foo -> ../../node_modules/foo
│  ├── d
│  │  └── node_modules
│  │     ├── baz -> ../../node_modules/baz
│  │     └── foo -> ../../node_modules/foo
│  ├── node_modules
│  │  ├── baz -> ../../node_modules/baz
│  │  └── foo -> ../../node_modules/foo
│  └── package.json
├── README.md
└── ws2
   ├── apps
   │  └── twoapp
   │     └── node_modules
   │        └── two -> ../../../node_modules/two
   ├── node_modules
   │  ├── bar -> ../../node_modules/bar
   │  ├── big-external-dep
   │  ├── two -> ../packages/two
   │  └── twoapp -> ../apps/twoapp
   ├── package.json
   └── packages
      └── two
         └── node_modules
            ├── bar -> ../../../node_modules/bar
            └── big-external-dep -> ../../../node_modules/big-external-dep
���E^�O��V�_Ҵ�C�T-p�n��F�3�� P$�D�
�V�$�wgv3��x{���Җ�����PQŁS���� �*P+�#PA���8�8P�{�g��q�͛m��h�z����}�~�g{��?��x�[����ͣ�/5Ê� \7C7 ��t����ۋ+R�0��x�FP���mnN�'9�����X���X�9PCӵ��24�� տ��3���ԙ�v�����Շ�TM���D�w\��mGw�d���\�u��'�⧚�X����7Μ�����޹�ج*z�f���z3ҽg�jw��.��Vz��= �(��Y��#����C���.�@��;G�K�<��_H�GrK|r�ڌuiyD��?���� ƾOv����1�O�7�.�}������"�y�sd�!{��Kd+d�%�۽��E�=���%����O3�c� dO�����`�d?$�B� �I�cd����E�s�W�^&�&�&�g���)�~O�&��)�/��E���� �ȶȞ%��ٻw1�+����d-�/���N�٫d��yd�d�9�؟��"�%{��d��=Bv�GwP���N�%�:����E��G�ߐ�M�#����";z4�A)/���>|��_{���zwk��v}�������f����v�¶��:A+�2��� ���<�+)D6 �o w}6����q�ۊS��M>m^
�~��\.����迠�I�F�4I7�Sk\���e5�O�����H��+!ʩ�2�k7[ʩ�[Z7��U��$���ҍ�/yr9M��l�H����A[&��������r�'4͍�Lx�R�RY�b�q�6q��qټ��lc�~n�qV��V���Qp��rU��ߝ�� u�ʮU����0!��2�S���8`� ?�p����f�U���g����e��左�3�q�Z)��8U��Muͤ�u�~��|rO�C�P�y
.�y�߲G��99����kO�B~�;oF�j�m��{�΀�M�����N�:A8�n�]���z���0�z�o��������i:���^�^�͇}��m{�NSl�z�������Foئov����� �o^��.�t���|��p��݀j&�A�S|����W�kkܿ�C�_% .ww(�}ާ�]�Ax� �7�0�ɻ�T�d��Q� B�or#�j�����z��? z����GDZ:e­a������� iW�r�b|s�o��A��=S�]�qDIZ�mf5�/P:~��|WGi�ŁR&��⪢|��۽n�2!���gGz�Tϻq����iņ�3*�THfPF��dF�
�Mf5�4�#ӛ�t�M��8�F� �h0\�����������?��Ό�H� Tk��a����`��
R�'<��}��_s\��wt ����b��eY���e��Z���_J�ɸѐ���h���1�Ch��ѐ��i��5��UІ�Nnc�sn,����d�ٛ R�����[#�oY��o�� ��*�F-m%�F+O��E��+ѽ��+����������o��r�����5��b
��u������o���*H���B�QKS�oY��U����pS�����t�'��8�a"�� ?�G�3�w��|���u>���͵S�����%?��=���b���`� 2��t��1�D��{d�&����~:J�s�q~���Ա�!w,��
#���H>V�Ǯ���\]���t݈���&��� ��ޡ��(!������?�P����߱H״���0]1a���������� �ճ��O�_L�xpj���v*��S���� �����o�S��Q�������o�Q��l�L� ��t��_���%2]�%���E�7�U0K���2���#���p�w����,��L� ��5q������������i��_��W�����5����/���?ɿ.m�]s�����#�+�D�K�߲b�1��J�,����D�k.�WA��R�k�Ӧ��Y6������\��� M���
����\���6E\������<�o[��w��7%̣�R�o��w��U0����R��ۺ��(��������G�ߵ��U0��J�����q�_ ����;n�����O�iT��Wf �u��q���q��R2K����/��]K�����f��?��(�/�_j���������S���cl-�-;����ޕ�W� пL�=�������=���&�/�_�>��o������&�]�%SL��p �-����:�+���'}
����+~�c�������_ŪM}�/a#���/�g�����k�¬@�h֠�+�<׸�Xv �")��������G E�ۇC��O E���@3��9�>��3��c���_S���Ϻ��O�SM]���طo�9����{�c��dD� �=���H�b�a�ݹҺ$���|�υ�k��3�]�>������.@!���-�&�w&�#�%>�xm��>��d������cZ����dM����}�wO,�����u�鏟#���>^��Xa��V2�c�p��11�Ge�˞����&�04����0S �n��_��d�V:��'�e����ݪ��-�4���> �/��]��w���c��f���G�[�m���`�����������l���� ����_y�ߍ�?��J���r����������������U1S���2q�G!3�W���������Jin��ף���ڿf�/����_��L�kڿ
R�wcs j�o�"��c����I�3��6k�gWO��[���r1��*��^�pre5^���B�Z����_P���&ڿ�ژ�Y ��G�^�>j�O H��P����R�iPG�v������j��] ��?z�����/�_<s�O���>��o�f��T�п��Gu�������v���0Ei�����F��5,��`^�׻[k���3�{��v��KAj�o�kU���E)�����߭��M3��Z��R� ������@ ����Ӆ���;���J+I пJ�����>@-���Cw]���0����G��� ��h���.��/�W�Yq�N�74��OS�ͪ��2�?���ܾ�K}��<
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment