@atlaskit/logo 15.2.1 → 15.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/logo
2
2
 
3
+ ## 15.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#112549](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/112549)
8
+ [`ed68a8d2ee5f7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ed68a8d2ee5f7) -
9
+ Update dependencies and remove unused exports and codemods.
10
+
3
11
  ## 15.2.1
4
12
 
5
13
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- export type Appearance = 'brand' | 'neutral' | 'inverse';
2
- export type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
1
+ type Appearance = 'brand' | 'neutral' | 'inverse';
2
+ type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
3
3
  export type LogoProps = {
4
4
  /**
5
5
  * The size of the icon, uses the same sizing scheme as in `@atlaskit/icon`.
@@ -1,5 +1,5 @@
1
- export type Appearance = 'brand' | 'neutral' | 'inverse';
2
- export type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
1
+ type Appearance = 'brand' | 'neutral' | 'inverse';
2
+ type Size = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge';
3
3
  export type LogoProps = {
4
4
  /**
5
5
  * The size of the icon, uses the same sizing scheme as in `@atlaskit/icon`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/logo",
3
- "version": "15.2.1",
3
+ "version": "15.2.2",
4
4
  "description": "A logo is a visual representation of a brand or product. It can be a word or an image, or a combination of both.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,8 +37,16 @@
37
37
  "devDependencies": {
38
38
  "@af/accessibility-testing": "*",
39
39
  "@af/integration-testing": "*",
40
+ "@af/visual-regression": "*",
41
+ "@atlaskit/code": "^15.7.1",
42
+ "@atlaskit/docs": "*",
43
+ "@atlaskit/form": "^11.1.1",
44
+ "@atlaskit/link": "*",
45
+ "@atlaskit/lozenge": "^11.13.2",
46
+ "@atlaskit/primitives": "^13.5.0",
47
+ "@atlaskit/section-message": "*",
48
+ "@atlaskit/select": "^18.10.4",
40
49
  "@atlaskit/ssr": "*",
41
- "@atlaskit/visual-regression": "*",
42
50
  "@testing-library/react": "^13.4.0",
43
51
  "jscodeshift": "^0.13.0",
44
52
  "react-dom": "^18.2.0",
@@ -1,80 +0,0 @@
1
- import {
2
- type API,
3
- type ASTPath,
4
- type FileInfo,
5
- type ImportDeclaration,
6
- type ImportSpecifier,
7
- type Options,
8
- } from 'jscodeshift';
9
-
10
- import { addCommentBefore } from './utils';
11
-
12
- const replacementMapping: { [name: string]: string } = {
13
- Props: 'LogoProps',
14
- DefaultProps: 'defaultLogoParams',
15
- JiraCoreIcon: 'JiraWorkManagementIcon',
16
- JiraCoreLogo: 'JiraWorkManagementLogo',
17
- JiraCoreWordmark: 'JiraWorkManagementWordmark',
18
- JiraServiceDeskIcon: 'JiraServiceManagementIcon',
19
- JiraServiceDeskLogo: 'JiraServiceManagementLogo',
20
- JiraServiceDeskWordmark: 'JiraServiceManagementWordmark',
21
- OpsGenieIcon: 'OpsgenieIcon',
22
- OpsGenieIconLogo: 'OpsgenieIconLogo',
23
- OpsGenieIconWordmark: 'OpsgenieIconWordmark',
24
- StrideIcon: 'NO_ALTERNATIVE_COMPONENT',
25
- StrideLogo: 'NO_ALTERNATIVE_COMPONENT',
26
- StrideWordmark: 'NO_ALTERNATIVE_COMPONENT',
27
- HipchatIcon: 'NO_ALTERNATIVE_COMPONENT',
28
- HipchatLogo: 'NO_ALTERNATIVE_COMPONENT',
29
- HipchatWordmark: 'NO_ALTERNATIVE_COMPONENT',
30
- };
31
-
32
- export default function transform(file: FileInfo, { jscodeshift: j }: API, options: Options) {
33
- const source = j(file.source);
34
- const target = source.find(j.ImportDeclaration).filter((path: ASTPath<ImportDeclaration>) => {
35
- const value = path.node.source.value as string;
36
- return value.includes('@atlaskit/logo');
37
- });
38
- const logoImports = target.find(j.ImportSpecifier);
39
-
40
- if (!logoImports.length) {
41
- // Returns original source file, untouched and unformatted
42
- return file.source;
43
- }
44
-
45
- logoImports.forEach((path: ASTPath<ImportSpecifier>) => {
46
- const foundKey = Object.keys(replacementMapping).find((key) => key === path.node.imported.name);
47
-
48
- if (!foundKey || !replacementMapping[foundKey] || !path.node.local) {
49
- return;
50
- }
51
- // add comment for logo component that don't have alternatives
52
- if (replacementMapping[foundKey] === 'NO_ALTERNATIVE_COMPONENT') {
53
- addCommentBefore(
54
- j,
55
- target,
56
- `This file uses the @atlaskit/logo \`${foundKey}\`
57
- which will be removed with no alternative in the next major version.`,
58
- );
59
- return;
60
- }
61
-
62
- // replace the import with mapping name
63
- const newLogoImport: ImportSpecifier = j.importSpecifier(
64
- j.identifier(replacementMapping[foundKey]),
65
- // if aliased import exist, keep the alias name unchanged, i.e.
66
- // before: import { JiraCoreLogo as JCLogo } from '@atlaskit/logo';
67
- // after: import { JiraWorkManagementLogo as JCLogo } from '@atlaskit/logo';
68
- // otherwise alias the import using the original name, i.e.
69
- // before: import { JiraCoreLogo } from '@atlaskit/logo';
70
- // after: import { JiraWorkManagementLogo as JiraCoreLogo } from '@atlaskit/logo';
71
- j.identifier(
72
- path.node.local.name !== path.node.imported.name ? path.node.local.name : foundKey,
73
- ),
74
- );
75
-
76
- j(path).replaceWith(newLogoImport);
77
- });
78
-
79
- return source.toSource(options.printOptions);
80
- }
@@ -1,233 +0,0 @@
1
- jest.autoMockOff();
2
-
3
- import transformer from '../13.6.0-rename-imports';
4
-
5
- const defineInlineTest = require('jscodeshift/dist/testUtils').defineInlineTest;
6
-
7
- describe('Rename Logo import code-mods', () => {
8
- ['tsx', 'babylon'].forEach((parser) => {
9
- describe(`parser: ${parser}`, () => {
10
- defineInlineTest(
11
- { default: transformer, parser },
12
- {},
13
- `
14
- import React from 'react';
15
- import { JiraCoreLogo } from '@atlaskit/logo';
16
-
17
- const Logo = () => (<JiraCoreLogo />);
18
- `,
19
- `
20
- import React from 'react';
21
- import { JiraWorkManagementLogo as JiraCoreLogo } from '@atlaskit/logo';
22
-
23
- const Logo = () => (<JiraCoreLogo />);
24
- `,
25
- 'should alias the import using alternative components',
26
- );
27
- defineInlineTest(
28
- { default: transformer, parser },
29
- {},
30
- `
31
- import React from 'react';
32
- import {
33
- AtlassianIcon,
34
- JiraCoreLogo
35
- } from '@atlaskit/logo';
36
- const getProductIcon = (productId: string) => {
37
- switch (productId) {
38
- case 'jira-core':
39
- return JiraCoreIcon;
40
- default:
41
- return AtlassianIcon;
42
- }
43
- }
44
- const Logo = () => getProductIcon();
45
- `,
46
- `
47
- import React from 'react';
48
- import {
49
- AtlassianIcon,
50
- JiraWorkManagementLogo as JiraCoreLogo
51
- } from '@atlaskit/logo';
52
- const getProductIcon = (productId: string) => {
53
- switch (productId) {
54
- case 'jira-core':
55
- return JiraCoreIcon;
56
- default:
57
- return AtlassianIcon;
58
- }
59
- }
60
- const Logo = () => getProductIcon();
61
- `,
62
- 'should alias the import using alternative components, and keep other logo components unchanged',
63
- );
64
- defineInlineTest(
65
- { default: transformer, parser },
66
- {},
67
- `
68
- import React from 'react';
69
- import { JiraCoreLogo } from '@atlaskit/logo';
70
-
71
- const Logo = ({textColor}) => (<JiraCoreLogo textColor={textColor} />);
72
- `,
73
- `
74
- import React from 'react';
75
- import { JiraWorkManagementLogo as JiraCoreLogo } from '@atlaskit/logo';
76
-
77
- const Logo = ({textColor}) => (<JiraCoreLogo textColor={textColor} />);
78
- `,
79
- 'should replace imports with alternative component with props unchanged',
80
- );
81
- defineInlineTest(
82
- { default: transformer, parser },
83
- {},
84
- `
85
- import React from 'react';
86
- import {
87
- JiraCoreWordmark,
88
- JiraCoreIcon
89
- } from '@atlaskit/logo';
90
-
91
- const Logo = () => (<><JiraCoreIcon /><JiraCoreWordmark /></>);
92
- `,
93
- `
94
- import React from 'react';
95
- import {
96
- JiraWorkManagementWordmark as JiraCoreWordmark,
97
- JiraWorkManagementIcon as JiraCoreIcon
98
- } from '@atlaskit/logo';
99
-
100
- const Logo = () => (<><JiraCoreIcon /><JiraCoreWordmark /></>);
101
- `,
102
- 'should alias multiple imports using alternative components',
103
- );
104
- defineInlineTest(
105
- { default: transformer, parser },
106
- {},
107
- `
108
- import React from 'react';
109
- import { JiraCoreLogo as JCLogo } from '@atlaskit/logo';
110
-
111
- const Logo = () => (<JCLogo />);
112
- `,
113
- `
114
- import React from 'react';
115
- import { JiraWorkManagementLogo as JCLogo } from '@atlaskit/logo';
116
-
117
- const Logo = () => (<JCLogo />);
118
- `,
119
- 'should replace aliased import and JSX element with alternative components',
120
- );
121
- defineInlineTest(
122
- { default: transformer, parser },
123
- {},
124
- `
125
- import React from 'react';
126
- import { StrideIcon } from '@atlaskit/logo';
127
-
128
- const Logo = () => (<StrideIcon />);
129
- `,
130
- `
131
- import React from 'react';
132
- /* TODO: (from codemod) This file uses the @atlaskit/logo \`StrideIcon\`
133
- which will be removed with no alternative in the next major version. */
134
- import { StrideIcon } from '@atlaskit/logo';
135
-
136
- const Logo = () => (<StrideIcon />);
137
- `,
138
- 'should prompt user when using logo components with no alternatives',
139
- );
140
- defineInlineTest(
141
- { default: transformer, parser },
142
- {},
143
- `
144
- import React from 'react';
145
- import { JiraCoreIcon, HipchatIcon } from '@atlaskit/logo';
146
- const Logo = () => (<><JiraCoreIcon /><HipchatIcon /></>);
147
- `,
148
- `
149
- import React from 'react';
150
- /* TODO: (from codemod) This file uses the @atlaskit/logo \`HipchatIcon\`
151
- which will be removed with no alternative in the next major version. */
152
- import { JiraWorkManagementIcon as JiraCoreIcon, HipchatIcon } from '@atlaskit/logo';
153
- const Logo = () => (<><JiraCoreIcon /><HipchatIcon /></>);
154
- `,
155
- 'should alias imports using alternative component and propt user when using logo compontns with no alternatives',
156
- );
157
- defineInlineTest(
158
- { default: transformer, parser },
159
- {},
160
- `
161
- import React from 'react';
162
-
163
- const MyComponent = () => (<div />);
164
- `,
165
- `
166
- import React from 'react';
167
-
168
- const MyComponent = () => (<div />);
169
- `,
170
- 'should not modify files that are not using @atlaskit/logo',
171
- );
172
- });
173
- describe(`parser: ${parser}`, () => {
174
- defineInlineTest(
175
- { default: transformer, parser },
176
- {},
177
- `
178
- import React from 'react';
179
- import { Props } from '@atlaskit/logo/constants';
180
-
181
- const ExampleLogoProps = Props;
182
- `,
183
- `
184
- import React from 'react';
185
- import { LogoProps as Props } from '@atlaskit/logo/constants';
186
-
187
- const ExampleLogoProps = Props;
188
- `,
189
- 'should alias the Props import using LogoProps',
190
- );
191
- });
192
- describe(`parser: ${parser}`, () => {
193
- defineInlineTest(
194
- { default: transformer, parser },
195
- {},
196
- `
197
- import React from 'react';
198
- import { DefaultProps } from '@atlaskit/logo/constants';
199
-
200
- const ExampleLogoProps = DefaultProps;
201
- `,
202
- `
203
- import React from 'react';
204
- import { defaultLogoParams as DefaultProps } from '@atlaskit/logo/constants';
205
-
206
- const ExampleLogoProps = DefaultProps;
207
- `,
208
- 'should alias the DefaultProps import using defaultLogoParams',
209
- );
210
- });
211
- describe(`parser: ${parser}`, () => {
212
- defineInlineTest(
213
- { default: transformer, parser },
214
- {},
215
- `
216
- import React from 'react';
217
- import { JiraCoreIcon } from '@atlaskit/logo';
218
- import { DefaultProps } from '@atlaskit/logo/constants';
219
-
220
- const Logo = (DefaultProps) => (<JiraCoreIcon />);
221
- `,
222
- `
223
- import React from 'react';
224
- import { JiraWorkManagementIcon as JiraCoreIcon } from '@atlaskit/logo';
225
- import { defaultLogoParams as DefaultProps } from '@atlaskit/logo/constants';
226
-
227
- const Logo = (DefaultProps) => (<JiraCoreIcon />);
228
- `,
229
- 'should alias imports from both @atlaskit/logo and the /constants entrypoint at the same time',
230
- );
231
- });
232
- });
233
- });
@@ -1,26 +0,0 @@
1
- import type { ASTPath, default as core } from 'jscodeshift';
2
- import { type Collection } from 'jscodeshift/src/Collection';
3
-
4
- // not replacing newlines (which \s does)
5
- const spacesAndTabs: RegExp = /[ \t]{2,}/g;
6
- const lineStartWithSpaces: RegExp = /^[ \t]*/gm;
7
-
8
- function clean(value: string): string {
9
- return value.replace(spacesAndTabs, ' ').replace(lineStartWithSpaces, '').trim();
10
- }
11
-
12
- export function addCommentBefore(j: core.JSCodeshift, target: Collection<any>, message: string) {
13
- const content: string = ` TODO: (from codemod) ${clean(message)} `;
14
- target.forEach((path: ASTPath<any>) => {
15
- path.value.comments = path.value.comments || [];
16
-
17
- const exists = path.value.comments.find((comment: any) => comment.value === content);
18
-
19
- // avoiding duplicates of the same comment
20
- if (exists) {
21
- return;
22
- }
23
-
24
- path.value.comments.push(j.commentBlock(content));
25
- });
26
- }