-
Notifications
You must be signed in to change notification settings - Fork 0
/
directories.js
100 lines (85 loc) · 2.84 KB
/
directories.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import path from "path";
/**
* Directory structure for the application
* dist
* images --> server images
* public --> Public folder that can be pushed to cdn
* build --> Compiled files
* middleware.js --> Single compiled server file
* node_modules
* core --> Core root
* src --> Main sources
* app
* components
* containers
* config
* assets.js --> Do not change this file, its used by webpack
* config.js
* pages --> All the bundled pages
* public --> Public folder adding schema or authentication data etc
* resources --> css/images/fonts etc
* client.js --> Client entry js
* routes.js --> Consolidated routes
* server.js --> Start server
* service-worker.js --> Service worker of your own!
*/
/**
* @description Public directory name preferred during
* application building and in src folder
* @type {string}
*/
export const publicDirName = "public";
/**
* @description Distribution directory name where all the code will
* be available after a build is run
* @type {string}
*/
export const distDirName = "dist";
/**
* @description When a build is generated its usually in format
* - dist
* - public
* - build
* {build files}
* - css
* - js
* - other assets
* - Server compilation files (server.prod.bundle.js)
* @type {string}
*/
export const buildDirName = "build";
/**
* @description the source of all the files
* This directory contains app, client, server, routes, configs
* @type {string}
*/
const srcDirName = "src";
/**
* @description the source of all the pages that needs code splitting
* @type {string}
*/
const pagesDirName = "pages";
export const buildPath = "/" + buildDirName + "/";
/**
* @description buildPublicPath is the path that would be used by dev server
* and the files will be dropped in the path relative to distribution folder
* @type {string}
*/
export const buildPublicPath = "/" + publicDirName + buildPath;
// Directory structure
// Root dir is the project root
export const rootDir = path.resolve(__dirname);
export const coreDirName = "core";
export const coreRootDir = path.resolve(path.join(rootDir, coreDirName));
export const coreSrcDir = path.resolve(path.join(coreRootDir, "src"));
// Distribution dir is the directory where
// We will put all the output dir
export const distDir = path.resolve(path.join(rootDir, distDirName));
// Src dir is the source of all the files, including server,
// api, client etc
export const srcDir = path.resolve(path.join(rootDir, srcDirName));
// Public directory where all the assets are stored
export const srcPublicDir = path.resolve(path.join(srcDir, publicDirName));
export const distPublicDir = path.join(distDir, publicDirName);
export const buildDir = path.join(distPublicDir, buildDirName);
export const pagesDir = path.join(srcDir, pagesDirName);