mango-cms 0.1.24 → 0.2.0
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/cli.js
CHANGED
|
@@ -10,18 +10,33 @@ const AdmZip = require('adm-zip');
|
|
|
10
10
|
|
|
11
11
|
const program = new Command();
|
|
12
12
|
|
|
13
|
-
// Helper function to download and extract src
|
|
13
|
+
// Helper function to download and extract versioned src zip file
|
|
14
14
|
async function ensureSrcExists(mangoCmsRoot) {
|
|
15
15
|
const srcDir = path.join(mangoCmsRoot, 'src');
|
|
16
16
|
if (!fs.existsSync(srcDir)) {
|
|
17
|
-
|
|
17
|
+
// Get the package version
|
|
18
|
+
const packageJsonPath = path.join(mangoCmsRoot, 'package.json');
|
|
19
|
+
let version = '0.1.24'; // Default fallback version
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
23
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
24
|
+
version = packageJson.version;
|
|
25
|
+
}
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.log('Error reading package.json:', error.message);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const zipFileName = `src-v${version}.zip`;
|
|
31
|
+
console.log(`Downloading Mango CMS source files (version ${version})...`);
|
|
32
|
+
|
|
18
33
|
const response = await axios({
|
|
19
34
|
method: 'get',
|
|
20
|
-
url:
|
|
35
|
+
url: `https://mango-cms.s3.amazonaws.com/${zipFileName}`,
|
|
21
36
|
responseType: 'arraybuffer'
|
|
22
37
|
});
|
|
23
38
|
|
|
24
|
-
const tempZipPath = path.join(mangoCmsRoot,
|
|
39
|
+
const tempZipPath = path.join(mangoCmsRoot, zipFileName);
|
|
25
40
|
fs.writeFileSync(tempZipPath, response.data);
|
|
26
41
|
|
|
27
42
|
console.log('Extracting source files...');
|
|
@@ -30,7 +45,7 @@ async function ensureSrcExists(mangoCmsRoot) {
|
|
|
30
45
|
|
|
31
46
|
// Clean up the zip file
|
|
32
47
|
fs.unlinkSync(tempZipPath);
|
|
33
|
-
console.log(
|
|
48
|
+
console.log(`Source files (version ${version}) installed successfully.`);
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
51
|
|
|
@@ -320,4 +335,58 @@ program
|
|
|
320
335
|
}
|
|
321
336
|
});
|
|
322
337
|
|
|
338
|
+
program
|
|
339
|
+
.command('update')
|
|
340
|
+
.description('Update Mango CMS source files to the latest version')
|
|
341
|
+
.action(async () => {
|
|
342
|
+
try {
|
|
343
|
+
// Path to @mango-cms/core inside node_modules
|
|
344
|
+
const cmsPackagePath = path.resolve(__dirname);
|
|
345
|
+
|
|
346
|
+
// Get the package version
|
|
347
|
+
const packageJsonPath = path.join(cmsPackagePath, 'package.json');
|
|
348
|
+
let version = '0.1.24'; // Default fallback version
|
|
349
|
+
|
|
350
|
+
try {
|
|
351
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
352
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
353
|
+
version = packageJson.version;
|
|
354
|
+
}
|
|
355
|
+
} catch (error) {
|
|
356
|
+
console.log('Error reading package.json:', error.message);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// Force remove existing src directory
|
|
360
|
+
const srcDir = path.join(cmsPackagePath, 'src');
|
|
361
|
+
if (fs.existsSync(srcDir)) {
|
|
362
|
+
console.log('Removing existing source files...');
|
|
363
|
+
fs.removeSync(srcDir);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
const zipFileName = `src-v${version}.zip`;
|
|
367
|
+
console.log(`Downloading Mango CMS source files (version ${version})...`);
|
|
368
|
+
|
|
369
|
+
const response = await axios({
|
|
370
|
+
method: 'get',
|
|
371
|
+
url: `https://mango-cms.s3.amazonaws.com/${zipFileName}`,
|
|
372
|
+
responseType: 'arraybuffer'
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
const tempZipPath = path.join(cmsPackagePath, zipFileName);
|
|
376
|
+
fs.writeFileSync(tempZipPath, response.data);
|
|
377
|
+
|
|
378
|
+
console.log('Extracting source files...');
|
|
379
|
+
const zip = new AdmZip(tempZipPath);
|
|
380
|
+
zip.extractAllTo(cmsPackagePath, true);
|
|
381
|
+
|
|
382
|
+
// Clean up the zip file
|
|
383
|
+
fs.unlinkSync(tempZipPath);
|
|
384
|
+
console.log(`Source files (version ${version}) updated successfully.`);
|
|
385
|
+
|
|
386
|
+
} catch (error) {
|
|
387
|
+
console.error('Error updating Mango CMS source files:', error.message);
|
|
388
|
+
process.exit(1);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
|
|
323
392
|
program.parse(process.argv);
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
import Swal from 'sweetalert2'
|
|
60
60
|
import { validateEmail } from '../../helpers/email'
|
|
61
61
|
import { getUser } from '../../helpers/user'
|
|
62
|
-
import Mango from '../../helpers/mango'
|
|
63
62
|
|
|
64
63
|
// Function for setting cookies
|
|
65
64
|
let setCookie = function (cname, cvalue) {
|
|
@@ -101,7 +100,7 @@ export default {
|
|
|
101
100
|
validateEmail,
|
|
102
101
|
async login() {
|
|
103
102
|
this.processing = true
|
|
104
|
-
let member = (await
|
|
103
|
+
let member = (await this.$mango.login({ email: this.user.email, password: this.user.password }))
|
|
105
104
|
|
|
106
105
|
if (member?.memberId) {
|
|
107
106
|
if (member.roles?.includes('admin')) member.admin = true
|
|
@@ -149,7 +148,7 @@ export default {
|
|
|
149
148
|
title: `${this.user.firstName} ${this.user.lastName || ''}`.trim()
|
|
150
149
|
}
|
|
151
150
|
|
|
152
|
-
let response = await
|
|
151
|
+
let response = await this.$mango.members.save(data)
|
|
153
152
|
if (!response.id) {
|
|
154
153
|
Swal.fire('Account Exists', response, 'info')
|
|
155
154
|
} else {
|
|
@@ -79,7 +79,6 @@
|
|
|
79
79
|
</template>
|
|
80
80
|
|
|
81
81
|
<script>
|
|
82
|
-
import Mango from '../../helpers/mango'
|
|
83
82
|
import Login from '../layout/login.vue'
|
|
84
83
|
|
|
85
84
|
export default {
|
|
@@ -106,9 +105,9 @@ export default {
|
|
|
106
105
|
}
|
|
107
106
|
},
|
|
108
107
|
async created() {
|
|
109
|
-
this.online = await
|
|
108
|
+
this.online = await this.$mango.online()
|
|
110
109
|
this.checker = setInterval(async () => {
|
|
111
|
-
this.online = await
|
|
110
|
+
this.online = await this.$mango.online()
|
|
112
111
|
}, 500);
|
|
113
112
|
},
|
|
114
113
|
beforeDestroy() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ref } from 'vue'
|
|
2
|
-
import
|
|
2
|
+
import { mango } from 'mango-cms'
|
|
3
3
|
|
|
4
4
|
const getUser = async (user) => {
|
|
5
5
|
|
|
@@ -23,7 +23,7 @@ const getUser = async (user) => {
|
|
|
23
23
|
|
|
24
24
|
if (!userId) return {}
|
|
25
25
|
|
|
26
|
-
user.value = await
|
|
26
|
+
user.value = await mango.member(userId, { depthLimit: 0 }).then(r => user.value = r)
|
|
27
27
|
|
|
28
28
|
return user.value
|
|
29
29
|
|
package/default/src/main.js
CHANGED
|
@@ -84,17 +84,15 @@ axios.defaults.headers.common['Authorization'] = Authorization
|
|
|
84
84
|
|
|
85
85
|
app.provide('store', store)
|
|
86
86
|
app.provide('axios', axios)
|
|
87
|
-
|
|
88
87
|
app.provide('mode', import.meta.env.MODE)
|
|
89
88
|
|
|
90
|
-
|
|
91
89
|
/*
|
|
92
90
|
|
|
93
91
|
Global Components
|
|
94
92
|
|
|
95
93
|
*/
|
|
96
94
|
|
|
97
|
-
import Mango from '
|
|
95
|
+
import { Mango, mango } from 'mango-cms'
|
|
98
96
|
import Spinner from './components/layout/spinner.vue'
|
|
99
97
|
import Modal from './components/layout/modal.vue'
|
|
100
98
|
|
|
@@ -103,6 +101,8 @@ app.component('Spinner', Spinner)
|
|
|
103
101
|
app.component('Modal', Modal)
|
|
104
102
|
// app.component('resource', defineAsyncComponent(Layouter.vue')))
|
|
105
103
|
|
|
104
|
+
app.config.globalProperties.$mango = mango
|
|
105
|
+
|
|
106
106
|
/*
|
|
107
107
|
|
|
108
108
|
Route Guard
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mango-cms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"!default/node_modules/**"
|
|
14
14
|
],
|
|
15
15
|
"author": "Colton Neifert",
|
|
16
|
-
"license": "
|
|
16
|
+
"license": "Commercial",
|
|
17
17
|
"bin": {
|
|
18
18
|
"mango": "./cli.js"
|
|
19
19
|
},
|