Skip to content

Commit 6ab059a

Browse files
committed
Fix meow patch and test fails
1 parent cd4f06c commit 6ab059a

File tree

4 files changed

+91
-88
lines changed

4 files changed

+91
-88
lines changed

patches/meow#13.2.0.patch

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,31 @@ Index: /meow/build/index.js
4747
const buildResult = (options, parserOptions) => {
4848
const {pkg: package_} = options;
4949
const argv = yargsParser(options.argv, parserOptions);
50-
@@ -54,8 +54,9 @@
50+
@@ -54,8 +54,23 @@
5151
checkUnknownFlags(input);
5252
}
5353

5454
const flags = camelcaseKeys(argv, {exclude: ['--', /^\w$/]});
55-
+ const unknownFlags = options.collectUnknownFlags ? collectUnknownFlags(input) : [];
55+
+ const unknownFlags = options.collectUnknownFlags
56+
+ ? collectUnknownFlags(
57+
+ options.allowUnknownFlags
58+
+ ? yargsParser(
59+
+ options.argv,
60+
+ buildParserOptions({
61+
+ ...options,
62+
+ allowUnknownFlags: false,
63+
+ autoHelp: false,
64+
+ autoVersion: false
65+
+ })
66+
+ )._
67+
+ : input
68+
+ )
69+
+ : [];
5670
const unnormalizedFlags = {...flags};
5771

5872
validate(flags, options);
5973

60-
@@ -73,8 +74,9 @@
74+
@@ -73,8 +88,9 @@
6175

6276
return {
6377
input,
@@ -67,21 +81,6 @@ Index: /meow/build/index.js
6781
pkg: package_,
6882
help,
6983
showHelp,
70-
Index: /meow/build/parser.js
71-
===================================================================
72-
--- /meow/build/parser.js
73-
+++ /meow/build/parser.js
74-
@@ -72,9 +72,9 @@
75-
if (parserOptions['--']) {
76-
parserOptions.configuration['populate--'] = true;
77-
}
78-
79-
- if (!options.allowUnknownFlags) {
80-
+ if (!options.allowUnknownFlags || options.collectUnknownFlags) {
81-
// Collect unknown options in `argv._` to be checked later.
82-
parserOptions.configuration['unknown-options-as-args'] = true;
83-
}
84-
8584
Index: /meow/build/validate.js
8685
===================================================================
8786
--- /meow/build/validate.js

src/commands/fix/cmd-fix.mts

Lines changed: 66 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,78 +20,76 @@ import type { RangeStyle } from '../../utils/semver.mts'
2020

2121
const { DRY_RUN_NOT_SAVING } = constants
2222

23-
const flags: CliCommandConfig['flags'] = {
24-
...commonFlags,
25-
autoMerge: {
26-
type: 'boolean',
27-
default: false,
28-
description: `Enable auto-merge for pull requests that Socket opens.\n See ${terminalLink(
29-
'GitHub documentation',
30-
'https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository',
31-
)} for managing auto-merge for pull requests in your repository.`,
32-
},
33-
autopilot: {
34-
type: 'boolean',
35-
default: false,
36-
description: `Shorthand for --autoMerge --test`,
37-
},
38-
ghsa: {
39-
type: 'string',
40-
default: [],
41-
description: `Provide a list of ${terminalLink(
42-
'GHSA IDs',
43-
'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids',
44-
)} to compute fixes for, as either a comma separated value or as multiple flags.\n Use '--ghsa auto' to automatically lookup GHSA IDs and compute fixes for them.`,
45-
isMultiple: true,
46-
},
47-
limit: {
48-
type: 'number',
49-
default: Infinity,
50-
description: 'The number of fixes to attempt at a time',
51-
},
52-
purl: {
53-
type: 'string',
54-
default: [],
55-
description: `Provide a list of ${terminalLink(
56-
'PURLs',
57-
'https://github.com/package-url/purl-spec?tab=readme-ov-file#purl',
58-
)} to compute fixes for, as either a comma separated value or as multiple flags,\n instead of querying the Socket API`,
59-
isMultiple: true,
60-
shortFlag: 'p',
61-
},
62-
rangeStyle: {
63-
type: 'string',
64-
default: 'preserve',
65-
description: `
66-
Define how updated dependency versions should be written in package.json.
67-
Available styles:
68-
* caret - Use ^ range for compatible updates (e.g. ^1.2.3)
69-
* gt - Use > to allow any newer version (e.g. >1.2.3)
70-
* gte - Use >= to allow any newer version (e.g. >=1.2.3)
71-
* lt - Use < to allow only lower versions (e.g. <1.2.3)
72-
* lte - Use <= to allow only lower versions (e.g. <=1.2.3)
73-
* pin - Use the exact version (e.g. 1.2.3)
74-
* preserve - Retain the existing version range style as-is
75-
* tilde - Use ~ range for patch/minor updates (e.g. ~1.2.3)
76-
`.trim(),
77-
},
78-
test: {
79-
type: 'boolean',
80-
default: false,
81-
description: 'Verify the fix by running unit tests',
82-
},
83-
testScript: {
84-
type: 'string',
85-
default: 'test',
86-
description: 'The test script to run for each fix attempt',
87-
},
88-
}
89-
9023
const config: CliCommandConfig = {
9124
commandName: 'fix',
9225
description: 'Update dependencies with "fixable" Socket alerts',
9326
hidden: false,
94-
flags,
27+
flags: {
28+
...commonFlags,
29+
autoMerge: {
30+
type: 'boolean',
31+
default: false,
32+
description: `Enable auto-merge for pull requests that Socket opens.\n See ${terminalLink(
33+
'GitHub documentation',
34+
'https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository',
35+
)} for managing auto-merge for pull requests in your repository.`,
36+
},
37+
autopilot: {
38+
type: 'boolean',
39+
default: false,
40+
description: `Shorthand for --autoMerge --test`,
41+
},
42+
ghsa: {
43+
type: 'string',
44+
default: [],
45+
description: `Provide a list of ${terminalLink(
46+
'GHSA IDs',
47+
'https://docs.github.com/en/code-security/security-advisories/working-with-global-security-advisories-from-the-github-advisory-database/about-the-github-advisory-database#about-ghsa-ids',
48+
)} to compute fixes for, as either a comma separated value or as multiple flags.\n Use '--ghsa auto' to automatically lookup GHSA IDs and compute fixes for them.`,
49+
isMultiple: true,
50+
},
51+
limit: {
52+
type: 'number',
53+
default: Infinity,
54+
description: 'The number of fixes to attempt at a time',
55+
},
56+
purl: {
57+
type: 'string',
58+
default: [],
59+
description: `Provide a list of ${terminalLink(
60+
'PURLs',
61+
'https://github.com/package-url/purl-spec?tab=readme-ov-file#purl',
62+
)} to compute fixes for, as either a comma separated value or as multiple flags,\n instead of querying the Socket API`,
63+
isMultiple: true,
64+
shortFlag: 'p',
65+
},
66+
rangeStyle: {
67+
type: 'string',
68+
default: 'preserve',
69+
description: `
70+
Define how updated dependency versions should be written in package.json.
71+
Available styles:
72+
* caret - Use ^ range for compatible updates (e.g. ^1.2.3)
73+
* gt - Use > to allow any newer version (e.g. >1.2.3)
74+
* gte - Use >= to allow any newer version (e.g. >=1.2.3)
75+
* lt - Use < to allow only lower versions (e.g. <1.2.3)
76+
* lte - Use <= to allow only lower versions (e.g. <=1.2.3)
77+
* pin - Use the exact version (e.g. 1.2.3)
78+
* preserve - Retain the existing version range style as-is
79+
* tilde - Use ~ range for patch/minor updates (e.g. ~1.2.3)
80+
`.trim(),
81+
},
82+
test: {
83+
type: 'boolean',
84+
default: false,
85+
description: 'Verify the fix by running unit tests',
86+
},
87+
testScript: {
88+
type: 'string',
89+
default: 'test',
90+
description: 'The test script to run for each fix attempt',
91+
},
92+
},
9593
help: (command, config) => `
9694
Usage
9795
$ ${command} [options] [CWD=.]

src/commands/raw-npm/cmd-raw-npm.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'
22

33
import { runRawNpm } from './run-raw-npm.mts'
44
import constants from '../../constants.mts'
5+
import { commonFlags } from '../../flags.mts'
56
import { meowOrExit } from '../../utils/meow-with-subcommands.mts'
67

78
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
@@ -12,7 +13,9 @@ const config: CliCommandConfig = {
1213
commandName: 'raw-npm',
1314
description: `Temporarily disable the Socket ${NPM} wrapper`,
1415
hidden: false,
15-
flags: {},
16+
flags: {
17+
...commonFlags,
18+
},
1619
help: command => `
1720
Usage
1821
$ ${command} ...

src/commands/raw-npx/cmd-raw-npx.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'
22

33
import { runRawNpx } from './run-raw-npx.mts'
44
import constants from '../../constants.mts'
5+
import { commonFlags } from '../../flags.mts'
56
import { meowOrExit } from '../../utils/meow-with-subcommands.mts'
67

78
import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
@@ -12,7 +13,9 @@ const config: CliCommandConfig = {
1213
commandName: 'raw-npx',
1314
description: `Temporarily disable the Socket ${NPX} wrapper`,
1415
hidden: false,
15-
flags: {},
16+
flags: {
17+
...commonFlags,
18+
},
1619
help: command => `
1720
Usage
1821
$ ${command} ...

0 commit comments

Comments
 (0)