Skip to content

Commit 638f98b

Browse files
committed
first commit
0 parents  commit 638f98b

23 files changed

+984
-0
lines changed

.babelrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": ["es2015", "stage-0", "react"],
3+
"plugins": [
4+
"transform-decorators-legacy"
5+
]
6+
}

.eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "trendmicro",
3+
"parser": "babel-eslint",
4+
"env": {
5+
"browser": true,
6+
"node": true
7+
}
8+
}

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
npm-debug.log
3+
/.nyc_output
4+
/coverage
5+
/dist
6+
/output
7+
/lib

.npmignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm-debug.log
2+
/.nyc_output
3+
/coverage

.stylintrc

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// https://github.com/rossPatton/stylint
3+
//
4+
{
5+
"blocks": false,
6+
"brackets": "always",
7+
"colons": "always",
8+
"colors": false,
9+
"commaSpace": "always",
10+
"commentSpace": false,
11+
"cssLiteral": "never",
12+
"depthLimit": false,
13+
"duplicates": false,
14+
"efficient": "always",
15+
"extendPref": false,
16+
"globalDupe": false,
17+
"indentPref": false,
18+
"leadingZero": "never",
19+
"maxErrors": false,
20+
"maxWarnings": false,
21+
"mixed": false,
22+
"namingConvention": false,
23+
"namingConventionStrict": false,
24+
"none": "never",
25+
"noImportant": true,
26+
"parenSpace": false,
27+
"placeholders": "always",
28+
"prefixVarsWithDollar": "always",
29+
"quotePref": false,
30+
"semicolons": "always",
31+
"sortOrder": false,
32+
"stackedProperties": "never",
33+
"trailingWhitespace": "never",
34+
"universal": false,
35+
"valid": true,
36+
"zeroUnits": "never",
37+
"zIndexNormalize": false
38+
}

.travis.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
sudo: required
2+
dist: trusty
3+
group: edge
4+
5+
language: node_js
6+
7+
os:
8+
- linux
9+
10+
node_js:
11+
- '6'
12+
- '5'
13+
- '4'
14+
15+
before_install:
16+
- npm install -g npm
17+
- npm --version
18+
19+
after_success:
20+
- npm run coveralls
21+
- npm run coverage-clean

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 https://github.com/cncjs
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# react-widget-boilerplate [![build status](https://travis-ci.org/cncjs/react-widget-boilerplate.svg?branch=master)](https://travis-ci.org/cncjs/react-widget-boilerplate) [![Coverage Status](https://coveralls.io/repos/github/cncjs/react-widget-boilerplate/badge.svg?branch=master)](https://coveralls.io/github/cncjs/react-widget-boilerplate?branch=master)
2+
3+
React Widget Boilerplate
4+
5+
## Under Construction
6+
7+
This repository is still under construction and content may change. Do not rely on the information on this page. The custom widget support will soon be available. Stay tuned for further updates.
8+
9+
## Installation
10+
11+
```
12+
npm i -g npm
13+
npm install
14+
```
15+
16+
## Development
17+
18+
Run `npm run dev` to start a local development server for development and testing. After that, connect to http://localhost:8000 and wait until bundle finished.
19+
20+
## Production
21+
22+
Run `npm run prepublish` to build production code. It will output index.html, fonts, images, and JavaScript files to the dist folder.
23+
24+
To load a custom widget on CNCjs, you need to copy all files to a directory (e.g. /home/widget), and specify a mount path for the static directory, as shown below:
25+
26+
```
27+
cnc -vv --mount /widget:/home/widget
28+
```
29+
30+
## License
31+
32+
MIT

assets/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<title>React Widget Template</title>
7+
<meta name="description" content="">
8+
<meta name="viewport" content="width=device-width, initial-scale=1">
9+
</head>
10+
<body>
11+
<div id="viewport"></div>
12+
</html>

package.json

+82
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"name": "react-widget-boilerplate",
3+
"version": "0.1.0",
4+
"description": "Create a custom widget with React",
5+
"main": "dist/index.js",
6+
"files": [
7+
"dist"
8+
],
9+
"scripts": {
10+
"prepublish": "npm run eslint && npm test && npm run clean && npm run build",
11+
"build": "webpack --config webpack.config.js",
12+
"clean": "rm -f dist/*",
13+
"demo": "http-server -p 8080 dist",
14+
"eslint": "eslint ./src",
15+
"test": "tap test/*.js --node-arg=--require --node-arg=babel-register --node-arg=--require --node-arg=babel-polyfill",
16+
"coveralls": "tap test/*.js --coverage --coverage-report=text-lcov --nyc-arg=--require --nyc-arg=babel-register --nyc-arg=--require --nyc-arg=babel-polyfill | coveralls",
17+
"dev": "NODE_ENV=development webpack-dev-server --hot --inline --host 0.0.0.0 --port 5000 --content-base dist",
18+
"pack": ""
19+
},
20+
"repository": {
21+
"type": "git",
22+
"url": "git+https://github.com/cncjs/react-widget-boilerplate.git"
23+
},
24+
"author": "nobody <[email protected]>",
25+
"license": "MIT",
26+
"bugs": {
27+
"url": "https://github.com/cncjs/react-widget-boilerplate/issues"
28+
},
29+
"homepage": "https://github.com/cncjs/react-widget-boilerplate",
30+
"keywords": [
31+
"cncjs",
32+
"react",
33+
"widget",
34+
"boilerplate"
35+
],
36+
"peerDependencies": {},
37+
"dependencies": {
38+
"classnames": "^2.2.5",
39+
"detect-browser": "^1.10.0",
40+
"font-awesome": "^4.7.0",
41+
"node-emoji": "^1.8.1",
42+
"normalize.css": "^7.0.0",
43+
"prop-types": "^15.0.0",
44+
"react": "^0.14.0 || ^15.0.0",
45+
"react-dom": "^0.14.0 || ^15.0.0",
46+
"socket.io-client": "^1.7.4",
47+
"universal-logger": "^1.0.1",
48+
"universal-logger-browser": "^1.0.2"
49+
},
50+
"devDependencies": {
51+
"babel-cli": "~6.26.0",
52+
"babel-core": "~6.26.0",
53+
"babel-eslint": "~7.2.3",
54+
"babel-loader": "~7.1.2",
55+
"babel-plugin-transform-decorators-legacy": "~1.3.4",
56+
"babel-preset-es2015": "~6.24.1",
57+
"babel-preset-react": "~6.24.1",
58+
"babel-preset-stage-0": "~6.24.1",
59+
"coveralls": "~2.13.1",
60+
"css-loader": "~0.28.7",
61+
"eslint": "~4.6.1",
62+
"eslint-config-trendmicro": "~1.0.0",
63+
"eslint-loader": "~1.9.0",
64+
"eslint-plugin-import": "~2.7.0",
65+
"eslint-plugin-jsx-a11y": "~5.1.1",
66+
"eslint-plugin-react": "~7.3.0",
67+
"file-loader": "~0.11.2",
68+
"find-imports": "~0.5.2",
69+
"html-webpack-plugin": "~2.30.1",
70+
"http-server": "~0.10.0",
71+
"nib": "~1.1.2",
72+
"style-loader": "~0.18.2",
73+
"stylint": "~1.5.9",
74+
"stylint-loader": "~1.0.0",
75+
"stylus-loader": "~3.0.1",
76+
"tap": "~10.7.2",
77+
"url-loader": "~0.5.9",
78+
"webpack": "~3.5.5",
79+
"webpack-dev-server": "~2.7.1",
80+
"write-file-webpack-plugin": "~4.1.0"
81+
}
82+
}

src/constants/index.js

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Controller
2+
export const GRBL = 'Grbl';
3+
export const SMOOTHIE = 'Smoothie';
4+
export const TINYG = 'TinyG';
5+
6+
// Workflow State
7+
export const WORKFLOW_STATE_RUNNING = 'running';
8+
export const WORKFLOW_STATE_PAUSED = 'paused';
9+
export const WORKFLOW_STATE_IDLE = 'idle';
10+
11+
// Grbl Active State
12+
export const GRBL_ACTIVE_STATE_IDLE = 'Idle';
13+
export const GRBL_ACTIVE_STATE_RUN = 'Run';
14+
export const GRBL_ACTIVE_STATE_HOLD = 'Hold';
15+
export const GRBL_ACTIVE_STATE_DOOR = 'Door';
16+
export const GRBL_ACTIVE_STATE_HOME = 'Home';
17+
export const GRBL_ACTIVE_STATE_SLEEP = 'Sleep';
18+
export const GRBL_ACTIVE_STATE_ALARM = 'Alarm';
19+
export const GRBL_ACTIVE_STATE_CHECK = 'Check';
20+
21+
// Smoothie Active State
22+
export const SMOOTHIE_ACTIVE_STATE_IDLE = 'Idle';
23+
export const SMOOTHIE_ACTIVE_STATE_RUN = 'Run';
24+
export const SMOOTHIE_ACTIVE_STATE_HOLD = 'Hold';
25+
export const SMOOTHIE_ACTIVE_STATE_DOOR = 'Door';
26+
export const SMOOTHIE_ACTIVE_STATE_HOME = 'Home';
27+
export const SMOOTHIE_ACTIVE_STATE_ALARM = 'Alarm';
28+
export const SMOOTHIE_ACTIVE_STATE_CHECK = 'Check';
29+
30+
// TinyG Machine State
31+
// https://github.com/synthetos/g2/wiki/Status-Reports#stat-values
32+
export const TINYG_MACHINE_STATE_INITIALIZING = 0; // Machine is initializing
33+
export const TINYG_MACHINE_STATE_READY = 1; // Machine is ready for use
34+
export const TINYG_MACHINE_STATE_ALARM = 2; // Machine is in alarm state
35+
export const TINYG_MACHINE_STATE_STOP = 3; // Machine has encountered program stop
36+
export const TINYG_MACHINE_STATE_END = 4; // Machine has encountered program end
37+
export const TINYG_MACHINE_STATE_RUN = 5; // Machine is running
38+
export const TINYG_MACHINE_STATE_HOLD = 6; // Machine is holding
39+
export const TINYG_MACHINE_STATE_PROBE = 7; // Machine is in probing operation
40+
export const TINYG_MACHINE_STATE_CYCLE = 8; // Reserved for canned cycles (not used)
41+
export const TINYG_MACHINE_STATE_HOMING = 9; // Machine is in a homing cycle
42+
export const TINYG_MACHINE_STATE_JOG = 10; // Machine is in a jogging cycle
43+
export const TINYG_MACHINE_STATE_INTERLOCK = 11; // Machine is in safety interlock hold
44+
export const TINYG_MACHINE_STATE_SHUTDOWN = 12; // Machine is in shutdown state. Will not process commands
45+
export const TINYG_MACHINE_STATE_PANIC = 13; // Machine is in panic state. Needs to be physically reset

0 commit comments

Comments
 (0)