Browse Source

Prepares for unified insiders builds

main
Eric Amodio 2 years ago
parent
commit
a6601bb51f
3 changed files with 13 additions and 12 deletions
  1. +1
    -1
      CONTRIBUTING.md
  2. +7
    -6
      src/container.ts
  3. +5
    -5
      src/extension.ts

+ 1
- 1
CONTRIBUTING.md View File

@ -201,4 +201,4 @@ If the action fails, the VSIX will need to be built locally with `yarn package`
### Insiders release ### Insiders release
The [Publish Insiders workflow](.github/workflows/cd-insiders.yml) is automatically ran every AM unless no new changes have been committed to `main`.
The [Publish Insiders workflow](.github/workflows/cd-insiders.yml) is automatically run every AM unless no new changes have been committed to `main`.

+ 7
- 6
src/container.ts View File

@ -78,10 +78,10 @@ export class Container {
}, },
}); });
static create(context: ExtensionContext, cfg: Config) {
static create(context: ExtensionContext, cfg: Config, insiders: boolean) {
if (Container.#instance != null) throw new Error('Container is already initialized'); if (Container.#instance != null) throw new Error('Container is already initialized');
Container.#instance = new Container(context, cfg);
Container.#instance = new Container(context, cfg, insiders);
return Container.#instance; return Container.#instance;
} }
@ -152,9 +152,10 @@ export class Container {
private _terminalLinks: GitTerminalLinkProvider | undefined; private _terminalLinks: GitTerminalLinkProvider | undefined;
private constructor(context: ExtensionContext, config: Config) {
private constructor(context: ExtensionContext, config: Config, insiders: boolean) {
this._context = context; this._context = context;
this._config = this.applyMode(config); this._config = this.applyMode(config);
this._insiders = insiders;
context.subscriptions.push((this._storage = new Storage(this._context))); context.subscriptions.push((this._storage = new Storage(this._context)));
@ -311,7 +312,7 @@ export class Container {
return this._config; return this._config;
} }
private _context: ExtensionContext;
private readonly _context: ExtensionContext;
get context() { get context() {
return this._context; return this._context;
} }
@ -409,9 +410,9 @@ export class Container {
return this._homeView; return this._homeView;
} }
@memoize()
private readonly _insiders;
get insiders() { get insiders() {
return this._context.extension.id.endsWith('-insiders');
return this._insiders;
} }
private _integrationAuthentication: IntegrationAuthenticationService; private _integrationAuthentication: IntegrationAuthenticationService;

+ 5
- 5
src/extension.ts View File

@ -17,12 +17,12 @@ import { executeCommand, executeCoreCommand, registerCommands } from './system/c
import { setDefaultDateLocales } from './system/date'; import { setDefaultDateLocales } from './system/date';
import { once } from './system/event'; import { once } from './system/event';
import { Stopwatch } from './system/stopwatch'; import { Stopwatch } from './system/stopwatch';
import { compare } from './system/version';
import { compare, satisfies } from './system/version';
import { ViewNode } from './views/nodes'; import { ViewNode } from './views/nodes';
export async function activate(context: ExtensionContext): Promise<GitLensApi | undefined> { export async function activate(context: ExtensionContext): Promise<GitLensApi | undefined> {
const insiders = context.extension.id === 'eamodio.gitlens-insiders';
const gitlensVersion = context.extension.packageJSON.version; const gitlensVersion = context.extension.packageJSON.version;
const insiders = context.extension.id === 'eamodio.gitlens-insiders' || satisfies(gitlensVersion, '> 2020.0.0');
Logger.configure(context, configuration.get('outputLevel'), o => { Logger.configure(context, configuration.get('outputLevel'), o => {
if (GitUri.is(o)) { if (GitUri.is(o)) {
@ -47,8 +47,8 @@ export async function activate(context: ExtensionContext): Promise
}, },
}); });
if (insiders) {
// Ensure that stable isn't also installed
// If we are using the separate insiders extension, ensure that stable isn't also installed
if (context.extension.id === 'eamodio.gitlens-insiders') {
const stable = extensions.getExtension('eamodio.gitlens'); const stable = extensions.getExtension('eamodio.gitlens');
if (stable != null) { if (stable != null) {
sw.stop({ message: ' was NOT activated because GitLens is also enabled' }); sw.stop({ message: ' was NOT activated because GitLens is also enabled' });
@ -107,7 +107,7 @@ export async function activate(context: ExtensionContext): Promise
// await migrateSettings(context, previousVersion); // await migrateSettings(context, previousVersion);
const container = Container.create(context, cfg);
const container = Container.create(context, cfg, insiders);
once(container.onReady)(() => { once(container.onReady)(() => {
context.subscriptions.push(...registerCommands(container)); context.subscriptions.push(...registerCommands(container));
registerBuiltInActionRunners(container); registerBuiltInActionRunners(container);

Loading…
Cancel
Save