Skip to content

Commit

Permalink
Merge branch 'chore/label-actions-more' of https://github.com/renovat…
Browse files Browse the repository at this point in the history
…ebot/renovate into chore/label-actions-more
  • Loading branch information
rarkins committed Feb 3, 2025
2 parents 4c2706c + 6c56570 commit 2a56c0a
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/containerbase/devcontainer:13.7.2
FROM ghcr.io/containerbase/devcontainer:13.7.5
8 changes: 4 additions & 4 deletions docs/development/local-development.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You need the following dependencies for local development:

- Git `>=2.45.1`
- Node.js `^20.15.1`
- pnpm `^9.0.0` (use corepack)
- pnpm `^9.0.0`
- C++ compiler

We recommend you use the version of Node.js defined in the repository's `.nvmrc` or use [Volta](https://volta.sh/) to manage your tool versions.
Expand All @@ -26,12 +26,12 @@ You can use the following commands on Ubuntu.
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get update
sudo apt-get install -y git build-essential nodejs
corepack enable
npm install -g pnpm@latest-10
```

#### Nix

To enter a development shell with the necessary packages, run `nix-shell --packages gcc gitFull nodejs` and then `corepack enable`.
To enter a development shell with the necessary packages, run `nix-shell --packages gcc gitFull nodejs` and then `npm install -global pnpm@latest-10`.

#### Windows

Expand All @@ -41,7 +41,7 @@ If you already installed a part, skip the corresponding step.
- Install [Git](https://git-scm.com/downloads). Make sure you've [configured your username and email](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup)
- Install [Node.js LTS](https://nodejs.org/en/download/)
- In an Administrator PowerShell prompt, run `npm install -global npm` and then `npm --debug install --global windows-build-tools`
- Enable corepack with: `corepack enable`
- Install pnpm with: `npm install -global pnpm@latest-10`

You can see what versions you're using like this:

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ It will be compiled using Handlebars and the regex `groups` result.
It specifies the syntax of the package file that's managed by the custom `jsonata` manager.
This setting helps the system correctly parse and interpret the configuration file's contents.

Only the `json` and `yaml` format is supported.
Only the `json` and `yaml` formats are supported.
`yaml` files are parsed as multi document YAML files.

```json title="Parsing a JSON file with a custom manager"
Expand Down
35 changes: 35 additions & 0 deletions lib/modules/manager/custom/jsonata/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ describe('modules/manager/custom/jsonata/index', () => {
const res = await extractPackageFile(json, 'unused', config);

expect(res).toMatchObject({
...config,
deps: [
{
depName: 'foo',
Expand Down Expand Up @@ -119,6 +120,7 @@ describe('modules/manager/custom/jsonata/index', () => {
const res = await extractPackageFile(json, 'unused', config);

expect(res).toMatchObject({
...config,
deps: [
{
depName: 'foo',
Expand Down Expand Up @@ -190,6 +192,7 @@ describe('modules/manager/custom/jsonata/index', () => {
const res = await extractPackageFile(json, 'unused', config);

expect(res).toMatchObject({
...config,
deps: [
{
depName: 'foo',
Expand Down Expand Up @@ -313,6 +316,7 @@ describe('modules/manager/custom/jsonata/index', () => {
};
const res = await extractPackageFile('{}', 'unused', config);
expect(res).toMatchObject({
...config,
deps: [
{
depName: 'foo',
Expand All @@ -327,4 +331,35 @@ describe('modules/manager/custom/jsonata/index', () => {
],
});
});

it('populates manager config and jsonata manager template fields in extract result', async () => {
const config = {
fileFormat: 'json',
matchStrings: [`{"depName": "foo"}`, `{"depName": "bar"}`],
currentValueTemplate: '1.0.0',
datasourceTemplate: 'npm',
// should be included present extract result as it is not valid jsonata manager template
// adding here for testing
autoReplaceStringTemplate: `{{{depName}}}:{{{newValue}}}`,
};
const res = await extractPackageFile('{}', 'unused', config);
expect(res).toMatchObject({
deps: [
{
depName: 'foo',
currentValue: '1.0.0',
datasource: 'npm',
},
{
depName: 'bar',
currentValue: '1.0.0',
datasource: 'npm',
},
],
fileFormat: 'json',
matchStrings: [`{"depName": "foo"}`, `{"depName": "bar"}`],
currentValueTemplate: '1.0.0',
datasourceTemplate: 'npm',
});
});
});
18 changes: 16 additions & 2 deletions lib/modules/manager/custom/jsonata/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { logger } from '../../../../logger';
import { parseJson } from '../../../../util/common';
import { parseYaml } from '../../../../util/yaml';
import type { PackageFileContent } from '../../types';
import type { JsonataExtractConfig } from './types';
import { validMatchFields } from '../utils';
import type { JSONataManagerTemplates, JsonataExtractConfig } from './types';
import { handleMatching } from './utils';

export const categories: Category[] = ['custom'];
Expand Down Expand Up @@ -47,7 +48,20 @@ export async function extractPackageFile(
return null;
}

return {
const res: PackageFileContent & JSONataManagerTemplates = {
deps,
matchStrings: config.matchStrings,
fileFormat: config.fileFormat,
};

// copy over templates for autoreplace
for (const field of validMatchFields.map(
(f) => `${f}Template` as keyof JSONataManagerTemplates,
)) {
if (config[field]) {
res[field] = config[field];
}
}

return res;
}
1 change: 1 addition & 0 deletions lib/modules/manager/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface PackageFileContent<T = Record<string, any>>
skipInstalls?: boolean | null;
matchStrings?: string[];
matchStringsStrategy?: MatchStringsStrategy;
fileFormat?: string;
}

export interface PackageFile<T = Record<string, any>>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
"@openpgp/web-stream-tools": "0.1.3",
"@renovate/eslint-plugin": "file:tools/eslint",
"@semantic-release/exec": "6.0.3",
"@swc/core": "1.10.9",
"@swc/core": "1.10.11",
"@types/auth-header": "1.0.6",
"@types/aws4": "1.11.6",
"@types/better-sqlite3": "7.6.12",
Expand Down
Loading

0 comments on commit 2a56c0a

Please sign in to comment.