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

feat: add flag to add UI source map files during the build process #1183

Merged
merged 29 commits into from May 17, 2024

Conversation

soleksy-splunk
Copy link
Contributor

@soleksy-splunk soleksy-splunk commented May 10, 2024

Add source map (.js.map files) conditionally to built code.

Issue number: ADDON-70442

Summary

Currently when users are running ucc-gen build by default source map files (.js.map) are generated and inserted in output. For most users it is unwanted code and only increases the size of package.
With this PR inside a command we can decide if we want to generate output code with source map or not
(By default it is WITHOUT source map)
the flag that decides about it is --ui-source-map

Changes

Add support for --ui-source-map flag and conditionally copies .js.map files from UI output

User experience

With that change standard user will have a significantly smaller package, as unnecessary source map files wont be generated.
But also there is a possibility to generate those files if needed.

When users runs standard command ucc-gen build, user will have smaller packed, reduced by source map (comparing to current behaviour)

When users runs standard command with flag ucc-gen build --ui-source-map, package with source map files will be generated (current state)

Checklist

If your change doesn't seem to apply, please leave them unchecked.

@soleksy-splunk soleksy-splunk requested review from a team as code owners May 10, 2024 12:24
Copy link
Member

@artemrys artemrys left a comment

Choose a reason for hiding this comment

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

Please add tests for the new changes in main.py and fix pre-commit.

docs/quickstart.md Outdated Show resolved Hide resolved
@soleksy-splunk
Copy link
Contributor Author

Please add tests for the new changes in main.py and fix pre-commit.

Please add tests for the new changes in main.py and fix pre-commit.

added simple test to check call generate function correctly but will have a think about some more tests to actually validate if files are propageted, not sure if we got any of tests like that

@soleksy-splunk
Copy link
Contributor Author

Also added smoke tests

kkedziak-splunk and others added 14 commits May 14, 2024 16:56
Separation done similar to:
https://splunk.github.io/addonfactory-ucc-generator/advanced/custom_rest_handler/

Fixes #331.

Co-authored-by: mahirchavda <mahir.chavda13@gmail.com>

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>
…figuration page (#1181)

- Added support for text truncation when the page width is too small.
- Adjusted the button width to prevent the label from overflowing beyond
the button's border.
- Here is the reference: 
screenshot before the fix:

<img width="1028" alt="Screenshot 2024-05-06 at 11 44 03 AM"
src="https://github.com/splunk/addonfactory-ucc-generator/assets/163995910/821bfb86-e39d-4d36-af0c-80ef0e84d682">

screenshot after the fix:

<img width="1053" alt="Screenshot 2024-05-09 at 3 01 32 PM"
src="https://github.com/splunk/addonfactory-ucc-generator/assets/163995910/471fe0b8-90ba-4148-8c9d-9b89268f7410">

---------

Co-authored-by: srv-rr-github-token <94607705+srv-rr-github-token@users.noreply.github.com>
Co-authored-by: Artem Rys <rysartem@gmail.com>
- Update `@splunk/react-ui` to v4.30.0
This PR introduces a new PR template.
)

This PR adds a new GitHub issue for documentation updates.
…1177)

ADDON-69825
- The generated files and source files are compared with their names. If
the names are same, warning log for such files is mentioned.
- Reason: the file names would be same when generated from globalConfig
vs present in the source code such that the source code would replace
the generated code.

- Updated the test case when the warning logs should be present and
absent.

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>
Add configurable support for none text files, via encoding content to
base64 string.
https://splunk.atlassian.net/browse/ADDON-69993
**Issue number:** ---

## Summary
Fix path reference inside smoke tests.
Previously 2 tests pointed to static "expected" files that were added
manually
### Changes

> Changes path reference to temp directory instead of static files

### User experience

> Not apllicable

## Checklist

If your change doesn't seem to apply, please leave them unchecked.

* [x] I have performed a self-review of this change
* [x] Changes have been tested
* [ ] Changes are documented
* [x] PR title follows [conventional commit
semantics](https://www.conventionalcommits.org/en/v1.0.0/)
…mework " (#1195)

Reverts #1177

This PR needs a bit more work to be able to be merged into the `develop`
branch, specifically we need to check for the content of the file, not
only the name of the file that is being generated.
hetangmodi-crest and others added 2 commits May 14, 2024 16:56
Updating the globalConfig before validating with `schema.json` to
provide straightforward upgrade of the add-on.

---------

Co-authored-by: Artem Rys <rysartem@gmail.com>
@artemrys
Copy link
Member

Please update the title of the PR and please use the new PR template, specifically please expand on the user experience section.

@soleksy-splunk soleksy-splunk changed the title chore/addon 70442 conditionaly ui source map webpack default licence removed chore/addon 70442 conditionaly ui source map May 15, 2024
@soleksy-splunk soleksy-splunk changed the title chore/addon 70442 conditionaly ui source map chore: addon 70442 conditionaly ui source map May 15, 2024
@soleksy-splunk soleksy-splunk changed the title chore: addon 70442 conditionaly ui source map chore: conditionaly ui source map - addon 70442 May 15, 2024
@soleksy-splunk
Copy link
Contributor Author

Please update the title of the PR and please use the new PR template, specifically please expand on the user experience section.

done

@artemrys artemrys changed the title chore: conditionaly ui source map - addon 70442 feat: add flag to add UI source map files during the build process May 15, 2024
assert path.exists(expected_file_path)


def test_ucc_generate_without_ui_source_map():
Copy link
Member

Choose a reason for hiding this comment

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

Can you please merge this test with test_ucc_generate_everything?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

splunk_add_on_ucc_framework/utils.py Show resolved Hide resolved
docs/quickstart.md Show resolved Hide resolved
@artemrys artemrys enabled auto-merge (squash) May 17, 2024 12:01
@artemrys artemrys merged commit 6e4944b into develop May 17, 2024
61 checks passed
@artemrys artemrys deleted the chore/ADDON-70442-remove-js-map-from-build branch May 17, 2024 12:35
@github-actions github-actions bot locked and limited conversation to collaborators May 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants