mango-cms 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/default/config/automation/index.js +37 -0
- package/default/config/collections/examples.js +60 -0
- package/default/config/config/.collections.json +1 -0
- package/default/config/config/globalFields.js +15 -0
- package/default/config/config/settings.json +23 -0
- package/default/config/config/statuses.js +0 -0
- package/default/config/config/users.js +35 -0
- package/default/config/endpoints/index.js +19 -0
- package/default/config/fields/vimeo.js +36 -0
- package/default/config/hooks/test.js +5 -0
- package/default/config/plugins/.gitkeep +0 -0
- package/default/index.html +25 -0
- package/default/package.json +41 -0
- package/default/postcss.config.js +6 -0
- package/default/public/_redirects +1 -0
- package/default/public/index.js +66 -0
- package/default/src/App.vue +27 -0
- package/default/src/components/layout/login.vue +212 -0
- package/default/src/components/layout/modal.vue +113 -0
- package/default/src/components/layout/spinner.vue +17 -0
- package/default/src/components/pages/404.vue +28 -0
- package/default/src/components/pages/home.vue +74 -0
- package/default/src/helpers/Mango.vue +482 -0
- package/default/src/helpers/darkMode.js +38 -0
- package/default/src/helpers/localDB.js +294 -0
- package/default/src/helpers/mango.js +341 -0
- package/default/src/helpers/user.js +40 -0
- package/default/src/index.css +281 -0
- package/default/src/main.js +145 -0
- package/default/tailwind.config.js +46 -0
- package/default/vite.config.js +37 -0
- package/package.json +5 -3
- package/webpack.config.js +58 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
@tailwind base;
|
|
2
|
+
@tailwind components;
|
|
3
|
+
@tailwind utilities;
|
|
4
|
+
|
|
5
|
+
.article a {
|
|
6
|
+
@apply font-semibold cursor-pointer
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.article a:hover {
|
|
10
|
+
@apply underline
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.article p,
|
|
14
|
+
.article div,
|
|
15
|
+
.article ul,
|
|
16
|
+
.article ol,
|
|
17
|
+
.article h2,
|
|
18
|
+
.article h3,
|
|
19
|
+
.article h4,
|
|
20
|
+
.article blockquote {
|
|
21
|
+
@apply mt-4 text-sm leading-relaxed break-words
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.article li {
|
|
25
|
+
@apply mt-2
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.article h2 {
|
|
29
|
+
@apply text-base font-semibold
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.article > :first-child,
|
|
33
|
+
.article > :first-child > :first-child,
|
|
34
|
+
.article > :first-child > :first-child > :first-child {
|
|
35
|
+
margin-top: 0px!important;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.article > .ql-container > .ql-editor > :first-child,
|
|
39
|
+
.article > .ql-container > .ql-editor > :first-child > :first-child,
|
|
40
|
+
.article > .ql-container > .ql-editor > :first-child > :first-child > :first-child {
|
|
41
|
+
margin-top: 0px!important;
|
|
42
|
+
}
|
|
43
|
+
/*.article > :first-child > :first-of-type {
|
|
44
|
+
margin-top: 0px
|
|
45
|
+
}*/
|
|
46
|
+
|
|
47
|
+
/*.ql-editor > :first-child {
|
|
48
|
+
margin-top: 0px
|
|
49
|
+
}*/
|
|
50
|
+
|
|
51
|
+
.article blockquote {
|
|
52
|
+
@apply
|
|
53
|
+
px-8
|
|
54
|
+
italic
|
|
55
|
+
text-gray-600
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@screen md {
|
|
59
|
+
.article p,
|
|
60
|
+
.article div,
|
|
61
|
+
.article ul,
|
|
62
|
+
.article ol,
|
|
63
|
+
.article h2,
|
|
64
|
+
.article h3,
|
|
65
|
+
.article h4,
|
|
66
|
+
.article blockquote {
|
|
67
|
+
@apply mt-8 text-base leading-relaxed
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.article li {
|
|
71
|
+
@apply mt-4
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.article h2 {
|
|
75
|
+
@apply text-2xl font-semibold
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
.space-1 {
|
|
81
|
+
@apply p-4
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@screen md {
|
|
85
|
+
.space-1 {
|
|
86
|
+
@apply p-6
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@screen xl {
|
|
91
|
+
.space-1 {
|
|
92
|
+
@apply p-8
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
.book-article a {
|
|
99
|
+
@apply font-semibold cursor-pointer
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.book-article a:hover {
|
|
103
|
+
@apply underline
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@screen md {
|
|
107
|
+
|
|
108
|
+
.book-article p,
|
|
109
|
+
.book-article div,
|
|
110
|
+
.book-article ul,
|
|
111
|
+
.book-article ol,
|
|
112
|
+
.book-article h2,
|
|
113
|
+
.book-article h3,
|
|
114
|
+
.book-article h4,
|
|
115
|
+
.book-article blockquote {
|
|
116
|
+
@apply mt-16
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.book-article li {
|
|
120
|
+
@apply mt-8
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.book-article h2 {
|
|
124
|
+
@apply text-5xl font-semibold
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.book-article p,
|
|
129
|
+
.book-article div,
|
|
130
|
+
.book-article ul,
|
|
131
|
+
.book-article ol,
|
|
132
|
+
.book-article h2,
|
|
133
|
+
.book-article h3,
|
|
134
|
+
.book-article h4,
|
|
135
|
+
.book-article blockquote {
|
|
136
|
+
@apply mt-8
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.book-article ul {
|
|
140
|
+
@apply list-disc
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.book-article li {
|
|
144
|
+
@apply mt-4
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.book-article h2 {
|
|
148
|
+
@apply text-2xl font-bold
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.book-article > :first-child,
|
|
152
|
+
.book-article > :first-child > :first-child,
|
|
153
|
+
.book-article > :first-child > :first-child > :first-child {
|
|
154
|
+
margin-top: 0px!important;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.book-article > .ql-container > .ql-editor > :first-child,
|
|
158
|
+
.book-article > .ql-container > .ql-editor > :first-child > :first-child,
|
|
159
|
+
.book-article > .ql-container > .ql-editor > :first-child > :first-child > :first-child {
|
|
160
|
+
margin-top: 0px!important;
|
|
161
|
+
}
|
|
162
|
+
/*.book-article > :first-child > :first-of-type {
|
|
163
|
+
margin-top: 0px
|
|
164
|
+
}*/
|
|
165
|
+
|
|
166
|
+
/*.ql-editor > :first-child {
|
|
167
|
+
margin-top: 0px
|
|
168
|
+
}*/
|
|
169
|
+
|
|
170
|
+
.book-article blockquote {
|
|
171
|
+
@apply
|
|
172
|
+
px-8
|
|
173
|
+
italic
|
|
174
|
+
text-gray-500
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
.ql-clipboard,
|
|
179
|
+
.ql-tooltip {
|
|
180
|
+
display: none!important;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.ql-editor {
|
|
184
|
+
outline: none!important;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
table.schedule {
|
|
188
|
+
@apply
|
|
189
|
+
my-4
|
|
190
|
+
w-full
|
|
191
|
+
text-xs
|
|
192
|
+
border-y
|
|
193
|
+
table-auto
|
|
194
|
+
border-collapse
|
|
195
|
+
dark:text-gray-500
|
|
196
|
+
dark:border-gray-800
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
table.schedule tr:nth-child(odd) {
|
|
200
|
+
@apply bg-gray-100 dark:bg-gray-800
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
table.schedule td {
|
|
204
|
+
@apply m-0 p-2
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
@screen md {
|
|
209
|
+
table.schedule {
|
|
210
|
+
@apply
|
|
211
|
+
my-8
|
|
212
|
+
text-sm
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
table.schedule td {
|
|
216
|
+
@apply m-0 p-4
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
.article-xs p,
|
|
222
|
+
.article-xs div,
|
|
223
|
+
.article-xs ul,
|
|
224
|
+
.article-xs ol,
|
|
225
|
+
.article-xs h2,
|
|
226
|
+
.article-xs h3,
|
|
227
|
+
.article-xs h4,
|
|
228
|
+
.article-xs blockquote {
|
|
229
|
+
@apply mt-2 text-xs leading-relaxed
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.article-xs li {
|
|
233
|
+
@apply mt-1
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.article-xs h2 {
|
|
237
|
+
@apply text-sm
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.article-sm p,
|
|
241
|
+
.article-sm div,
|
|
242
|
+
.article-sm ul,
|
|
243
|
+
.article-sm ol,
|
|
244
|
+
.article-sm h2,
|
|
245
|
+
.article-sm h3,
|
|
246
|
+
.article-sm h4,
|
|
247
|
+
.article-sm blockquote {
|
|
248
|
+
@apply mt-4 text-sm leading-relaxed
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.article-sm li {
|
|
252
|
+
@apply mt-2
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.article-sm h2 {
|
|
256
|
+
@apply text-base
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.article-md p,
|
|
260
|
+
.article-md div,
|
|
261
|
+
.article-md ul,
|
|
262
|
+
.article-md ol,
|
|
263
|
+
.article-md h2,
|
|
264
|
+
.article-md h3,
|
|
265
|
+
.article-md h4,
|
|
266
|
+
.article-md blockquote {
|
|
267
|
+
@apply mt-4 text-base leading-relaxed
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.article-md li {
|
|
271
|
+
@apply mt-2
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.article-md h2 {
|
|
275
|
+
@apply text-2xl
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.video-container,
|
|
279
|
+
.video-container iframe {
|
|
280
|
+
@apply aspect-video w-full !h-auto
|
|
281
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import axios from 'axios'
|
|
2
|
+
import { computed, createApp, defineAsyncComponent, reactive, ref } from 'vue'
|
|
3
|
+
import { createRouter, createWebHistory } from 'vue-router'
|
|
4
|
+
import { MotionPlugin } from '@vueuse/motion'
|
|
5
|
+
// import { port, domain } from '../../mango/config/settings'
|
|
6
|
+
import { port, domain } from '../../config/config/settings'
|
|
7
|
+
import VueClipboard from 'vue3-clipboard'
|
|
8
|
+
import Vue3TouchEvents from "vue3-touch-events";
|
|
9
|
+
import App from './App.vue'
|
|
10
|
+
import './index.css'
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
If these are dynamicly imported I end up with a blank
|
|
14
|
+
screen while the route is waiting for the component
|
|
15
|
+
to download... not sure how to fix.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import Home from './components/pages/home.vue'
|
|
19
|
+
const isDev = ['true', '1'].includes(import.meta.env.VITE_DEVMODE)
|
|
20
|
+
|
|
21
|
+
const routes = [
|
|
22
|
+
|
|
23
|
+
{ path: '/', component: Home },
|
|
24
|
+
{ path: '/protectedRoute', component: Home, meta: { protected: true, fallback: '/' } },
|
|
25
|
+
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const router = createRouter({
|
|
29
|
+
history: createWebHistory(),
|
|
30
|
+
scrollBehavior(to, from, savedPosition) {
|
|
31
|
+
|
|
32
|
+
let toPath = to.matched?.[0]?.path
|
|
33
|
+
|
|
34
|
+
let sameComponent = to.matched?.[0]?.components?.default == from.matched?.[0]?.components?.default
|
|
35
|
+
let sameComponentExceptions = ['/inventory/:id', /account\/*/g]
|
|
36
|
+
let exceptionExists = sameComponentExceptions.some(e => !!toPath?.match(e)?.length)
|
|
37
|
+
|
|
38
|
+
if (to.hash) { return { el: to.hash, behavior: 'smooth' } }
|
|
39
|
+
if (savedPosition) return savedPosition
|
|
40
|
+
if (sameComponent && !exceptionExists) return null
|
|
41
|
+
|
|
42
|
+
return { top: 0 }
|
|
43
|
+
|
|
44
|
+
},
|
|
45
|
+
routes,
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
const app = createApp(App)
|
|
50
|
+
|
|
51
|
+
app.use(router)
|
|
52
|
+
app.use(Vue3TouchEvents)
|
|
53
|
+
app.use(MotionPlugin)
|
|
54
|
+
app.use(VueClipboard, {
|
|
55
|
+
autoSetContainer: true,
|
|
56
|
+
appendToBody: true,
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
|
|
61
|
+
Global Properties
|
|
62
|
+
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
import breakpoints from './helpers/breakpoints'
|
|
66
|
+
import darkMode from './helpers/darkMode'
|
|
67
|
+
import formatPhone from './helpers/formatPhone'
|
|
68
|
+
import { initUser } from './helpers/user';
|
|
69
|
+
|
|
70
|
+
app.provide('breakpoints', breakpoints().breakpoints)
|
|
71
|
+
app.provide('darkMode', darkMode().darkMode)
|
|
72
|
+
|
|
73
|
+
const user = initUser()
|
|
74
|
+
|
|
75
|
+
let api = `http://localhost:${port}`
|
|
76
|
+
// let api = `https://${domain}`
|
|
77
|
+
if (!isDev) api = `https://${domain}`
|
|
78
|
+
|
|
79
|
+
const store = reactive({
|
|
80
|
+
|
|
81
|
+
user,
|
|
82
|
+
api,
|
|
83
|
+
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
let Authorization = window.localStorage.getItem('email') + ';' + window.localStorage.getItem('user')
|
|
87
|
+
axios.defaults.headers.common['Authorization'] = Authorization
|
|
88
|
+
|
|
89
|
+
app.provide('store', store)
|
|
90
|
+
app.provide('axios', axios)
|
|
91
|
+
|
|
92
|
+
app.provide('mode', import.meta.env.MODE)
|
|
93
|
+
app.provide('formatPhone', formatPhone)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
|
|
98
|
+
Global Components
|
|
99
|
+
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
import Mango from './helpers/Mango.vue'
|
|
103
|
+
import Spinner from './components/layout/spinner.vue'
|
|
104
|
+
import Modal from './components/layout/modal.vue'
|
|
105
|
+
import Button from './components/partials/button.vue'
|
|
106
|
+
|
|
107
|
+
app.component('Mango', Mango)
|
|
108
|
+
app.component('Spinner', Spinner)
|
|
109
|
+
app.component('Modal', Modal)
|
|
110
|
+
app.component('btn', Button)
|
|
111
|
+
// app.component('resource', defineAsyncComponent(Layouter.vue')))
|
|
112
|
+
|
|
113
|
+
/*
|
|
114
|
+
|
|
115
|
+
Route Guard
|
|
116
|
+
|
|
117
|
+
*/
|
|
118
|
+
|
|
119
|
+
router.beforeEach((to, from, next) => {
|
|
120
|
+
|
|
121
|
+
// Log in google analytics...
|
|
122
|
+
if (window.ga) window.ga('send', 'pageview', to.fullPath);
|
|
123
|
+
|
|
124
|
+
if (to.meta?.protected && !store.user?.id) {
|
|
125
|
+
console.log('protected', store.user?.id)
|
|
126
|
+
store.login = { next: to.path }
|
|
127
|
+
if (to.meta?.fallback) {
|
|
128
|
+
console.log('to', to)
|
|
129
|
+
// Get params from path and add them to the fallback path (/event/:id)
|
|
130
|
+
let fallback = to.meta.fallback?.split('/')?.map(p => {
|
|
131
|
+
if (p.includes(':')) {
|
|
132
|
+
let param = p.replaceAll(':', '')
|
|
133
|
+
return to.params[param] || ''
|
|
134
|
+
} else {
|
|
135
|
+
return p
|
|
136
|
+
}
|
|
137
|
+
})?.join('/')
|
|
138
|
+
return next(fallback || to.meta.fallback)
|
|
139
|
+
}
|
|
140
|
+
return next('')
|
|
141
|
+
}
|
|
142
|
+
next()
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
app.mount('#app')
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
darkMode: 'class',
|
|
5
|
+
content: [
|
|
6
|
+
"./index.html",
|
|
7
|
+
"./src/**/*.{vue,js,ts,jsx,tsx}",
|
|
8
|
+
],
|
|
9
|
+
theme: {
|
|
10
|
+
screens: {
|
|
11
|
+
'3xs': '390px',
|
|
12
|
+
'2xs': '425px',
|
|
13
|
+
xs: '475px',
|
|
14
|
+
...defaultTheme.screens,
|
|
15
|
+
'3xl': '1750px',
|
|
16
|
+
},
|
|
17
|
+
extend: {
|
|
18
|
+
fontSize: {
|
|
19
|
+
'3xs': '.45rem',
|
|
20
|
+
'2xs': '.6rem',
|
|
21
|
+
'10xl': '10rem'
|
|
22
|
+
},
|
|
23
|
+
lineClamp: {
|
|
24
|
+
7: '7',
|
|
25
|
+
8: '8',
|
|
26
|
+
9: '9',
|
|
27
|
+
10: '10',
|
|
28
|
+
},
|
|
29
|
+
boxShadow: {
|
|
30
|
+
card: '0 8px 40px 0 rgba(0, 0, 0, 0.1)',
|
|
31
|
+
'card-focus': '0 8px 40px 6px rgba(0, 0, 0, 0.1)'
|
|
32
|
+
},
|
|
33
|
+
maxWidth: {
|
|
34
|
+
'32': '8rem',
|
|
35
|
+
'40': '10rem',
|
|
36
|
+
'48': '12rem',
|
|
37
|
+
'56': '14rem',
|
|
38
|
+
'64': '16rem',
|
|
39
|
+
'8xl': '88rem',
|
|
40
|
+
'9xl': '96rem',
|
|
41
|
+
'10xl': '104rem',
|
|
42
|
+
'11xl': '112rem',
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import vue from '@vitejs/plugin-vue'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import fs from 'fs'
|
|
5
|
+
|
|
6
|
+
// Determine project root based on config directory location
|
|
7
|
+
let projectRoot = process.cwd()
|
|
8
|
+
let configPath = path.resolve(projectRoot, 'config')
|
|
9
|
+
|
|
10
|
+
// If config doesn't exist in current directory, check parent
|
|
11
|
+
if (!fs.existsSync(configPath)) {
|
|
12
|
+
projectRoot = path.resolve(projectRoot, '..')
|
|
13
|
+
configPath = path.resolve(projectRoot, 'config')
|
|
14
|
+
|
|
15
|
+
// If config still doesn't exist, throw error
|
|
16
|
+
if (!fs.existsSync(configPath)) {
|
|
17
|
+
throw new Error('Config folder not found. Please ensure your config folder exists either in the current directory or parent directory.')
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// https://vitejs.dev/config/
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [vue()],
|
|
24
|
+
server: {
|
|
25
|
+
host: '0.0.0.0',
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
'@config': configPath,
|
|
30
|
+
'@plugins': path.resolve(configPath, 'plugins'),
|
|
31
|
+
'vue': path.resolve(__dirname, 'node_modules/vue'),
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
optimizeDeps: {
|
|
35
|
+
exclude: ['vue'], // Prevent Vite from optimizing Vue separately
|
|
36
|
+
},
|
|
37
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mango-cms",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"exports": {
|
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"cli.js",
|
|
12
|
+
"webpack.config.js",
|
|
13
|
+
"default/**/*",
|
|
14
|
+
"!default/node_modules/**"
|
|
13
15
|
],
|
|
14
16
|
"author": "Colton Neifert",
|
|
15
17
|
"license": "ISC",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const webpack = require('webpack');
|
|
3
|
+
const nodeExternals = require('webpack-node-externals');
|
|
4
|
+
const NodemonPlugin = require('nodemon-webpack-plugin');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// Get the user's project root from the execution context (passed via CLI or fallback to cwd)
|
|
8
|
+
process.env.PROJECT_ROOT = process.env.PROJECT_ROOT || process.cwd();
|
|
9
|
+
process.env.MANGO_ROOT = process.env.MANGO_ROOT || __dirname;
|
|
10
|
+
let moduleLocation = process.env.PROJECT_ROOT
|
|
11
|
+
|
|
12
|
+
let legacyMode = process.env.PROJECT_ROOT == process.env.MANGO_ROOT
|
|
13
|
+
if (legacyMode) {
|
|
14
|
+
moduleLocation = __dirname
|
|
15
|
+
process.env.PROJECT_ROOT = path.join(__dirname, '..')
|
|
16
|
+
}
|
|
17
|
+
console.log('env', process.env.PROJECT_ROOT, process.env.MANGO_ROOT, legacyMode, path.resolve(moduleLocation, 'node_modules'))
|
|
18
|
+
|
|
19
|
+
const userProjectRoot = process.env.PROJECT_ROOT
|
|
20
|
+
const mangoRoot = process.env.MANGO_ROOT
|
|
21
|
+
const buildPath = legacyMode ? mangoRoot : userProjectRoot
|
|
22
|
+
|
|
23
|
+
console.log('moduleLocation', moduleLocation)
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
mode: 'production',
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
'@mango': path.resolve(mangoRoot),
|
|
30
|
+
'@cms': path.resolve(mangoRoot, 'src/cms'),
|
|
31
|
+
'@config': path.resolve(userProjectRoot, 'config'),
|
|
32
|
+
'@fields': path.resolve(mangoRoot, 'src/cms/1. build/fields'),
|
|
33
|
+
'@mongo': path.resolve(mangoRoot, 'src/cms/1. build/libraries/mongo'),
|
|
34
|
+
'@helpers': path.resolve(mangoRoot, 'src/cms/1. build/helpers'),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
devtool: 'inline-source-map',
|
|
38
|
+
entry: {
|
|
39
|
+
server: path.resolve(mangoRoot, 'src/main.js'), // Entry point in @mango-cms/core
|
|
40
|
+
},
|
|
41
|
+
output: {
|
|
42
|
+
path: path.resolve(buildPath, 'build'), // Change to build in mango directory
|
|
43
|
+
filename: 'index.js',
|
|
44
|
+
},
|
|
45
|
+
target: 'node',
|
|
46
|
+
plugins: [new NodemonPlugin()],
|
|
47
|
+
node: {
|
|
48
|
+
__dirname: false,
|
|
49
|
+
__filename: false,
|
|
50
|
+
},
|
|
51
|
+
externals: [
|
|
52
|
+
nodeExternals(),
|
|
53
|
+
// Also check for externals in the mango package
|
|
54
|
+
nodeExternals({
|
|
55
|
+
modulesDir: path.resolve(moduleLocation, 'node_modules')
|
|
56
|
+
})
|
|
57
|
+
],
|
|
58
|
+
};
|