mercur-cli 0.1.8 → 0.1.9
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/.github/dependabot.yml +11 -0
- package/cli/pull-and-install.js +37 -37
- package/index.js +17 -17
- package/package.json +5 -12
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
- package-ecosystem: "npm" # See documentation for possible values
|
|
9
|
+
directory: "/" # Location of package manifests
|
|
10
|
+
schedule:
|
|
11
|
+
interval: "weekly"
|
package/cli/pull-and-install.js
CHANGED
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
import { execa } from
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
4
|
-
import ora from
|
|
1
|
+
import { execa } from 'execa';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import ora from 'ora';
|
|
5
5
|
import {
|
|
6
6
|
b2cDependencies,
|
|
7
7
|
b2cMedusaConfigTemplate,
|
|
8
8
|
getSeedScript,
|
|
9
|
-
} from
|
|
9
|
+
} from './data.js';
|
|
10
10
|
|
|
11
11
|
export async function pullAndInstall(options) {
|
|
12
12
|
const targetDir = path.resolve(process.cwd(), options.directory);
|
|
13
13
|
const mercurVersion = options.mercur_version;
|
|
14
14
|
|
|
15
|
-
const spinner = ora(
|
|
15
|
+
const spinner = ora('Setting up Mercur...').start();
|
|
16
16
|
await fs.ensureDir(targetDir);
|
|
17
17
|
|
|
18
|
-
spinner.text =
|
|
18
|
+
spinner.text = 'Installing Mercur backend...';
|
|
19
19
|
await execa(
|
|
20
|
-
|
|
21
|
-
[
|
|
20
|
+
'git',
|
|
21
|
+
['clone', 'https://github.com/mercurjs/clean-medusa-starter', 'backend'],
|
|
22
22
|
{
|
|
23
23
|
cwd: targetDir,
|
|
24
24
|
}
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
for (let dependency of b2cDependencies) {
|
|
28
|
-
if (mercurVersion !==
|
|
28
|
+
if (mercurVersion !== 'latest') {
|
|
29
29
|
dependency = `${dependency}@${mercurVersion}`;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
await execa(
|
|
33
|
-
cwd: path.join(targetDir,
|
|
32
|
+
await execa('yarn', ['add', dependency], {
|
|
33
|
+
cwd: path.join(targetDir, 'backend'),
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
await fs.remove(path.join(targetDir,
|
|
37
|
+
await fs.remove(path.join(targetDir, 'backend/medusa-config.ts'));
|
|
38
38
|
|
|
39
39
|
await fs.writeFile(
|
|
40
|
-
path.join(targetDir,
|
|
40
|
+
path.join(targetDir, 'backend/medusa-config.ts'),
|
|
41
41
|
b2cMedusaConfigTemplate
|
|
42
42
|
);
|
|
43
43
|
|
|
44
44
|
const seedScript = await getSeedScript();
|
|
45
45
|
|
|
46
46
|
await fs.writeFile(
|
|
47
|
-
path.join(targetDir,
|
|
47
|
+
path.join(targetDir, 'backend/src/scripts/seed.ts'),
|
|
48
48
|
seedScript.seedScript
|
|
49
49
|
);
|
|
50
50
|
|
|
51
|
-
await fs.mkdir(path.join(targetDir,
|
|
51
|
+
await fs.mkdir(path.join(targetDir, 'backend/src/scripts/seed'));
|
|
52
52
|
await fs.writeFile(
|
|
53
|
-
path.join(targetDir,
|
|
53
|
+
path.join(targetDir, 'backend/src/scripts/seed/seed-functions.ts'),
|
|
54
54
|
seedScript.seedFunctions
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
await fs.writeFile(
|
|
58
|
-
path.join(targetDir,
|
|
58
|
+
path.join(targetDir, 'backend/src/scripts/seed/seed-products.ts'),
|
|
59
59
|
seedScript.seedProducts
|
|
60
60
|
);
|
|
61
61
|
|
|
62
|
-
await execa(
|
|
62
|
+
await execa('yarn', ['install'], { cwd: path.join(targetDir, 'backend') });
|
|
63
63
|
|
|
64
|
-
spinner.text =
|
|
64
|
+
spinner.text = 'Installing Mercur admin panel...';
|
|
65
65
|
await execa(
|
|
66
|
-
|
|
67
|
-
[
|
|
66
|
+
'git',
|
|
67
|
+
['clone', 'https://github.com/mercurjs/admin-panel.git', 'admin-panel'],
|
|
68
68
|
{
|
|
69
69
|
cwd: targetDir,
|
|
70
70
|
}
|
|
71
71
|
);
|
|
72
|
-
await execa(
|
|
73
|
-
cwd: path.join(targetDir,
|
|
72
|
+
await execa('yarn', ['install'], {
|
|
73
|
+
cwd: path.join(targetDir, 'admin-panel'),
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
if (options.install_storefront) {
|
|
77
|
-
spinner.text =
|
|
77
|
+
spinner.text = 'Installing Mercur storefront...';
|
|
78
78
|
await execa(
|
|
79
|
-
|
|
79
|
+
'git',
|
|
80
80
|
[
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
'clone',
|
|
82
|
+
'https://github.com/mercurjs/b2c-marketplace-storefront.git',
|
|
83
|
+
'storefront',
|
|
84
84
|
],
|
|
85
85
|
{
|
|
86
86
|
cwd: targetDir,
|
|
87
87
|
}
|
|
88
88
|
);
|
|
89
|
-
await execa(
|
|
90
|
-
cwd: path.join(targetDir,
|
|
89
|
+
await execa('yarn', ['install'], {
|
|
90
|
+
cwd: path.join(targetDir, 'storefront'),
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
if (options.install_vendor) {
|
|
95
|
-
spinner.text =
|
|
95
|
+
spinner.text = 'Installing Mercur vendor panel...';
|
|
96
96
|
await execa(
|
|
97
|
-
|
|
98
|
-
[
|
|
97
|
+
'git',
|
|
98
|
+
['clone', 'https://github.com/mercurjs/vendor-panel.git', 'vendor-panel'],
|
|
99
99
|
{
|
|
100
100
|
cwd: targetDir,
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
|
-
await execa(
|
|
104
|
-
cwd: path.join(targetDir,
|
|
103
|
+
await execa('yarn', ['install'], {
|
|
104
|
+
cwd: path.join(targetDir, 'vendor-panel'),
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
spinner.succeed(
|
|
108
|
+
spinner.succeed('Download complete!');
|
|
109
109
|
}
|
package/index.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import chalk from
|
|
4
|
-
import { program } from
|
|
5
|
-
import { fullInstall } from
|
|
6
|
-
import { startAll } from
|
|
7
|
-
import { displayMercurVersions } from
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { program } from 'commander';
|
|
5
|
+
import { fullInstall } from './cli/full-install.js';
|
|
6
|
+
import { startAll } from './cli/start.js';
|
|
7
|
+
import { displayMercurVersions } from './cli/mercur-versions.js';
|
|
8
8
|
|
|
9
9
|
console.log(
|
|
10
10
|
chalk.blue(`
|
|
11
11
|
╔═══════════════════════════════════════════════╗
|
|
12
12
|
║ ║
|
|
13
|
-
║ ${chalk.bold(
|
|
13
|
+
║ ${chalk.bold('Mercur - Open Source Marketplace Platform')} ║
|
|
14
14
|
║ ║
|
|
15
|
-
║ ${chalk.bold(
|
|
15
|
+
║ ${chalk.bold('CLI Version:')} 0.1.9 ║
|
|
16
16
|
╚═══════════════════════════════════════════════╝
|
|
17
17
|
`)
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
program
|
|
21
|
-
.command(
|
|
22
|
-
.version(
|
|
23
|
-
.description(
|
|
24
|
-
.option(
|
|
21
|
+
.command('install')
|
|
22
|
+
.version('1.1.0')
|
|
23
|
+
.description('Perform full installation of Mercur')
|
|
24
|
+
.option('--mv, --mercur-version <mercur_version>', 'Mercur version', 'latest')
|
|
25
25
|
.action(fullInstall);
|
|
26
26
|
|
|
27
27
|
program
|
|
28
|
-
.command(
|
|
29
|
-
.version(
|
|
30
|
-
.description(
|
|
28
|
+
.command('dev')
|
|
29
|
+
.version('1.0.0')
|
|
30
|
+
.description('Start all Mercur components')
|
|
31
31
|
.action(startAll);
|
|
32
32
|
|
|
33
33
|
program
|
|
34
|
-
.command(
|
|
35
|
-
.version(
|
|
36
|
-
.description(
|
|
34
|
+
.command('versions')
|
|
35
|
+
.version('1.0.0')
|
|
36
|
+
.description('Show versions')
|
|
37
37
|
.action(displayMercurVersions);
|
|
38
38
|
|
|
39
39
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mercur-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "CLI for Mercur - Open Source Marketplace Platform",
|
|
5
5
|
"author": "MercurJS <hello@mercurjs.com> (https://mercurjs.com)",
|
|
6
6
|
"repository": {
|
|
@@ -21,19 +21,12 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"scripts": {},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"chalk": "^
|
|
25
|
-
"commander": "^
|
|
24
|
+
"chalk": "^5.6.2",
|
|
25
|
+
"commander": "^14.0.3",
|
|
26
26
|
"execa": "^9.5.2",
|
|
27
27
|
"fs-extra": "^11.2.0",
|
|
28
|
-
"inquirer": "^
|
|
29
|
-
"ora": "^
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"@types/fs-extra": "^11.0.4",
|
|
33
|
-
"@types/inquirer": "^8.2.10",
|
|
34
|
-
"@types/node": "^20.11.0",
|
|
35
|
-
"tsup": "^8.0.2",
|
|
36
|
-
"typescript": "^5.3.3"
|
|
28
|
+
"inquirer": "^13.2.2",
|
|
29
|
+
"ora": "^9.1.0"
|
|
37
30
|
},
|
|
38
31
|
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
39
32
|
}
|