Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"warn" action for socket npm #60

Merged
merged 13 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
with:
no-lockfile: true
npm-test-script: 'test-ci'
node-versions: '14,16,18,19'
# Node 16 has a SegFault from C8 when using --test
node-versions: '18,19'
# We currently have some issues on Windows that will have to wait to be fixed
# os: 'ubuntu-latest,windows-latest'
os: 'ubuntu-latest'
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"prettier-config-x-standard"
14 changes: 13 additions & 1 deletion lib/commands/login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export const login = {
if (!isInteractive()) {
throw new InputError('cannot prompt for credentials in a non-interactive shell')
}
/**
* @type {{ apiKey: string }}
*/
const result = await prompts({
type: 'password',
name: 'apiKey',
Expand Down Expand Up @@ -91,6 +94,9 @@ export const login = {
let enforcedOrgs = []

if (enforcedChoices.length > 1) {
/**
* @type { {id: string} }
*/
const { id } = await prompts({
type: 'select',
name: 'id',
Expand All @@ -104,6 +110,9 @@ export const login = {
})
if (id) enforcedOrgs = [id]
} else if (enforcedChoices.length) {
/**
* @type { {confirmOrg: boolean} }
*/
const { confirmOrg } = await prompts({
type: 'confirm',
name: 'confirmOrg',
Expand All @@ -112,7 +121,10 @@ export const login = {
onState: promptAbortHandler
})
if (confirmOrg) {
enforcedOrgs = [enforcedChoices[0]?.value]
const existing = /** @type {undefined | {value: string}} */(enforcedChoices[0])
if (existing) {
enforcedOrgs = [existing.value]
}
}
}
// MUST DO all updateSetting ON SAME TICK TO AVOID PARTIAL WRITE
Expand Down
22 changes: 12 additions & 10 deletions lib/commands/report/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ async function setupCommand (name, description, argv, importMeta) {

Options
${printFlagList({
'--all': 'Include all issues',
'--debug': 'Output debug information',
'--dry-run': 'Only output what will be done without actually doing it',
'--json': 'Output result as json',
'--markdown': 'Output result as markdown',
'--strict': 'Exits with an error code if any matching issues are found',
'--view': 'Will wait for and return the created report'
'all': 'Include all issues',
'debug': 'Output debug information',
'dry-run': 'Only output what will be done without actually doing it',
'json': 'Output result as json',
'markdown': 'Output result as markdown',
'strict': 'Exits with an error code if any matching issues are found',
'view': 'Will wait for and return the created report'
}, 6)}

Examples
Expand Down Expand Up @@ -185,9 +185,11 @@ async function setupCommand (name, description, argv, importMeta) {
.then(res => {
if (!res.success) handleUnsuccessfulApiResponse('getReportSupportedFiles', res, ora())
return res.data
}).catch(cause => {
throw new ErrorWithCause('Failed getting supported files for report', { cause })
})
}).catch(
/** @type {(cause: Error) => never} */
(cause) => {
throw new ErrorWithCause('Failed getting supported files for report', { cause })
})

const packagePaths = await getPackageFiles(cwd, cli.input, config, supportedFiles, debugLog)

Expand Down
Loading
Loading