generator-reshow 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # `generator-reshow`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const generatorReshow = require('generator-reshow');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,34 @@
1
+ /**
2
+ * https://yeoman.io/authoring/testing.html
3
+ * https://gilsondev.gitbooks.io/yeoman-authoring/content/authoring/unit_testing.html
4
+ */
5
+
6
+ const getYo = require("yo-reshow");
7
+ const { YoTest, assert } = getYo();
8
+
9
+ describe("generator-reshow-app:app", () => {
10
+ before(async () => {
11
+ await YoTest({
12
+ source: __dirname + "/../.",
13
+ params: {
14
+ isReady: true,
15
+ appNamee: "foo",
16
+ description: "foo-desc",
17
+ keyword: "foo-keyword",
18
+ },
19
+ });
20
+ });
21
+
22
+ it("should have folder", () => {
23
+ assert.file(["src", "ui"]);
24
+ });
25
+
26
+ it("should have file", () => {
27
+ assert.file(["compile.sh", "index.html"]);
28
+ });
29
+
30
+ it("should have content", () => {
31
+ // assert.fileContent('composer.json', 'foo-desc');
32
+ // assert.fileContent('.circleci/config.yml', 'foo');
33
+ });
34
+ });
@@ -0,0 +1,82 @@
1
+ const getYo = require("yo-reshow");
2
+ const { YoGenerator, YoHelper } = getYo();
3
+
4
+ module.exports = class extends YoGenerator {
5
+ /**
6
+ * Run loop (Life cycle)
7
+ * https://yeoman.io/authoring/running-context.html#the-run-loop
8
+ *
9
+ * 1. initializing
10
+ * 2. prompting
11
+ * 3. configuring
12
+ * 4. default
13
+ * 5. writing
14
+ * 6. conflicts
15
+ * 7. install
16
+ * 8. end
17
+ */
18
+
19
+ /**
20
+ * Using lists in a yeoman prompt
21
+ *
22
+ * https://www.alwaystwisted.com/post.php?s=using-lists-in-a-yeoman-generator
23
+ * https://github.com/SBoudrias/Inquirer.js
24
+ */
25
+ async prompting() {
26
+ const { say, destFolderName } = YoHelper(this);
27
+ // https://github.com/yeoman/environment/blob/main/lib/util/log.js
28
+ say(
29
+ 'Before "Start!"\n\n!! Need Create Folder First !!\n\nYou need create folder by yourself.'
30
+ );
31
+
32
+ const prompts = [
33
+ {
34
+ type: "confirm",
35
+ name: "isReady",
36
+ message: `We will put files at [${destFolderName}], do you already create app folder?`,
37
+ default: false,
38
+ },
39
+ {
40
+ when: (response) => {
41
+ if (!response.isReady) {
42
+ process.exit(0);
43
+ }
44
+ },
45
+ },
46
+ {
47
+ type: "input",
48
+ name: "mainName",
49
+ message: "Please input your app name?",
50
+ default: destFolderName,
51
+ },
52
+ {
53
+ type: "input",
54
+ name: "description",
55
+ message:
56
+ "Please input description for plug-in? (will use in package.json)",
57
+ default: "About ...",
58
+ },
59
+ {
60
+ type: "input",
61
+ name: "keyword",
62
+ message: "Please input keyword for plug-in? (will use in package.json)",
63
+ default: "",
64
+ },
65
+ ];
66
+ const answers = await this.prompt(prompts);
67
+ this.mainName = answers.mainName;
68
+ this.description = answers.description;
69
+ this.keyword = answers.keyword || answers.mainName;
70
+ }
71
+
72
+ writing() {
73
+ const { cp } = YoHelper(this);
74
+ cp("ui");
75
+ cp("src");
76
+ cp(".gitignore");
77
+ cp("compile.sh");
78
+ cp("index.html");
79
+ cp("package.json");
80
+ cp("webpack.config.js");
81
+ }
82
+ };
@@ -0,0 +1,8 @@
1
+ node_modules
2
+ npm-debug.log
3
+ coverage*
4
+ .tern-port
5
+ v8.log
6
+ build
7
+ .*.sw?
8
+ webpack.pid
@@ -0,0 +1,104 @@
1
+ #!/bin/sh
2
+
3
+ conf='{'
4
+ conf+='"assetsRoot":"./assets/",'
5
+ conf+='"externals":{"d3": "d3"},'
6
+ conf+='"devPort": "'${hotPort:-8080}'"'
7
+ conf+='}'
8
+
9
+ PWD=`dirname $0`
10
+ cd $PWD
11
+ webpack='npm run webpack --'
12
+
13
+ production(){
14
+ echo "Production Mode";
15
+ npm run build
16
+ CONFIG=$conf NODE_ENV=production $webpack --mode=production
17
+ }
18
+
19
+ analyzer(){
20
+ echo "Analyzer Mode";
21
+ npm run build
22
+ CONFIG=$conf BUNDLE='{}' $webpack
23
+ }
24
+
25
+ develop(){
26
+ stop
27
+ echo "Develop Mode";
28
+ npm run build
29
+ CONFIG=$conf $webpack
30
+ }
31
+
32
+ startServer(){
33
+ DIR="$( cd "$(dirname "$0")" ; pwd -P )"
34
+ killBy ${DIR}/node_modules/.bin/ws
35
+ yarn
36
+ port=${port-3000}
37
+ echo "Start server";
38
+ npm run start -- -p $port -v
39
+ }
40
+
41
+ killBy(){
42
+ ps -eo pid,args | grep $1 | grep -v grep | awk '{print $1}' | xargs -I{} kill -9 {}
43
+ }
44
+
45
+ stop(){
46
+ DIR="$( cd "$(dirname "$0")" ; pwd -P )"
47
+ killBy ${DIR}/node_modules/.bin/babel
48
+ cat webpack.pid | xargs -I{} kill -9 {}
49
+ npm run clean
50
+ echo "Stop done";
51
+ }
52
+
53
+ watch(){
54
+ stop
55
+ echo "Watch Mode";
56
+ npm run build:ui -- --watch &
57
+ npm run build:src -- --watch &
58
+ sleep 10
59
+ CONFIG=$conf $webpack --watch &
60
+ }
61
+
62
+ watchTest(){
63
+ stop
64
+ echo "Watch Test";
65
+ npm run build:test:ui -- --watch &
66
+ npm run build:test:src -- --watch &
67
+ }
68
+
69
+ hot(){
70
+ stop
71
+ echo "Hot Mode";
72
+ npm run build:ui -- --watch &
73
+ npm run build:src -- --watch &
74
+ HOT_UPDATE=1 CONFIG=$conf $webpack serve &
75
+ }
76
+
77
+ case "$1" in
78
+ p)
79
+ production
80
+ ;;
81
+ a)
82
+ analyzer
83
+ ;;
84
+ s)
85
+ startServer
86
+ ;;
87
+ hot)
88
+ hot
89
+ ;;
90
+ watch)
91
+ watch
92
+ ;;
93
+ watchTest)
94
+ watchTest
95
+ ;;
96
+ stop)
97
+ stop
98
+ ;;
99
+ *)
100
+ develop
101
+ exit
102
+ esac
103
+
104
+ exit $?
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge; IE=11; IE=10; IE=9; IE=8;">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <script defer src="//cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js"></script>
8
+ <script defer src="//cdn.jsdelivr.net/npm/d3@6.5.0/dist/d3.js"></script>
9
+ <script defer src="assets/main.bundle.js"></script>
10
+ <link rel="icon" href="data:,">
11
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/purecss@2.0.6/build/base-min.css">
12
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/purecss@2.0.6/build/grids-min.css">
13
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/purecss@2.0.6/build/grids-responsive-min.css">
14
+ </head>
15
+ <body>
16
+ <div id="app"></div>
17
+ </body>
18
+ <script src="assets/vendor.bundle.js"></script>
19
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-segment@latest/segment.min.css">
20
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-progress@latest/progress.min.css">
21
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-rail@latest/rail.min.css">
22
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-header@latest/header.min.css">
23
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-form@latest/form.min.css">
24
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-menu@latest/menu.min.css">
25
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-dropdown@latest/dropdown.css">
26
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-input@latest/input.min.css">
27
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-button@latest/button.min.css">
28
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-search@latest/search.min.css">
29
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-label@latest/label.min.css">
30
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-card@latest/card.min.css">
31
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-popup@latest/popup.min.css">
32
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-modal@latest/modal.min.css">
33
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-dimmer@latest/dimmer.min.css">
34
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-message@latest/message.min.css">
35
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-table@latest/table.min.css">
36
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-tab@latest/tab.min.css">
37
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/semantic-ui-checkbox@latest/checkbox.min.css">
38
+ <link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/prismjs/themes/prism.css">
39
+ </html>
@@ -0,0 +1,40 @@
1
+ {
2
+ "description": "Reshow App",
3
+ "repository": {
4
+ "type": "git",
5
+ "url": "https://github.com/react-atomic/react-atomic-ui"
6
+ },
7
+ "keywords": [
8
+ "app",
9
+ "reshow-app"
10
+ ],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "dependencies": {
14
+ "get-object-value": "*",
15
+ "get-scroll-info": "*",
16
+ "organism-react-ajax": "*",
17
+ "organism-react-navigation": "*",
18
+ "organism-react-popup": "*",
19
+ "organism-react-progress": "*",
20
+ "pmvc_react_admin": "*",
21
+ "pmvc_react_list": "*",
22
+ "react": "^16.x",
23
+ "react-dom": "^16.x",
24
+ "reshow": "*",
25
+ "reshow-app": "*",
26
+ "reshow-constant": "*",
27
+ "reshow-url": "*",
28
+ "ricon": "*"
29
+ },
30
+ "scripts": {
31
+ "webpack": "webpack",
32
+ "start": "ws",
33
+ "format": "prettier-eslint --write 'src/**/*.js' 'ui/**/*.jsx'",
34
+ "clean": "find ./build ./assets -name '*.*' | xargs rm -rf",
35
+ "build:ui": "BABEL_ENV=es babel ui -d build/es/ui --ignore /**/__tests__",
36
+ "build:src": "BABEL_ENV=es babel src -d build/es/src --ignore /**/__tests__",
37
+ "build": "npm run clean && npm run build:ui && npm run build:src",
38
+ "prepublishOnly": "exit 1;"
39
+ }
40
+ }
@@ -0,0 +1,4 @@
1
+ import client from "reshow-app/client";
2
+ import app from "../ui/pages/index";
3
+
4
+ export default client(app);
@@ -0,0 +1,36 @@
1
+ import { useEffect } from "react";
2
+ import { dispatch } from "reshow";
3
+ import { navigationDispatch } from "organism-react-navigation";
4
+ import { ajaxDispatch } from "organism-react-ajax";
5
+
6
+ const usePage = (props) => {
7
+ const { pageName, tplProps } = props;
8
+
9
+ useEffect(() => {
10
+ setTimeout(() => {
11
+ navigationDispatch({
12
+ params: {
13
+ activeMenu: pageName,
14
+ },
15
+ });
16
+ if (tplProps) {
17
+ dispatch({ tplProps });
18
+ }
19
+ });
20
+ ajaxDispatch("ajaxGet", {
21
+ url: "/data/env",
22
+ ini: true,
23
+ });
24
+ return () => {
25
+ setTimeout(() => {
26
+ navigationDispatch({
27
+ params: {
28
+ activeMenu: null,
29
+ },
30
+ });
31
+ });
32
+ };
33
+ });
34
+ };
35
+
36
+ export default usePage;
@@ -0,0 +1,25 @@
1
+ import { VerticalMenu } from "pmvc_react_admin";
2
+ import { SideMenu } from "organism-react-navigation";
3
+ import get from "get-object-value";
4
+ import { pageStore, ReLink } from "reshow";
5
+ import { KEYS } from "reshow-constant";
6
+
7
+ const Menu = (props) => {
8
+ const thisMenus = {};
9
+ const themes = pageStore.getMap("themes");
10
+ KEYS(themes).forEach((item) => {
11
+ thisMenus[item] = {
12
+ text: item,
13
+ href: "#/" + item,
14
+ };
15
+ });
16
+ return (
17
+ <SideMenu
18
+ menus={thisMenus}
19
+ linkComponent={ReLink}
20
+ component={<VerticalMenu />}
21
+ />
22
+ );
23
+ };
24
+
25
+ export default Menu;
@@ -0,0 +1,8 @@
1
+ import usePage from "../../src/usePage";
2
+
3
+ const Atoms = (props) => {
4
+ usePage({ ...props, pageName: "Atoms" });
5
+ return <>This is atom</>;
6
+ };
7
+
8
+ export default Atoms;
@@ -0,0 +1,28 @@
1
+ import { ReshowMessage, Return } from "reshow";
2
+ import { ClientRoute } from "reshow-url";
3
+ import { PopupPool } from "organism-react-popup";
4
+ import { PageLoadProgressHandler } from "organism-react-progress";
5
+
6
+ import Doc from "../templates/Doc";
7
+ import Atoms from "../pages/Atoms";
8
+
9
+ const themes = {
10
+ Atoms,
11
+ };
12
+
13
+ const Index = (props) => (
14
+ <Return initStates={["tplProps"]}>
15
+ {({ tplProps }) => {
16
+ return (
17
+ <Doc {...tplProps}>
18
+ <ClientRoute {...props} themes={themes} defaultThemePath="Atoms" />
19
+ <PageLoadProgressHandler ajax={true} />
20
+ <ReshowMessage />
21
+ <PopupPool />
22
+ </Doc>
23
+ );
24
+ }}
25
+ </Return>
26
+ );
27
+
28
+ export default Index;
@@ -0,0 +1,14 @@
1
+ import React, { Component } from "react";
2
+ import { getDocTemplate } from "organism-react-navigation";
3
+ import Menu from "../molecules/Menu";
4
+
5
+ const DocTemplate = getDocTemplate({
6
+ sideWidth: 160,
7
+ active: true
8
+ });
9
+
10
+ const Doc = ({ children, ...props }) => (
11
+ <DocTemplate {...props} body={children} menu={<Menu />} />
12
+ );
13
+
14
+ export default Doc;
@@ -0,0 +1,3 @@
1
+ const webpack = require('reshow-app/webpack.client');
2
+
3
+ module.exports = webpack(__dirname);
@@ -0,0 +1,82 @@
1
+ const getYo = require("yo-reshow");
2
+ const { YoGenerator, YoHelper } = getYo();
3
+
4
+ module.exports = class extends YoGenerator {
5
+ /**
6
+ * Run loop (Life cycle)
7
+ * https://yeoman.io/authoring/running-context.html#the-run-loop
8
+ *
9
+ * 1. initializing
10
+ * 2. prompting
11
+ * 3. configuring
12
+ * 4. default
13
+ * 5. writing
14
+ * 6. conflicts
15
+ * 7. install
16
+ * 8. end
17
+ */
18
+
19
+ /**
20
+ * Using lists in a yeoman prompt
21
+ *
22
+ * https://www.alwaystwisted.com/post.php?s=using-lists-in-a-yeoman-generator
23
+ * https://github.com/SBoudrias/Inquirer.js
24
+ */
25
+ async prompting() {
26
+ const { say, destFolderName } = YoHelper(this);
27
+ // https://github.com/yeoman/environment/blob/main/lib/util/log.js
28
+ say(
29
+ 'Before "Start!"\n\n!! Need Create Folder First !!\n\nYou need create folder by yourself.'
30
+ );
31
+
32
+ const prompts = [
33
+ {
34
+ type: "confirm",
35
+ name: "isReady",
36
+ message: `We will put files at [${destFolderName}], do you already create generator folder?`,
37
+ default: false,
38
+ },
39
+ {
40
+ when: (response) => {
41
+ if (!response.isReady) {
42
+ process.exit(0);
43
+ }
44
+ },
45
+ },
46
+ {
47
+ type: "input",
48
+ name: "mainName",
49
+ message: "Please input your generator name?",
50
+ default: destFolderName,
51
+ },
52
+ {
53
+ type: "input",
54
+ name: "description",
55
+ message:
56
+ "Please input description for plug-in? (will use in package.json)",
57
+ default: "About ...",
58
+ },
59
+ {
60
+ type: "input",
61
+ name: "keyword",
62
+ message: "Please input keyword for plug-in? (will use in package.json)",
63
+ default: "",
64
+ },
65
+ ];
66
+ const answers = await this.prompt(prompts);
67
+ this.mainName = answers.mainName;
68
+ this.description = answers.description;
69
+ this.keyword = answers.keyword || answers.mainName;
70
+ }
71
+
72
+ writing() {
73
+ const { cp } = YoHelper(this);
74
+ cp("ui");
75
+ cp("src");
76
+ cp(".gitignore");
77
+ cp("compile.sh");
78
+ cp("index.html");
79
+ cp("package.json");
80
+ cp("webpack.config.js");
81
+ }
82
+ };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "generator-reshow",
3
+ "version": "0.0.0",
4
+ "description": "Yeoman generator for reshow. (app, generator, ...etc)",
5
+ "author": "Hill <hill@kimo.com>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/react-atomic/reshow",
9
+ "directory": "packages/generator-reshow"
10
+ },
11
+ "keywords": [
12
+ "yeoman-generator"
13
+ ],
14
+ "license": "ISC",
15
+ "main": "",
16
+ "dependencies": {
17
+ "yo-reshow": "*"
18
+ },
19
+ "files": [
20
+ "generators"
21
+ ],
22
+ "scripts": {
23
+ "mochaFor": "mocha",
24
+ "mocha": "npm run mochaFor -- 'generators/**/__tests__/*.js'",
25
+ "test": "npm run mocha",
26
+ "prepublishOnly": "npm run test"
27
+ },
28
+ "engines": {
29
+ "node": ">=12"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/react-atomic/reshow/issues"
33
+ }
34
+ }