Skip to content

Commit b33a7cd

Browse files
jeremy-davis-sonarsourcesonartech
authored andcommitted
SONAR-18524 New Main App bar
1 parent 8d902e9 commit b33a7cd

File tree

128 files changed

+10388
-2213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+10388
-2213
lines changed

.cirrus.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ eslint_report_cache_template: &ESLINT_REPORT_CACHE_TEMPLATE
144144
eslint_report_cache:
145145
folders:
146146
- server/sonar-web/eslint-report/
147+
- server/sonar-web/design-system/eslint-report/
147148
- private/core-extension-securityreport/eslint-report/
148149
- private/core-extension-license/eslint-report/
149150
- private/core-extension-enterprise-server/eslint-report/
@@ -154,6 +155,7 @@ jest_report_cache_template: &JEST_REPORT_CACHE_TEMPLATE
154155
jest_report_cache:
155156
folders:
156157
- server/sonar-web/coverage/
158+
- server/sonar-web/design-system/coverage/
157159
- private/core-extension-securityreport/coverage/
158160
- private/core-extension-license/coverage/
159161
- private/core-extension-enterprise-server/coverage/

server/sonar-web/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ task yarn_run(type: Exec) {
3131
['config', 'public', 'scripts', 'src'].each {
3232
inputs.dir(it).withPathSensitivity(PathSensitivity.RELATIVE)
3333
}
34-
['package.json', 'tsconfig.json', 'yarn.lock'].each {
34+
['package.json', 'tsconfig.json', 'yarn.lock', 'tailwind.config.js', 'tailwind.base.config.js'].each {
3535
inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
3636
}
3737
outputs.dir(webappDir)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2023 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
import { ThemeContext } from '@emotion/react';
21+
import { lightTheme } from 'design-system';
22+
23+
// Hack : override the default value of the context used for theme by emotion
24+
// This allows tests to get the theme value without specifiying a theme provider
25+
ThemeContext['_currentValue'] = lightTheme;
26+
ThemeContext['_currentValue2'] = lightTheme;

server/sonar-web/design-system/babel.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1919
*/
2020

21-
export default {
21+
module.exports = {
2222
plugins: [
2323
'babel-plugin-macros',
2424
[
@@ -30,5 +30,6 @@ export default {
3030
},
3131
],
3232
['@babel/plugin-transform-react-jsx', { pragma: '__cssprop' }, 'twin.macro'],
33+
'@emotion',
3334
],
3435
};
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
sonar {
2+
properties {
3+
property 'sonar.projectName', "${projectTitle} :: Web :: Design System"
4+
property "sonar.sources", "src"
5+
property "sonar.exclusions", "src/**/__tests__/**,src/types/**,src/@types/**,src/helpers/testUtils.tsx"
6+
property "sonar.tests", "src"
7+
property "sonar.test.inclusions", "src/**/__tests__/**"
8+
property "sonar.javascript.lcov.reportPaths", "./coverage/lcov.info"
9+
}
10+
}
11+
12+
task "yarn_validate-ci"(type: Exec) {
13+
dependsOn ":server:sonar-web:yarn_design-system"
14+
15+
inputs.dir('src')
16+
17+
['package.json', '../yarn.lock', 'jest.config.js'].each {
18+
inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
19+
}
20+
21+
outputs.dir('coverage')
22+
outputs.cacheIf { true }
23+
24+
commandLine osAdaptiveCommand(['npm', 'run', 'validate-ci'])
25+
}
26+
27+
task "yarn_lint-report-ci"(type: Exec) {
28+
dependsOn ":server:sonar-web:yarn_design-system"
29+
30+
['src'].each {
31+
inputs.dir(it)
32+
}
33+
['package.json', '../yarn.lock', 'tsconfig.json', '.eslintrc'].each {
34+
inputs.file(it)
35+
}
36+
outputs.dir('eslint-report')
37+
outputs.cacheIf { true }
38+
39+
commandLine osAdaptiveCommand(['npm', 'run', 'lint-report-ci'])
40+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2023 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
import '@testing-library/jest-dom';
21+
import { configure } from '@testing-library/react';
22+
23+
configure({
24+
asyncUtilTimeout: 3000,
25+
});
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2023 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
import 'whatwg-fetch';
21+
22+
const content = document.createElement('div');
23+
content.id = 'content';
24+
document.documentElement.appendChild(content);
25+
26+
Element.prototype.scrollIntoView = () => {};
27+
28+
global.___loader = {
29+
enqueue: jest.fn(),
30+
};
31+
32+
const MockResizeObserverEntries = [
33+
{
34+
contentRect: {
35+
width: 100,
36+
height: 200,
37+
},
38+
},
39+
];
40+
41+
const MockResizeObserver = {
42+
observe: jest.fn(),
43+
unobserve: jest.fn(),
44+
disconnect: jest.fn(),
45+
};
46+
47+
global.ResizeObserver = jest.fn().mockImplementation((callback) => {
48+
callback(MockResizeObserverEntries, MockResizeObserver);
49+
return MockResizeObserver;
50+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2023 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
import { ThemeContext } from '@emotion/react';
21+
import { lightTheme } from '../../src/theme';
22+
23+
// Hack : override the default value of the context used for theme by emotion
24+
// This allows tests to get the theme value without specifiying a theme provider
25+
ThemeContext['_currentValue'] = lightTheme;
26+
ThemeContext['_currentValue2'] = lightTheme;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* SonarQube
3+
* Copyright (C) 2009-2023 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
21+
const babelConfig = require('./babel.config');
22+
23+
babelConfig.presets = [
24+
['@babel/preset-env', { targets: { node: 'current' } }],
25+
'@babel/preset-typescript',
26+
];
27+
28+
module.exports = {
29+
coverageDirectory: '<rootDir>/coverage',
30+
collectCoverageFrom: [
31+
'src/components/**/*.{ts,tsx,js}',
32+
'src/helpers/**/*.{ts,tsx,js}',
33+
'!src/helpers/{keycodes,testUtils}.{ts,tsx}',
34+
],
35+
coverageReporters: ['lcovonly', 'text'],
36+
globals: {
37+
'ts-jest': {
38+
diagnostics: false,
39+
},
40+
},
41+
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
42+
moduleNameMapper: {
43+
'^.+\\.(md|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
44+
'<rootDir>/config/jest/FileStub.js',
45+
// '^.+\\.css$': '<rootDir>/config/jest/CSSStub.js',
46+
},
47+
setupFiles: [
48+
'<rootDir>/config/jest/SetupTestEnvironment.js',
49+
'<rootDir>/config/jest/SetupTheme.js',
50+
],
51+
setupFilesAfterEnv: ['<rootDir>/config/jest/SetupReactTestingLibrary.ts'],
52+
snapshotSerializers: ['@emotion/jest/serializer'],
53+
testEnvironment: 'jsdom',
54+
testPathIgnorePatterns: ['<rootDir>/config/jest', '<rootDir>/node_modules', '<rootDir>/scripts'],
55+
testRegex: '(/__tests__/.*|\\-test)\\.(ts|tsx|js)$',
56+
transform: {
57+
'^.+\\.(t|j)sx?$': ['babel-jest', babelConfig],
58+
},
59+
transformIgnorePatterns: ['/node_modules/(?!(d3-.+))/'],
60+
testTimeout: 30000,
61+
};
Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,63 @@
11
{
22
"name": "design-system",
33
"version": "1.0.0",
4-
"main": "./lib/index.js",
5-
"types": "./lib/index.d.ts",
4+
"main": "lib/index.js",
5+
"types": "lib/index.d.ts",
66
"scripts": {
77
"build": "yarn lint && vite build",
88
"build-release": "yarn install --immutable && yarn build",
9-
"lint": "npx eslint --ext js,ts,tsx,snap --quiet src"
9+
"lint": "eslint --ext js,ts,tsx,snap --quiet src",
10+
"lint-report-ci": "yarn install --immutable && eslint --ext js,ts,tsx -f json -o eslint-report/eslint-report.json src || yarn lint",
11+
"test": "jest",
12+
"validate-ci": "yarn install --immutable && yarn test --coverage --ci"
1013
},
1114
"devDependencies": {
1215
"@babel/core": "7.20.5",
1316
"@babel/plugin-transform-react-jsx": "7.20.13",
17+
"@babel/preset-env": "7.20.2",
18+
"@babel/preset-typescript": "7.18.6",
19+
"@emotion/babel-plugin": "11.10.6",
1420
"@emotion/babel-plugin-jsx-pragmatic": "0.2.0",
21+
"@testing-library/dom": "8.20.0",
22+
"@testing-library/jest-dom": "5.16.5",
23+
"@testing-library/react": "12.1.5",
24+
"@testing-library/user-event": "14.4.3",
25+
"@types/react": "16.14.34",
26+
"@typescript-eslint/parser": "5.49.0",
1527
"@vitejs/plugin-react": "3.1.0",
28+
"autoprefixer": "10.4.13",
29+
"eslint": "8.32.0",
1630
"eslint-plugin-header": "3.1.1",
1731
"eslint-plugin-typescript-sort-keys": "2.1.0",
18-
"twin.macro": "3.1.0",
32+
"history": "5.3.0",
33+
"jest": "29.3.1",
34+
"postcss": "8.4.21",
35+
"postcss-calc": "8.2.4",
36+
"postcss-custom-properties": "12.1.11",
37+
"twin.macro": "2.8.2",
38+
"typescript": "4.9.4",
1939
"vite": "4.1.1",
20-
"vite-plugin-dts": "1.7.2"
40+
"vite-plugin-dts": "2.0.2",
41+
"whatwg-fetch": "3.6.2"
2142
},
2243
"peerDependencies": {
2344
"@emotion/react": "11.10.5",
2445
"@emotion/styled": "11.10.5",
25-
"@typescript-eslint/parser": "5.49.0",
26-
"eslint": "8.32.0",
46+
"@primer/octicons-react": "17.11.1",
47+
"classnames": "2.3.2",
48+
"clipboard": "2.0.11",
49+
"lodash": "4.17.21",
2750
"react": "16.14.0",
2851
"react-dom": "16.14.0",
29-
"tailwindcss": "3.2.6",
30-
"typescript": "4.9.4"
52+
"react-helmet-async": "1.3.0",
53+
"react-intl": "6.2.5",
54+
"react-router-dom": "6.7.0",
55+
"tailwindcss": "2.2.19"
56+
},
57+
"babelMacros": {
58+
"twin": {
59+
"config": "../tailwind.config.js",
60+
"preset": "emotion"
61+
}
3162
}
3263
}

0 commit comments

Comments
 (0)