ihub-cli 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.js +17 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -139,21 +139,29 @@ async function getFile(folder,cid,pinata) {
139
139
  const arrayBuffer = await Data.arrayBuffer()
140
140
  const buffer = Buffer.from(arrayBuffer);
141
141
  console.log(buffer)
142
+
143
+
144
+
145
+ //tester
146
+ deleteFilesWithExtension(".history.bundle",".")
147
+
148
+
142
149
  let dynamicstring=crypto.randomUUID()
143
150
  let shortID = dynamicstring.substring(0, 5)
144
151
  let bpath=`${shortID}.history.bundle`
145
152
 
146
- fs.writeFileSync(`${bpath}`,buffer);
153
+ fs.writeFileSync(`${bpath}`,buffer);
147
154
 
155
+ const absolutePath = path.resolve(folder);
148
156
 
149
- if (fs.existsSync(folder)){
150
- fs.rmSync(folder, { recursive: true, force: true });
157
+ if (fs.existsSync(absolutePath)){
158
+ fs.rmSync(absolutePath, { recursive: true, force: true });
151
159
  }
152
160
 
153
161
 
154
- fs.mkdirSync(folder, { recursive: true });
162
+ fs.mkdirSync(absolutePath, { recursive: true });
155
163
 
156
- execSync(`git clone ${bpath} ${folder}`, {
164
+ execSync(`git clone ${bpath} ${absolutePath}`, {
157
165
  cwd: ".",
158
166
  stdio: 'inherit'
159
167
  });
@@ -178,7 +186,10 @@ async function getFileNew(folder,obj,pinata) {
178
186
 
179
187
  function deleteFilesWithExtension(extension, folder) {
180
188
  try {
181
- const files = fs.readdirSync(folder);
189
+
190
+
191
+ const absolutePath = path.resolve(folder);
192
+ const files = fs.readdirSync(absolutePath);
182
193
 
183
194
  for (const file of files) {
184
195
  if (file.endsWith(extension)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ihub-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "immutablehub cli to push and clone repos",
5
5
  "main": "index.js",
6
6
  "type": "module",