forked from bony2023/react-terminal
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
On branch develop new file: .eslintrc.json new file: .github/workflows/npmpublish.yml new file: .gitignore new file: .pre-commit-config.yaml new file: package.json new file: rollup.config.js new file: src/components/Controls.tsx new file: src/components/Editor.tsx new file: src/components/Terminal.tsx new file: src/contexts/StyleContext.tsx new file: src/contexts/index.tsx new file: src/global.d.tsx new file: src/index.scss new file: src/index.tsx new file: src/styles/controls.scss new file: src/styles/editor.scss new file: src/styles/terminal.scss new file: src/styles/variables.scss new file: tsconfig.json new file: yarn.lock
- Loading branch information
0 parents
commit 775c505
Showing
20 changed files
with
6,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"plugin:react/recommended", | ||
"airbnb" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaFeatures": { | ||
"jsx": true | ||
}, | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"react", | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Node.js Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
|
||
publish-npm: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
|
||
publish-gpr: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://npm.pkg.github.com/ | ||
scope: '@your-github-username' | ||
- run: npm ci | ||
- run: npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
|
||
# Created by https://www.gitignore.io/api/node | ||
# Edit at https://www.gitignore.io/?templates=node | ||
|
||
### Node ### | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# rollup.js default build output | ||
dist/ | ||
|
||
# Uncomment the public line if your project uses Gatsby | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav | ||
# public | ||
|
||
# Storybook build outputs | ||
.out | ||
.storybook-out | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# Temporary folders | ||
tmp/ | ||
temp/ | ||
|
||
# End of https://www.gitignore.io/api/node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
- repo: https://github.com/pre-commit/mirrors-eslint | ||
rev: 'v6.8.0' | ||
hooks: | ||
- id: eslint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{ | ||
"name": "react-terminal", | ||
"version": "0.1.0", | ||
"description": "React component that renders a terminal", | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
"build": "rollup -c", | ||
"watch": "rollup -cw", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"files": [ | ||
"dist/index.d.ts", | ||
"dist", | ||
"LICENCE", | ||
"package.json", | ||
"README.md" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/bony2023/react-terminal.git" | ||
}, | ||
"keywords": [ | ||
"node", | ||
"npm", | ||
"react", | ||
"terminal" | ||
], | ||
"author": "Bony Roopchandani", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/bony2023/react-terminal/issues" | ||
}, | ||
"homepage": "https://github.com/bony2023/react-terminal#readme", | ||
"devDependencies": { | ||
"@types/react": "^16.9.17", | ||
"@types/react-dom": "^16.9.4", | ||
"@typescript-eslint/eslint-plugin": "^2.14.0", | ||
"@typescript-eslint/parser": "^2.14.0", | ||
"eslint": "^6.8.0", | ||
"eslint-config-airbnb": "^18.0.1", | ||
"eslint-plugin-import": "^2.19.1", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.17.0", | ||
"eslint-plugin-react-hooks": "^1.7.0", | ||
"node-sass": "^4.13.0", | ||
"rollup": "^1.27.14", | ||
"rollup-plugin-postcss": "^2.0.3", | ||
"rollup-plugin-terser": "^5.1.3", | ||
"rollup-plugin-typescript2": "^0.25.3", | ||
"source-map-loader": "^0.2.4", | ||
"ts-loader": "^6.2.1", | ||
"typescript": "^3.7.4", | ||
"webpack": "^4.41.5", | ||
"webpack-cli": "^3.3.10" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
import { terser } from 'rollup-plugin-terser'; | ||
import pkg from './package.json'; | ||
|
||
export default { | ||
input: 'src/index.tsx', | ||
output: [ | ||
{ | ||
file: pkg.main, | ||
format: 'cjs', | ||
}, | ||
{ | ||
file: pkg.module, | ||
format: 'es', | ||
}, | ||
], | ||
external: [ | ||
...Object.keys(pkg.dependencies || {}), | ||
...Object.keys(pkg.peerDependencies || {}), | ||
], | ||
plugins: [ | ||
postcss({ | ||
extract: false, | ||
modules: true, | ||
use: ['sass'], | ||
}), | ||
typescript({ | ||
/* eslint-disable global-require */ | ||
typescript: require('typescript'), | ||
/* eslint-enable global-require */ | ||
}), | ||
terser(), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from 'react' | ||
import { StyleContext } from "../contexts/StyleContext" | ||
|
||
|
||
export default function Controls(props: any) { | ||
const style = React.useContext(StyleContext) | ||
|
||
let controls = props.controls.map((control: string, index: number) => { | ||
return ( | ||
<div key={index} className={`${style.consoleCtrl} ${style[control]}`}></div> | ||
) | ||
}) | ||
|
||
return ( | ||
<div className={style.controls}> | ||
{controls} | ||
</div> | ||
) | ||
} | ||
|
||
Controls.defaultProps = { | ||
controls: ["close", "minimize", "maximize"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as React from 'react' | ||
import { StyleContext } from "../contexts/StyleContext" | ||
|
||
|
||
export default function Editor(props: any) { | ||
const style = React.useContext(StyleContext) | ||
|
||
return ( | ||
<div className={style.editor}> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import * as React from "react" | ||
import { StyleContext } from "../contexts/StyleContext" | ||
|
||
import Controls from "./Controls" | ||
import Editor from "./Editor" | ||
|
||
|
||
export default function Terminal(props: any) { | ||
const style = React.useContext(StyleContext) | ||
|
||
return ( | ||
<div className={style.terminal}> | ||
<Controls {...props.controls}/> | ||
<Editor {...props.editor}/> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as React from "react" | ||
import * as style from "../index.scss" | ||
|
||
|
||
export const StyleContext = React.createContext(null) | ||
|
||
|
||
export const StyleContextProvider = (props: any) => { | ||
|
||
return ( | ||
<StyleContext.Provider value={style.default}> | ||
{props.children} | ||
</StyleContext.Provider> | ||
) | ||
} | ||
|
||
export default { | ||
StyleContext, | ||
StyleContextProvider | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import * as React from "react" | ||
import { StyleContextProvider } from "./StyleContext" | ||
|
||
|
||
export default function ContextProvider(props: any) { | ||
return ( | ||
<StyleContextProvider> | ||
{props.children} | ||
</StyleContextProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare module '*.scss' { | ||
const content: { [className: string]: string }; | ||
export = content; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
@import "./styles/variables.scss"; | ||
@import "./styles/controls.scss"; | ||
@import "./styles/editor.scss"; | ||
@import "./styles/terminal.scss"; |
Oops, something went wrong.