Skip to content

Commit

Permalink
Merge pull request #6 from teambit/master
Browse files Browse the repository at this point in the history
[pull] master from teambit:master
  • Loading branch information
ammar-ahmed-butt authored Sep 16, 2023
2 parents ed45ad9 + 04120d4 commit 1b665d1
Show file tree
Hide file tree
Showing 167 changed files with 5,555 additions and 4,759 deletions.
668 changes: 340 additions & 328 deletions .bitmap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module.exports = function (api) {
'babel-plugin-transform-typescript-metadata',
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-transform-runtime'],
['@babel/plugin-proposal-object-rest-spread'],
['@babel/plugin-proposal-class-properties'],
['@babel/plugin-transform-object-rest-spread'],
['@babel/plugin-transform-class-properties'],
];

return {
Expand Down
4 changes: 4 additions & 0 deletions components/ui/inputs/lane-selector/lane-selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export function LaneSelector(props: LaneSelectorProps) {
const [allLanes, setAllLanes] = useState<LaneModel[]>([]);
const [loadingState, setLoading] = useState<boolean>(loading ?? false);

useEffect(() => {
if (hasMore !== hasMoreState) setHasMore(!!hasMore);
}, [hasMore]);

useEffect(() => {
if (loading !== loadingState) setLoading(!!loading);
}, [loading]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"presets": ["@babel/preset-env", "@babel/typescript"],
"plugins": [
"@babel/plugin-proposal-class-properties"
"@babel/plugin-transform-class-properties"
],
"sourceMaps": true
}
}
2 changes: 1 addition & 1 deletion e2e/harmony/babel.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('babel compiler', function () {
dependencies: {
'@babel/runtime': '^7.12.0',
'@babel/core': '7.11.6',
'@babel/preset-env': '7.11.5',
'@babel/preset-env': '7.22.15',
},
},
});
Expand Down
52 changes: 52 additions & 0 deletions e2e/harmony/delete.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { IssuesClasses } from '@teambit/component-issues';
import { expect } from 'chai';
import Helper from '../../src/e2e-helper/e2e-helper';
import NpmCiRegistry, { supportNpmCiRegistryTesting } from '../npm-ci-registry';

describe('bit delete command', function () {
let helper: Helper;
let npmCiRegistry: NpmCiRegistry;
this.timeout(0);
before(() => {
helper = new Helper();
});
after(() => {
helper.scopeHelper.destroy();
});
/**
* comp1 -> comp2 -> comp3
* deleting comp2 and comp3, now comp1 has a missing dependency, installing comp2 as a package from main.
* all should be fine now. however, when snapping, it used to check for issues also the deleted components.
* this makes sure that deleted components are not part of issues-checking for both: bit snap and bit status.
*/
(supportNpmCiRegistryTesting ? describe : describe.skip)(
'deleting two components which are dependency of each other then installing the missing dep',
() => {
before(async () => {
helper = new Helper({ scopesOptions: { remoteScopeWithDot: true } });
helper.scopeHelper.setNewLocalAndRemoteScopes();
helper.fixtures.populateComponents(3);
npmCiRegistry = new NpmCiRegistry(helper);
npmCiRegistry.configureCiInPackageJsonHarmony();
await npmCiRegistry.init();
helper.command.tagAllComponents();
helper.command.export();
helper.command.createLane();
helper.command.snapAllComponentsWithoutBuild('--unmodified');
helper.command.export();
helper.command.softRemoveOnLane('comp3');
helper.command.softRemoveOnLane('comp2');
helper.command.install(helper.general.getPackageNameByCompName('comp2'));
});
after(() => {
npmCiRegistry.destroy();
});
it('bit status should not show RemovedDependencies issues', () => {
helper.command.expectStatusToNotHaveIssue(IssuesClasses.RemovedDependencies.name);
});
it('bit snap should fail due to removedDependencies error', () => {
expect(() => helper.command.snapAllComponentsWithoutBuild()).not.to.throw();
});
}
);
});
49 changes: 42 additions & 7 deletions e2e/harmony/lanes/bit-checkout-on-lanes.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('bit checkout command when on a lane', function () {
});
describe('checkout head when some components are merge-pending', () => {
let originalWs: string;
let output: string;
let comp1Head: string;
let comp2RemoteHead: string;
before(() => {
Expand All @@ -32,18 +31,16 @@ describe('bit checkout command when on a lane', function () {
helper.command.snapComponentWithoutBuild('comp1', '--unmodified');
comp1Head = helper.command.getHeadOfLane('dev', 'comp1');
helper.command.import();
output = helper.command.checkoutHead();
});
it('should not allow checking out to head because it is merge pending', () => {
expect(output).to.have.string('component is merge-pending and cannot be checked out');
// should not allow checking out to head because it is merge pending
expect(() => helper.command.checkoutHead()).to.throw('component is merge-pending and cannot be checked out');
});
it('should leave the merge-pending component with the current version', () => {
const bitmap = helper.bitMap.read();
expect(bitmap.comp1.version).to.equal(comp1Head);
});
it('should update the non-merge-pending component to the latest', () => {
it('should not update the non-merge-pending component to the latest', () => {
const bitmap = helper.bitMap.read();
expect(bitmap.comp2.version).to.equal(comp2RemoteHead);
expect(bitmap.comp2.version).to.not.equal(comp2RemoteHead);
});
});
describe('checkout head on main when some components are not available on main', () => {
Expand Down Expand Up @@ -75,4 +72,42 @@ describe('bit checkout command when on a lane', function () {
expect(list).to.have.lengthOf(2);
});
});
describe('checkout when some are pending-merge', () => {
before(() => {
helper.scopeHelper.setNewLocalAndRemoteScopes();
helper.fixtures.populateComponents(3);
helper.command.tagWithoutBuild();
helper.command.export();

helper.command.createLane();
helper.command.snapAllComponentsWithoutBuild('--unmodified');
helper.command.export();

helper.command.switchLocalLane('main', '-x');
helper.command.tagWithoutBuild('comp1', '--unmodified');
helper.command.export();

helper.command.switchLocalLane('dev', '-x');
helper.command.mergeLane('main', '-x'); // comp1 is now pending-merge

const originalWs = helper.scopeHelper.cloneLocalScope();

helper.scopeHelper.reInitLocalScope();
helper.scopeHelper.addRemoteScope();
helper.command.importLane('dev');

helper.fs.outputFile(`${helper.scopes.remote}/comp3/index.js`, 'console.log("v2");');
helper.command.snapComponentWithoutBuild('comp3');
helper.command.export();

helper.scopeHelper.getClonedLocalScope(originalWs);
});
it('checkout head should stop with an error', () => {
expect(() => helper.command.checkoutHead('-x')).to.throw();
});
it('should not merged the head of other components', () => {
const comp3File = helper.fs.readFile('comp3/index.js');
expect(comp3File).to.not.include('v2');
});
});
});
22 changes: 9 additions & 13 deletions e2e/harmony/sign.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(undefined, helper.scopes.remotePath);
const ids = [`${helper.scopes.remote}/comp1`, `${helper.scopes.remote}/comp2`];
// console.log('sign-command', `bit sign ${ids.join(' ')}`);
signOutput = helper.command.sign(ids, '--push', helper.scopes.remotePath);
signOutput = helper.command.sign(ids, '--push --original-scope', helper.scopes.remotePath);
});
it('on the workspace, the build status should be pending', () => {
const comp1 = helper.command.catComponent(`${helper.scopes.remote}/comp1@latest`);
Expand Down Expand Up @@ -69,7 +69,7 @@ describe('sign command', function () {
helper.command.export();
const ids = [`${helper.scopes.remote}/comp1`, `${helper.scopes.remote}/comp2`];
// console.log('sign-command', `bit sign ${ids.join(' ')}`);
signOutput = helper.command.sign(ids, '', helper.scopes.remotePath);
signOutput = helper.command.sign(ids, '--original-scope', helper.scopes.remotePath);
});
it('on the workspace, the build status should be pending', () => {
const comp1 = helper.command.catComponent(`${helper.scopes.remote}/comp1@latest`);
Expand All @@ -92,11 +92,7 @@ describe('sign command', function () {
});
it('should sign the last successfully', () => {
helper.scopeHelper.addRemoteScope(helper.scopes.remotePath, signRemote.scopePath);
const signOutput = helper.command.sign(
[`${helper.scopes.remote}/comp1@${firstSnap}`],
`--multiple`,
signRemote.scopePath
);
const signOutput = helper.command.sign([`${helper.scopes.remote}/comp1@${firstSnap}`], '', signRemote.scopePath);
expect(signOutput).to.include('the following component(s) were already signed successfully');
expect(signOutput).to.include('no more components left to sign');
});
Expand All @@ -109,7 +105,7 @@ describe('sign command', function () {
helper.command.tagAllWithoutBuild();
helper.command.export();
// console.log('sign-command', `bit sign ${ids.join(' ')}`);
signOutput = helper.command.sign([], '', helper.scopes.remotePath);
signOutput = helper.command.sign([], '--original-scope', helper.scopes.remotePath);
});
it('should sign successfully', () => {
expect(signOutput).to.include('the following 2 component(s) were signed with build-status "succeed"');
Expand All @@ -130,7 +126,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(undefined, helper.scopes.remotePath);
const ids = [`${helper.scopes.remote}/bar`];
// console.log('sign-command', `bit sign ${ids.join(' ')}`);
signOutput = helper.command.sign(ids, '--always-succeed --push', helper.scopes.remotePath);
signOutput = helper.command.sign(ids, '--always-succeed --push --original-scope', helper.scopes.remotePath);
});
it('on the workspace, the build status should be pending', () => {
const comp1 = helper.command.catComponent(`${helper.scopes.remote}/bar@latest`);
Expand Down Expand Up @@ -181,7 +177,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(helper.scopes.remotePath, signRemote.scopePath);
signOutput = helper.command.sign(
[`${secondScopeName}/comp1@${snapHash}`],
`--multiple --lane ${helper.scopes.remote}/dev`,
`--lane ${helper.scopes.remote}/dev`,
signRemote.scopePath
);
expect(signOutput).to.include('the following 1 component(s) were signed with build-status "succeed"');
Expand All @@ -192,7 +188,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(helper.scopes.remotePath, signRemote.scopePath);
signOutput = helper.command.sign(
[`${secondScopeName}/comp1@${firstSnapHash}`],
`--multiple --lane ${helper.scopes.remote}/dev`,
`--lane ${helper.scopes.remote}/dev`,
signRemote.scopePath
);
expect(signOutput).to.include('the following 1 component(s) were signed with build-status "succeed"');
Expand All @@ -202,7 +198,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(helper.scopes.remotePath, signRemote.scopePath);
signOutput = helper.command.sign(
[`${secondScopeName}/comp1@${snapHash}`],
`--multiple --lane ${helper.scopes.remote}/dev --push`,
`--lane ${helper.scopes.remote}/dev --push`,
signRemote.scopePath
);
expect(signOutput).to.include('the following 1 component(s) were signed with build-status "succeed"');
Expand All @@ -229,7 +225,7 @@ describe('sign command', function () {
helper.scopeHelper.addRemoteScope(secondRemote.scopePath, signRemote.scopePath);
signOutput = helper.command.sign(
[`${helper.scopes.remote}/comp1`, `${secondRemote.scopeName}/comp2`],
'--multiple',
'',
signRemote.scopePath
);
});
Expand Down
5 changes: 3 additions & 2 deletions e2e/harmony/snap.e2e.2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,9 @@ describe('bit snap command', function () {
expect(status.mergePendingComponents).to.have.lengthOf(0);
});
it('should block checking out the component', () => {
const output = helper.command.checkoutVersion(firstSnap, 'bar/foo', '--auto-merge-resolve manual');
expect(output).to.have.string('is in during-merge state');
expect(() => helper.command.checkoutVersion(firstSnap, 'bar/foo', '--auto-merge-resolve manual')).to.throw(
'is in during-merge state'
);
});
describe('tagging or snapping the component', () => {
beforeEach(() => {
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teambit/legacy",
"version": "1.0.556",
"version": "1.0.561",
"license": "Apache-2.0",
"main": "./dist/api.js",
"preferGlobal": true,
Expand Down Expand Up @@ -129,7 +129,7 @@
"cacache": "15.0.5",
"chalk": "2.4.2",
"checksum": "0.1.1",
"chokidar": "3.5.3",
"@teambit/chokidar": "3.5.6",
"cli-spinners": "1.3.1",
"comment-json": "3.0.3",
"core-js": "3.9.0",
Expand Down Expand Up @@ -231,14 +231,14 @@
},
"devDependencies": {
"@babel/cli": "7.19.3",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-transform-class-properties": "7.22.5",
"@babel/plugin-proposal-decorators": "7.20.0",
"@babel/plugin-proposal-object-rest-spread": "7.19.4",
"@babel/plugin-transform-object-rest-spread": "7.22.15",
"@babel/plugin-transform-modules-commonjs": "7.19.6",
"@babel/plugin-transform-runtime": "7.19.6",
"@babel/preset-env": "7.19.4",
"@babel/preset-react": "7.18.6",
"@babel/preset-typescript": "7.18.6",
"@babel/preset-env": "7.22.15",
"@babel/preset-react": "7.22.15",
"@babel/preset-typescript": "7.22.15",
"@babel/register": "7.18.9",
"@types/bluebird": "3.5.33",
"@types/cacache": "12.0.1",
Expand Down
Loading

0 comments on commit 1b665d1

Please sign in to comment.