generator-reackt 0.5.0 → 1.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.
Files changed (61) hide show
  1. package/.prettierrc +1 -1
  2. package/.stylelintrc +3 -102
  3. package/LICENSE +17 -5
  4. package/README.md +4 -2
  5. package/generators/app/index.js +1 -1
  6. package/generators/component/index.js +1 -1
  7. package/generators/module/index.js +1 -1
  8. package/generators/util/fs.js +1 -1
  9. package/package.json +53 -39
  10. package/templates/app/.lintstagedrc +1 -1
  11. package/templates/app/.prettierrc +1 -1
  12. package/templates/app/.storybook/main.ts +19 -0
  13. package/templates/app/.storybook/preview.ts +36 -0
  14. package/templates/app/.stylelintrc +2 -268
  15. package/templates/app/.yarnrc.yml +3 -0
  16. package/templates/app/_eslint.config.mjs +51 -0
  17. package/templates/app/{package.json → _package.json} +2 -2
  18. package/templates/app/_stories/SuspenseFallback.stories.tsx +17 -0
  19. package/templates/app/gitignore +1 -0
  20. package/templates/app/jest.config.js +1 -1
  21. package/templates/app/src/components/ErrorBoundary.tsx +45 -0
  22. package/templates/app/src/components/Layout.tsx +142 -0
  23. package/templates/app/src/components/SuspenseFallback.tsx +96 -0
  24. package/templates/app/src/{index.scss → index.nscss} +8 -7
  25. package/templates/app/src/index.tsx +60 -0
  26. package/templates/app/src/pages/index.tsx +3 -0
  27. package/templates/app/src/reducers/application.ts +36 -0
  28. package/templates/app/src/reducers/{index.js → index.ts} +1 -0
  29. package/templates/app/src/sagas/application.ts +9 -0
  30. package/templates/app/src/sagas/{index.js → index.ts} +1 -0
  31. package/templates/app/src/selectors/application.test.ts +18 -0
  32. package/templates/app/src/selectors/application.ts +6 -0
  33. package/templates/app/src/types/globals.d.ts +1 -0
  34. package/templates/app/src/types/index.ts +11 -0
  35. package/templates/app/src/utils/{index.js → index.ts} +3 -3
  36. package/templates/app/tsconfig.json +18 -0
  37. package/templates/app/webpack.config.nts +121 -0
  38. package/templates/component/index.stories.tsx +14 -0
  39. package/templates/component/{index.js → index.tsx} +2 -5
  40. package/generators/es.regexp.flags-ccfbed60.js +0 -1
  41. package/templates/app/.babelrc +0 -9
  42. package/templates/app/.eslintrc.js +0 -185
  43. package/templates/app/.storybook/addons.js +0 -1
  44. package/templates/app/.storybook/config.js +0 -14
  45. package/templates/app/.storybook/webpack.config.babel.js +0 -7
  46. package/templates/app/jsconfig.json +0 -8
  47. package/templates/app/src/components/App.js +0 -14
  48. package/templates/app/src/icons.js +0 -4
  49. package/templates/app/src/index.js +0 -50
  50. package/templates/app/src/reducers/application.js +0 -21
  51. package/templates/app/src/sagas/application.js +0 -9
  52. package/templates/app/src/selectors/application.js +0 -1
  53. package/templates/app/src/selectors/application.test.js +0 -13
  54. package/templates/app/webpack.config.babel.js +0 -103
  55. /package/templates/component/{index.test.js → index.test.tsx} +0 -0
  56. /package/templates/module/reducer/{index.test.js → index.test.ts} +0 -0
  57. /package/templates/module/reducer/{index.js → index.ts} +0 -0
  58. /package/templates/module/saga/{index.test.js → index.test.ts} +0 -0
  59. /package/templates/module/saga/{index.js → index.ts} +0 -0
  60. /package/templates/module/selector/{index.js → index.test.ts} +0 -0
  61. /package/templates/module/selector/{index.test.js → index.ts} +0 -0
package/.prettierrc CHANGED
@@ -2,4 +2,4 @@
2
2
  "singleQuote": true,
3
3
  "trailingComma": "none",
4
4
  "endOfLine": "auto"
5
- }
5
+ }
package/.stylelintrc CHANGED
@@ -1,104 +1,5 @@
1
1
  {
2
- "defaultSeverity": "error",
3
- "rules": {
4
- "at-rule-empty-line-before": [
5
- "always",
6
- {
7
- "except": [ "blockless-after-blockless", "first-nested" ],
8
- "ignore": [ "after-comment" ],
9
- "ignoreAtRules": [ "else" ]
10
- }
11
- ],
12
- "at-rule-name-newline-after": "always-multi-line",
13
- "at-rule-name-space-after": "always-single-line",
14
- "at-rule-semicolon-newline-after": "always",
15
- "at-rule-semicolon-space-before": "never",
16
- "block-closing-brace-empty-line-before": "never",
17
- "block-closing-brace-newline-after": [
18
- "always",
19
- {
20
- "ignoreAtRules": [ "else", "if" ]
21
- }
22
- ],
23
- "block-closing-brace-newline-before": "always-multi-line",
24
- "block-closing-brace-space-after": "always-single-line",
25
- "block-closing-brace-space-before": "always-single-line",
26
- "block-no-empty": true,
27
- "block-opening-brace-newline-after": "always",
28
- "block-opening-brace-newline-before": "never-single-line",
29
- "block-opening-brace-space-after": "always-single-line",
30
- "block-opening-brace-space-before": "always",
31
- "comment-empty-line-before": [
32
- "always",
33
- {
34
- "ignore": [ "after-comment", "stylelint-commands" ]
35
- }
36
- ],
37
- "comment-no-empty": true,
38
- "comment-whitespace-inside": "always",
39
- "custom-property-empty-line-before": null,
40
- "declaration-bang-space-after": "never",
41
- "declaration-bang-space-before": "always",
42
- "declaration-block-semicolon-newline-after": "always",
43
- "declaration-block-semicolon-newline-before": null,
44
- "declaration-block-semicolon-space-after": "always-single-line",
45
- "declaration-block-semicolon-space-before": "never",
46
- "declaration-block-single-line-max-declarations": 1,
47
- "declaration-block-trailing-semicolon": "always",
48
- "declaration-colon-newline-after": null,
49
- "declaration-colon-space-after": "always",
50
- "declaration-colon-space-before": "never",
51
- "declaration-empty-line-before": "never",
52
- "function-comma-newline-after": null,
53
- "function-comma-newline-before": null,
54
- "function-comma-space-after": "always",
55
- "function-comma-space-before": null,
56
- "function-max-empty-lines": 0,
57
- "function-whitespace-after": "always",
58
- "indentation": 2,
59
- "max-empty-lines": 2,
60
- "max-line-length": 100,
61
- "max-nesting-depth": 4,
62
- "media-feature-colon-space-after": "always",
63
- "media-feature-colon-space-before": "never",
64
- "media-feature-parentheses-space-inside": "never",
65
- "media-feature-range-operator-space-after": "always",
66
- "media-feature-range-operator-space-before": "always",
67
- "media-query-list-comma-newline-after": null,
68
- "media-query-list-comma-newline-before": null,
69
- "media-query-list-comma-space-after": null,
70
- "media-query-list-comma-space-before": null,
71
- "no-duplicate-at-import-rules": true,
72
- "no-duplicate-selectors": true,
73
- "no-empty-source": true,
74
- "no-eol-whitespace": true,
75
- "no-extra-semicolons": true,
76
- "no-invalid-double-slash-comments": true,
77
- "no-missing-end-of-source-newline": true,
78
- "rule-empty-line-before": [
79
- "always",
80
- {
81
- "except": [ "first-nested" ],
82
- "ignore": [ "after-comment" ]
83
- }
84
- ],
85
- "selector-attribute-brackets-space-inside": "never",
86
- "selector-attribute-operator-space-after": "never",
87
- "selector-attribute-operator-space-before": "never",
88
- "selector-combinator-space-after": "always",
89
- "selector-combinator-space-before": "always",
90
- "selector-descendant-combinator-no-non-space": true,
91
- "selector-list-comma-newline-after": "always",
92
- "selector-list-comma-newline-before": "never-multi-line",
93
- "selector-list-comma-space-after": "always-single-line",
94
- "selector-list-comma-space-before": null,
95
- "selector-max-empty-lines": 0,
96
- "string-no-newline": true,
97
- "string-quotes": "double",
98
- "value-list-comma-newline-after": "always-multi-line",
99
- "value-list-comma-newline-before": null,
100
- "value-list-comma-space-after": null,
101
- "value-list-comma-space-before": "never",
102
- "value-list-max-empty-lines": 0
103
- }
2
+ "customSyntax": "postcss-scss",
3
+ "defaultSeverity": "warning",
4
+ "extends": "stylelint-config-recommended"
104
5
  }
package/LICENSE CHANGED
@@ -1,9 +1,21 @@
1
- The MIT License
1
+ MIT License
2
2
 
3
- Copyright 2018-2023 ayan4m1 <andrew@bulletlogic.com>
3
+ Copyright (c) 2018-2026 ayan4m1 <andrew@bulletlogic.com>
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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 furnished
10
+ to do so, subject to the following conditions:
6
11
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice (including the next
13
+ paragraph) shall be included in all copies or substantial portions of the
14
+ Software.
8
15
 
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
19
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
21
+ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md CHANGED
@@ -4,15 +4,17 @@ This project scaffolds a modern web application. It is fairly opinionated, but i
4
4
 
5
5
  Here's the mile-long list of technologies the generated project can leverage:
6
6
 
7
- - [Babel](https://babeljs.io/) - Compile modern ECMAScript to Node-compatible JS
7
+ - [TypeScript](https://www.typescriptlang.org/) - The language of the modern web
8
8
  - [Webpack](https://webpack.js.org/) - Bundle code, styles, markup, and more into a web application
9
9
  - [husky](https://www.npmjs.com/package/husky) - Execute lint-staged before committing to Git
10
10
  - [lint-staged](https://www.npmjs.com/package/lint-staged) - Execute linters for specific file types
11
- - [ESLint](https://eslint.org/) - Apply hundreds of style/usage rules to ECMAScript
11
+ - [ESLint](https://eslint.org/) - Apply hundreds of style/usage rules to JS/TS
12
12
  - [Prettier](https://prettier.io/) - Apply style/formatting rules to code
13
13
  - [stylelint](https://stylelint.io/) - Apply style/usage rules to Sass
14
14
  - [Bootstrap](https://getbootstrap.com/) - UI toolkit
15
+ - [Material-UI](https://mui.com/material-ui/) - UI toolkit
15
16
  - [React](https://reactjs.org/) - UI library
16
17
  - [Redux](https://redux.js.org/) - Application state container
17
18
  - [Redux-Saga](https://redux-saga.js.org/) - Redux middleware for action/side-effect interaction
18
19
  - [Jest](https://jestjs.io/) - Unit, integration, and snapshot testing
20
+ - [RTL](https://testing-library.com/docs/react-testing-library/intro/) - Opinionated unit testing for React
@@ -1 +1 @@
1
- "use strict";var e=require("got"),t=require("path"),s=require("gulp-if"),a=require("date-fns"),i=require("../util/fs.js"),o=require("gulp-prettier"),r=require("jsonfile"),n=require("yeoman-stylelint"),l=require("spdx-license-ids");require("mkdirp"),l.push("SEE LICENSE IN LICENSE"),l.sort();const p=require("yeoman-generator"),c=(...e)=>t.join("src",...e),d=[{value:null,name:"None"},{value:"bootstrap",name:"Bootstrap"},{value:"bulma",name:"Bulma"},{value:"foundation",name:"Foundation"},{value:"materialize",name:"Materialize"},{value:"uikit",name:"UIKit"},{value:"materialUi",name:"Material-UI"}],m={fontAwesome:["@fortawesome/fontawesome-svg-core","@fortawesome/free-solid-svg-icons","@fortawesome/react-fontawesome"],bootstrap:["bootstrap"],uikit:["uikit","uikit-react"],foundation:["foundation-sites"],materialize:["materialize-css"],bulma:["bulma"],materialUi:["@material-ui/core"],lintStaged:["husky","lint-staged"],redux:["redux","react-redux","redux-saga"],reduxJest:["redux-mock-store"],core:["@babel/runtime","core-js","normalize-scss","prop-types","react@17","react-dom@17","react-router-dom","reselect","classnames"],storybook:["@storybook/react","@storybook/addons","@storybook/addon-knobs"],esdoc:["esdoc","esdoc-ecmascript-proposal-plugin","esdoc-jsx-plugin","esdoc-standard-plugin","opener"],jest:["babel-jest","eslint-plugin-jest","jest","react-test-renderer","opener"],dev:["@babel/core","@babel/eslint-parser","@babel/plugin-proposal-class-properties","@babel/plugin-proposal-object-rest-spread","@babel/plugin-transform-regenerator","@babel/plugin-transform-runtime","@babel/preset-env","@babel/preset-react","@babel/register","autoprefixer","babel-loader","clean-webpack-plugin","cross-env","css-loader","css-minimizer-webpack-plugin","eslint-config-prettier","eslint-import-resolver-webpack","eslint-plugin-import","eslint-plugin-jsx-a11y","eslint-plugin-prettier","eslint-plugin-react-hooks","eslint-plugin-react","eslint-webpack-plugin","eslint","html-loader","html-webpack-plugin","mini-css-extract-plugin","postcss-flexbugs-fixes","postcss-loader","postcss-scss","prettier","sass-loader","sass","style-loader","stylelint-config-recommended","stylelint-webpack-plugin","stylelint","terser-webpack-plugin","webpack-cli","webpack","webpack-dev-server"]},u={core:[".babelrc",".prettierrc",".stylelintrc",".editorconfig","jsconfig.json",".browserslistrc",c("utils","index.js")],templated:[".eslintrc.js","package.json",c("index.js"),c("index.html"),c("index.scss"),"webpack.config.babel.js"],esdoc:[".esdoc.json"],jest:["jest.config.js"],lintStaged:[".lintstagedrc"],fontAwesome:[c("icons.js")]},g={redux:[c("reducers"),c("sagas"),c("selectors")],core:[c("components"),c("utils")]},h={"build:documentation":"esdoc","view:documentation":"opener ./docs/index.html"},y={test:"jest","view:coverage":"opener ./coverage/index.html"};module.exports=class extends p{constructor(...e){super(...e),this.env.adapter.promptModule.registerPrompt("autocomplete",require("inquirer-autocomplete-prompt")),this.sourceRoot(t.join(__dirname,"..","..","templates","app")),this.answers={},this.fileSystem=i(this),this.registerTransformStream(s(/\.js$/,o(r.readFileSync(t.join(__dirname,"..","..",".prettierrc"))))),this.registerTransformStream(s(/\.scss$/,n({configFile:t.join(__dirname,"..","..",".stylelintrc")})))}async prompting(){const{name:e,email:t}=this.user.git;this.answers=await this.prompt([{type:"input",name:"package.name",message:"Package name",default:this.appname.replace(/\s+/g,"-")},{type:"input",name:"package.version",message:"Package version",default:"0.1.0"},{type:"autocomplete",name:"package.license",message:"Package license",source:(e,t)=>{const s=new RegExp(`.*${t}.*`,"i");return new Promise((e=>{e(l.filter((e=>s.test(e))))}))}},{type:"input",name:"package.description",message:"Package description"},{type:"input",name:"author.name",message:"Author name",default:e()},{type:"input",name:"author.email",message:"Author email address",default:t()},{type:"list",name:"styleFramework",message:"What CSS framework would you like to use?",choices:d},{type:"confirm",name:"flags.addLintStaged",message:"Force linting before commits?",default:!0},{type:"confirm",name:"flags.addFontAwesome",message:"Add Font Awesome?",default:!0},{type:"confirm",name:"flags.addRedux",message:"Add Redux?",default:!0},{type:"confirm",name:"flags.addJest",message:"Add Jest?",default:!0},{type:"confirm",name:"flags.addStorybook",message:"Add Storybook?",default:!1},{type:"confirm",name:"flags.addESDoc",message:"Add ESDoc?",default:!1}])}async writing(){const{flags:t,package:{license:s},author:{name:i,email:o}}=this.answers;let r="Place your license here.\n";if("SEE LICENSE IN LICENSE"!==s){this.log(`Downloading ${s} license from spdx/license-list-data...`);const{body:t}=await e(`https://raw.githubusercontent.com/spdx/license-list-data/master/text/${s}.txt`);r=t.replace("<year>",a.format(new Date,"yyyy")).replace("<copyright holders>",`${i} <${o}>`)}this.fileSystem.createFile("LICENSE",r),u.core.forEach(this.fileSystem.copy),u.templated.forEach(this.fileSystem.copyTemplateInPlace),g.core.forEach(this.fileSystem.copyDirectory),this.fileSystem.copyTo("gitignore",".gitignore"),t.addRedux&&g.redux.forEach(this.fileSystem.copyDirectory),t.addJest&&(u.jest.forEach(this.fileSystem.copy),this.fs.append(this.destinationPath(".gitignore"),"coverage/"),this.fs.extendJSON(this.destinationPath("package.json"),{scripts:{...y}})),t.addESDoc&&(u.esdoc.forEach(this.fileSystem.copy),this.fs.append(this.destinationPath(".gitignore"),"docs/"),this.fs.extendJSON(this.destinationPath("package.json"),{scripts:{...h}})),t.addLintStaged&&u.lintStaged.forEach(this.fileSystem.copy),t.addFontAwesome&&u.fontAwesome.forEach(this.fileSystem.copy)}install(){const e=[],t=[],{flags:s,styleFramework:a}=this.answers;this.log("Building a list of packages to install"),e.push.apply(e,m.core),t.push.apply(t,m.dev),null!==a&&e.push.apply(e,m[a]),s.addLintStaged&&t.push.apply(t,m.lintStaged),s.addFontAwesome&&e.push.apply(e,m.fontAwesome),s.addRedux&&e.push.apply(e,m.redux),s.addJest&&t.push.apply(t,m.jest),s.addRedux&&s.addJest&&t.push.apply(t,m.reduxJest),s.addStorybook&&t.push.apply(t,m.storybook),s.addESDoc&&e.push.apply(e,m.esdoc),this.log(`Getting ready to install ${e.length} dependencies and ${t.length} dev dependencies.`),this.npmInstall(e,{save:!0}),this.npmInstall(t,{"save-dev":!0}),this.spawnCommandSync("git",["init"]),this.spawnCommandSync("npx",["husky","install"]),this.spawnCommandSync("npx",["husky","add",".husky/pre-commit","npx lint-staged"])}};
1
+ import{join as e}from"path";import t from"gulp-if";import{format as s}from"date-fns";import a from"gulp-prettier";import{readFileSync as i}from"jsonfile";import o from"yeoman-stylelint";import n from"spdx-license-ids"with{type:"json"};import r from"yeoman-generator";import l,{src as c}from"../util/fs.js";n.push("SEE LICENSE IN LICENSE"),n.sort();const d=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,/^\d/.test(t)?`^${t}`:t])),p=[{value:null,name:"None"},{value:"bootstrap",name:"Bootstrap"},{value:"bulma",name:"Bulma"},{value:"foundation",name:"Foundation"},{value:"materialize",name:"Materialize"},{value:"uikit",name:"UIKit"},{value:"materialUi",name:"Material-UI"}],m={fontAwesome:["@fortawesome/fontawesome-svg-core","@fortawesome/free-solid-svg-icons","@fortawesome/react-fontawesome"],bootstrap:["bootstrap","react-bootstrap","@popperjs/core"],uikit:["uikit","uikit-react"],foundation:["foundation-sites","react-foundation"],materialize:["materialize-css","react-materialize"],bulma:["bulma"],materialUi:["@mui/material","@emotion/react","@emotion/styled"],lintStaged:["husky","lint-staged"],redux:["redux","react-redux","redux-saga"],reduxJest:["redux-mock-store"],rtl:["@testing-library/react","@testing-library/dom"],core:["normalize-scss","react","react-dom","react-router-dom@6","reselect","classnames"],storybook:["storybook@10","@storybook/react-vite@10","@storybook/addon-docs@10","@storybook/addon-a11y@10","@storybook/addon-links@10","@storybook/addon-themes@10","@vitejs/plugin-react","vite"],esdoc:["esdoc","esdoc-ecmascript-proposal-plugin","esdoc-jsx-plugin","esdoc-standard-plugin","opener"],jest:["@types/jest","eslint-plugin-jest","jest","react-test-renderer","opener"],dev:["@eslint/js@9","@types/react","@types/react-dom","autoprefixer","clean-webpack-plugin","cross-env","css-loader","css-minimizer-webpack-plugin","eslint-config-prettier","eslint-import-resolver-typescript","eslint-plugin-import-x","eslint-plugin-prettier","eslint-plugin-react-hooks","eslint-plugin-react","eslint-webpack-plugin","eslint@9","globals","html-loader","html-webpack-plugin","mini-css-extract-plugin","postcss","postcss-flexbugs-fixes","postcss-loader","postcss-scss","prettier","sass-loader","sass","style-loader","stylelint-config-recommended","stylelint-webpack-plugin","stylelint","terser-webpack-plugin","ts-loader","typescript@6","typescript-eslint","webpack-cli","webpack","webpack-dev-server"]},g={foundation:["@types/react-foundation"]},u={core:[".yarnrc.yml",".prettierrc",".stylelintrc",".editorconfig",".browserslistrc"],templated:["tsconfig.json",c("index.tsx"),c("index.html"),c("utils","index.ts")],esdoc:[".esdoc.json"],jest:["jest.config.js"],storybook:[e(".storybook","main.ts"),e(".storybook","preview.ts")],lintStaged:[".lintstagedrc"]},y={redux:[c("reducers"),c("sagas"),c("selectors")],templated:[c("components"),c("pages"),c("types")]},f={"build:documentation":"esdoc","view:documentation":"opener ./docs/index.html"},h={test:"jest","view:coverage":"opener ./coverage/index.html"},k={storybook:"storybook dev -p 6006","build:storybook":"storybook build"};class b extends r{answers;fileSystem;constructor(e,t,s){super(e,t,s),this.answers={component:{},deploy:{},module:{},package:{},author:{},flags:{}},this.fileSystem=l(this),this.sourceRoot(this.fileSystem.resolve("templates","app"))}initializing(){this.env.options.nodePackageManager="yarn",process.env.YARN_NPM_MINIMAL_AGE_GATE="0",this.queueTransformStream({},t(/\.tsx?$/,a(i(this.fileSystem.resolve(".prettierrc")))),t(/\.scss$/,o({configFile:this.fileSystem.resolve(".stylelintrc")})))}async prompting(){const[e,t]=await Promise.all([this.git.name(),this.git.email()]);this.answers=await this.prompt([{type:"input",name:"package.name",message:"Package name",default:this.appname.replace(/\s+/g,"-")},{type:"input",name:"package.version",message:"Package version",default:"0.1.0"},{type:"search",name:"package.license",message:"Package license",source:e=>{const t=new RegExp(`.*${e??""}.*`,"i");return n.filter(e=>t.test(e))}},{type:"input",name:"package.description",message:"Package description"},{type:"input",name:"author.name",message:"Author name",default:e},{type:"input",name:"author.email",message:"Author email address",default:t},{type:"select",name:"styleFramework",message:"What CSS framework would you like to use?",choices:p},{type:"confirm",name:"flags.addCnamePlugin",message:"Deploying to GitHub Pages with CNAME?",default:!1},{type:"input",name:"deploy.domain",message:"Hostname to use",when:e=>e.flags.addCnamePlugin},{type:"confirm",name:"flags.addLintStaged",message:"Force linting before commits?",default:!0},{type:"confirm",name:"flags.addFontAwesome",message:"Add Font Awesome?",default:!0},{type:"confirm",name:"flags.addRedux",message:"Add Redux?",default:!1},{type:"confirm",name:"flags.addJest",message:"Add Jest?",default:!1},{type:"confirm",name:"flags.addStorybook",message:"Add Storybook?",default:!1},{type:"confirm",name:"flags.addEsDoc",message:"Add ESDoc?",default:!1}])}async writing(){const{flags:t,styleFramework:a,package:{license:i},author:{name:o,email:n}}=this.answers;let r="Place your license here.\n";if("SEE LICENSE IN LICENSE"!==i){this.log(`Downloading ${i} license from spdx/license-list-data...`);const e=await fetch(`https://raw.githubusercontent.com/spdx/license-list-data/master/text/${i}.txt`);if(200!==e.status)this.log(`License download failed with HTTP ${e.status} - ${e.statusText}`);else{r=(await e.text()).replace("<year>",s(new Date,"yyyy")).replace("<copyright holders>",`${o} <${n}>`)}}this.fileSystem.createFile("LICENSE",r),u.core.forEach(this.fileSystem.copy),u.templated.forEach(this.fileSystem.copyTemplateInPlace),y.templated.forEach(this.fileSystem.copyDirectory),this.fileSystem.copyTemplate("_package.json","package.json"),this.fileSystem.copyTemplate("_eslint.config.mjs","eslint.config.mjs"),this.fileSystem.copyTemplate("webpack.config.nts","webpack.config.ts"),"materialUi"!==this.answers.styleFramework&&this.fileSystem.copyTemplate(c("index.nscss"),c("index.scss")),this.fileSystem.copyTo("gitignore",".gitignore"),t.addRedux&&y.redux.forEach(this.fileSystem.copyDirectory),t.addJest&&(u.jest.forEach(this.fileSystem.copy),this.fs.append(this.destinationPath(".gitignore"),"coverage/"),this.fs.extendJSON(this.destinationPath("package.json"),{scripts:{...h}})),t.addStorybook&&(u.storybook.forEach(this.fileSystem.copyTemplateInPlace),this.fileSystem.copyTemplate(e("_stories","SuspenseFallback.stories.tsx"),c("components","SuspenseFallback.stories.tsx")),this.fs.append(this.destinationPath(".gitignore"),"storybook-static/"),this.fs.extendJSON(this.destinationPath("package.json"),{scripts:{...k}})),t.addEsDoc&&(u.esdoc.forEach(this.fileSystem.copy),this.fs.append(this.destinationPath(".gitignore"),"docs/"),this.fs.extendJSON(this.destinationPath("package.json"),{scripts:{...f}})),t.addLintStaged&&(u.lintStaged.forEach(this.fileSystem.copy),this.fileSystem.createFile(".husky/pre-commit","npx lint-staged\n"));const l=[...m.core],p=[...m.dev];a&&(l.push(...m[a]),g[a]&&p.push(...g[a])),t.addLintStaged&&p.push(...m.lintStaged),t.addFontAwesome&&l.push(...m.fontAwesome),t.addRedux&&l.push(...m.redux),t.addJest&&p.push(...m.jest),t.addRedux&&t.addJest&&p.push(...m.reduxJest),t.addStorybook&&p.push(...m.storybook),t.addEsDoc&&l.push(...m.esdoc),this.log(`Resolving ${l.length} dependencies and ${p.length} dev dependencies.`);const[b,w]=await Promise.all([this.addDependencies(l),this.addDevDependencies(p)]);this.packageJson.merge({dependencies:d(b),devDependencies:d(w)})}install(){this.spawnSync("yarn",["set","version","stable"],{stdio:"inherit"})}async end(){const{flags:e}=this.answers;this.spawnSync("git",["init"],{stdio:"inherit"}),e.addLintStaged&&this.spawnSync("npx",["husky"],{stdio:"inherit"})}}export{b as default};
@@ -1 +1 @@
1
- "use strict";var e=require("path"),t=require("../util/fs.js");require("mkdirp");const s=require("yeoman-generator"),n=(...t)=>e.join("src",...t);module.exports=class extends s{constructor(...s){super(...s),this.sourceRoot(e.join(__dirname,"..","..","templates","component")),this.answers={},this.fileSystem=t(this)}async prompting(){this.answers=await this.prompt([{type:"input",name:"component.name",message:"Component name"},{type:"confirm",name:"flags.addRedux",message:"Connect this component to the Redux store?",default:!1}])}async writing(){const{component:{name:e}}=this.answers,t=n("components",`${e}.js`),s=n("components",`${e}.test.js`);this.log(`Creating ${e} component`),await this.fileSystem.copyTemplate("index.js",t),await this.fileSystem.copyTemplate("index.test.js",s)}};
1
+ import e from"yeoman-generator";import t,{src as s}from"../util/fs.js";class o extends e{answers;fileSystem;constructor(e,s,o){super(e,s,o),this.answers={component:{},deploy:{},module:{},package:{},author:{},flags:{}},this.fileSystem=t(this),this.sourceRoot(this.fileSystem.resolve("templates","component"))}async prompting(){this.answers=await this.prompt([{type:"input",name:"component.name",message:"Component name"},{type:"confirm",name:"flags.addRedux",message:"Connect this component to the Redux store?",default:!1},{type:"confirm",name:"flags.addStorybook",message:"Add a Storybook story?",default:!1}])}async writing(){const{flags:e,component:{name:t}}=this.answers,o=s("components",`${t}.tsx`),n=s("components",`${t}.test.tsx`);this.log(`Creating ${t} component`),this.fileSystem.copyTemplate("index.tsx",o),this.fileSystem.copyTemplate("index.test.tsx",n),e.addStorybook&&this.fileSystem.copyTemplate("index.stories.tsx",s("components",`${t}.stories.tsx`))}}export{o as default};
@@ -1 +1 @@
1
- "use strict";var e=require("path"),t=require("../util/fs.js");require("mkdirp");const a=require("yeoman-generator"),s=(...t)=>e.join("src",...t);module.exports=class extends a{constructor(...a){super(...a),this.sourceRoot(e.join(__dirname,"..","..","templates","module")),this.answers={},this.fileSystem=t(this)}async prompting(){this.answers=await this.prompt([{type:"input",name:"module.name",message:"Module name"},{type:"list",name:"directoryMode",message:"Choose a way of structuring the module.",choices:[{name:"Create a directory with the module name and an index.js file inside that.",value:"dir",short:"Directory"},{name:"Create a file with the module name.",value:"file",short:"File"}]},{type:"confirm",name:"flags.createReducer",message:"Generate a reducer?",default:!0},{type:"confirm",name:"flags.createSaga",message:"Generate a saga?",default:!0},{type:"confirm",name:"flags.createSelector",message:"Generate a selector?",default:!0},{type:"confirm",name:"flags.addJest",message:"Generate test files?",default:!0}])}async writing(){const{directoryMode:t,module:{name:a},flags:r}=this.answers;this.log(`Creating module ${a}`);const i=i=>{const o=`${a}${i}`,n=`index${i}`,c=[];switch(t){default:case"file":c.push(o);break;case"dir":c.push(a,n)}r.createReducer&&this.fileSystem.copyTemplate(e.join("reducer",n),s("reducers",...c)),r.createSaga&&this.fileSystem.copyTemplate(e.join("saga",n),s("sagas",...c)),r.createSelector&&this.fileSystem.copyTemplate(e.join("selector",n),s("selectors",...c))};i(".js"),r.addJest&&i(".test.js")}};
1
+ import{join as e}from"path";import t from"yeoman-generator";import a,{src as s}from"../util/fs.js";class r extends t{answers;fileSystem;constructor(e,t,s){super(e,t,s),this.answers={component:{},deploy:{},module:{},package:{},author:{},flags:{}},this.fileSystem=a(this),this.sourceRoot(this.fileSystem.resolve("templates","module"))}async prompting(){this.answers=await this.prompt([{type:"input",name:"module.name",message:"Module name"},{type:"select",name:"directoryMode",message:"Choose a way of structuring the module.",choices:[{name:"Create a directory with the module name and an index.js file inside that.",value:"dir",short:"Directory"},{name:"Create a file with the module name.",value:"file",short:"File"}]},{type:"confirm",name:"flags.createReducer",message:"Generate a reducer?",default:!0},{type:"confirm",name:"flags.createSaga",message:"Generate a saga?",default:!0},{type:"confirm",name:"flags.createSelector",message:"Generate a selector?",default:!0},{type:"confirm",name:"flags.addJest",message:"Generate test files?",default:!0}])}async writing(){const{directoryMode:t,module:{name:a},flags:r}=this.answers;if(!a)return void this.log("ERROR: No module name provided!");this.log(`Creating module ${a}`);const o=o=>{const i=`${a}${o}`,m=`index${o}`,l=[];switch(t){default:case"file":l.push(i);break;case"dir":l.push(a,m)}r.createReducer&&this.fileSystem.copyTemplate(e("reducer",m),s("reducers",...l)),r.createSaga&&this.fileSystem.copyTemplate(e("saga",m),s("sagas",...l)),r.createSelector&&this.fileSystem.copyTemplate(e("selector",m),s("selectors",...l))};o(".ts"),r.addJest&&o(".test.ts")}}export{r as default};
@@ -1 +1 @@
1
- "use strict";var t=require("mkdirp");module.exports=e=>({copy:t=>e.fs.copy(e.templatePath(t),e.destinationPath(t)),copyTo:(t,a)=>e.fs.copy(e.templatePath(t),e.destinationPath(a)),copyDirectory:t=>e.fs.copyTpl(e.templatePath(`${t}/**/*`),e.destinationPath(t),e.answers),copyTemplate:(t,a)=>e.fs.copyTpl(e.templatePath(t),e.destinationPath(a),e.answers),copyTemplateInPlace:t=>e.fs.copyTpl(e.templatePath(t),e.destinationPath(t),e.answers),createFile:(t,a)=>e.fs.write(e.destinationPath(t),a),makeDirectory:t});
1
+ import{join as t}from"path";import{mkdirp as e}from"mkdirp";import{fileURLToPath as a}from"url";const o=a(import.meta.url),p=(...e)=>t("src",...e);var r=a=>({copy:t=>a.fs.copy(a.templatePath(t),a.destinationPath(t)),copyTo:(t,e)=>a.fs.copy(a.templatePath(t),a.destinationPath(e)),copyDirectory:t=>a.fs.copyTpl(a.templatePath(`${t}/**/*`),a.destinationPath(t),a.answers),copyTemplate:(t,e)=>a.fs.copyTpl(a.templatePath(t),a.destinationPath(e),a.answers),copyTemplateInPlace:t=>a.fs.copyTpl(a.templatePath(t),a.destinationPath(t),a.answers),createFile:(t,e)=>a.fs.write(a.destinationPath(t),e),makeDirectory:e,resolve:(...e)=>t(o,"..","..","..",...e)});export{r as default,p as src};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "generator-reackt",
3
- "version": "0.5.0",
4
- "description": "Create an opinionated React-based web application",
3
+ "version": "1.0.0",
4
+ "description": "Create an opinionated React-based web applcication",
5
+ "type": "module",
5
6
  "files": [
6
7
  "generators",
7
8
  "templates",
@@ -10,60 +11,73 @@
10
11
  ],
11
12
  "repository": {
12
13
  "type": "git",
13
- "url": "ssh://git@git.codecube.xyz:7999/web/generator-reackt.git"
14
+ "url": "git+https://github.com/ayan4m1/generator-reackt.git"
14
15
  },
15
16
  "keywords": [
16
17
  "yeoman-generator",
17
18
  "generator",
18
19
  "scaffold",
19
20
  "frontend",
20
- "reactjs",
21
- "webpack",
22
- "redux"
21
+ "react",
22
+ "webpack"
23
23
  ],
24
24
  "scripts": {
25
- "build": "rollup -c",
26
- "watch": "rollup -c -w",
27
- "prepublishOnly": "rollup -c",
28
- "version": "auto-changelog -l false -p --hide-credit && git add CHANGELOG.md"
25
+ "version": "auto-changelog -l false -p --hide-credit && git add CHANGELOG.md",
26
+ "prepare": "husky",
27
+ "prepack": "rollup -c",
28
+ "build": "rollup -c"
29
29
  },
30
30
  "engines": {
31
- "node": ">=16"
31
+ "node": ">=22"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "provenance": true
32
36
  },
33
37
  "author": "ayan4m1 <andrew@bulletlogic.com>",
34
38
  "license": "MIT",
35
39
  "dependencies": {
36
- "chalk": "^5.2.0",
37
- "date-fns": "^2.30.0",
38
- "got": "^11.8.3",
40
+ "date-fns": "^3.6.0",
39
41
  "gulp-if": "^3.0.0",
40
- "gulp-prettier": "^4.0.0",
41
- "inquirer": "8.x",
42
- "inquirer-autocomplete-prompt": "^1.4.0",
43
- "jsonfile": "^6.1.0",
42
+ "gulp-prettier": "^6.0.0",
43
+ "jsonfile": "^6.2.1",
44
+ "mem-fs": "^4.0.0",
44
45
  "mkdirp": "^3.0.1",
45
- "spdx-license-ids": "^3.0.13",
46
- "yeoman-generator": "^4.13.0",
47
- "yeoman-stylelint": "^0.1.3"
46
+ "spdx-license-ids": "^3.0.23",
47
+ "yeoman-generator": "^8.3.0",
48
+ "yeoman-stylelint": "^1.0.0"
48
49
  },
49
50
  "devDependencies": {
50
- "@babel/core": "^7.21.8",
51
- "@babel/eslint-parser": "^7.21.8",
52
- "@babel/preset-env": "^7.21.5",
53
- "@babel/register": "^7.21.0",
54
- "@rollup/plugin-babel": "^6.0.3",
55
- "@rollup/plugin-eslint": "^9.0.4",
56
- "@rollup/plugin-node-resolve": "^15.0.2",
57
- "@rollup/plugin-terser": "^0.4.1",
58
- "auto-changelog": "^2.4.0",
59
- "eslint": "^8.40.0",
60
- "eslint-config-prettier": "^8.8.0",
61
- "eslint-plugin-prettier": "^4.2.1",
62
- "husky": "^8.0.3",
63
- "lint-staged": "^13.2.2",
64
- "prettier": "^2.8.8",
65
- "rollup": "^3.21.7",
51
+ "@eslint/js": "^9.39.5",
52
+ "@rollup/plugin-terser": "^1.0.0",
53
+ "@rollup/plugin-typescript": "^12.3.0",
54
+ "@types/gulp-if": "^3.0.5",
55
+ "@types/jest": "^30.0.0",
56
+ "@types/jsonfile": "^6.1.4",
57
+ "@types/node": "24.13.3",
58
+ "@types/rollup-plugin-auto-external": "^2",
59
+ "@types/spdx-license-ids": "^3.0.0",
60
+ "@yeoman/types": "^1.1.1",
61
+ "auto-changelog": "^2.6.0",
62
+ "eslint": "^9.39.5",
63
+ "eslint-config-prettier": "10.1.8",
64
+ "eslint-import-resolver-typescript": "^4.4.5",
65
+ "eslint-plugin-import-x": "^4.17.1",
66
+ "eslint-plugin-prettier": "^5.5.6",
67
+ "globals": "^17.11.0",
68
+ "husky": "^9.1.7",
69
+ "lint-staged": "^17.4.1",
70
+ "postcss": "^8.5.26",
71
+ "postcss-scss": "^4.0.9",
72
+ "prettier": "^3.9.6",
73
+ "rollup": "^4.63.1",
66
74
  "rollup-plugin-auto-external": "^2.0.0",
67
- "rollup-plugin-multi-input": "^1.4.1"
68
- }
75
+ "semantic-release": "^25.0.9",
76
+ "stylelint": "^17.14.1",
77
+ "stylelint-config-recommended": "^18.0.0",
78
+ "tslib": "^2.8.1",
79
+ "typescript": "^6.0.3",
80
+ "typescript-eslint": "^8.68.0"
81
+ },
82
+ "packageManager": "yarn@4.18.0"
69
83
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "*.js": "eslint",
2
+ "*.{ts,tsx}": "eslint",
3
3
  "*.scss": "stylelint"
4
4
  }
@@ -2,4 +2,4 @@
2
2
  "singleQuote": true,
3
3
  "trailingComma": "none",
4
4
  "endOfLine": "auto"
5
- }
5
+ }
@@ -0,0 +1,19 @@
1
+ import react from '@vitejs/plugin-react';
2
+ import { mergeConfig } from 'vite';
3
+ import type { StorybookConfig } from '@storybook/react-vite';
4
+
5
+ const config: StorybookConfig = {
6
+ framework: '@storybook/react-vite',
7
+ stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
8
+ addons: [
9
+ '@storybook/addon-docs',
10
+ '@storybook/addon-a11y',
11
+ '@storybook/addon-links',
12
+ '@storybook/addon-themes'
13
+ ],
14
+ // since Storybook 8 the framework no longer injects @vitejs/plugin-react
15
+ viteFinal: (config: StorybookConfig) =>
16
+ mergeConfig(config, { plugins: [react()] })
17
+ };
18
+
19
+ export default config;
@@ -0,0 +1,36 @@
1
+ <% if (styleFramework === 'bootstrap') { %>
2
+ import { withThemeByDataAttribute } from '@storybook/addon-themes';
3
+ <% } else { %>
4
+ import { withThemeByClassName } from '@storybook/addon-themes';
5
+ <% } %>
6
+ import type { Preview } from '@storybook/react-vite';
7
+
8
+ import '../src/index.scss';
9
+
10
+ const preview: Preview = {
11
+ parameters: {
12
+ controls: {
13
+ matchers: {
14
+ color: /(background|bg|color)$/i,
15
+ date: /date$/i
16
+ }
17
+ }
18
+ },
19
+ decorators: [
20
+ <% if (styleFramework === 'bootstrap') { %>
21
+ withThemeByDataAttribute({
22
+ attributeName: 'data-bs-theme',
23
+ themes: { light: 'light', dark: 'dark' },
24
+ defaultTheme: 'light'
25
+ })
26
+ <% } else { %>
27
+ withThemeByClassName({
28
+ themes: { light: 'light', dark: 'dark' },
29
+ defaultTheme: 'light'
30
+ })
31
+ <% } %>
32
+ ],
33
+ tags: ['autodocs']
34
+ };
35
+
36
+ export default preview;