Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xcatliu committed Jul 18, 2021
1 parent 90e0fa1 commit 13d803f
Show file tree
Hide file tree
Showing 16 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<img src="https://img.shields.io/badge/Deno-1.12.0-brightgreen.svg?logo=deno" alt="deno" />
</a>
<a href="https://pagic.org">
<img src="https://img.shields.io/badge/Pagic-v1.3.1-orange.svg" alt="pagic" />
<img src="https://img.shields.io/badge/Pagic-v1.4.0-orange.svg" alt="pagic" />
</a>
<a href="https://discord.gg/vn3VvdUycW">
<img src="https://img.shields.io/discord/785366263823335424" alt="discord" />
Expand Down
2 changes: 1 addition & 1 deletion cloudbaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"pagic": {
"use": "@cloudbase/framework-plugin-website",
"inputs": {
"buildCommand": "cd pagic.cn && deno run --unstable --allow-read --allow-write build.ts && deno run --unstable --allow-read --allow-write --allow-net --allow-run https://deno.land/x/pagic@v1.3.1/mod.ts build",
"buildCommand": "cd pagic.cn && deno run --unstable --allow-read --allow-write build.ts && deno run --unstable --allow-read --allow-write --allow-net --allow-run https://deno.land/x/pagic@v1.4.0/mod.ts build",
"outputPath": "pagic.cn/dist"
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pagic",
"version": "1.3.1",
"version": "1.4.0",
"description": "A static site generator powered by Deno + React",
"main": "mod.ts",
"scripts": {
Expand Down
10 changes: 5 additions & 5 deletions pagic.org/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Additional elements that need to be injected into the HTML `<head>` of the curre
For example, add a custom favicon:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
head: <link rel="icon" type="image/png" href="/favicon.png" />,
Expand All @@ -278,7 +278,7 @@ export default {
If you need to inject multiple elements, you need to wrap it with `<>` tags:

```tsx {5,8}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
head: (
Expand All @@ -299,7 +299,7 @@ export default {
Navigation configuration, an example is as follows:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
nav: [
Expand Down Expand Up @@ -413,7 +413,7 @@ In the above example:
Ads displayed at the top of the table of content, an example is as follows:
```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
tocAd: (
Expand Down Expand Up @@ -463,7 +463,7 @@ export default {
The footer of all pages, an example is as follows:
```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
footer: (
Expand Down
8 changes: 4 additions & 4 deletions pagic.org/docs/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ site/
Its content is:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => <h1>Hello world</h1>;

Expand Down Expand Up @@ -227,7 +227,7 @@ Pagic will not only execute the logic in the `tsx` file when building the page,
For example, we can use `React.setState` to implement a counter page:

```tsx {4,9}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => {
const [count, setCount] = React.useState(0);
Expand Down Expand Up @@ -263,7 +263,7 @@ site/
In the above example, `hello.tsx` will be constructed as `dist/hello.html`, and `_count.tsx` will not be constructed as a page because it starts with `_`. In this way, we can split the `Count` component into the `_count.tsx` file, and then import it in `hello.tsx`:

```tsx {3,8}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

import Count from './_count.tsx';

Expand All @@ -282,7 +282,7 @@ export default Hello;
Similar to `md` files, `tsx` files also support frontMatter, which is achieved by exporting a `frontMatter` object:

```tsx {7-9}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => <h1>Hello world</h1>;

Expand Down
2 changes: 1 addition & 1 deletion pagic.org/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Build gh-pages
run: |
deno --version
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.3.1/mod.ts
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.4.0/mod.ts
pagic build
- name: Deploy gh-pages
Expand Down
4 changes: 2 additions & 2 deletions pagic.org/docs/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ site/
The content of `_layout.tsx` is as follows:

```tsx
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Layout: PagicLayout = ({ title, content }) => (
<html>
Expand Down Expand Up @@ -93,7 +93,7 @@ site/
In the above example, `hello.tsx` will be constructed as `dist/hello.html`, and `_sidebar.tsx` will not be constructed as a page because it starts with `_`. In this way, you can split the `Sidebar` component into the `_sidebar.tsx` file, and then import it in `_layout.tsx`:

```tsx {3,12}
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

import Sidebar from './_sidebar.tsx';

Expand Down
2 changes: 1 addition & 1 deletion pagic.org/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ The `fn` function is the core logic of the plugin. Since its parameter `pagic` i
For example, we can create a plugin that adds a prefix to the `title` of all pages:

```ts {6-15}
import { PagicPlugin } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { PagicPlugin } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const prependTitle: PagicPlugin = {
name: 'prepend_title',
Expand Down
2 changes: 1 addition & 1 deletion pagic.org/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ deno install --unstable --allow-read --allow-write --allow-net --allow-run --nam
If you need to install a specific version of Pagic, you can add the version in the URL:

```bash
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.3.1/mod.ts
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.4.0/mod.ts
```

> Pagic will only require the necessary permissions. If you want to further restrict Pagic's runtime permissions, you can limit it by specifying the read and write directories:
Expand Down
10 changes: 5 additions & 5 deletions pagic.org/zh-CN/docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default {
举个例子,增加一个自定义的 favicon:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
head: <link rel="icon" type="image/png" href="/favicon.png" />,
Expand All @@ -279,7 +279,7 @@ export default {
如果需要引入多个标签,则需要用 `<>` 标签包裹:

```tsx {5,8}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
head: (
Expand All @@ -300,7 +300,7 @@ export default {
导航栏配置,示例如下:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
nav: [
Expand Down Expand Up @@ -414,7 +414,7 @@ export default {
展示在目录上方的广告,示例如下:
```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
tocAd: (
Expand Down Expand Up @@ -464,7 +464,7 @@ export default {
页面底部,会展示在所有页面里,示例如下:
```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

export default {
footer: (
Expand Down
8 changes: 4 additions & 4 deletions pagic.org/zh-CN/docs/content.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ site/
它的内容是:

```tsx
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => <h1>Hello world</h1>;

Expand Down Expand Up @@ -227,7 +227,7 @@ Pagic 不仅会在渲染页面时执行 `tsx` 文件中的逻辑,而且其中
比如,我们可以使用 `React.setState` 实现一个计数器页面:

```tsx {4,9}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => {
const [count, setCount] = React.useState(0);
Expand Down Expand Up @@ -263,7 +263,7 @@ site/
在上面的例子中,`hello.tsx` 会被构建为 `dist/hello.html`,而 `_count.tsx` 由于是 `_` 开头,所以不会被构建为页面。这样就可以实现对 `hello.tsx` 的拆分,将 `Count` 组件拆分到 `_count.tsx` 文件中,然后在 `hello.tsx` 中引用即可:

```tsx {3,8}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

import Count from './_count.tsx';

Expand All @@ -282,7 +282,7 @@ export default Hello;
`md` 文件类似,`tsx` 文件也支持头信息,它是通过导出一个 `frontMatter` 对象实现的:

```tsx {7-9}
import { React } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Hello = () => <h1>Hello world</h1>;

Expand Down
2 changes: 1 addition & 1 deletion pagic.org/zh-CN/docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Build gh-pages
run: |
deno --version
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.3.1/mod.ts
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.4.0/mod.ts
pagic build
- name: Deploy gh-pages
Expand Down
4 changes: 2 additions & 2 deletions pagic.org/zh-CN/docs/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ site/
其中 `_layout.tsx` 的内容如下:

```tsx
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const Layout: PagicLayout = ({ title, content }) => (
<html>
Expand Down Expand Up @@ -93,7 +93,7 @@ site/
在上面的例子中,`hello.tsx` 会被构建为 `dist/hello.html`,而 `_sidebar.tsx` 由于是 `_` 开头,所以不会被构建为页面。这样就可以实现对 `_layout.tsx` 的拆分,将 `Sidebar` 组件拆分到 `_sidebar.tsx` 文件中,然后在 `_layout.tsx` 中引用即可:

```tsx {3,12}
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { React, PagicLayout } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

import Sidebar from './_sidebar.tsx';

Expand Down
2 changes: 1 addition & 1 deletion pagic.org/zh-CN/docs/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ interface PagicPlugin {
比如,我们可以创建一个插件,它给所有页面的 `title` 加一个前缀:

```ts {6-15}
import { PagicPlugin } from 'https://deno.land/x/pagic@v1.3.1/mod.ts';
import { PagicPlugin } from 'https://deno.land/x/pagic@v1.4.0/mod.ts';

const prependTitle: PagicPlugin = {
name: 'prepend_title',
Expand Down
2 changes: 1 addition & 1 deletion pagic.org/zh-CN/docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ deno install --unstable --allow-read --allow-write --allow-net --allow-run --nam
若需要安装指定版本的 Pagic,则可以在安装的 URL 中加入版本号:

```bash
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.3.1/mod.ts
deno install --unstable --allow-read --allow-write --allow-net --allow-run --name=pagic https://deno.land/x/pagic@v1.4.0/mod.ts
```

> Pagic 只会要求必须用到的权限,如果你希望更进一步限制 Pagic 运行时的权限,可以通过指定读写目录的方式加以限制:
Expand Down

0 comments on commit 13d803f

Please sign in to comment.