Merge main
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"moduleResolution": "node",
|
||||
"module": "es2022",
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true
|
||||
"moduleResolution": "nodenext",
|
||||
"module": "NodeNext"
|
||||
},
|
||||
"extends": "../../tsconfig.json",
|
||||
"ts-node": {
|
||||
|
||||
@@ -20,7 +20,7 @@ export const readMeContent = `
|
||||
To build this Markdown, do the following:
|
||||
|
||||
$ cd /docs (from the root of the repository)
|
||||
$ make sources/panels-visualizations/query-transform-data/transform-data/index.md
|
||||
$ make sources/visualizations/panels-visualizations/query-transform-data/transform-data/index.md
|
||||
$ make docs
|
||||
|
||||
Browse to http://localhost:3003/docs/grafana/latest/panels-visualizations/query-transform-data/transform-data/
|
||||
@@ -34,19 +34,20 @@ comments: |
|
||||
${readMeContent}
|
||||
|
||||
aliases:
|
||||
- ../../panels/reference-transformation-functions/
|
||||
- ../../panels/transform-data/
|
||||
- ../../panels/transform-data/about-transformation/
|
||||
- ../../panels/transform-data/add-transformation-to-data/
|
||||
- ../../panels/transform-data/apply-transformation-to-data/
|
||||
- ../../panels/transform-data/debug-transformation/
|
||||
- ../../panels/transform-data/delete-transformation/
|
||||
- ../../panels/transform-data/transformation-functions/
|
||||
- ../../panels/transformations/
|
||||
- ../../panels/transformations/apply-transformations/
|
||||
- ../../panels/transformations/config-from-query/
|
||||
- ../../panels/transformations/rows-to-fields/
|
||||
- ../../panels/transformations/types-options/
|
||||
- ../../../panels/transform-data/ # /docs/grafana/next/panels/transform-data/
|
||||
- ../../../panels/transform-data/about-transformation/ # /docs/grafana/next/panels/transform-data/about-transformation/
|
||||
- ../../../panels/transform-data/add-transformation-to-data/ # /docs/grafana/next/panels/transform-data/add-transformation-to-data/
|
||||
- ../../../panels/transform-data/apply-transformation-to-data/ # /docs/grafana/next/panels/transform-data/apply-transformation-to-data/
|
||||
- ../../../panels/transform-data/debug-transformation/ # /docs/grafana/next/panels/transform-data/debug-transformation/
|
||||
- ../../../panels/transform-data/delete-transformation/ # /docs/grafana/next/panels/transform-data/delete-transformation/
|
||||
- ../../../panels/transform-data/transformation-functions/ # /docs/grafana/next/panels/transform-data/transformation-functions/
|
||||
- ../../../panels/transformations/ # /docs/grafana/next/panels/transformations/
|
||||
- ../../../panels/transformations/apply-transformations/ # /docs/grafana/next/panels/transformations/apply-transformations/
|
||||
- ../../../panels/transformations/config-from-query/ # /docs/grafana/next/panels/transformations/config-from-query/
|
||||
- ../../../panels/transformations/rows-to-fields/ # /docs/grafana/next/panels/transformations/rows-to-fields/
|
||||
- ../../../panels/transformations/types-options/ # /docs/grafana/next/panels/transformations/types-options/
|
||||
- ../../../panels/reference-transformation-functions/ # /docs/grafana/next/panels/reference-transformation-functions/
|
||||
- ../../../panels-visualizations/query-transform-data/transform-data/ # /docs/grafana/next/panels-visualizations/query-transform-data/transform-data/
|
||||
labels:
|
||||
products:
|
||||
- cloud
|
||||
|
||||
@@ -16,6 +16,7 @@ queryLibrary=true
|
||||
queryService=true
|
||||
secretsManagementAppPlatform = true
|
||||
secretsManagementAppPlatformUI = true
|
||||
reportingCsvEncodingOptions = true
|
||||
|
||||
[environment]
|
||||
stack_id = 12345
|
||||
@@ -40,5 +41,6 @@ host = localhost:7777
|
||||
developer_mode = true ; Enable developer mode to use in-memory implementations of 3rdparty services needed.
|
||||
|
||||
[secrets_manager]
|
||||
register_api_server = true
|
||||
run_secrets_db_migrations = true
|
||||
run_data_key_migration = true
|
||||
|
||||
@@ -1,108 +1,35 @@
|
||||
//@ts-check
|
||||
import PackageJson from '@npmcli/package-json';
|
||||
import { mkdir } from 'node:fs/promises';
|
||||
|
||||
const cwd = process.cwd();
|
||||
|
||||
try {
|
||||
const pkgJson = await PackageJson.load(cwd);
|
||||
const cjsIndex = pkgJson.content.publishConfig?.main ?? pkgJson.content.main;
|
||||
const esmIndex = pkgJson.content.publishConfig?.module ?? pkgJson.content.module;
|
||||
const typesIndex = pkgJson.content.publishConfig?.types ?? pkgJson.content.types;
|
||||
const pkgJsonExports = pkgJson.content.exports;
|
||||
|
||||
const exports = {
|
||||
'./package.json': './package.json',
|
||||
'.': {
|
||||
import: {
|
||||
types: typesIndex,
|
||||
default: esmIndex,
|
||||
},
|
||||
require: {
|
||||
types: typesIndex,
|
||||
default: cjsIndex,
|
||||
},
|
||||
},
|
||||
};
|
||||
// Fix so scenes can access `@grafana/schema` nested dist import paths e.g.
|
||||
// import {} from '@grafana/schema/dist/esm/raw/composable/bargauge/panelcfg/x/BarGaugePanelCfg_types.gen'
|
||||
if (pkgJson.content.name === '@grafana/schema') {
|
||||
exports['./dist/*'] = {
|
||||
types: './dist/*',
|
||||
default: './dist/*',
|
||||
};
|
||||
}
|
||||
|
||||
// Fix for @grafana/i18n so eslint-plugin can be imported by consumers
|
||||
if (pkgJson.content.name === '@grafana/i18n') {
|
||||
exports['./eslint-plugin'] = {
|
||||
types: './dist/eslint/index.d.ts',
|
||||
import: './dist/eslint/index.cjs',
|
||||
require: './dist/eslint/index.cjs',
|
||||
};
|
||||
}
|
||||
|
||||
pkgJson.update({
|
||||
main: cjsIndex,
|
||||
types: typesIndex,
|
||||
module: esmIndex,
|
||||
exports,
|
||||
});
|
||||
|
||||
await pkgJson.save();
|
||||
|
||||
// If an alias package name is provided we add an exports entry for the alias
|
||||
// then generate an additional "nested" package.json for typescript resolution that
|
||||
// doesn't use the exports property in package.json.
|
||||
if (process.env.ALIAS_PACKAGE_NAME) {
|
||||
const aliasNames = process.env.ALIAS_PACKAGE_NAME.split(',');
|
||||
|
||||
const additionalExports = aliasNames.reduce((acc, alias) => {
|
||||
acc[`./${alias}`] = {
|
||||
import: {
|
||||
types: typesIndex.replace('index', alias),
|
||||
default: esmIndex.replace('index', alias),
|
||||
},
|
||||
require: {
|
||||
types: typesIndex.replace('index', alias),
|
||||
default: cjsIndex.replace('index', alias),
|
||||
},
|
||||
};
|
||||
return acc;
|
||||
}, {});
|
||||
// skip packages without exports otherwise consumers cannot import anything from the package
|
||||
if (pkgJsonExports && typeof pkgJsonExports === 'object') {
|
||||
// Remove all exports that only contain a single key '@grafana-app/source'
|
||||
// as these will not resolve when validating packages with attw because the
|
||||
// source code is not available in the tarball.
|
||||
for (const [key, val] of Object.entries(pkgJsonExports)) {
|
||||
if (
|
||||
val !== null &&
|
||||
typeof val === 'object' &&
|
||||
Object.keys(val).length === 1 &&
|
||||
Object.keys(val)[0] === '@grafana-app/source'
|
||||
) {
|
||||
delete pkgJsonExports[key];
|
||||
}
|
||||
}
|
||||
|
||||
pkgJson.update({
|
||||
exports: {
|
||||
...pkgJson.content.exports,
|
||||
...additionalExports,
|
||||
},
|
||||
files: [...pkgJson.content.files, ...aliasNames],
|
||||
exports: pkgJsonExports,
|
||||
});
|
||||
await pkgJson.save();
|
||||
|
||||
for await (const aliasName of aliasNames) {
|
||||
await createAliasPackageJsonFiles(pkgJson.content, aliasName);
|
||||
}
|
||||
await pkgJson.save();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
async function createAliasPackageJsonFiles(packageJsonContent, aliasName) {
|
||||
const pkgName = `${packageJsonContent.name}/${aliasName}`;
|
||||
try {
|
||||
console.log(`📦 Writing alias package.json for ${pkgName}.`);
|
||||
const pkgJsonPath = `${cwd}/${aliasName}`;
|
||||
await mkdir(pkgJsonPath, { recursive: true });
|
||||
const pkgJson = await PackageJson.create(pkgJsonPath, {
|
||||
data: {
|
||||
name: pkgName,
|
||||
types: `../dist/types/${aliasName}.d.ts`,
|
||||
main: `../dist/cjs/${aliasName}.cjs`,
|
||||
module: `../dist/esm/${aliasName}.mjs`,
|
||||
},
|
||||
});
|
||||
await pkgJson.save();
|
||||
} catch (error) {
|
||||
throw new Error(`Error generating package.json for ${pkgName}`, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,16 +59,3 @@ if (( ${#failed_packages[@]} > 0 )); then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if any files in packages/grafana-e2e-selectors were changed. If so, add a 'modified' tag to the package
|
||||
CHANGES_COUNT=$(git show --name-only --format= HEAD -- packages/grafana-e2e-selectors | awk 'END{print NR}')
|
||||
if (( CHANGES_COUNT > 0 )); then
|
||||
# Wait a little bit to allow the package to be published to the registry
|
||||
sleep 5s
|
||||
regex_pattern="canary: ([0-9.-]+)"
|
||||
TAGS=$(npm dist-tag ls @grafana/e2e-selectors)
|
||||
if [[ $TAGS =~ $regex_pattern ]]; then
|
||||
echo "$CHANGES_COUNT file(s) in packages/grafana-e2e-selectors were changed. Adding 'modified' tag to @grafana/e2e-selectors@${BASH_REMATCH[1]}"
|
||||
npm dist-tag add @grafana/e2e-selectors@"${BASH_REMATCH[1]}" modified
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"alwaysStrict": true,
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"customConditions": ["@grafana-app/source"],
|
||||
"downlevelIteration": true,
|
||||
"esModuleInterop": true,
|
||||
"experimentalDecorators": true,
|
||||
|
||||
@@ -17,7 +17,7 @@ for file in "$ARTIFACTS_DIR"/*.tgz; do
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
if ! yarn attw "$file" --ignore-rules "false-cjs" $ATTW_FLAGS; then
|
||||
if ! NODE_OPTIONS="-C @grafana-app/source" yarn attw "$file" --ignore-rules "false-cjs" $ATTW_FLAGS; then
|
||||
echo "attw check failed for $file"
|
||||
echo ""
|
||||
failed_checks+=("$file - yarn attw")
|
||||
|
||||
@@ -22,6 +22,7 @@ module.exports = {
|
||||
publicPath: 'public/build/',
|
||||
},
|
||||
resolve: {
|
||||
conditionNames: ['@grafana-app/source', '...'],
|
||||
extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'],
|
||||
alias: {
|
||||
// some of data source plugins use global Prism object to add the language definition
|
||||
|
||||
Reference in New Issue
Block a user