Skip to content

Commit

Permalink
fix(module): properly move the CMS build to the dist folder on `nux…
Browse files Browse the repository at this point in the history
…t generate`

fixes #23
  • Loading branch information
medfreeman committed Sep 22, 2017
1 parent ab0dfc7 commit dd4b970
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/module.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* eslint-disable import/no-extraneous-dependencies */
import { join } from "path";

/* covered by nuxt */
import { move } from "fs-extra";
import _ from "lodash";
import { Utils } from "nuxt";
import chokidar from "chokidar";
Expand Down Expand Up @@ -166,6 +169,17 @@ export default function NetlifyCmsModule(moduleOptions) {
})
});
}

// Move cms folder from `dist/_nuxt` folder to `dist/` after nuxt generate
this.nuxt.plugin("generator", generator => {
generator.plugin("generate", async () => {
await move(
join(generator.distNuxtPath, config.adminPath).replace(/\/$/, ""),
join(generator.distPath, config.adminPath).replace(/\/$/, "")
);
debug("Netlify CMS files copied");
});
});
}

// REQUIRED if publishing as an NPM package
Expand Down

0 comments on commit dd4b970

Please sign in to comment.