PromucFlow_constructor/app/shared
Favour Ohanekwu d6fbdb15b9
feat: Linting in entity properties and methods (#16171)
* Initial commit

* Remove arrow function params from identifiers

* Remove invalid identifiers from extracted identifiers

* Remove invalid identifiers which are derived from function params and variable declarations

* Fix typo error

* Correctly remove invalid identifiers

* Remove invalid names from identifier list

* fix build failure

* Add Promise to list of unacceptable entity name

* Keep track of unreferenced identifiers in bindings

* Add Global scope object names as unusable entity names

* Keep track of unreferenced identifiers

* Prevent traversal of data tree for addition of new paths and entities

* Sync linting in trigger fields

* Support linting of invalid properties

* Fix linting reactivity bug in trigger field

* Remove unused objects

* Fix conflict in merging

* Lint jsobject body for function change

* Remove unused map from tests

* Code cleanup

* Modify jest tests

* Update jest tests

* Fix cypress tests

* Code cleanup

* Support  linting of multiple bindings

* Set squiggle line as long as invalid property length

* Add jest tests

* Minor code refactor

* Move ast to shared repo

* Rename confusing identifiers

* Improve naming of functions and their return values

* move shared widget validation utils and constants to shared folder

* Add jest test for invalid entity names

* Add cypress tests

* Modify test comment

* Extend list of dedicated worker scope identifiers

* Resolve code review comments

* Resolve review comments

* Annonate code where necessary

* Code refactor

* Improve worker global scope object

* Code refactor

* Fix merge conflict

* Code refactor

* Minor bug fix

* Redundant commit to retrigger vercel build

* Add null checks to dependecy chain
2022-09-17 18:40:28 +01:00
..
ast feat: Linting in entity properties and methods (#16171) 2022-09-17 18:40:28 +01:00
.gitignore feat: ast mono repo poc (#15610) 2022-08-11 20:59:26 +05:30
build-shared-dep.js feat: ast mono repo poc (#15610) 2022-08-11 20:59:26 +05:30
install-dependencies.js feat: ast mono repo poc (#15610) 2022-08-11 20:59:26 +05:30
package.json feat: ast mono repo poc (#15610) 2022-08-11 20:59:26 +05:30
Readme.md feat: AST apis for parsing script and returning identifiers (#16252) 2022-09-12 14:45:47 +05:30
shared-dependencies.json feat: AST apis for parsing script and returning identifiers (#16252) 2022-09-12 14:45:47 +05:30
verify-shared-dep.js feat: ast mono repo poc (#15610) 2022-08-11 20:59:26 +05:30

Shared Dependencies

We wanted to share common logic with different applications within our repo, so we picked yarn symlinks as our approach to tackle this problem. Following are the way in which you can take advantage of the module sharing architecture.

Creation of a Shared Module

  • Create a directory inside shared directory with name eg. abc
  • Inside package.json of module, keep the name like @shared/abc
  • Add a rollup config to generate package.json after the module is build

Installation of Shared Modules

  • Add an entry for an application inside shared-dependencies.json eg. for client there should be an entry "client": []
  • Add the name of the shared module in the entry of the application in the above file eg. "client": ["@shared/abc"]
  • If the application does not have any postinstall or preinstall scripts for shared modules then add the two commands described below in the application's (eg. client) package.json : "postinstall": "CURRENT_SCOPE=client node ../shared/install-dependencies.js" "preinstall": "CURRENT_SCOPE=client node ../shared/build-shared-dep.js" CURRENT_SCOPE is the environment variable that's being used in the scripts

Verifying the Installed Shared Modules

  • Run yarn run verify inside shared directory to verify shared dependencies for an application.
  • yarn install : installs packages
  • rollup -c : Module bundler bundles the package and creates a build
  • cd build : Change the present working directory
  • cp -R ../node_modules ./node_modules : copies its own node_modules directory to its build directory to make sure its own version dependencies do not mismatch when its installed in other directories as shared module
  • yarn link : Creates a link for the package to make it available for other directories to use.