Skip to content

Commit cbd4df5

Browse files
committed
create .pods and ROOT.json if not exist
1 parent 0ec00c2 commit cbd4df5

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

cpkernel/src/resolver_local.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,23 @@ export function getResolvers(appDir) {
215215
// await convertLocal(path.join(appDir, name, ".pods"));
216216
// }
217217
let dir = path.join(appDir, name, ".pods");
218+
if (!fs.existsSync(dir)) {
219+
// This is a folder, without .pods. So init it.
220+
await fs.promises.mkdir(dir, {
221+
recursive: true,
222+
});
223+
// create ROOT.json
224+
let root = {
225+
id: "ROOT",
226+
type: "DECK",
227+
ns: "ROOT",
228+
children: [],
229+
};
230+
await fs.promises.writeFile(
231+
path.join(dir, "ROOT.json"),
232+
JSON.stringify(root, null, 2)
233+
);
234+
}
218235
let jsons = await fs.promises.readdir(dir);
219236
let podlst = [];
220237
for (let jsonfile of jsons) {

0 commit comments

Comments
 (0)