Skip to content

Commit

Permalink
Chore: Watch for package changes (#25910)
Browse files Browse the repository at this point in the history
<!-- This is a pull request template, you do not need to uncomment or remove the comments, they won't show up in the PR text. -->

<!-- Your Pull Request name should start with one of the following tags
  [NEW] For new features
  [IMPROVE] For an improvement (performance or little improvements) in existing features
  [FIX] For bug fixes that affect the end-user
  [BREAK] For pull requests including breaking changes
  Chore: For small tasks
  Doc: For documentation
-->

<!-- Checklist!!! If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. 
  - I have read the Contributing Guide - https://github.com/RocketChat/Rocket.Chat/blob/develop/.github/CONTRIBUTING.md#contributing-to-rocketchat doc
  - I have signed the CLA - https://cla-assistant.io/RocketChat/Rocket.Chat
  - Lint and unit tests pass locally with my changes
  - I have added tests that prove my fix is effective or that my feature works (if applicable)
  - I have added necessary documentation (if applicable)
  - Any dependent changes have been merged and published in downstream modules
-->

## Proposed changes (including videos or screenshots)
<!-- CHANGELOG -->
<!--
  Describe the big picture of your changes here to communicate to the maintainers why we should accept this pull request.
  If it fixes a bug or resolves a feature request, be sure to link to that issue below.
  This description will appear in the release notes if we accept the contribution.
-->
With the current `dev` pipeline, whenever we modify a package (e.g. `api-client`), we have to kill the meteor proccess and run `yarn dev` again in order for the changes to be compiled and the new output to be used by meteor.

This has the drawback of taking a little longer to run the dev environment, since we can't cache a watched buid. In the other hand, it reduces the friction of modifying internal packages since we don't need to rebuild the project for changes to take effect.

This will enable us to move more things to separate packages without affecting the dev experience too much.
<!-- END CHANGELOG -->

## Issue(s)
<!-- Link the issues being closed by or related to this PR. For example, you can use #594 if this PR closes issue number 594 -->

## Steps to test or reproduce
<!-- Mention how you would reproduce the bug if not mentioned on the issue page already. Also mention which screens are going to have the changes if applicable -->

## Further comments
<!-- If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc... -->
  • Loading branch information
gabriellsh committed Jun 17, 2022
1 parent 42ae7aa commit 06043f5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion _templates/package/new/package.json.ejs.t
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ to: packages/<%= name %>/package.json
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"jest": "jest",
"build": "rm -rf dist && tsc -p tsconfig.json"
"build": "rm -rf dist && tsc -p tsconfig.json",
"dev": "tsc -p --watch --preserveWatchOutput tsconfig.json"
},
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build:services": "turbo run build --filter=rocketchat-services...",
"build:ci": "turbo run build:ci",
"testunit": "turbo run testunit",
"dev": "turbo run dev --filter=@rocket.chat/meteor...",
"dev": "turbo run dev --parallel --filter=@rocket.chat/meteor...",
"lint": "turbo run lint",
"storybook": "yarn workspace @rocket.chat/meteor run storybook"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"jest": "jest",
"build": "tsc -p tsconfig.json"
"build": "tsc -p tsconfig.json",
"dev": "tsc --watch --preserveWatchOutput -p tsconfig.json"
},
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions packages/core-typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "tsc --watch --preserveWatchOutput -p tsconfig.json",
"build": "rm -rf dist && tsc -p tsconfig.json"
},
"main": "./dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/livechat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"scripts": {
"clean": "rimraf dist",
"build": "webpack-cli --mode production",
"dev": "yarn build",
"start": "webpack-dev-server --mode development",
"lint": "run-s eslint stylelint",
"eslint": "eslint src",
Expand Down
1 change: 1 addition & 0 deletions packages/rest-typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"jest": "jest",
"dev": "tsc --watch --preserveWatchOutput -p tsconfig.json",
"build": "rm -rf dist && tsc -p tsconfig.json"
},
"main": "./dist/index.js",
Expand Down
1 change: 1 addition & 0 deletions packages/ui-contexts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"lint": "eslint --ext .js,.jsx,.ts,.tsx .",
"lint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"jest": "jest",
"dev": "tsc --watch --preserveWatchOutput -p tsconfig.json",
"build": "rm -rf dist && tsc -p tsconfig.json"
},
"main": "./dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"outputs": []
},
"dev": {
"dependsOn": ["build"],
"dependsOn": ["^dev"],
"cache": false
}
}
Expand Down

0 comments on commit 06043f5

Please sign in to comment.