-
Notifications
You must be signed in to change notification settings - Fork 475
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
Auto test + deploy using Github Action #567
Conversation
cc21f59
to
5b2bf01
Compare
All API and naming are keept for backward compatibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be broken up into smaller PRs, there's also some changes here that were not properly thought through. Honestly this would have been a lot easier to review if it was two PRs, a build system update and one that adds the github actions.
Sorry about that, I wanted the GithubActions to run without vulnerabilities, which lead me to updating our buildtools/testtool, which lead me to fix many lint warning etc... This is why I carefully split my commit by subjects (action, lint, ...) : to ease the reading (I hope you didn't read this PR as a single page ...). Also avoid repeating the same comment:
I hope I answered all your question and fix all the changed you asked. I think I'll add a jsdoc enforcement since some prototype ( |
Yeah sorry about the duplicated messages, I was trying an integrated PR reviewing tool in my code editor, I guess it applies the message to everywhere it finds a match if you use it during a code-search. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just need a little clarification on some stuff and one small change to package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
Before someone merges this, give me a second please, I want to add some things! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't have the time for a thorough test, working on too many other things... But I did quickly check this out and try it. Here is something I stumbled upon:
- I was a bit confused when running
npm run start
and instead of getting the dev server with the index.html, which I frequently use during development - So, I added the parameter
--servedir=\"./\"
to the start script, then we can open the pages at http://127.0.0.1:8000/docs/ (we should update the "Contribute" section in the README to lead new contributors there) - However, we have to change the paths to the js file in the html files as well,
src="dist/opentype.js"
tosrc="../dist/opentype.js"
(plus one level down for the files in /docs/examples). And we also need to add the parameter--global-name=opentype
to the script in order to have the opentype global available. - Unfortunately, esbuild doesn't support HMR (see serve dir evanw/esbuild#796) ☹ But at least we can add the parameters
--watch --footer:js=\"window.IS_DEV_BUILD=true\"
parameter and add this to the html files:
if(window.IS_DEV_BUILD) {
new EventSource('/esbuild').addEventListener('change', () => location.reload());
}
Now, the page will reload on file changes, which is good enough for me now. So, the final start script should look like this:
"start": "esbuild --bundle src/opentype.js --outdir=dist --external:fs --target=es2018 --watch --serve --servedir=\"./\"",
If you prefer, I can do those changes and add them to the PR, just let me know.
We must also not forget to set the GitHub pages root to the /docs folder!
But I have to say, I love how blazing fast the build process of esbuild is compared to even vite, which I mainly use for my projects right now. That's really great!
Another thing: I'm not able to run npm run test, getting Edit: And I think the test command should run the build and dist before running mocha, so we always have all the latest files. |
Shouldn't |
Good point, I'll change that 👍 |
rebased over #575 and over #572
Tell me if I missed anything |
- keep vulnerable mocha 8.x version since 9.x+ break import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, the page reload on rebuild does not get triggered...
And I have to double-escape all line breaks in the script parameters to \\n
in order for the scripts to work.
We can fix that later in order to get this finally over with, but could you please check if the commands still work for you with double-encoded line breaks?
Fixed, see #578
I can remove all {
"start": "esbuild --bundle src/opentype.js --outdir=dist --external:fs --target=es2018 --format=iife --out-extension:.js=.js --global-name=opentype --footer:js='(function (root, factory) {\nif (typeof define === \"function\" && define.amd)define(factory);\nelse if (typeof module === \"object\" && module.exports)module.exports = factory();\nelse root.opentype = factory();\n}(typeof self !== \"undefined\" ? self : this, () => ({...opentype, \"default\" : opentype })));' --watch --servedir=. --footer:js=\"new EventSource('/esbuild').addEventListener('change', () => location.reload())\"",
"b:umd": "esbuild --bundle src/opentype.js --outdir=dist --external:fs --target=es2018 --format=iife --out-extension:.js=.js --global-name=opentype --footer:js='(function (root, factory) {\nif (typeof define === \"function\" && define.amd)define(factory);\nelse if (typeof module === \"object\" && module.exports)module.exports = factory();\nelse root.opentype = factory();\n}(typeof self !== \"undefined\" ? self : this, () => ({...opentype, \"default\" : opentype })));'",
"d:umd": "esbuild --bundle src/opentype.js --outdir=dist --external:fs --target=es2018 --format=iife --out-extension:.js=.min.js --global-name=opentype --footer:js='(function (root, factory) {\nif (typeof define === \"function\" && define.amd)define(factory);\nelse if (typeof module === \"object\" && module.exports)module.exports = factory();\nelse root.opentype = factory();\n}(typeof self !== \"undefined\" ? self : this, () => ({...opentype, \"default\" : opentype })));' --minify --sourcemap",
} I'll let you try and tell me |
I just noticed that the font inspector and glyph inspector don't work, while the index page does: https://opentype.js.org/index.html |
The pages are working, but they "demo" font is not loaded (404)
I'll unify them all to Hotfixed : c75791a |
With the quotes stopped, the commands fail completely, so I guess we'll have to get rid of the line breaks! |
done: 234a535 |
Great! Can you add it to master? |
Sorry been out of the loop a little bit as i've been a bit busy. I'll spend tommorow trying to catch up. |
done |
Description
This PR add the following:
/docs/
folderMotivation and Context
I've made this PR because it's a burden to
How Has This Been Tested?
I've forked the opentype.js repos as opentype.yne.js and deployed it on NPM and on github page
I've also tested the following developer use cases (after
npm i opentype.yne.js
) :index.mjs
index.js
Types of changes
Checklist:
npm run test
and all tests passed green (including code styling checks).