source: imaps-frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.3 KB
Line 
1'use strict';
2
3var assert = require('assert');
4var path = require('path');
5var resolve = require('resolve');
6
7var basedir = __dirname + '/node_modules/@my-scope/package-b';
8
9var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js');
10
11/*
12 * preserveSymlinks === false
13 * will search NPM package from
14 * - packages/package-b/node_modules
15 * - packages/node_modules
16 * - node_modules
17 */
18assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected);
19assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected);
20
21/*
22 * preserveSymlinks === true
23 * will search NPM package from
24 * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules
25 * - packages/package-a/node_modules/@my-scope/packages/node_modules
26 * - packages/package-a/node_modules/@my-scope/node_modules
27 * - packages/package-a/node_modules/node_modules
28 * - packages/package-a/node_modules
29 * - packages/node_modules
30 * - node_modules
31 */
32assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected);
33assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected);
34
35console.log(' * all monorepo paths successfully resolved through symlinks');
Note: See TracBrowser for help on using the repository browser.