mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Use extension storeName to get store and data location
This commit is contained in:
parent
a73f166f1f
commit
95b83b1ce6
@ -18,6 +18,7 @@ describe("lens extension", () => {
|
||||
name: "foo-bar",
|
||||
version: "0.1.1",
|
||||
engines: { lens: "^5.5.0" },
|
||||
storeName: "foo-bar-store",
|
||||
},
|
||||
id: "/this/is/fake/package.json",
|
||||
absolutePath: "/absolute/fake/",
|
||||
@ -33,4 +34,10 @@ describe("lens extension", () => {
|
||||
expect(ext.name).toBe("foo-bar");
|
||||
});
|
||||
});
|
||||
|
||||
describe("storeName", () => {
|
||||
it("returns storeName", () => {
|
||||
expect(ext.storeName).toBe("foo-bar-store");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -92,6 +92,6 @@ export abstract class ExtensionStore<T extends object> extends BaseStore<T> {
|
||||
protected cwd() {
|
||||
assert(this.extension, "must call this.load() first");
|
||||
|
||||
return path.join(super.cwd(), "extension-store", this.extension.name);
|
||||
return path.join(super.cwd(), "extension-store", this.extension.storeLocation);
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ export interface LensExtensionManifest extends PackageJson {
|
||||
npm?: string;
|
||||
node?: string;
|
||||
};
|
||||
storeName?: string;
|
||||
}
|
||||
|
||||
export const lensExtensionDependencies = Symbol("lens-extension-dependencies");
|
||||
@ -79,6 +80,18 @@ export class LensExtension<
|
||||
get description() {
|
||||
return this.manifest.description;
|
||||
}
|
||||
|
||||
get storeName() {
|
||||
return this.manifest.storeName;
|
||||
}
|
||||
|
||||
get dataLocation() {
|
||||
return this.storeName || this.id;
|
||||
}
|
||||
|
||||
get storeLocation() {
|
||||
return this.storeName || this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
@ -93,7 +106,7 @@ export class LensExtension<
|
||||
* folder name.
|
||||
*/
|
||||
async getExtensionFileFolder(): Promise<string> {
|
||||
return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.id);
|
||||
return this[lensExtensionDependencies].fileSystemProvisionerStore.requestDirectory(this.dataLocation);
|
||||
}
|
||||
|
||||
@action
|
||||
|
||||
Loading…
Reference in New Issue
Block a user