stencil icon indicating copy to clipboard operation
stencil copied to clipboard

Extend the System abstraction to support framework wrappers

Open splitinfinities opened this issue 4 years ago • 1 comments

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [x] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [x] Build (npm run build) was run locally and any changes were pushed
  • [x] Unit tests (npm test) were run locally and passed
  • [x] E2E Tests (npm run test.karma.prod) were run locally and passed
  • [x] Prettier (npm run prettier) was run locally and passed

Pull request type

Please check the type of change your PR introduces:

  • [ ] Bugfix
  • [x] Feature
  • [ ] Refactoring (no functional changes, no api changes)
  • [ ] Build related changes
  • [ ] Documentation content changes
  • [ ] Other (please describe):

What is the current behavior?

While working on the Angular bindings and applying the binding to a couple starter projects, as well as long-lived projects, I discovered that the bindings weren't relying on the abstracted system layer. This would cause me to need to install nodePolyfills/rollup-plugin-node-polyfills during compilation. This causes some pretty huge confusion points as the onboarding of a binding then causes folks to poke around at docs in order to understand the issue.

GitHub Issue Number: N/A

What is the new behavior?

This PR adds 6 new items to the Compiler system.

  • EOL - the end of line character for the platform the system is running on.
  • joinPaths - the path.join option
  • isAbsolutePath - a function to determine if a string represents an absolute path
  • basename - returns the last part of a path (link)
  • dirname - returns the directory name of a path (link)
  • relative - returns the relative path from one directory to another (link)

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

Testing

I NPM linked this in the output target's repo, and in the starter libraries & my long-lived repo. I then rewrote parts of the Angular output target code to leverage to updated system, instead of importing from path, os, and more. I will have a corresponding PR for the output targets repo shortly.

Other information

splitinfinities avatar Nov 11 '21 07:11 splitinfinities

Hi @splitinfinities, since we are just importing and exporting again, what is the benefit of an end user using the path methods exported here vs importing path in their own project?

willmartian avatar Dec 06 '21 15:12 willmartian