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.
- package/.prettierrc +1 -1
- package/.stylelintrc +3 -102
- package/LICENSE +17 -5
- package/README.md +4 -2
- package/generators/app/index.js +1 -1
- package/generators/component/index.js +1 -1
- package/generators/module/index.js +1 -1
- package/generators/util/fs.js +1 -1
- package/package.json +53 -39
- package/templates/app/.lintstagedrc +1 -1
- package/templates/app/.prettierrc +1 -1
- package/templates/app/.storybook/main.ts +19 -0
- package/templates/app/.storybook/preview.ts +36 -0
- package/templates/app/.stylelintrc +2 -268
- package/templates/app/.yarnrc.yml +3 -0
- package/templates/app/_eslint.config.mjs +51 -0
- package/templates/app/{package.json → _package.json} +2 -2
- package/templates/app/_stories/SuspenseFallback.stories.tsx +17 -0
- package/templates/app/gitignore +1 -0
- package/templates/app/jest.config.js +1 -1
- package/templates/app/src/components/ErrorBoundary.tsx +45 -0
- package/templates/app/src/components/Layout.tsx +142 -0
- package/templates/app/src/components/SuspenseFallback.tsx +96 -0
- package/templates/app/src/{index.scss → index.nscss} +8 -7
- package/templates/app/src/index.tsx +60 -0
- package/templates/app/src/pages/index.tsx +3 -0
- package/templates/app/src/reducers/application.ts +36 -0
- package/templates/app/src/reducers/{index.js → index.ts} +1 -0
- package/templates/app/src/sagas/application.ts +9 -0
- package/templates/app/src/sagas/{index.js → index.ts} +1 -0
- package/templates/app/src/selectors/application.test.ts +18 -0
- package/templates/app/src/selectors/application.ts +6 -0
- package/templates/app/src/types/globals.d.ts +1 -0
- package/templates/app/src/types/index.ts +11 -0
- package/templates/app/src/utils/{index.js → index.ts} +3 -3
- package/templates/app/tsconfig.json +18 -0
- package/templates/app/webpack.config.nts +121 -0
- package/templates/component/index.stories.tsx +14 -0
- package/templates/component/{index.js → index.tsx} +2 -5
- package/generators/es.regexp.flags-ccfbed60.js +0 -1
- package/templates/app/.babelrc +0 -9
- package/templates/app/.eslintrc.js +0 -185
- package/templates/app/.storybook/addons.js +0 -1
- package/templates/app/.storybook/config.js +0 -14
- package/templates/app/.storybook/webpack.config.babel.js +0 -7
- package/templates/app/jsconfig.json +0 -8
- package/templates/app/src/components/App.js +0 -14
- package/templates/app/src/icons.js +0 -4
- package/templates/app/src/index.js +0 -50
- package/templates/app/src/reducers/application.js +0 -21
- package/templates/app/src/sagas/application.js +0 -9
- package/templates/app/src/selectors/application.js +0 -1
- package/templates/app/src/selectors/application.test.js +0 -13
- package/templates/app/webpack.config.babel.js +0 -103
- /package/templates/component/{index.test.js → index.test.tsx} +0 -0
- /package/templates/module/reducer/{index.test.js → index.test.ts} +0 -0
- /package/templates/module/reducer/{index.js → index.ts} +0 -0
- /package/templates/module/saga/{index.test.js → index.test.ts} +0 -0
- /package/templates/module/saga/{index.js → index.ts} +0 -0
- /package/templates/module/selector/{index.js → index.test.ts} +0 -0
- /package/templates/module/selector/{index.test.js → index.ts} +0 -0
package/.prettierrc
CHANGED
package/.stylelintrc
CHANGED
|
@@ -1,104 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
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
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright 2018-
|
|
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
|
|
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
|
|
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
|
|
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
|
-
- [
|
|
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
|
|
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
|
package/generators/app/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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};
|
package/generators/util/fs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"
|
|
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.
|
|
4
|
-
"description": "Create an opinionated React-based web
|
|
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": "
|
|
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
|
-
"
|
|
21
|
-
"webpack"
|
|
22
|
-
"redux"
|
|
21
|
+
"react",
|
|
22
|
+
"webpack"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
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": ">=
|
|
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
|
-
"
|
|
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": "^
|
|
41
|
-
"
|
|
42
|
-
"
|
|
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.
|
|
46
|
-
"yeoman-generator": "^
|
|
47
|
-
"yeoman-stylelint": "^0.
|
|
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
|
-
"@
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@rollup
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"eslint
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
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
|
-
"
|
|
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
|
}
|
|
@@ -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;
|