Skip to content

Commit dd4b970

Browse files
committed
fix(module): properly move the CMS build to the dist folder on nuxt generate
fixes #23
1 parent ab0dfc7 commit dd4b970

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: src/module.js

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
/* eslint-disable import/no-extraneous-dependencies */
2+
import { join } from "path";
3+
24
/* covered by nuxt */
5+
import { move } from "fs-extra";
36
import _ from "lodash";
47
import { Utils } from "nuxt";
58
import chokidar from "chokidar";
@@ -166,6 +169,17 @@ export default function NetlifyCmsModule(moduleOptions) {
166169
})
167170
});
168171
}
172+
173+
// Move cms folder from `dist/_nuxt` folder to `dist/` after nuxt generate
174+
this.nuxt.plugin("generator", generator => {
175+
generator.plugin("generate", async () => {
176+
await move(
177+
join(generator.distNuxtPath, config.adminPath).replace(/\/$/, ""),
178+
join(generator.distPath, config.adminPath).replace(/\/$/, "")
179+
);
180+
debug("Netlify CMS files copied");
181+
});
182+
});
169183
}
170184

171185
// REQUIRED if publishing as an NPM package

0 commit comments

Comments
 (0)