Skip to content

Commit

Permalink
Add boilerplate code
Browse files Browse the repository at this point in the history
  • Loading branch information
arcatdmz committed Jul 5, 2020
0 parents commit 8df2ca0
Show file tree
Hide file tree
Showing 15 changed files with 9,561 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

root = true

[*]
charset = utf-8
indent_size = 2
38 changes: 38 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: github-pages
on:
push:
branches:
- master
jobs:
deploy:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: https://registry.npmjs.org/
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci --no-optional
- name: Build pages
run: npm run build-pages
env:
GITHUB_PAGES: true
- name: Export pages
run: npm run export-pages
- name: Build API docs
run: npm run build-docs
- name: Deploy pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/out
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: npm-publish
on:
push:
tags:
- "v*"
jobs:
npm-publish:
name: npm-publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "12.x"
registry-url: https://registry.npmjs.org/
scope: "@arch-inc"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- name: Build package
run: npm run build
- name: Publish package
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
dist/
.next/
out/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.formatOnSave": true
}
2 changes: 2 additions & 0 deletions docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
7 changes: 7 additions & 0 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const basePath = process.env.GITHUB_PAGES ? "/react-color-modal" : "";
module.exports = {
experimental: {
basePath
},
env: { BASE_PATH: basePath }
}
137 changes: 137 additions & 0 deletions docs/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import { useMemo, useRef, useEffect } from "react";
import { NextPage } from "next";
import Head from "next/head";
import {
Container,
Message,
Divider,
List,
Icon,
Header,
} from "semantic-ui-react";

const basePath = process.env.BASE_PATH.replace(/\/$/, "");
const packageName = "react-color-modal";
const description = "Yet another color picker component for React";

const Index: NextPage = () => {
return (
<>
<Head>
<title key="title">
{packageName} | {description}
</title>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.css"
></link>
</Head>
<style jsx>{`
:global(html, body) {
background: #eee;
}
div.hero {
padding: 3em 0;
}
div.main.content {
background: #fff;
padding: 2em 0 0 0;
}
div.demo-wrapper {
background: #f5f5f5;
margin: 2em auto 0 auto;
padding: 2em 0;
}
footer {
padding: 2em 0;
}
`}</style>
<div className="hero">
<Container>
<Header as="h1" content={packageName} subheader={description} />
</Container>
</div>
<div className="main content">
<Container>
<Message
header="How to install"
content={
<>
<pre>npm i @arch-inc/{packageName}</pre>
<p>
For more details on how to use this library, please refer to
the following documents.
</p>
</>
}
/>
<div className="ui selection divided list">
<a
className="item"
href={`https://www.npmjs.com/package/@arch-inc/${packageName}`}
>
<i className="npm icon"></i>
<div className="content">
<div className="header">NPM package registry</div>
<div className="description">@arch-inc/{packageName}</div>
</div>
</a>
<a
className="item"
href={`https://github.com/arch-inc/${packageName}`}
>
<i className="github icon"></i>
<div className="content">
<div className="header">GitHub repository</div>
<div className="description">@arch-inc/{packageName}</div>
</div>
</a>
<a
className="item"
href={`https://arch-inc.github.io/${packageName}/api/globals.html`}
>
<i className="file alternate outline icon"></i>
<div className="content">
<div className="header">API document</div>
<div className="description">
automatically generated with TypeDoc
</div>
</div>
</a>
</div>
</Container>
<div className="demo-wrapper">
<Container>
<Header as="h3" content="Live demo" />
<p>...</p>
<Divider />
<p>...</p>
</Container>
</div>
</div>
<footer>
<Container>
<List horizontal divided>
<List.Item
content={
<>
&copy; <a href="//research.archinc.jp">Arch Inc.</a> 2020
</>
}
/>
<List.Item
content={
<a href={`https://github.com/arch-inc/${packageName}`}>
<Icon name="github" /> arch-inc/{packageName}
</a>
}
/>
</List>
</Container>
</footer>
</>
);
};

export default Index;
26 changes: 26 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"./next-env.d.ts",
"**/*.ts",
"**/*.tsx"
]
}
3 changes: 3 additions & 0 deletions lib/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function hello() {
console.log("hello world!");
}
2 changes: 2 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

export * from "./hello";
Loading

0 comments on commit 8df2ca0

Please sign in to comment.