Skip to content

Commit d69a18c

Browse files
committed
add product pages
1 parent 4d11b34 commit d69a18c

File tree

10 files changed

+277
-0
lines changed

10 files changed

+277
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Release Chrome Extension'
2+
description: 'Publish a chrome extension in the Chrome Web Store'
3+
author: "Shin'ya Ueoka"
4+
5+
inputs:
6+
extension-id:
7+
description: 'ID of the extension to be published'
8+
required: true
9+
extension-path:
10+
description: 'Path to the extension to be published'
11+
required: true
12+
oauth-client-id:
13+
description: 'OAuth Client ID for Chrome Web Store API'
14+
required: true
15+
oauth-client-secret:
16+
description: 'OAuth Client Secret for Chrome Web Store API'
17+
required: true
18+
oauth-refresh-token:
19+
description: 'OAuth Refresh Token for Chrome Web Store API'
20+
required: true
21+
22+
runs:
23+
using: 'node16'
24+
main: 'index.js'
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: 'Release Firefox addon'
2+
description: 'Release a Firefox add-on to addons.mozilla.org by uploading a zip file with optional source file'
3+
author: "Shin'ya Ueoka"
4+
5+
inputs:
6+
addon-id:
7+
description: 'ID of the add-on to be published in numeric or UUID format, or the add-on slug.'
8+
required: true
9+
addon-path:
10+
description: 'Path to the add-on file to be published'
11+
required: true
12+
source-path:
13+
description: 'Optional path to the source file of the version. This is nessesary if the version contains minified, concatenated, or transpiled code.'
14+
approval-note:
15+
description: 'Optional note to help reviewers such as how to build the add-on or how to test with test accounts'
16+
compatibility-firefox-min:
17+
description: 'Minimum version of Firefox that the version is compatible with'
18+
compatibility-firefox-max:
19+
description: 'Maximum version of Firefox that the version of the add-on is compatible with'
20+
license:
21+
description: 'License of the version'
22+
release-note:
23+
description: 'Information about changes in the new version. Note that this field supports only locale "en-US".'
24+
channel:
25+
description: 'Channel to publish the version. This field supports only "listed" and "unlisted".'
26+
default: 'listed'
27+
auth-api-issuer:
28+
description: 'An API key of the JWT token for authentication'
29+
required: true
30+
auth-api-secret:
31+
description: 'An API secret of the JWT token for authentication'
32+
required: true
33+
34+
outputs:
35+
version:
36+
description: 'Version number of the uploaded version'
37+
version-id:
38+
description: 'ID of the uploaded version in numeric format'
39+
version-edit-url:
40+
description: 'URL of the edit page of the uploaded version'
41+
42+
runs:
43+
using: 'node16'
44+
main: 'index.js'

data/actions/setup-chrome.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: 'Setup Chrome'
2+
description: 'Install and setup Google Chrome and Chromium'
3+
author: "Shin'ya Ueoka"
4+
inputs:
5+
chrome-version:
6+
description: |-
7+
The Google Chrome/Chromium version to install and use.
8+
default: latest
9+
required: false
10+
install-dependencies:
11+
description: |-
12+
Install dependent packages for Google Chrome/Chromium (Linux only).
13+
default: false
14+
install-chromedriver:
15+
description: |-
16+
Install the compatible version of ChromeDriver with the installed Google Chrome/Chromium.
17+
default: false
18+
no-sudo:
19+
description: |-
20+
Do not use sudo to install Google Chrome/Chromium (Linux only).
21+
default: false
22+
outputs:
23+
chrome-version:
24+
description: 'The installed Google Chrome/Chromium version. Useful when given a latest version.'
25+
chrome-path:
26+
description: 'The installed Google Chrome/Chromium path.'
27+
chromedriver-version:
28+
description: 'The installed ChromeDriver version. Useful when given a latest version.'
29+
chromedriver-path:
30+
description: 'The installed ChromeDriver path.'
31+
runs:
32+
using: 'node20'
33+
main: 'index.js'

data/actions/setup-edge.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Setup Edge'
2+
description: 'Install and setup Microsoft Edge'
3+
author: "Shin'ya Ueoka"
4+
inputs:
5+
edge-version:
6+
description: |-
7+
The Edge version to be installed. Supported versions are "stable", "beta", "dev"
8+
default: stable
9+
required: false
10+
outputs:
11+
edge-version:
12+
description: 'The installed Edge version. Useful when given a latest version.'
13+
edge-path:
14+
description: 'The installed Edge path.'
15+
runs:
16+
using: 'node20'
17+
main: 'index.js'

data/actions/setup-firefox.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: 'Setup Firefox'
2+
description: 'Install and setup Firefox'
3+
author: "Shin'ya Ueoka"
4+
inputs:
5+
firefox-version:
6+
description: 'The Firefox version to install and use. Examples: 84.0, 84.0.1, latest-esr'
7+
outputs:
8+
firefox-version:
9+
description: 'The installed Firefox version. Useful when given a latest version.'
10+
firefox-path:
11+
description: 'The installed Firefox path.'
12+
runs:
13+
using: 'node20'
14+
main: 'index.js'

gatsby-node.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as fs from "node:fs";
2+
import * as path from "node:path";
3+
import type { GatsbyNode } from "gatsby";
4+
import * as yaml from "js-yaml";
5+
import type { ActionType } from "./src/types";
6+
7+
export const createPages: GatsbyNode["createPages"] = async ({
8+
actions: { createPage },
9+
}) => {
10+
const actionFiles = (await fs.promises.readdir("./data/actions")).filter(
11+
(file) => file.endsWith(".yaml") || file.endsWith(".yml"),
12+
);
13+
14+
for (const file of actionFiles) {
15+
const slug = path.basename(file, path.extname(file));
16+
const content = await fs.promises.readFile(
17+
`./data/actions/${file}`,
18+
"utf-8",
19+
);
20+
const { name, description, inputs, outputs } = yaml.load(
21+
content,
22+
) as ActionType;
23+
createPage({
24+
path: `/${slug}/`,
25+
component: path.resolve("./src/templates/action.tsx"),
26+
context: {
27+
name: slug,
28+
action: {
29+
name,
30+
description,
31+
inputs,
32+
outputs,
33+
},
34+
},
35+
});
36+
}
37+
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"gatsby-transformer-sharp": "^5.13.1",
2626
"grommet": "^2.38.0",
2727
"grommet-icons": "^4.12.1",
28+
"js-yaml": "^4.1.0",
2829
"react": "^18.2.0",
2930
"react-dom": "^18.2.0",
3031
"styled-components": "^6.1.11"

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/templates/action.tsx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import type { HeadFC, PageProps } from "gatsby";
2+
import {
3+
Box,
4+
Heading,
5+
NameValueList,
6+
NameValuePair,
7+
Page,
8+
PageContent,
9+
Paragraph,
10+
} from "grommet";
11+
import { Layout } from "../components/layout";
12+
import type { ActionType } from "../types";
13+
14+
interface Props {
15+
pageContext: {
16+
name: string;
17+
action: ActionType;
18+
};
19+
}
20+
21+
const ActionPage: React.FC<PageProps & Props> = ({ pageContext }) => {
22+
const { name, action } = pageContext;
23+
return (
24+
<Layout>
25+
<Page kind="narrow" margin={{ vertical: "xlarge" }}>
26+
<PageContent>
27+
<Heading level="1" margin="none">
28+
{name}
29+
</Heading>
30+
<Paragraph>{action.description}</Paragraph>
31+
32+
<Heading level="2">Inputs</Heading>
33+
{action.inputs ? (
34+
<NameValueList>
35+
{Object.entries(action.inputs).map(([key, { description }]) => (
36+
<NameValuePair key={key} name={key}>
37+
{description}
38+
</NameValuePair>
39+
))}
40+
</NameValueList>
41+
) : (
42+
<Paragraph>No inputs</Paragraph>
43+
)}
44+
45+
<Heading level="2">Outputs</Heading>
46+
{action.outputs ? (
47+
<NameValueList>
48+
{Object.entries(action.outputs).map(([key, { description }]) => (
49+
<NameValuePair key={key} name={key}>
50+
{description}
51+
</NameValuePair>
52+
))}
53+
</NameValueList>
54+
) : (
55+
<Paragraph>No outputs</Paragraph>
56+
)}
57+
</PageContent>
58+
</Page>
59+
</Layout>
60+
);
61+
};
62+
63+
export const Head: HeadFC = () => <title>Home Page</title>;
64+
65+
export default ActionPage;

src/types.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type ActionInputType = {
2+
description: string;
3+
required?: boolean;
4+
default?: string;
5+
deprecationMessage?: string;
6+
};
7+
8+
type ActionOutputType = {
9+
description: string;
10+
};
11+
12+
type ActionJavaScriptRunsType = {
13+
using: string;
14+
main: string;
15+
pre?: string;
16+
"pre-if"?: string;
17+
post?: string;
18+
"post-if"?: string;
19+
};
20+
21+
export type ActionType = {
22+
name: string;
23+
description: string;
24+
author?: string;
25+
inputs?: Record<string, ActionInputType>;
26+
outputs?: Record<string, ActionOutputType>;
27+
runs: ActionJavaScriptRunsType;
28+
};

0 commit comments

Comments
 (0)