@suitegeezus/suitecloud-stacker 25.2.130 → 25.2.131

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.
@@ -14,7 +14,7 @@ const cp = require("node:child_process");
14
14
  const assert = require("node:assert");
15
15
  const passthroughCommand = 'custom:hook';
16
16
  const sdfExec = process.env['SUITECLOUD_EXE'] || 'sdf';
17
- const SdfCompileCommand = `${sdfExec} ${passthroughCommand} --option1 compiless`;
17
+ const SdfCompileCommand = `${sdfExec} ${passthroughCommand} --name compiless --option1 compiless`;
18
18
  /**
19
19
  * @description
20
20
  * @example sdf custom:hook --option1 watchss --option2 ignore --multi2 module.d.ts foo.d.ts
@@ -11,7 +11,7 @@ import { FileImportCommand, SdfCommand } from "index";
11
11
  */
12
12
  export declare const downloadForDiff: () => SdfCommand;
13
13
  /**
14
- * @description - very similar tothe fixFileUploadPaths except we need to compare against netsuite
14
+ * @description - very similar to the fixFileUploadPaths except we need to compare against what is actually in netsuite
15
15
  * Also we don't filter out any files
16
16
  */
17
17
  export declare const fixFileImportPaths: () => SdfCommand;
@@ -9,6 +9,7 @@ const console = require("node:console");
9
9
  const cp = require("node:child_process");
10
10
  const nodePath = require("node:path");
11
11
  const promptHelpers_1 = require("../lib/promptHelpers");
12
+ const pathHelpers = require("../lib/pathHelpers");
12
13
  const tempFileHelper = require("../lib/tempFileHelper");
13
14
  const os = require("node:os");
14
15
  const pathHelpers_1 = require("../lib/pathHelpers");
@@ -59,7 +60,7 @@ const downloadForDiff = () => {
59
60
  throw onErrorHelper.makeError(origin, new Error('Diff compare needs an array.'));
60
61
  // single length array
61
62
  if (options.arguments.paths.length === 0)
62
- throw onErrorHelper.makeError(origin, new Error('Diff compare supports exactly 1 file at a time currently.'));
63
+ throw onErrorHelper.makeError(origin, new Error('Diff compare needs at least 1 valid file. Perhaps your file is not in NetSuite e.g. Typescript'));
63
64
  // fixed lists
64
65
  const candidates = await Promise.all([...options.arguments.paths].map(async (candidate) => {
65
66
  // normalize to file system
@@ -108,9 +109,11 @@ const downloadForDiff = () => {
108
109
  cwd: os.tmpdir()
109
110
  // spawns in a separate location but is still a child process
110
111
  });
112
+ // this is allowed to fail as one environment might not have the requested file
111
113
  if (errorCode !== 0)
112
- process.exit(errorCode);
113
- // the file location is the
114
+ process.stdout.write((0, promptHelpers_1.goColor)('WARN', `\nimport from ${auth} failed -- probably no files matching the pattern`));
115
+ else
116
+ process.stdout.write((0, promptHelpers_1.goColor)('GOOD', `\nimport from ${auth} successful`));
114
117
  }));
115
118
  let diffTool = process.env.SUITECLOUD_DIFF_TOOL;
116
119
  {
@@ -125,15 +128,34 @@ const downloadForDiff = () => {
125
128
  }
126
129
  }
127
130
  // iterate over ALL the files to create diff commands
128
- const diffCombos = candidates.map((file) => {
129
- return [...tempLocations, options.projectPath].map((location) => {
130
- return (0, pathHelpers_1.joinPaths)(location, 'FileCabinet', file);
131
- }).filter(Boolean).map((f) => `"${f}"`);
132
- });
131
+ const diffCombos = await Promise.all(candidates.map(async (file) => {
132
+ const verifiedPaths = await Promise.all([...tempLocations, options.projectPath].map(async (location) => {
133
+ const joined = (0, pathHelpers_1.joinPaths)(location, 'FileCabinet', file);
134
+ // make sure the file exists
135
+ return (await pathHelpers.hasFile(joined))
136
+ ? joined
137
+ : false;
138
+ }));
139
+ return verifiedPaths.filter(Boolean).map((f) => `"${f}"`);
140
+ }));
133
141
  await diffCombos.reduce(async (linked, combo, currentIndex) => {
134
142
  const keepGoing = await linked;
135
143
  if (!keepGoing)
136
144
  return keepGoing;
145
+ let [left, right, primary] = combo;
146
+ if (!primary)
147
+ primary = right;
148
+ if (!right)
149
+ primary = left;
150
+ if (combo.length <= 1) {
151
+ // nothing to diff
152
+ if (!isQuiet) {
153
+ await (0, promptHelpers_1.promptUser)({
154
+ message: `${primary} not found in any environment`,
155
+ });
156
+ }
157
+ return true;
158
+ }
137
159
  const diffChildProc = cp.spawn(diffTool, ['diff', ...combo], {
138
160
  detached: true, // Allows the child to run independently
139
161
  stdio: 'inherit',
@@ -218,7 +240,7 @@ const downloadForDiff = () => {
218
240
  };
219
241
  exports.downloadForDiff = downloadForDiff;
220
242
  /**
221
- * @description - very similar tothe fixFileUploadPaths except we need to compare against netsuite
243
+ * @description - very similar to the fixFileUploadPaths except we need to compare against what is actually in netsuite
222
244
  * Also we don't filter out any files
223
245
  */
224
246
  const fixFileImportPaths = () => {
@@ -235,11 +257,12 @@ const fixFileImportPaths = () => {
235
257
  return options;
236
258
  const { projectPath } = options;
237
259
  const executionPath = options.executionPath || process.cwd();
238
- await (0, promptHelpers_1.promptUser)({
239
- message: JSON.stringify({
240
- executionPath, ...options, ischild: spawnSuitecloud.isChildProcess()
241
- })
242
- });
260
+ if (!isQuiet)
261
+ await (0, promptHelpers_1.promptUser)({
262
+ message: JSON.stringify({
263
+ executionPath, ...options, ischild: spawnSuitecloud.isChildProcess()
264
+ })
265
+ });
243
266
  // deal with relative paths, etc 1️⃣
244
267
  const shortenedPathOrGlobs = options.arguments.paths.map((path) => {
245
268
  if (/^\.+[\\\/]/.test(path) && !/\bSuiteScripts\b/.test(path))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suitegeezus/suitecloud-stacker",
3
- "version": "25.2.130",
3
+ "version": "25.2.131",
4
4
  "description": "SuiteCloud Stacker",
5
5
  "main": "safeCommands.js",
6
6
  "scripts": {