@multiplatform.one/cli 1.0.32 → 1.0.34

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.
@@ -7,7 +7,7 @@ import path from "path";
7
7
  import { execa } from "execa";
8
8
  import { fileURLToPath } from "url";
9
9
  import { program } from "commander";
10
- process.env.COOKIECUTTER = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/cookiecutter.sh");
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
13
  program.command("init").argument("[remote]", "the remote to use", "https://gitlab.com/bitspur/multiplatform.one/cookiecutter").option("--name <name>", "the name of the project").description("init multiplatform.one").action(async (remote) => {
@@ -28,17 +28,24 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
28
28
  }
29
29
  ]))?.name
30
30
  };
31
- const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-"));
32
- await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
33
- await execa("sh", [
34
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/init.sh"),
35
- "-f",
36
- "--config-file",
37
- cookieCutterConfigFile,
38
- remote
39
- ], {
40
- stdio: "inherit"
41
- });
31
+ const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-")), "config.json");
32
+ try {
33
+ await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
34
+ await execa("sh", [
35
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/init.sh"),
36
+ "-f",
37
+ "--config-file",
38
+ cookieCutterConfigFile,
39
+ remote
40
+ ], {
41
+ stdio: "inherit"
42
+ });
43
+ } finally {
44
+ await fs.rm(cookieCutterConfigFile, {
45
+ recursive: true,
46
+ force: true
47
+ });
48
+ }
42
49
  });
43
50
  program.command("update").argument("[remote]", "the remote to use", "https://gitlab.com/bitspur/multiplatform.one/cookiecutter").description("update multiplatform.one").action(async (remote) => {
44
51
  if ((await execa("git", [
@@ -70,17 +77,24 @@ program.command("update").argument("[remote]", "the remote to use", "https://git
70
77
  };
71
78
  }
72
79
  if (!cookieCutterConfig) throw new Error("not a multiplatform.one project");
73
- const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-"));
74
- await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
75
- await execa("sh", [
76
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/update.sh"),
77
- "-f",
78
- "--config-file",
79
- cookieCutterConfigFile,
80
- remote
81
- ], {
82
- cwd: projectRoot,
83
- stdio: "inherit"
84
- });
80
+ const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-")), "config.json");
81
+ try {
82
+ await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
83
+ await execa("sh", [
84
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../scripts/update.sh"),
85
+ "-f",
86
+ "--config-file",
87
+ cookieCutterConfigFile,
88
+ remote
89
+ ], {
90
+ cwd: projectRoot,
91
+ stdio: "inherit"
92
+ });
93
+ } finally {
94
+ await fs.rm(cookieCutterConfigFile, {
95
+ recursive: true,
96
+ force: true
97
+ });
98
+ }
85
99
  });
86
100
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@multiplatform.one/cli",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "author": "BitSpur <support@bitspur.com> (https://bitspur.com)",
5
5
  "contributors": [
6
6
  {
@@ -52,7 +52,7 @@
52
52
  "@types/node": "~20.12.13",
53
53
  "tsup": "^8.1.0",
54
54
  "typescript": "~5.3.3",
55
- "@multiplatform.one/utils": "^0.0.17"
55
+ "@multiplatform.one/utils": "^0.0.19"
56
56
  },
57
57
  "dependencies": {
58
58
  "commander": "^9.5.0",
@@ -4,7 +4,7 @@
4
4
  * File Created: 22-06-2024 14:17:12
5
5
  * Author: Clay Risser
6
6
  * -----
7
- * BitSpur (c) Copyright 2021 - 2024
7
+ * BitSpur Copyright 2021 - 2024
8
8
  *
9
9
  * Licensed under the Apache License, Version 2.0 (the "License");
10
10
  * you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ import { execa } from 'execa';
29
29
  import { fileURLToPath } from 'url';
30
30
  import { program } from 'commander';
31
31
 
32
- process.env.COOKIECUTTER = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/cookiecutter.sh');
32
+ process.env.COOKIECUTTER = `sh ${path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/cookiecutter.sh')}`;
33
33
  program.name('multiplatform.one');
34
34
  program.version(
35
35
  JSON.parse(
@@ -59,21 +59,25 @@ program
59
59
  ])
60
60
  )?.name,
61
61
  };
62
- const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-'));
63
- await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
64
- await execa(
65
- 'sh',
66
- [
67
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/init.sh'),
68
- '-f',
69
- '--config-file',
70
- cookieCutterConfigFile,
71
- remote,
72
- ],
73
- {
74
- stdio: 'inherit',
75
- },
76
- );
62
+ const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-')), 'config.json');
63
+ try {
64
+ await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
65
+ await execa(
66
+ 'sh',
67
+ [
68
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/init.sh'),
69
+ '-f',
70
+ '--config-file',
71
+ cookieCutterConfigFile,
72
+ remote,
73
+ ],
74
+ {
75
+ stdio: 'inherit',
76
+ },
77
+ );
78
+ } finally {
79
+ await fs.rm(cookieCutterConfigFile, { recursive: true, force: true });
80
+ }
77
81
  });
78
82
 
79
83
  program
@@ -106,22 +110,26 @@ program
106
110
  if (name) cookieCutterConfig = { name };
107
111
  }
108
112
  if (!cookieCutterConfig) throw new Error('not a multiplatform.one project');
109
- const cookieCutterConfigFile = await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-'));
110
- await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
111
- await execa(
112
- 'sh',
113
- [
114
- path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/update.sh'),
115
- '-f',
116
- '--config-file',
117
- cookieCutterConfigFile,
118
- remote,
119
- ],
120
- {
121
- cwd: projectRoot,
122
- stdio: 'inherit',
123
- },
124
- );
113
+ const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-')), 'config.json');
114
+ try {
115
+ await fs.writeFile(cookieCutterConfigFile, JSON.stringify(cookieCutterConfig, null, 2));
116
+ await execa(
117
+ 'sh',
118
+ [
119
+ path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../scripts/update.sh'),
120
+ '-f',
121
+ '--config-file',
122
+ cookieCutterConfigFile,
123
+ remote,
124
+ ],
125
+ {
126
+ cwd: projectRoot,
127
+ stdio: 'inherit',
128
+ },
129
+ );
130
+ } finally {
131
+ await fs.rm(cookieCutterConfigFile, { recursive: true, force: true });
132
+ }
125
133
  });
126
134
 
127
135
  program.parse(process.argv);