Skip to content
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

add releases to JSR #291

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "@eta-dev/eta",
"version": "3.4.0",
"exports": "./src/index.ts",
"publish": {
"include": [
"LICENSE",
"README.md",
"src/**/*.ts"
]
}
}
4 changes: 4 additions & 0 deletions jsr.release.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require('node:fs').writeFileSync('jsr.json', JSON.stringify({
...require('./jsr.json'),
"version": require('./package.json').version,
}, null, 2) + '\n');
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -52,7 +52,8 @@
"format": "prettier --write '{src,test}/**/**.ts'",
"lint": "eslint src/*.ts test/*.spec.ts --ext .js,.ts",
"prebuild": "rimraf dist",
"release": "npm run build && np",
"release": "npm run build && np && npx jsr publish",
"postversion": "node ./jsr.release.js",
"size": "size-limit",
"start": "microbundle watch",
"test": "jest --coverage && npm run size",
2 changes: 1 addition & 1 deletion src/compile-string.ts
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@ return __eta.res;
* ```
*/

export function compileBody(this: Eta, buff: Array<AstObject>) {
export function compileBody(this: Eta, buff: Array<AstObject>): string {
const config = this.config;

let i = 0;
6 changes: 3 additions & 3 deletions src/core.ts
Original file line number Diff line number Diff line change
@@ -34,8 +34,8 @@ export class Eta {
renderStringAsync = renderStringAsync;

filepathCache: Record<string, string> = {};
templatesSync = new Cacher<TemplateFunction>({});
templatesAsync = new Cacher<TemplateFunction>({});
templatesSync: Cacher<TemplateFunction> = new Cacher<TemplateFunction>({});
Copy link
Contributor

Choose a reason for hiding this comment

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

These annotations are useless thanks to TypeScript type inference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, JSR complains though; it won't generate docs for types that take too many cycles to resolve; running the dry-run it said to add explicit types for those interfaces to enable auto-docs.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, now I understand 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any speedup is probably imperceptible on these in any non-constrained system, but I figured it wouldn't hurt to add them.

templatesAsync: Cacher<TemplateFunction> = new Cacher<TemplateFunction>({});

// resolvePath takes a relative path from the "views" directory
resolvePath: null | ((this: Eta, template: string, options?: Partial<Options>) => string) = null;
@@ -47,7 +47,7 @@ export class Eta {
this.config = { ...this.config, ...customConfig };
}

withConfig(customConfig: Partial<EtaConfig>) {
withConfig(customConfig: Partial<EtaConfig>): this & { config: EtaConfig }{
return { ...this, config: { ...this.config, ...customConfig } };
}