Skip to content

Commit

Permalink
Merge pull request #2861 from evidence-dev/release-2024-11-28
Browse files Browse the repository at this point in the history
Release release-2024-11-28
  • Loading branch information
kwongz authored Nov 28, 2024
2 parents eb5da22 + 84319db commit 9f06314
Show file tree
Hide file tree
Showing 54 changed files with 504 additions and 91 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-peas-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

series names can be formatted in Area, Bar, Bubble, Line charts and Scatter plot
5 changes: 5 additions & 0 deletions .changeset/fuzzy-radios-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'evidence-vscode': patch
---

dont create legacy file on new project
5 changes: 5 additions & 0 deletions .changeset/giant-parrots-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/sdk': patch
---

ignore non-strings in `addBasePath`
5 changes: 5 additions & 0 deletions .changeset/healthy-panthers-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/core-components': patch
---

fixed table header chevron layout shift
6 changes: 6 additions & 0 deletions .changeset/selfish-cherries-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@evidence-dev/evidence': patch
'@evidence-dev/core-components': patch
---

Upgrade @sveltejs/kit to 2.8.4
5 changes: 5 additions & 0 deletions .changeset/unlucky-ants-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@evidence-dev/evidence': patch
---

re-enable logging on dev mode
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://editorconfig.org
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 100
2 changes: 0 additions & 2 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: 8.6.9
- uses: actions/setup-node@v4
with:
node-version: 20
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: 8.6.9
- uses: actions/setup-node@v4
with:
node-version: 20
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ jobs:

- name: Action Setup (pnpm)
uses: pnpm/action-setup@v4
with:
version: 8

- name: Setup Node
uses: actions/setup-node@v4
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:

- name: Set up pnpm
uses: pnpm/[email protected]
with:
version: 8.6.9
- name: Set up node
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- uses: pnpm/[email protected]
with:
version: 8.6.9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- uses: pnpm/[email protected]
with:
version: 8.6.9

- uses: actions/setup-node@v4
with:
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.11.0
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,6 @@
"dset": ">=3.1.4",
"cookie": ">=0.7.1"
}
}
}
},
"packageManager": "[email protected]+sha512.499434c9d8fdd1a2794ebf4552b3b25c0a633abcee5bb15e7b5de90f32f47b513aca98cd5cfd001c31f0db454bc3804edccd578501e4ca293a6816166bbd9f81"
}
7 changes: 1 addition & 6 deletions packages/evidence/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ const populateTemplate = function () {
// - local settings
// - telemetry profile
// - static folder (mainly to preserve the data directory)
const keepers = new Set([
'evidence.settings.json',
'.profile.json',
'static',
'.evidence-queries'
]);
const keepers = new Set(['.profile.json', 'static', '.evidence-queries']);
fs.readdirSync('./.evidence/template/').forEach((file) => {
if (!keepers.has(file)) fs.removeSync(path.join('./.evidence/template/', file));
});
Expand Down
4 changes: 2 additions & 2 deletions packages/evidence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@evidence-dev/component-utilities": "workspace:*",
"@evidence-dev/core-components": "workspace:*",
"@evidence-dev/tailwind": "workspace:*",
"@sveltejs/kit": "2.5.4",
"@sveltejs/kit": "2.8.4",
"svelte": "4.2.19",
"vite": "5.4.11"
},
Expand All @@ -49,7 +49,7 @@
"sade": "^1.8.1"
},
"peerDependencies": {
"@sveltejs/kit": "2.5.4",
"@sveltejs/kit": "2.8.4",
"autoprefixer": "^10.4.7",
"debounce": "^1.2.1",
"git-remote-origin-url": "4.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/extension/.vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ node_modules/**
template/node_modules/**
template/build/**
template/.evidence/template/**
!template/.evidence/template/evidence.settings.json
data/**
src/**

Expand Down
6 changes: 3 additions & 3 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evidence-vscode",
"displayName": "Evidence",
"description": "Build polished data products with SQL and Markdown",
"version": "1.5.4",
"version": "1.5.5",
"private": true,
"engines": {
"vscode": "^1.52.0"
Expand Down Expand Up @@ -541,9 +541,9 @@
"svelte.svelte-vscode"
],
"dependencies": {
"@vscode/extension-telemetry": "^0.9.0",
"@vscode/extension-telemetry": "^0.9.8",
"@vscode/vsce": "^2.21.1",
"js-yaml": "^4.1.0",
"tiged": "^2.12.5"
}
}
}
11 changes: 0 additions & 11 deletions packages/extension/src/commands/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,6 @@ export async function cloneTemplateRepository(
message: 'Finished cloning template project.'
});

// degit.json does not seem to be respected by tiged in this case
// add credentials file to .evidence/template/evidence.settings.json if it is using default template, and also delete the degit.json file
if (templateRepositoryUrl === templateProjectUrl) {
let credentialsString = `{"database":"duckdb","credentials":{"filename":"needful_things.duckdb","gitignoreDuckdb":null}}`;
await workspace.fs.writeFile(
Uri.file(`${projectFolderPath}/.evidence/template/evidence.settings.json`),
Buffer.from(credentialsString)
);
await workspace.fs.delete(Uri.file(`${projectFolderPath}/degit.json`));
}

// update Evidence project context and status bar
updateProjectContext();

Expand Down
11 changes: 10 additions & 1 deletion packages/lib/component-utilities/src/getSeriesConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import getDistinctValues from './getDistinctValues.js';
import { fmt } from '@evidence-dev/component-utilities/formatting';

export default function getSeriesConfig(
data,
Expand All @@ -13,7 +14,8 @@ export default function getSeriesConfig(
seriesOrder,
size = undefined,
tooltipTitle = undefined,
y2 = undefined
y2 = undefined,
seriesLabelFmt = undefined
) {
function generateTempConfig(seriesData, seriesName, yAxisIndex, baseConfig) {
let tempConfig = {
Expand Down Expand Up @@ -223,5 +225,12 @@ export default function getSeriesConfig(
seriesConfig.sort((a, b) => seriesOrder.indexOf(a.name) - seriesOrder.indexOf(b.name));
}

// format series config:
if (seriesLabelFmt) {
seriesConfig.forEach((item) => {
item.name = fmt(item.name, seriesLabelFmt);
});
}

return seriesConfig;
}
5 changes: 3 additions & 2 deletions packages/lib/sdk/src/utils/svelte/addBasePath.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Adjusts a path to include the configured base path
* Ignores undefined, and absolute URLs
* @param {string} path
* @param {unknown} path
* @param {import("../../configuration/schemas/config.schema.js").EvidenceConfig} config
* @example addBasePath('http://localhost:3000/test') // 'http://localhost:3000/test'
* @example addBasePath('/test') // '/base/test'
Expand All @@ -10,7 +10,8 @@
* @returns
*/
export const addBasePath = (path, config) => {
if (path === undefined) return path;
if (path instanceof String) path = path.toString();
if (typeof path !== 'string') return path;
if (path.startsWith('http')) return path;
if (path.startsWith('#')) return path; // ignore hash links
if (/^[^/]*:/.test(path)) return path; // ignore other protocols
Expand Down
14 changes: 14 additions & 0 deletions packages/lib/sdk/src/utils/svelte/addBasePath.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,18 @@ describe('addBasePath', () => {
basePath = '/base';
expect(addBasePath('/test:123', config)).toBe('/base/test:123');
});
it('should properly handle String wrapper or non-string values', () => {
basePath = '/base';
expect(addBasePath(new String('/test'), config)).toBe('/base/test');
expect(addBasePath(123, config)).toBe(123);
expect(addBasePath(123n, config)).toBe(123n);
expect(addBasePath(true, config)).toBe(true);
expect(addBasePath(Symbol.for('test'), config)).toBe(Symbol.for('test'));
const fn = () => {};
expect(addBasePath(fn, config)).toBe(fn);
expect(addBasePath(null, config)).toBe(null);
expect(addBasePath(undefined, config)).toBe(undefined);
const obj = {};
expect(addBasePath(obj, config)).toBe(obj);
});
});
2 changes: 1 addition & 1 deletion packages/ui/core-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"@storybook/testing-library": "^0.2.2",
"@storybook/theming": "^8.1.3",
"@sveltejs/adapter-auto": "3.1.1",
"@sveltejs/kit": "2.5.4",
"@sveltejs/kit": "2.8.4",
"@sveltejs/package": "^2.3.1",
"@sveltejs/vite-plugin-svelte": "3.0.2",
"@types/lodash.debounce": "^4.0.9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</script>

{#if ascending}
<Icon src={ChevronUp} class="w-3 h-3 inline mb-0.5" />
<Icon src={ChevronUp} class="w-[10px] h-[10px] mb-0.5 inline" />
{:else}
<Icon src={ChevronDown} class="w-3 h-3 inline mb-0.5" />
<Icon src={ChevronDown} class="w-[10px] h-[10px] mb-0.5 inline" />
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
}
export let showAllLabels = false;
export let seriesOrder = undefined;
export let seriesLabelFmt = undefined;
// Prop check. If local props supplied, use those. Otherwise fall back to global props.
$: data = $props.data;
$: x = $props.x;
Expand Down Expand Up @@ -156,7 +158,11 @@
name,
xMismatch,
columnSummary,
seriesOrder
seriesOrder,
undefined, // size (not needed)
undefined, // tooltipTitle (not needed)
undefined, // y2 (not needed)
seriesLabelFmt
);
$: config.update((d) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,24 @@ LIMIT 200`,
{@const data = Query.create(`select * from numeric_series`, query)}
<AreaChart {data} {...args} />
</Story>
<Story
name="With seriesLabelFmt"
args={{ x: 'x', y: 'y', series: 'series', seriesOrder: ['ivory', 'blue', 'violet', 'olive'] }}
let:args
>
{@const data = Query.create(
`SELECT 0.1 AS series, 1 AS x, 10 AS y
UNION
SELECT 0.1 AS series, 2 AS x, 20 AS y
UNION
SELECT 0.1 AS series, 3 AS x, 30 AS y
UNION
SELECT 0.5 AS series, 1 AS x, 5 AS y
UNION
SELECT 0.5 AS series, 2 AS x, 15 AS y
UNION
SELECT 0.5 AS series, 3 AS x, 25 AS y`,
query
)}
<AreaChart {data} seriesLabelFmt="pct" {...args} />
</Story>
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
export let seriesOrder = undefined;
export let connectGroup = undefined;
export let seriesLabelFmt = undefined;
</script>

<Chart
Expand Down Expand Up @@ -143,6 +144,7 @@
{labelFmt}
{showAllLabels}
{seriesOrder}
{seriesLabelFmt}
/>
<slot />
</Chart>
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@
}
};
export let seriesLabelFmt = undefined;
$: seriesConfig = getSeriesConfig(
data,
x,
Expand All @@ -210,7 +212,8 @@
seriesOrder,
undefined,
undefined,
y2
y2,
seriesLabelFmt
);
$: config.update((d) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,24 @@
{@const data = Query.create(`select * from numeric_series`, query)}
<BarChart {data} {...args} />
</Story>
<Story
name="With seriesLabelFmt"
args={{ x: 'x', y: 'y', series: 'series', seriesOrder: [0.1, 0.5] }}
let:args
>
{@const data = Query.create(
`SELECT 0.1 AS series, 1 AS x, 10 AS y
UNION
SELECT 0.1 AS series, 2 AS x, 20 AS y
UNION
SELECT 0.1 AS series, 3 AS x, 30 AS y
UNION
SELECT 0.5 AS series, 1 AS x, 5 AS y
UNION
SELECT 0.5 AS series, 2 AS x, 15 AS y
UNION
SELECT 0.5 AS series, 3 AS x, 25 AS y`,
query
)}
<BarChart {data} seriesLabelFmt="pct" {...args} />
</Story>
Loading

0 comments on commit 9f06314

Please sign in to comment.