terascope / teraslice

Scalable data processing pipelines in JavaScript
https://terascope.github.io/teraslice/
Apache License 2.0
50 stars 13 forks source link

add feature to terasclice-cli replace flag #3403

Closed sotojn closed 1 year ago

sotojn commented 1 year ago

I added an If statement on line 138 inside teraslice/packages/teraslice-cli/src/cmds/assets/deploy.ts

File: deploy.ts
  130:         } else if (cliConfig.args.build || assetJsonExists) {
  131:             const asset = new AssetSrc(
  132:                 assetJsonExists ? '.' : cliConfig.args.srcDir,
  133:                 cliConfig.args.dev
  134:             );
  135: 
  136:             try {
  137:                 reply.green('Beginning asset build.');
+ 138:                 if (cliConfig.args.replace) {
+ 139:                     asset.overwrite = true;
+ 140:                 }
  141:                 const buildResult = await asset.build();
  142:                 assetPath = buildResult.name;
  143:                 reply.green(`Asset created:\n\t${buildResult.name} (${buildResult.bytes})`);
  144:             } catch (err) {
  145:                 reply.fatal(new TSError(err, {
  146:                     reason: 'Failure to build asset'
  147:                 }));
  148:                 return;
  149:             }
  150: 

I ran all the teraslice-cli tests and they are all passing.

 PASS   teraslice-cli  packages/teraslice-cli/test/lib/jobs-spec.ts (6.593 s)
  jobs
    ✓ should return a job object (1 ms)
  jobs.workers should
    ✓ return correct response if ts-client response is an object (11 ms)
    ✓ return correct response if ts-client response is a string (5 ms)
  jobs.awaitStatus should
    ✓ return status when desired status is reached (5015 ms)

Test Suites: 38 passed, 38 total
Tests:       129 passed, 129 total
Snapshots:   0 total
Time:        6.747 s, estimated 7 s

This should solve the issue referenced here #3402