Skip to content
Open
Show file tree
Hide file tree
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
69 changes: 0 additions & 69 deletions .github/workflows/deploy.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Builds the documentation site on every pull request and on pushes to
# master, so that a page that no longer renders, a dead link or a stale
# generated API page is caught before it reaches blazejs.org.
name: Docs

on:
push:
branches:
- master
pull_request:

permissions:
contents: read

jobs:
build-site:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js environment
uses: actions/setup-node@v6
with:
node-version: 22

- name: Install site dependencies
run: npm install
working-directory: site

- name: Link repository pages and regenerate the API pages
run: npm run docs:init && npm run docs:api
working-directory: site

- name: Check that the generated API pages match the JSDoc
run: git diff --exit-code -- site/source/api

- name: Build the site
run: npm run docs:build
working-directory: site
10 changes: 10 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Builds the documentation site (site/) on Netlify, which serves blazejs.org.
# Paths are relative to the base directory. Netlify installs the npm
# dependencies of site/ before running the command.
[build]
base = "site"
command = "npm run docs:init && npm run docs:api && npm run docs:build"
publish = ".vitepress/dist"

[build.environment]
NODE_VERSION = "22"
2 changes: 1 addition & 1 deletion packages/blaze/blaze.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ declare module 'meteor/blaze' {
class TemplateInstance<D = any> {
constructor(view: View);

$<TElement extends HTMLElement = HTMLElement>(selector: string): JQuery<TElement>;
$<TElement extends HTMLElement = HTMLElement>(selector: string): JQuery<TElement> | TElement[];
autorun(runFunc: (computation: Tracker.Computation) => void): Tracker.Computation;
data: D;
find(selector: string): HTMLElement;
Expand Down
4 changes: 2 additions & 2 deletions packages/blaze/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ Blaze.TemplateInstance = function (view) {
};

/**
* @summary Find all elements matching `selector` in this template instance, and return them as a JQuery object.
* @summary Find all elements matching `selector` in this template instance. Returns a jQuery object when the `jquery` package is installed, and an array of DOM elements otherwise.
* @locus Client
* @param {String} selector The CSS selector to match, scoped to the template contents.
* @returns {DOMNode[]}
* @returns {JQuery|DOMElement[]}
*/
Blaze.TemplateInstance.prototype.$ = function (selector) {
const view = this.view;
Expand Down
3 changes: 2 additions & 1 deletion site/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ node_modules/
.deploy*/
data
.vitepress/cache/
source/repo/*.md
source/repo/*.md
.vitepress/dist/
16 changes: 14 additions & 2 deletions site/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
title: "Blaze Docs",
srcDir: "source",
lang: 'en-US',
base: '/blaze/',
base: '/',
description: "The original MeteorJS Frontend",
head: [['link', {rel: 'icon', href: '/logo/icon.ico'}]],
lastUpdated: true,
Expand Down Expand Up @@ -136,7 +136,19 @@ export default defineConfig({
{ icon: "discord", link: "https://discord.gg/hZkTCaVjmT" },
],
editLink: {
pattern: 'https://github.com/meteor/blaze/edit/master/site/sources/:path'
pattern: 'https://github.com/meteor/blaze/edit/master/site/source/:path'
}
},
markdown: {
config: (md) => {
// Blaze docs are full of {{mustaches}} in inline code. Fenced code
// blocks already get v-pre; give inline code the same so Vue does
// not try to interpolate them.
const renderInlineCode = md.renderer.rules.code_inline
md.renderer.rules.code_inline = (tokens, idx, options, env, self) => {
tokens[idx].attrSet('v-pre', '')
return renderInlineCode(tokens, idx, options, env, self)
}
}
},
vite: {
Expand Down
25 changes: 16 additions & 9 deletions site/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
## Blaze JS - http://blazejs.org
## Blaze JS - https://blazejs.org

This is a [vitepress](https://vitepress.dev) static site used to generate
the [Blaze JS Documentation](http://blazejs.org/).
This is a [VitePress](https://vitepress.dev) site used to generate the
[Blaze JS documentation](https://blazejs.org/).

### Running locally

```
npm install
npm run docs:init # links CONTRIBUTING, CODE_OF_CONDUCT and SECURITY from the repository root
npm run docs:api # regenerates source/api/{blaze,spacebars,templates_api}.md from the JSDoc
npm run docs:dev
```

#### Generating `data.js`
`npm run docs:build` builds the static site into `.vitepress/dist`.

To generate the api boxes, the site uses a file `data/data.js` which is generated from the js docs in
the [Blaze source code](https://github.com/meteor/blaze). This will automatically happen whenever you start your local
hexo server.
### Generated API pages

#### Starting hexo
`source/api/blaze.md`, `source/api/spacebars.md` and `source/api/templates_api.md`
are generated from the JSDoc comments of the packages by `npm run docs:api` and
committed. Run it after changing a JSDoc comment: the `Docs` workflow fails when
they are out of date.

Ensure you've run `npm install`. Then simply `npm start`.
### Deployment

blazejs.org is served by Netlify, configured by `netlify.toml` at the repository
root: it builds `site/` with the three commands above and publishes
`.vitepress/dist`. The `Docs` workflow runs the same build on every pull request.
8 changes: 4 additions & 4 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"version": "0.0.0",
"private": true,
"scripts": {
"docs:init": "ln -f ../*.md source/repo/",
"docs:init": "mkdir -p source/repo && ln -f ../CONTRIBUTING.md ../CODE_OF_CONDUCT.md ../SECURITY.md source/repo/",
"docs:dev": "vitepress dev",
"docs:build": "vitepress build",
"docs:preview": "vitepress preview",
"docs:api": "jsdoc2md -m none -g none ../packages/blaze/*.js > source/api/blaze.md && jsdoc2md -m none -g none ../packages/spacebars/*.js > source/api/spacebars.md && jsdoc2md -m none -g none ../packages/templating-runtime/*.js > source/api/templates_api.md"
},
"devDependencies": {
"jsdoc": "^4.0.5",
"jsdoc-to-markdown": "^9.1.3",
"vitepress": "^2.0.0-alpha.16"
"jsdoc": "4.0.5",
"jsdoc-to-markdown": "9.1.3",
"vitepress": "2.0.0-alpha.21"
}
}
16 changes: 8 additions & 8 deletions site/source/api/blaze.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ and manipulate "Views," the building blocks of reactive templates.
* [.view](#Blaze.TemplateInstance+view) : [<code>View</code>](#Blaze.View)
* [.firstNode](#Blaze.TemplateInstance+firstNode) : <code>DOMNode</code>
* [.lastNode](#Blaze.TemplateInstance+lastNode) : <code>DOMNode</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>Array.&lt;DOMNode&gt;</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
* [.findAll(selector)](#Blaze.TemplateInstance+findAll) ⇒ <code>Array.&lt;DOMElement&gt;</code>
* [.find(selector)](#Blaze.TemplateInstance+find) ⇒ <code>DOMElement</code>
* [.autorun(runFunc)](#Blaze.TemplateInstance+autorun)
Expand Down Expand Up @@ -114,7 +114,7 @@ Same as the constructor argument.
* [.view](#Blaze.TemplateInstance+view) : [<code>View</code>](#Blaze.View)
* [.firstNode](#Blaze.TemplateInstance+firstNode) : <code>DOMNode</code>
* [.lastNode](#Blaze.TemplateInstance+lastNode) : <code>DOMNode</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>Array.&lt;DOMNode&gt;</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
* [.findAll(selector)](#Blaze.TemplateInstance+findAll) ⇒ <code>Array.&lt;DOMElement&gt;</code>
* [.find(selector)](#Blaze.TemplateInstance+find) ⇒ <code>DOMElement</code>
* [.autorun(runFunc)](#Blaze.TemplateInstance+autorun)
Expand Down Expand Up @@ -155,9 +155,9 @@ Same as the constructor argument.
**Locus**: Client
<a name="Blaze.TemplateInstance+$"></a>

#### templateInstance.$(selector) ⇒ <code>Array.&lt;DOMNode&gt;</code>
#### templateInstance.$(selector) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
**Kind**: instance method of [<code>TemplateInstance</code>](#Blaze.TemplateInstance)
**Summary**: Find all elements matching `selector` in this template instance, and return them as a JQuery object.
**Summary**: Find all elements matching `selector` in this template instance. Returns a jQuery object when the `jquery` package is installed, and an array of DOM elements otherwise.
**Locus**: Client

| Param | Type | Description |
Expand Down Expand Up @@ -784,7 +784,7 @@ error will be thrown. This is in contrast to
* [.view](#Blaze.TemplateInstance+view) : [<code>View</code>](#Blaze.View)
* [.firstNode](#Blaze.TemplateInstance+firstNode) : <code>DOMNode</code>
* [.lastNode](#Blaze.TemplateInstance+lastNode) : <code>DOMNode</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>Array.&lt;DOMNode&gt;</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
* [.findAll(selector)](#Blaze.TemplateInstance+findAll) ⇒ <code>Array.&lt;DOMElement&gt;</code>
* [.find(selector)](#Blaze.TemplateInstance+find) ⇒ <code>DOMElement</code>
* [.autorun(runFunc)](#Blaze.TemplateInstance+autorun)
Expand Down Expand Up @@ -880,7 +880,7 @@ Same as the constructor argument.
* [.view](#Blaze.TemplateInstance+view) : [<code>View</code>](#Blaze.View)
* [.firstNode](#Blaze.TemplateInstance+firstNode) : <code>DOMNode</code>
* [.lastNode](#Blaze.TemplateInstance+lastNode) : <code>DOMNode</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>Array.&lt;DOMNode&gt;</code>
* [.$(selector)](#Blaze.TemplateInstance+$) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
* [.findAll(selector)](#Blaze.TemplateInstance+findAll) ⇒ <code>Array.&lt;DOMElement&gt;</code>
* [.find(selector)](#Blaze.TemplateInstance+find) ⇒ <code>DOMElement</code>
* [.autorun(runFunc)](#Blaze.TemplateInstance+autorun)
Expand Down Expand Up @@ -921,9 +921,9 @@ Same as the constructor argument.
**Locus**: Client
<a name="Blaze.TemplateInstance+$"></a>

#### templateInstance.$(selector) ⇒ <code>Array.&lt;DOMNode&gt;</code>
#### templateInstance.$(selector) ⇒ <code>JQuery</code> \| <code>Array.&lt;DOMElement&gt;</code>
**Kind**: instance method of [<code>TemplateInstance</code>](#Blaze.TemplateInstance)
**Summary**: Find all elements matching `selector` in this template instance, and return them as a JQuery object.
**Summary**: Find all elements matching `selector` in this template instance. Returns a jQuery object when the `jquery` package is installed, and an array of DOM elements otherwise.
**Locus**: Client

| Param | Type | Description |
Expand Down
Loading
Loading