Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. var assert = require('assert');
  3. var path = require('path');
  4. var resolve = require('resolve');
  5. var basedir = __dirname + '/node_modules/@my-scope/package-b';
  6. var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js');
  7. /*
  8. * preserveSymlinks === false
  9. * will search NPM package from
  10. * - packages/package-b/node_modules
  11. * - packages/node_modules
  12. * - node_modules
  13. */
  14. assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected);
  15. assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected);
  16. /*
  17. * preserveSymlinks === true
  18. * will search NPM package from
  19. * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules
  20. * - packages/package-a/node_modules/@my-scope/packages/node_modules
  21. * - packages/package-a/node_modules/@my-scope/node_modules
  22. * - packages/package-a/node_modules/node_modules
  23. * - packages/package-a/node_modules
  24. * - packages/node_modules
  25. * - node_modules
  26. */
  27. assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected);
  28. assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected);
  29. console.log(' * all monorepo paths successfully resolved through symlinks');