forked from netlify/next-on-netlify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (25 loc) · 902 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const prepareFolders = require("./lib/steps/prepareFolders");
const copyPublicFiles = require("./lib/steps/copyPublicFiles");
const copyNextAssets = require("./lib/steps/copyNextAssets");
const setupPages = require("./lib/steps/setupPages");
const setupRedirects = require("./lib/steps/setupRedirects");
const {
NETLIFY_PUBLISH_PATH,
NETLIFY_FUNCTIONS_PATH,
} = require("./lib/config");
/** options param:
* {
* functionsDir: string to path
* publishDir: string to path
* }
*/
const nextOnNetlify = (options = {}) => {
const functionsPath = options.functionsDir || NETLIFY_FUNCTIONS_PATH;
const publishPath = options.publishDir || NETLIFY_PUBLISH_PATH;
prepareFolders({ functionsPath, publishPath });
copyPublicFiles(publishPath);
copyNextAssets(publishPath);
setupPages({ functionsPath, publishPath });
setupRedirects(publishPath);
};
module.exports = nextOnNetlify;