-
Notifications
You must be signed in to change notification settings - Fork 71
@W-18471994 ci: web bundling #1189
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
base: main
Are you sure you want to change the base?
Conversation
@@ -54,6 +54,9 @@ export const retrieveKeychain = async (platform: string): Promise<KeyChain> => { | |||
return keyChainImpl.generic_unix; | |||
} | |||
} | |||
} else if (platform === 'browser') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the polyfill for os
will return platform as browser
, something node would never do
@@ -7,9 +7,6 @@ | |||
|
|||
import { AnyJson, Dictionary } from '@salesforce/ts-types'; | |||
import { compare } from 'semver'; | |||
// needed for TS to not put everything inside /lib/src |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this ignore comment didn't seem necessary
@@ -278,7 +279,7 @@ export class Logger { | |||
* Gets the name of this logger. | |||
*/ | |||
public getName(): string { | |||
return (this.pinoLogger.bindings().name as string) ?? ''; | |||
return (this.pinoLogger?.bindings ? (this.pinoLogger.bindings().name as string) : '') ?? ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the binding don't come through when pino is in browser
mode
@@ -216,7 +224,7 @@ export const getFileLocation = (): string => join(homedir(), Global.SFDX_STATE_F | |||
|
|||
const unlockIfLocked = async (fileLocation: string): Promise<void> => { | |||
try { | |||
await unlock(fileLocation); | |||
await unlock(fileLocation, { fs }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the fs is injectable, otherwise it defaults to graceful.
this lets the lockfile use our memfs polyfill
import { lockOptions, lockRetryOptions } from './lockRetryOptions'; | ||
|
||
type LockInitResponse = { writeAndUnlock: (data: string) => Promise<void>; unlock: () => Promise<void> }; | ||
type LockInitSyncResponse = { writeAndUnlock: (data: string) => void; unlock: () => void }; | ||
|
||
export const noop = (): void => {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hypothesis: the in-memory fs is fast enough to not have synchronous read/write; also we're single-org in the web.
we can have these use locks if that turns out to be wrong
@@ -6,9 +6,11 @@ | |||
*/ | |||
|
|||
// docs: https://github.com/moxystudio/node-proper-lockfile | |||
import fs from 'node:fs'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same injectable fs to get polyfill
@@ -142,60 +142,3 @@ describe('myDomainResolver', () => { | |||
expect(lookupAsyncSpy.callCount).to.be.equal(0); | |||
}); | |||
}); | |||
describe('cname resolver', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't used by anything in salesforcecli or forcedotcom.
I know it's a breaking change to a public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no public references https://github.com/search?q=myDomainResolver+cnames&type=code
import { SfdcUrl } from '../../../src/util/sfdcUrl'; | ||
import { MyDomainResolver } from '../../../src/status/myDomainResolver'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and then you don't have to mock it
@@ -116,19 +115,21 @@ export class AliasAccessor extends AsyncOptionalCreatable { | |||
*/ | |||
public async setAndSave(alias: string, entity: Aliasable): Promise<void> { | |||
// get a very fresh copy to merge with to avoid conflicts, then lock | |||
await this.readFileToAliasStore(true); | |||
const lockResponse = await lockInit(this.fileLocation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the biggest change. I reworked alias to use the same exported lockfile that everything else is using.
What does this PR do?
makes a web bundle
simplify existing bundling code
What issues does this PR fix or reference?
@W-18471994@