Skip to content

Commit

Permalink
Merge branch 'master' of github.com:coveo/plasma into next
Browse files Browse the repository at this point in the history
  • Loading branch information
gdostie committed May 16, 2022
2 parents 4bc0767 + 5945750 commit c4d2119
Show file tree
Hide file tree
Showing 24 changed files with 1,024 additions and 983 deletions.
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
# 41.5.0 (2022-05-16)


### Bug Fixes

* **website:** window is not defined on first load ([eb0875b](https://github.com/coveo/plasma/commits/eb0875b388ba8fe63dd6c31c2a1eaaeecf5a9d26))


### Features

* **react:** focus on lower limit after selecting upper limit ([891ea49](https://github.com/coveo/plasma/commits/891ea49dc8833b5d1017c51547dd4f478a53e3bc))



## 41.4.9 (2022-05-13)


### Bug Fixes

* **publish:** a random quote appeared ([eab2285](https://github.com/coveo/plasma/commits/eab22852b2817b7464ce52ebe88b1b42711720f9))



## 41.4.8 (2022-05-13)


### Bug Fixes

* **publish:** deployment package version ([#2744](https://github.com/coveo/plasma/issues/2744)) ([0b5bbe7](https://github.com/coveo/plasma/commits/0b5bbe7b116977fa91f5130ea5274cd35d4b0722))



## 41.4.7 (2022-05-13)



## 41.4.6 (2022-05-13)


### Bug Fixes

* **publish:** force [email protected] and change publish ([7849125](https://github.com/coveo/plasma/commits/78491251ab42655fd9ad07bc06d8a2395abf0fad))



# 41.3.0 (2022-05-04)


Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pipeline {

sh "npm cache clean --force"
sh "rm -rf node_modules"
sh "npm install -g pnpm@7"
sh "npm install -g pnpm@7.0.0"
sh "pnpm install"
}
}
Expand Down Expand Up @@ -217,7 +217,7 @@ pipeline {
}

NEW_VERSION = sh(
script: "node -p -e 'require(`./package.json`).version;'",
script: "node build/getLastTag.mjs",
returnStdout: true
).trim()
}
Expand Down
8 changes: 4 additions & 4 deletions TokensExtraction.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pipeline {

sh "npm cache clean --force"
sh "rm -rf node_modules"
sh "npm install -g pnpm"
sh "npm install -g pnpm@7.0.0"
sh "pnpm install"
}
}
Expand All @@ -80,9 +80,9 @@ pipeline {
steps {
script {
if (params.LIBRARIES.length() > 0) {
sh "pnpm run tokens:fetch --filter @coveord/plasma-tokens -- --libraries ${params.LIBRARIES}"
sh "pnpm run --filter @coveord/plasma-tokens tokens:fetch --libraries ${params.LIBRARIES}"
} else {
sh "pnpm run tokens:fetch --filter @coveord/plasma-tokens"
sh "pnpm run --filter @coveord/plasma-tokens tokens:fetch"
}
}
}
Expand All @@ -91,7 +91,7 @@ pipeline {
stage('Build tokens') {
steps {
script {
sh "pnpm run tokens:build --filter @coveord/plasma-tokens"
sh "pnpm run --filter @coveord/plasma-tokens tokens:build"
}
}
}
Expand Down
14 changes: 14 additions & 0 deletions build/getLastTag.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {getLastTag} from '@coveo/semantic-monorepo-tools';
import url from 'url';

const VERSION_PREFIX = 'v';
const lastTag = getLastTag(VERSION_PREFIX)?.[0];

export default function() {
return lastTag;
};

// detect if that file is run directly instead of being imported
if (import.meta.url === url.pathToFileURL(process.argv[1]).href) {
console.log(lastTag);
}
28 changes: 13 additions & 15 deletions build/publishNewVersion.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
generateChangelog,
getLastTag,
getNextVersion,
getCommits,
getCurrentVersion,
getRemoteName,
gitPush,
gitPushTags,
Expand All @@ -15,9 +13,12 @@ import {
pnpmPublish,
writeChangelog,
} from '@coveo/semantic-monorepo-tools';
import {spawnSync} from 'node:child_process';
import {Command, Option} from 'commander';
import angularChangelogConvention from 'conventional-changelog-angular';

import getLastTag from './getLastTag.mjs';

const VERSION_PREFIX = 'v';
const PATH = '.';
const BUMP_TYPES = ['major', 'minor', 'patch', 'prerelease'];
Expand Down Expand Up @@ -47,15 +48,12 @@ const outputProcess = (process) => {
(async () => {
const convention = await angularChangelogConvention;

const [lastTag] = getLastTag(VERSION_PREFIX);
const lastTag = getLastTag();
console.log('Last tag: %s', lastTag);

const [remote] = getRemoteName();
const since = lastTag;

console.log('Since: %s', since);

const changedPackages = pnpmGetChangedPackages(since);
const changedPackages = pnpmGetChangedPackages(lastTag);
if (!changedPackages.includes('root')) {
changedPackages.push('root');
}
Expand All @@ -71,12 +69,12 @@ const outputProcess = (process) => {
bumpInfo = convention.recommendedBumpOpts.whatBump(parsedCommits);
}

const currentVersion = getCurrentVersion(PATH);
const currentVersion = {version: lastTag.replace(VERSION_PREFIX, '')};
const newVersion = getNextVersion(currentVersion, bumpInfo);

if (newVersion !== currentVersion) {
console.log('Bumping %s to version %s', changedPackages.join(', '), newVersion);
pnpmBumpVersion(newVersion, since, ['root']);
pnpmBumpVersion(newVersion, lastTag, ['root']);

if (parsedCommits.length > 0) {
const changelog = await generateChangelog(
Expand All @@ -94,19 +92,19 @@ const outputProcess = (process) => {

const versionTag = `${VERSION_PREFIX}${newVersion}`;
if (!options.dry) {
gitCommit(`chore(release): publish version ${versionTag} [version bump]`, '.');
outputProcess(gitCommit(`chore(release): publish version ${versionTag} [version bump]`, '.'));
gitTag(versionTag);

console.log(`Publishing version ${versionTag} on NPM`);
outputProcess(
pnpmPublish(since, options.tag, options.branch)
);

if (remote) {
console.log(`Pushing version ${versionTag} on git`);
outputProcess(gitPush());
outputProcess(gitPushTags());
}

outputProcess(spawnSync('git', ['status'], {encoding: 'utf-8'}));

console.log(`Publishing version ${versionTag} on NPM`);
outputProcess(pnpmPublish(lastTag, options.tag, options.branch));
}
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "root",
"version": "41.2.10-next.10",
"version": "0.0.0-next.10",
"private": true,
"scripts": {
"build": "ultra --recursive build",
Expand Down Expand Up @@ -48,7 +48,7 @@
"devDependencies": {
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@coveo/semantic-monorepo-tools": "0.3.7",
"@coveo/semantic-monorepo-tools": "0.4.0",
"@sindresorhus/slugify": "2.1.0",
"aws-sdk": "2.1125.0",
"axios": "0.27.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coveord/plasma-react",
"version": "41.3.0-next.11",
"version": "41.5.0-next.11",
"description": "Plasma components implemented with React!",
"keywords": [
"coveo",
Expand Down Expand Up @@ -136,7 +136,7 @@
"eslint-plugin-jest-dom": "3.9.4",
"eslint-plugin-testing-library": "5.3.1",
"faker": "4.1.0",
"fancy-log": "1.3.3",
"fancy-log": "2.0.0",
"identity-obj-proxy": "3.0.0",
"jest": "28.0.3",
"jest-environment-jsdom": "28.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,39 +130,31 @@ describe('Calendar', () => {
expect(calendar.find(OptionsCycleConnected).length).toBe(2);
});

it(
'should set the selected value of the picker to an empty string when calling onClick on a date range picker ' +
'and the limit selected is the upper one',
() => {
const pickerSelected: string = DateLimits.upper;
it('focuses on the lower limit after selecting the upper limit', () => {
const pickerSelected: string = DateLimits.upper;

store.dispatch(DEFAULT_ADD_DATE_PICKER_WITH_RANGE);
store.dispatch(selectDate(PICKER_ID, pickerSelected));
store.dispatch(DEFAULT_ADD_DATE_PICKER_WITH_RANGE);
store.dispatch(selectDate(PICKER_ID, pickerSelected));

expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(pickerSelected);
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(pickerSelected);

calendar.props().onClick(PICKER_ID, true, new Date());
calendar.props().onClick(PICKER_ID, true, new Date());

expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe('');
}
);
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(DateLimits.lower);
});

it(
'should set the selected value of the picker to the upper limit when calling onClick on a date range picker ' +
'and the limit selected is the lower one',
() => {
const pickerSelected: string = DateLimits.lower;
it('focuses on the upper limit after selecting the lower limit', () => {
const pickerSelected: string = DateLimits.lower;

store.dispatch(DEFAULT_ADD_DATE_PICKER_WITH_RANGE);
store.dispatch(selectDate(PICKER_ID, pickerSelected));
store.dispatch(DEFAULT_ADD_DATE_PICKER_WITH_RANGE);
store.dispatch(selectDate(PICKER_ID, pickerSelected));

expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(pickerSelected);
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(pickerSelected);

calendar.props().onClick(PICKER_ID, false, new Date());
calendar.props().onClick(PICKER_ID, false, new Date());

expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(DateLimits.upper);
}
);
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(DateLimits.upper);
});

it(
'should set the selected value of the picker to an empty string when calling onClick on a standard date picker ' +
Expand Down Expand Up @@ -327,7 +319,7 @@ describe('Calendar', () => {
store.dispatch(changeDatePickerUpperLimit(PICKER_ID, currentUpperLimit));

expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).upperLimit).toBe(currentUpperLimit);
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe('');
expect(_.findWhere(store.getState().datePickers, {id: PICKER_ID}).selected).toBe(DateLimits.lower);

calendar.props().onSelectUnselectable(PICKER_ID);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const changeUpperLimit = (state: IDatePickerState, action: IReduxAction<IReduxAc
: _.extend({}, state, {
upperLimit: action.payload.date,
inputUpperLimit: action.payload.date,
selected: '',
selected: state.isRange ? DateLimits.lower : '',
});

const selectDate = (state: IDatePickerState, action: IReduxAction<IReduxActionsPayload>): IDatePickerState =>
Expand Down
14 changes: 9 additions & 5 deletions packages/react/src/components/editor/CodeEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import loadable from '@loadable/component';
import classNames from 'classnames';
import type {Editor, EditorConfiguration} from 'codemirror';
import {ComponentType, createRef, Component} from 'react';
import {Component, ComponentType, createRef} from 'react';
import type {Controlled} from 'react-codemirror2';
import {connect} from 'react-redux';

import {PlasmaState} from '../../PlasmaState';
import {IDispatch} from '../../utils';
import {CollapsibleSelectors} from '../collapsible/CollapsibleSelectors';
import {CollapsibleSelectors} from '../collapsible';
import {CodeEditorActions} from './CodeEditorActions';
import {CodeMirrorGutters} from './EditorConstants';

Expand Down Expand Up @@ -81,7 +81,7 @@ class CodeEditorDisconnect extends Component<
> {
static defaultProps: Partial<ICodeEditorProps> = {
className: 'mod-border',
value: '{}',
value: '',
};

static defaultOptions = {
Expand Down Expand Up @@ -119,9 +119,13 @@ class CodeEditorDisconnect extends Component<
this.editor.refresh();
this.setState({numberOfRefresh: this.state.numberOfRefresh + 1});
}
if (prevProps.value !== this.props.value && this.editor) {

if (prevProps.value !== this.props.value) {
this.setState({value: this.props.value});
this.editor.getDoc().clearHistory();

if (this.editor) {
this.editor.getDoc().clearHistory();
}
}
}

Expand Down
Loading

0 comments on commit c4d2119

Please sign in to comment.