Skip to content

Commit

Permalink
Merge branch 'master' into aspects-loading-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GiladShoham authored Aug 16, 2022
2 parents fc1e91d + 53e6893 commit e8da91f
Show file tree
Hide file tree
Showing 54 changed files with 649 additions and 514 deletions.
236 changes: 121 additions & 115 deletions .bitmap

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default_working_dir: &default_working_dir
working_directory: ~/bit

orbs:
win: circleci/windows@5.0
win: circleci/windows@4.1

windows_default_working_dir: &windows_default_working_dir
working_directory: C:\Users\circleci\project\bit
Expand Down Expand Up @@ -938,10 +938,11 @@ jobs:
# - run: choco install nodejs --version 16.15.1
# - run: cinst nodejs --version 16.16.0
# - run: nodejs.install v12.16.0
- run: nvm install 16.16.0
- run: nvm use 16.16.0
# We can't use Node.js newer than 16.13.2 due to this issue with npm: https://github.com/npm/cli/issues/4234
- run: nvm install 16.13.2
- run: nvm use 16.13.2
- run: node -v
- run: corepack enable
- run: npm install --global yarn
- run: 'yarn -v'
- run:
name: set bit.dev registry
Expand Down Expand Up @@ -1305,7 +1306,10 @@ jobs:
- restore_cache:
key: v2-bvm-folder-{{ checksum "version.txt" }}
- run: 'npm i -g @teambit/bvm'
- run: 'bvm upgrade'
- run:
name: 'bvm upgrade'
command: 'bvm upgrade'
no_output_timeout: 60m
- run: 'setx path "%path%;C:\Users\circleci\AppData\Local\.bvm"'
- run: 'bit -v'
- run: bit -v | Out-File -FilePath .\version.txt
Expand All @@ -1329,7 +1333,9 @@ jobs:
steps:
- attach_workspace:
at: .
- run: cinst nodejs --version 16.16.0
# We can't use Node.js newer than 16.13.2 due to this issue with npm: https://github.com/npm/cli/issues/4234
- run: nvm install 16.13.2
- run: nvm use 16.13.2
- run: node -v
- run: npm -v
# - run: Get-Content -Path .\version.txt
Expand Down Expand Up @@ -1384,7 +1390,9 @@ jobs:
steps:
- attach_workspace:
at: .
- run: cinst nodejs --version 16.16.0
# We can't use Node.js newer than 16.13.2 due to this issue with npm: https://github.com/npm/cli/issues/4234
- run: nvm install 16.13.2
- run: nvm use 16.13.2
- run: node -v
- run: npm -v
# - run: Get-Content -Path .\version.txt
Expand Down
20 changes: 16 additions & 4 deletions e2e/harmony/imported-component-deps.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry';
npmCiRegistry.configureCiInPackageJsonHarmony();
helper.fixtures.populateComponents(3);
scope = `@${helper.scopes.remote.replace('.', '/')}.`;
helper.fs.outputFile(`comp1/index.js`, `const comp3 = require("${scope}comp3");`);
helper.fs.outputFile(`comp2/index.js`, `const comp3 = require("${scope}comp3");`);
helper.command.install();
const code = `const comp3 = require("${scope}comp3");
const isPositive = require('is-positive');
`;
helper.fs.outputFile(`comp1/index.js`, code);
helper.fs.outputFile(`comp2/index.js`, code);
helper.command.install('[email protected]');
helper.command.compile();
helper.command.tagComponent('comp3 comp1');
helper.command.export();
helper.command.removeComponent('comp1');
helper.command.install('[email protected] --update-existing');
helper.command.tagComponent('comp3 comp2', undefined, '--unmodified');
helper.command.export();

Expand All @@ -37,14 +41,22 @@ import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry';
helper.command.import(`${helper.scopes.remote}/comp1`);
helper.command.import(`${helper.scopes.remote}/comp2`);
});
it('should install dependencies from their respective models to the imported components', () => {
it('should install component dependencies from their respective models to the imported components', () => {
expect(helper.fs.readJsonFile(`node_modules/${scope}comp3/package.json`).version).to.eq('0.0.1');
expect(
helper.fs.readJsonFile(
path.join(helper.scopes.remoteWithoutOwner, `comp2/node_modules/${scope}comp3/package.json`)
).version
).to.eq('0.0.2');
});
it('should install package dependencies from their respective models to the imported components', () => {
expect(helper.fs.readJsonFile(`node_modules/is-positive/package.json`).version).to.eq('1.0.0');
expect(
helper.fs.readJsonFile(
path.join(helper.scopes.remoteWithoutOwner, `comp2/node_modules/is-positive/package.json`)
).version
).to.eq('2.0.0');
});
after(() => {
npmCiRegistry.destroy();
});
Expand Down
49 changes: 49 additions & 0 deletions e2e/harmony/installing-component-dependency.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { expect } from 'chai';
import path from 'path';
import Helper from '../../src/e2e-helper/e2e-helper';
import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry';

(supportNpmCiRegistryTesting ? describe : describe.skip)('installing a component dependency', function () {
this.timeout(0);
let scope: string;
let helper: Helper;
let npmCiRegistry: NpmCiRegistry;
before(async () => {
helper = new Helper({ scopesOptions: { remoteScopeWithDot: true } });
helper.scopeHelper.setNewLocalAndRemoteScopesHarmony();
helper.bitJsonc.setupDefault();
helper.bitJsonc.setPackageManager(`teambit.dependencies/pnpm`);
npmCiRegistry = new NpmCiRegistry(helper);
await npmCiRegistry.init();
npmCiRegistry.configureCiInPackageJsonHarmony();
helper.fixtures.populateComponents(2);
scope = `@${helper.scopes.remote.replace('.', '/')}.`;
helper.fs.outputFile(`comp1/index.js`, `const comp2 = require("${scope}comp2");`);
helper.command.install();
helper.command.compile();
helper.command.tagComponent('comp2 comp1');
helper.command.export();
helper.command.removeComponent('comp1');
helper.command.tagComponent('comp2', undefined, '--unmodified');
helper.command.export();

helper.scopeHelper.reInitLocalScopeHarmony();
helper.extensions.bitJsonc.setPackageManager(`teambit.dependencies/pnpm`);
helper.scopeHelper.addRemoteScope();
helper.bitJsonc.setupDefault();
helper.command.import(`${helper.scopes.remote}/comp1`);
});
it('should install the version of the component dependency from the model, when it is not in the workspace policies', () => {
expect(helper.fs.readJsonFile(`node_modules/${scope}comp2/package.json`).version).to.eq('0.0.1');
});
it('should not install the version of the component dependency from the model, when the component dependency is in the workspace policies', () => {
helper.command.install(`${scope}[email protected]`);
expect(helper.fs.readJsonFile(`node_modules/${scope}comp2/package.json`).version).to.eq('0.0.2');
expect(
helper.fs.exists(path.join(helper.scopes.remoteWithoutOwner, `comp1/node_modules/${scope}comp2/package.json`))
).to.eq(false);
});
after(() => {
npmCiRegistry.destroy();
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teambit/legacy",
"version": "1.0.327",
"version": "1.0.329",
"license": "Apache-2.0",
"main": "./dist/api.js",
"preferGlobal": true,
Expand Down
Loading

0 comments on commit e8da91f

Please sign in to comment.