Chore: Switch yarn 2 to plug-n-play strategy (#40300)

This commit is contained in:
kay delaney
2021-10-27 14:21:07 +01:00
committed by GitHub
parent 690849cfd6
commit 3a7c5a0755
65 changed files with 3122 additions and 1393 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ set -e
echo -e "Collecting code stats (typescript errors & more)"
ERROR_COUNT_LIMIT=6
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
ERROR_COUNT="$(yarn run tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
if [ "$ERROR_COUNT" -gt $ERROR_COUNT_LIMIT ]; then
echo -e "Typescript strict errors $ERROR_COUNT exceeded $ERROR_COUNT_LIMIT so failing build"
+2 -2
View File
@@ -1,7 +1,7 @@
#!/bin/bash
set -e
ERROR_COUNT="$(./node_modules/.bin/tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
ERROR_COUNT="$(yarn run tsc --project tsconfig.json --noEmit --strict true | grep -oP 'Found \K(\d+)')"
ACCESSIBILITY_ERRORS="$(grep -oP '\"errors\":(\d+),' pa11y-ci-results.json | grep -oP '\d+')"
DIRECTIVES="$(grep -r -o directive public/app/ | wc -l)"
CONTROLLERS="$(grep -r -oP 'class .*Ctrl' public/app/ | wc -l)"
@@ -9,7 +9,7 @@ STORIES_COUNT="$(find ./packages/grafana-ui/src/components -name "*.story.tsx" |
MDX_COUNT="$(find ./packages/grafana-ui/src/components -name "*.mdx" | wc -l)"
LEGACY_FORMS="$(grep -r -oP 'LegacyForms;' public/app | wc -l)"
STRICT_LINT_RESULTS="$(./node_modules/.bin/eslint --rule '@typescript-eslint/no-explicit-any: ["error"]' --format unix --ext .ts,.tsx ./public || true)"
STRICT_LINT_RESULTS="$(yarn run eslint --rule '@typescript-eslint/no-explicit-any: ["error"]' --format unix --ext .ts,.tsx ./public || true)"
STRICT_LINT_EXPLICIT_ANY="$(echo "${STRICT_LINT_RESULTS}" | grep -o "no-explicit-any" | wc -l)"
TOTAL_BUNDLE="$(du -sk ./public/build | cut -f1)"
+1 -1
View File
@@ -994,7 +994,7 @@ def ensure_cuetsified_step():
'# The above command generates Typescript files (*.gen.ts) from all appropriate .cue files.',
'# It is required that the generated Typescript be in sync with the input CUE files.',
'# ...Modulo eslint auto-fixes...:',
'./node_modules/.bin/eslint . --ext .gen.ts --fix',
'yarn run eslint . --ext .gen.ts --fix',
'# If any filenames are emitted by the below script, run the generator command `grafana-cli cue gen-ts` locally and commit the result.',
'./scripts/clean-git-or-error.sh',
'# Un-stash changes.',
+14 -17
View File
@@ -10,7 +10,10 @@ class CopyUniconsPlugin {
let destDir = path.resolve(__dirname, '../../public/img/icons/unicons');
if (!fs.pathExistsSync(destDir)) {
let srcDir = path.resolve(__dirname, '../../node_modules/iconscout-unicons-tarball/unicons/svg/line');
let srcDir = path.join(
path.dirname(require.resolve('iconscout-unicons-tarball/package.json')),
'unicons/svg/line'
);
fs.copySync(srcDir, destDir);
}
});
@@ -32,27 +35,19 @@ module.exports = {
resolve: {
extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'],
alias: {
// rc-trigger uses babel-runtime which has internal dependency to core-js@2
// this alias maps that dependency to core-js@t3
'core-js/library/fn': 'core-js/stable',
// storybook v6 bump caused the app to bundle multiple versions of react breaking hooks
// make sure to resolve only from the project: https://github.com/facebook/react/issues/13991#issuecomment-435587809
react: path.resolve(__dirname, '../../node_modules/react'),
// Needed as these don't work across different execution contexts, which can cause
// problems with @grafana/ui
'react-router': require.resolve('react-router'),
'react-router-dom': require.resolve('react-router-dom'),
'react-hook-form': require.resolve('react-hook-form'),
jquery: require.resolve('jquery'),
// some of data source pluginis use global Prism object to add the language definition
// we want to have same Prism object in core and in grafana/ui
prismjs: path.resolve(__dirname, '../../node_modules/prismjs'),
prismjs: require.resolve('prismjs'),
},
modules: [
'node_modules',
path.resolve('public'),
// we need full path to root node_modules for grafana-enterprise symlink to work
path.resolve('node_modules'),
'.yarn',
path.resolve('.yarn'),
path.resolve('public'),
],
fallback: {
buffer: false,
@@ -60,6 +55,7 @@ module.exports = {
stream: false,
http: false,
https: false,
string_decoder: false,
},
},
ignoreWarnings: [/export .* was not found in/],
@@ -75,9 +71,9 @@ module.exports = {
new CopyWebpackPlugin({
patterns: [
{
context: path.resolve(__dirname, '../../node_modules/monaco-editor/'),
from: 'min/vs/**',
to: '../lib/monaco/', // inside the public/build folder
context: path.join(require.resolve('monaco-editor/package.json'), '../min/vs/'),
from: '**/*',
to: '../lib/monaco/min/vs/', // inside the public/build folder
globOptions: {
ignore: [
'**/*.map', // debug files
@@ -85,7 +81,8 @@ module.exports = {
},
},
{
from: './node_modules/@kusto/monaco-kusto/release/min/',
context: path.join(require.resolve('@kusto/monaco-kusto'), '../'),
from: '**/*',
to: '../lib/monaco/min/vs/language/kusto/',
},
],