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

post-intall script added #930

Merged

Conversation

monalisamsteccentric
Copy link
Contributor

✨ Pull Request

📓 Referenced Issue

Fixes: #859

#859 (comment)

ℹ️ About the PR

I have made some modifications to the code to address the issue of the post-install script not working correctly on Windows. However, I will need assistance to determine whether the changes also work as expected on macOS.

To solve the problem on Windows, I added a postinstall.ts script. This script handles the correct parsing of commands, including the proper escaping of angled brackets, which was causing issues on Windows systems.

In addition to the postinstall.ts script, I made changes to the prepare script to improve the setup process. Here are the modifications I made:

"prepare": "cd .. && husky install desktop-app/.husky && chmod a+x desktop-app/.husky/pre-commit",
"prepare": "cd .. && husky install desktop-app/.husky && icacls desktop-app/.husky/pre-commit /grant Everyone:RX"

The first line of the prepare script remains the same as before, which installs Husky and sets up the pre-commit hook in the desktop-app/.husky directory.

The second line is an additional command I added to modify the permissions of the pre-commit file. On Windows, it uses the icacls command to grant read and execute permissions to everyone (Everyone:RX).

🖼️ Testing Scenarios / Screenshots

To ensure compatibility and proper execution, I conducted tests on Windows. Here are the steps I followed during testing:

  1. Cloned the repository on a Windows machine.
  2. Ran the yarn command to trigger the preparation steps.
  3. Verified that Husky was successfully installed and the pre-commit hook was set up in the desktop-app/.husky directory.
    Checked the permissions of the pre-commit file to confirm that it had the appropriate permissions (Everyone:RX on Windows).
    Attached is a screenshot showing the successful execution of the updated prepare script on the Windows environment.
Screenshot

I believe these changes, along with the addition of the postinstall.ts script, resolve the issue mentioned in #859 and enhance the overall setup process.

I kindly request the community to review and merge this pull request. Please let me know if you have any questions or if further tests or modifications are required.

Thank you for your attention and assistance!

@CLAassistant
Copy link

CLAassistant commented May 10, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@manojVivek manojVivek left a comment

Choose a reason for hiding this comment

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

Thank you so much for taking this up!
Just a couple of minor changes, looks good otherwise.

"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
"package": "ts-node ./.erb/scripts/clean.js dist && yarn run build && electron-builder build --publish never",
"prepare": "cd .. && husky install desktop-app/.husky && chmod a+x desktop-app/.husky/pre-commit",
"prepare": "cd .. && husky install desktop-app/.husky && icacls desktop-app/.husky/pre-commit /grant Everyone:RX",
Copy link
Collaborator

Choose a reason for hiding this comment

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

icacls doesn't seem to work on linux/mac. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I apologize for any confusion. The "chmod" command is not recognized by Windows operating systems. So "icacls" is only for windows users. It think I shouldn't have put it in the merge request. It probably just requires a mention for contributors using windows.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No worries, we just need to find a way that runs on all OSes.

@@ -27,10 +27,10 @@
"build": "concurrently \"yarn run build:main\" \"yarn run build:renderer\"",
"build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts",
"build:renderer": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.prod.ts",
"postinstall": "yarn rimraf --glob node_modules/browser-sync/dist/**/*.map && yarn replace '\"network-throttle\".*' '' node_modules/browser-sync-ui/lib/UI.js && ts-node .erb/scripts/check-native-dep.js && replace-in-file '/// <reference types=\"howler\" />' \"import { Howl } from 'howler';\" node_modules/use-sound/dist/types.d.ts && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
"postinstall": "ts-node postinstall.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we keep the app dependencies installation and webpack here only?
So that the postinstall.ts can only take care of the housekeeping stuff and at the same time the visibility of these important commands is maintained too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The updated commit seems to have added a duplicate entry for postinstall. Hope that's not intentional.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi Manoj,
Thank you so much for the feedback. Please consider the latest changes.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good now, thank you for your patience!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Will merge this after cutting a release. So, we'll have time to test and fix if there are any issues.

@manojVivek manojVivek merged commit 48033a2 into responsively-org:main Jun 16, 2023
@manojVivek
Copy link
Collaborator

@all-contributors Please add @monalisamsteccentric for code.

@allcontributors
Copy link
Contributor

@manojVivek

I've put up a pull request to add @monalisamsteccentric! 🎉

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.

post-install script is not working in windows
3 participants