@multiplatform.one/cli 1.0.33 → 1.0.35

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) => {
@@ -29,16 +29,23 @@ program.command("init").argument("[remote]", "the remote to use", "https://gitla
29
29
  ]))?.name
30
30
  };
31
31
  const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-")), "config.json");
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
- });
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", [
@@ -71,16 +78,23 @@ program.command("update").argument("[remote]", "the remote to use", "https://git
71
78
  }
72
79
  if (!cookieCutterConfig) throw new Error("not a multiplatform.one project");
73
80
  const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), "multiplatform-")), "config.json");
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
- });
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.33",
3
+ "version": "1.0.35",
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.18"
55
+ "@multiplatform.one/utils": "^0.0.20"
56
56
  },
57
57
  "dependencies": {
58
58
  "commander": "^9.5.0",
@@ -16,4 +16,5 @@ if ! which cookiecutter >/dev/null 2>&1; then
16
16
  exit 1
17
17
  fi
18
18
 
19
- cookiecutter -f "$@"
19
+ echo cookiecutter "$@"
20
+ cookiecutter "$@"
@@ -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(
@@ -60,20 +60,24 @@ program
60
60
  )?.name,
61
61
  };
62
62
  const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-')), 'config.json');
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
- );
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
@@ -107,21 +111,25 @@ program
107
111
  }
108
112
  if (!cookieCutterConfig) throw new Error('not a multiplatform.one project');
109
113
  const cookieCutterConfigFile = path.join(await fs.mkdtemp(path.join(os.tmpdir(), 'multiplatform-')), 'config.json');
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
- );
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);