@multiplatform.one/cli 1.0.37 → 1.0.39
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/lib/bin/multiplatformOne.mjs +14 -7
- package/package.json +1 -1
- package/src/bin/multiplatformOne.ts +25 -20
|
@@ -10,7 +10,7 @@ import { program } from "commander";
|
|
|
10
10
|
process.env.COOKIECUTTER = `sh ${path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/cookiecutter.sh")}`;
|
|
11
11
|
program.name("multiplatform.one");
|
|
12
12
|
program.version(JSON.parse(fsSync.readFileSync(path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../package.json"), "utf8"))?.version);
|
|
13
|
-
program.command("init").argument("[
|
|
13
|
+
program.command("init").argument("[name]", "the name of the project", "").option("-r, --remote <remote>", "the remote to use", "https://gitlab.com/bitspur/multiplatform.one/cookiecutter").option("-c, --checkout <branch>", "branch, tag or commit to checkout", "main").description("init multiplatform.one").action(async (name) => {
|
|
14
14
|
if ((await execa("git", [
|
|
15
15
|
"rev-parse",
|
|
16
16
|
"--is-inside-work-tree"
|
|
@@ -19,14 +19,17 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
|
|
|
19
19
|
})).exitCode === 0) {
|
|
20
20
|
throw new Error("multiplatform.one cannot be initialized inside a git repository");
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
name
|
|
22
|
+
if (!name) {
|
|
23
|
+
name = (await inquirer.prompt([
|
|
24
24
|
{
|
|
25
25
|
message: "What is the project name?",
|
|
26
26
|
name: "name",
|
|
27
27
|
type: "input"
|
|
28
28
|
}
|
|
29
|
-
]))
|
|
29
|
+
])).name;
|
|
30
|
+
}
|
|
31
|
+
const cookieCutterConfig = {
|
|
32
|
+
name
|
|
30
33
|
};
|
|
31
34
|
const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-")), "config.json");
|
|
32
35
|
try {
|
|
@@ -37,7 +40,9 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
|
|
|
37
40
|
"-f",
|
|
38
41
|
"--config-file",
|
|
39
42
|
cookieCutterConfigFile,
|
|
40
|
-
|
|
43
|
+
"--checkout",
|
|
44
|
+
program.opts().branch,
|
|
45
|
+
program.opts().remote
|
|
41
46
|
], {
|
|
42
47
|
stdio: "inherit"
|
|
43
48
|
});
|
|
@@ -48,7 +53,7 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
|
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
});
|
|
51
|
-
program.command("update").
|
|
56
|
+
program.command("update").option("-r, --remote <remote>", "the remote to use", "https://gitlab.com/bitspur/multiplatform.one/cookiecutter").option("-c, --checkout <branch>", "branch, tag or commit to checkout", "main").description("update multiplatform.one").action(async () => {
|
|
52
57
|
if ((await execa("git", [
|
|
53
58
|
"rev-parse",
|
|
54
59
|
"--is-inside-work-tree"
|
|
@@ -87,7 +92,9 @@ program.command("update").argument("[remote]", "the remote to use", "https://git
|
|
|
87
92
|
"-f",
|
|
88
93
|
"--config-file",
|
|
89
94
|
cookieCutterConfigFile,
|
|
90
|
-
|
|
95
|
+
"--checkout",
|
|
96
|
+
program.opts().branch,
|
|
97
|
+
program.opts().remote
|
|
91
98
|
], {
|
|
92
99
|
cwd: projectRoot,
|
|
93
100
|
stdio: "inherit"
|
package/package.json
CHANGED
|
@@ -39,26 +39,26 @@ program.version(
|
|
|
39
39
|
|
|
40
40
|
program
|
|
41
41
|
.command('init')
|
|
42
|
-
.argument('[
|
|
43
|
-
.option('--
|
|
42
|
+
.argument('[name]', 'the name of the project', '')
|
|
43
|
+
.option('-r, --remote <remote>', 'the remote to use', 'https://gitlab.com/bitspur/multiplatform.one/cookiecutter')
|
|
44
|
+
.option('-c, --checkout <branch>', 'branch, tag or commit to checkout', 'main')
|
|
44
45
|
.description('init multiplatform.one')
|
|
45
|
-
.action(async (
|
|
46
|
+
.action(async (name) => {
|
|
46
47
|
if ((await execa('git', ['rev-parse', '--is-inside-work-tree'], { reject: false })).exitCode === 0) {
|
|
47
48
|
throw new Error('multiplatform.one cannot be initialized inside a git repository');
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
name
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
50
|
+
if (!name) {
|
|
51
|
+
name = (
|
|
52
|
+
await inquirer.prompt([
|
|
53
|
+
{
|
|
54
|
+
message: 'What is the project name?',
|
|
55
|
+
name: 'name',
|
|
56
|
+
type: 'input',
|
|
57
|
+
},
|
|
58
|
+
])
|
|
59
|
+
).name;
|
|
60
|
+
}
|
|
61
|
+
const cookieCutterConfig: CookieCutterConfig = { name };
|
|
62
62
|
const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-')), 'config.json');
|
|
63
63
|
try {
|
|
64
64
|
await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
|
|
@@ -70,7 +70,9 @@ program
|
|
|
70
70
|
'-f',
|
|
71
71
|
'--config-file',
|
|
72
72
|
cookieCutterConfigFile,
|
|
73
|
-
|
|
73
|
+
'--checkout',
|
|
74
|
+
program.opts().branch,
|
|
75
|
+
program.opts().remote,
|
|
74
76
|
],
|
|
75
77
|
{
|
|
76
78
|
stdio: 'inherit',
|
|
@@ -83,9 +85,10 @@ program
|
|
|
83
85
|
|
|
84
86
|
program
|
|
85
87
|
.command('update')
|
|
86
|
-
.
|
|
88
|
+
.option('-r, --remote <remote>', 'the remote to use', 'https://gitlab.com/bitspur/multiplatform.one/cookiecutter')
|
|
89
|
+
.option('-c, --checkout <branch>', 'branch, tag or commit to checkout', 'main')
|
|
87
90
|
.description('update multiplatform.one')
|
|
88
|
-
.action(async (
|
|
91
|
+
.action(async () => {
|
|
89
92
|
if ((await execa('git', ['rev-parse', '--is-inside-work-tree'], { reject: false })).exitCode !== 0) {
|
|
90
93
|
throw new Error('multiplatform.one cannot be updated outside of a git repository');
|
|
91
94
|
}
|
|
@@ -122,7 +125,9 @@ program
|
|
|
122
125
|
'-f',
|
|
123
126
|
'--config-file',
|
|
124
127
|
cookieCutterConfigFile,
|
|
125
|
-
|
|
128
|
+
'--checkout',
|
|
129
|
+
program.opts().branch,
|
|
130
|
+
program.opts().remote,
|
|
126
131
|
],
|
|
127
132
|
{
|
|
128
133
|
cwd: projectRoot,
|