Skip to content

Update build/distribution tooling. - #10

Merged
jgerigmeyer merged 3 commits into
mainfrom
dev-tooling
Aug 11, 2022
Merged

Update build/distribution tooling.#10
jgerigmeyer merged 3 commits into
mainfrom
dev-tooling

Conversation

@jgerigmeyer

@jgerigmeyer jgerigmeyer commented Aug 10, 2022

Copy link
Copy Markdown
Member

  • Compile TS to JS and distribute type defs
  • Bundle JS into ESM + UMD (CJS/IIFE) bundles
  • Transpile all code (including npm deps) down to es6 target browsers

@jgerigmeyer
jgerigmeyer marked this pull request as ready for review August 10, 2022 15:33

@jgerigmeyer jgerigmeyer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sanajaved7 @oluoluoxenfree @jerivas This is an initial pass, ready for review/feedback.

Comment thread package.json
"test:ci": "run-p test:unit:ci test:e2e:ci"
},
"devDependencies": {
"@floating-ui/dom": "^1.0.1",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we're bundling (and transpiling) any dependencies into our published polyfill, then they are no longer actually "dependencies" for consumers.

Comment thread src/fetching.ts
Comment on lines +27 to +52

// @@@ Testing purposes...
console.log('running');
applyPolyfill();
}

// @@@ This is just to test that the floating-ui code can run...
function applyPolyfill() {
const referenceElement: HTMLElement | null =
document.querySelector('#button');
const floatingElement: HTMLElement | null =
document.querySelector('#my-popup');

if (referenceElement && floatingElement) {
const applyStyles = ({ x = 0, y = 0, strategy = 'absolute' } = {}) => {
Object.assign(floatingElement.style, {
position: strategy,
left: `${x}px`,
top: `${y}px`,
});
};

computePosition(referenceElement, floatingElement, {
placement: 'bottom',
}).then(applyStyles);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

All this stuff can get removed/replaced with the actual polyfill code -- it's just to test that this package can be installed/run, including the floating-ui code.

Comment thread vite.config.ts
fileName: 'css-anchor-positioning',
formats: ['es', 'umd', 'iife'],
},
target: 'es6',

@jgerigmeyer jgerigmeyer Aug 10, 2022

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@sanajaved7 @oluoluoxenfree @jerivas Right now this is targeting es6, which is pretty straightforward. If we want to target es5 we might need to consider a different build tool (Babel?) -- Vite and esbuild do not support es5 transpilation yet.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ES2020+ 😎

Comment thread src/index.ts
import { transformCSS } from './fetching.js';

// Expose API
// @@@ This should be replaced with the actual API we want to expose

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Again, just for testing purposes. I imagine that the API we want to expose would go here.

@jgerigmeyer

Copy link
Copy Markdown
Member Author

Refine build process

@jgerigmeyer
jgerigmeyer merged commit 1abfd7e into main Aug 11, 2022
@jgerigmeyer
jgerigmeyer deleted the dev-tooling branch August 11, 2022 16:49
@VicGUTT

VicGUTT commented Aug 11, 2022

Copy link
Copy Markdown

Yay this has been merged ! :)

But quick question, are folks able to see my comments other than "ES2020+ 😎" ? 🤔 Where I tried to "start reviews" and provide some feedback to the implementation.

If not, please let me know, I'll try to re-post them or screenshot what I'm seeing.

@jerivas

jerivas commented Aug 11, 2022

Copy link
Copy Markdown
Member

I only see the ES2020 comment 😕 Did you "submit" the review after adding inline comments (top right corner)?

Comment thread package.json
Comment thread vite.config.ts
@VicGUTT

VicGUTT commented Aug 13, 2022

Copy link
Copy Markdown

I only see the ES2020 comment 😕 Did you "submit" the review after adding inline comments (top right corner)?

Wow good catch, thank you. I won't be making that mistake again ^^

@jgerigmeyer

Copy link
Copy Markdown
Member Author

But quick question, are folks able to see my comments other than "ES2020+ 😎" ?

@VicGUTT I made some changes based on your suggestions -- please review #12 when you are able. Thanks!

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.

4 participants