Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sc 123399/delete and disable #698

Merged
merged 13 commits into from
Dec 12, 2023

Conversation

keeramis
Copy link
Contributor

@keeramis keeramis commented Dec 11, 2023

Description

Implements disable and delete commands for Logic Functions.

How to Test

The commands are:

npm start -- lf delete
npm start -- lf disable

Related Issues / Discussions

https://app.shortcut.com/particle/story/123399/implement-disable-command
https://app.shortcut.com/particle/story/123400/implement-delete-command

Completeness

  • User is totes amazing for contributing!
  • Contributor has signed CLA
  • Problem and solution clearly stated
  • Tests have been provided
  • Docs have been updated
  • CI is passing

@keeramis keeramis changed the base branch from master to feature/logic-function December 11, 2023 20:20
npm-shrinkwrap.json Outdated Show resolved Hide resolved
@keeramis keeramis marked this pull request as ready for review December 11, 2023 21:43
@@ -329,21 +340,22 @@ describe('LogicFunctionCommands', () => {

const paths = ['dir/', 'dir/path/to/file'];

const res = await logicFunctionCommands._validatePaths({ paths });
const res = await logicFunctionCommands._validatePaths({ dirPath: paths[0], jsonPath: paths[1], _exit: false });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels too odd to have an _exit property that is defined as an fn and here you have it as boolean

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hugomontero can u please elaborate on what feels odd about this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default you are telling in the definition that exit is a function but over here you are passing exit as a boolean so you are breaking with the type definition, in case the code reach that exit that now is false it will throw you an error indicating that exit is not a function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an example of what is happening with this code:
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is great. thanks for sharing

});
if (!overwrite) {
this.ui.stdout.write(`Aborted.${os.EOL}`);
process.exit(0);
_exit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case you need it just for testing (like stub stuff) I think you can do as its mentioned here 👉 https://remarkablemark.org/blog/2017/12/10/sinon-stub-process-exit/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising. I used the _exit() as Julien suggested is a good alternative as well.

Copy link
Contributor

@hugomontero hugomontero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@keeramis keeramis merged commit fd4d874 into feature/logic-function Dec 12, 2023
6 checks passed
@monkbroc monkbroc deleted the feature/sc-123399/delete-and-disable branch January 19, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants