@stepzen/sdk 0.9.38 → 0.9.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.
@@ -9,6 +9,7 @@ const FormData = require("form-data");
9
9
  const fs = require("fs");
10
10
  const glob = require("glob");
11
11
  const os = require("os");
12
+ const path = require("path");
12
13
  // This function takes a (yaml) file path
13
14
  // and creates a FormData payload, containing the yaml content as 'yaml'
14
15
  const generateYamlPayload = async (file) => {
@@ -41,7 +42,7 @@ const generateZipPayload = async (directory, data, filters) => {
41
42
  }
42
43
  }
43
44
  // Store it in /tmp. Create a WriteStream
44
- const filepath = `${os.tmpdir()}/stepzen-payload-${Date.now()}.zip`;
45
+ const filepath = path.join(os.tmpdir(), `stepzen-payload-${Date.now()}.zip`);
45
46
  const output = fs.createWriteStream(filepath);
46
47
  // We're making a zip file
47
48
  const archive = archiver("zip", {
@@ -64,7 +65,7 @@ const generateZipPayload = async (directory, data, filters) => {
64
65
  const include = filters.some((filter) => file.match(filter));
65
66
  if (include) {
66
67
  debug("stepzen:archive")(file);
67
- archive.file(`${directory}/${file}`, { name: file });
68
+ archive.file(path.join(directory, file), { name: file });
68
69
  }
69
70
  });
70
71
  }
@@ -13,14 +13,15 @@ const transpileConfigurationset = async (file) => {
13
13
  }
14
14
  const source = file.substring(0, file.lastIndexOf("/"));
15
15
  dotenv.config({ path: path.resolve(source, ".env") });
16
- const tmp = `${os.tmpdir()}/stepzen-transpiler-${Date.now()}`;
16
+ const tmp = path.join(os.tmpdir(), `stepzen-transpiler-${Date.now()}`);
17
+ const configPath = path.join(tmp, 'config.yaml');
17
18
  fs.ensureDirSync(tmp);
18
- fs.copyFileSync(file, `${tmp}/config.yaml`);
19
+ fs.copyFileSync(file, configPath);
19
20
  const result = await transpile(tmp);
20
21
  if (result.transpiled) {
21
22
  fs.emptyDirSync(tmp);
22
- fs.writeFileSync(`${tmp}/config.yaml`, result.config);
23
- return `${tmp}/config.yaml`;
23
+ fs.writeFileSync(configPath, result.config);
24
+ return configPath;
24
25
  }
25
26
  fs.removeSync(tmp);
26
27
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stepzen/sdk",
3
- "version": "0.9.38",
3
+ "version": "0.9.39",
4
4
  "license": "MIT",
5
5
  "author": "Darren Waddell <darren@stepzen.com>",
6
6
  "homepage": "https://stepzen.com",