@devicecloud.dev/dcd 3.3.4-beta.2 → 3.3.4-beta.4

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/dist/plan.js CHANGED
@@ -37,48 +37,60 @@ async function checkDependencies(input) {
37
37
  }
38
38
  function filterFlowFiles(unfilteredFlowFiles, excludeFlows) {
39
39
  if (excludeFlows) {
40
- return unfilteredFlowFiles.filter((file) => !excludeFlows.some((flow) => file.startsWith(path.resolve(flow))));
40
+ return unfilteredFlowFiles.filter((file) => !excludeFlows.some((flow) => path.normalize(file).startsWith(path.normalize(path.resolve(flow)))));
41
41
  }
42
42
  return unfilteredFlowFiles;
43
43
  }
44
44
  function getWorkspaceConfig(input, unfilteredFlowFiles) {
45
- const configFilePath = unfilteredFlowFiles.find((file) => file === input + 'config.yaml' || file === input + 'config.yml');
46
- return configFilePath
45
+ console.log('[getWorkspaceConfig] Input path:', input);
46
+ console.log('[getWorkspaceConfig] Unfiltered flow files:', unfilteredFlowFiles);
47
+ const possibleConfigPaths = [
48
+ path.join(input, 'config.yaml'),
49
+ path.join(input, 'config.yml'),
50
+ ].map((p) => path.normalize(p));
51
+ console.log('[getWorkspaceConfig] Looking for config files:', possibleConfigPaths);
52
+ const configFilePath = unfilteredFlowFiles.find((file) => possibleConfigPaths.includes(path.normalize(file)));
53
+ console.log('[getWorkspaceConfig] Found config file path:', configFilePath);
54
+ const config = configFilePath
47
55
  ? (0, planMethods_1.readYamlFileAsJson)(configFilePath)
48
56
  : {};
57
+ console.log('[getWorkspaceConfig] Parsed config:', config);
58
+ return config;
49
59
  }
50
60
  async function plan(input, includeTags, excludeTags, excludeFlows) {
51
- if (!fs.existsSync(input)) {
52
- throw new Error(`Flow path does not exist: ${path.resolve(input)}`);
61
+ const normalizedInput = path.normalize(input);
62
+ if (!fs.existsSync(normalizedInput)) {
63
+ throw new Error(`Flow path does not exist: ${path.resolve(normalizedInput)}`);
53
64
  }
54
- if (fs.lstatSync(input).isFile()) {
55
- if (input.endsWith('config.yaml') || input.endsWith('config.yml')) {
65
+ if (fs.lstatSync(normalizedInput).isFile()) {
66
+ if (normalizedInput.endsWith('config.yaml') ||
67
+ normalizedInput.endsWith('config.yml')) {
56
68
  throw new Error('If using config.yaml, pass the workspace folder path, not the config file');
57
69
  }
58
- const checkedDependancies = await checkDependencies(input);
70
+ const checkedDependancies = await checkDependencies(normalizedInput);
59
71
  return {
60
- flowsToRun: [input],
72
+ flowsToRun: [normalizedInput],
61
73
  referencedFiles: [...new Set(checkedDependancies)],
62
74
  totalFlowFiles: 1,
63
75
  };
64
76
  }
65
- let unfilteredFlowFiles = await (0, planMethods_1.readDirectory)(input, planMethods_1.isFlowFile);
77
+ let unfilteredFlowFiles = await (0, planMethods_1.readDirectory)(normalizedInput, planMethods_1.isFlowFile);
66
78
  if (unfilteredFlowFiles.length === 0) {
67
- throw new Error(`Flow directory does not contain any Flow files: ${path.resolve(input)}`);
79
+ throw new Error(`Flow directory does not contain any Flow files: ${path.resolve(normalizedInput)}`);
68
80
  }
69
81
  unfilteredFlowFiles = filterFlowFiles(unfilteredFlowFiles, excludeFlows);
70
- const workspaceConfig = getWorkspaceConfig(input, unfilteredFlowFiles);
82
+ const workspaceConfig = getWorkspaceConfig(normalizedInput, unfilteredFlowFiles);
71
83
  if (workspaceConfig.flows) {
72
84
  const globs = workspaceConfig.flows.map((glob) => glob);
73
85
  const matchedFiles = await (0, glob_1.glob)(globs, {
74
- cwd: input,
86
+ cwd: normalizedInput,
75
87
  nodir: true,
76
88
  });
77
89
  // overwrite the list of files with the globbed ones
78
90
  unfilteredFlowFiles = matchedFiles
79
91
  .filter((file) => file !== 'config.yaml' &&
80
92
  (file.endsWith('.yaml') || file.endsWith('.yml')))
81
- .map((file) => path.resolve(input, file));
93
+ .map((file) => path.resolve(normalizedInput, file));
82
94
  }
83
95
  else {
84
96
  // workspace config has no flows, so we need to remove the config file from the test list
@@ -87,7 +99,7 @@ async function plan(input, includeTags, excludeTags, excludeFlows) {
87
99
  if (unfilteredFlowFiles.length === 0) {
88
100
  const error = workspaceConfig.flows
89
101
  ? new Error(`Flow inclusion pattern(s) did not match any Flow files:\n${workspaceConfig.flows.join('\n')}`)
90
- : new Error(`Workspace does not contain any Flows: ${path.resolve(input)}`);
102
+ : new Error(`Workspace does not contain any Flows: ${path.resolve(normalizedInput)}`);
91
103
  throw error;
92
104
  }
93
105
  const configPerFlowFile =
@@ -398,5 +398,5 @@
398
398
  ]
399
399
  }
400
400
  },
401
- "version": "3.3.4-beta.2"
401
+ "version": "3.3.4-beta.4"
402
402
  }
package/package.json CHANGED
@@ -80,7 +80,7 @@
80
80
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
81
81
  "version": "oclif readme && git add README.md"
82
82
  },
83
- "version": "3.3.4-beta.2",
83
+ "version": "3.3.4-beta.4",
84
84
  "bugs": {
85
85
  "url": "https://discord.gg/gm3mJwcNw8"
86
86
  },