@openfn/project 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -97,10 +97,12 @@ declare class Project {
|
|
|
97
97
|
declare class Workspace {
|
|
98
98
|
private config?;
|
|
99
99
|
private projects;
|
|
100
|
+
private projectPaths;
|
|
100
101
|
private isValid;
|
|
101
102
|
constructor(workspacePath: string);
|
|
102
103
|
list(): Project[];
|
|
103
104
|
get(id: string): Project | undefined;
|
|
105
|
+
getProjectPath(id: string): string | undefined;
|
|
104
106
|
getActiveProject(): Project | undefined;
|
|
105
107
|
getConfig(): OpenfnConfig | undefined;
|
|
106
108
|
get activeProjectId(): string | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1073,6 +1073,7 @@ var PROJECT_EXTENSIONS = [".yaml", ".yml"];
|
|
|
1073
1073
|
var Workspace = class {
|
|
1074
1074
|
config;
|
|
1075
1075
|
projects = [];
|
|
1076
|
+
projectPaths = /* @__PURE__ */ new Map();
|
|
1076
1077
|
isValid = false;
|
|
1077
1078
|
constructor(workspacePath) {
|
|
1078
1079
|
const projectsPath = path2.join(workspacePath, PROJECTS_DIRECTORY);
|
|
@@ -1087,8 +1088,11 @@ var Workspace = class {
|
|
|
1087
1088
|
(fileName) => PROJECT_EXTENSIONS.includes(path2.extname(fileName))
|
|
1088
1089
|
);
|
|
1089
1090
|
this.projects = stateFiles.map((file) => {
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1091
|
+
const stateFilePath = path2.join(projectsPath, file);
|
|
1092
|
+
const data = fs3.readFileSync(stateFilePath, "utf-8");
|
|
1093
|
+
const project = from_app_state_default(data, { format: "yaml" });
|
|
1094
|
+
this.projectPaths.set(project.name, stateFilePath);
|
|
1095
|
+
return project;
|
|
1092
1096
|
});
|
|
1093
1097
|
}
|
|
1094
1098
|
}
|
|
@@ -1098,6 +1102,9 @@ var Workspace = class {
|
|
|
1098
1102
|
get(id) {
|
|
1099
1103
|
return this.projects.find((p) => p.name === id);
|
|
1100
1104
|
}
|
|
1105
|
+
getProjectPath(id) {
|
|
1106
|
+
return this.projectPaths.get(id);
|
|
1107
|
+
}
|
|
1101
1108
|
getActiveProject() {
|
|
1102
1109
|
return this.projects.find((p) => p.name === this.config?.name);
|
|
1103
1110
|
}
|