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

Allow packaging extension without a publisher #1040

Merged
merged 4 commits into from
Aug 23, 2024
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
16 changes: 13 additions & 3 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ export interface Contributions {

export type ExtensionKind = 'ui' | 'workspace' | 'web';

export interface Manifest {
export interface ManifestPackage {
// mandatory (npm)
name: string;
version: string;
engines: { [name: string]: string };
engines: { vscode: string;[name: string]: string };

// vscode
publisher: string;
publisher?: string;
icon?: string;
contributes?: Contributions;
activationEvents?: string[];
Expand Down Expand Up @@ -125,3 +125,13 @@ export interface Manifest {
// preferGlobal
// publishConfig
}

export interface ManifestPublish extends ManifestPackage {
publisher: string;
}

type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends object ? RecursivePartial<T[P]> : T[P];
};

export type UnverifiedManifest = RecursivePartial<ManifestPackage>;
4 changes: 2 additions & 2 deletions src/nls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Manifest } from './manifest';
import { ManifestPackage } from './manifest';

export interface ITranslations {
[key: string]: string;
Expand Down Expand Up @@ -27,7 +27,7 @@ function createPatcher(translations: ITranslations): <T>(value: T) => T {
};
}

export function patchNLS(manifest: Manifest, translations: ITranslations): Manifest {
export function patchNLS(manifest: ManifestPackage, translations: ITranslations): ManifestPackage {
const patcher = createPatcher(translations);
return JSON.parse(JSON.stringify(manifest, (_, value: any) => patcher(value)));
}
Loading