generator-reackt 0.6.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 +5 -5
- package/.stylelintrc +5 -188
- package/LICENSE +21 -7
- package/README.md +20 -18
- package/generators/app/index.js +1 -392
- package/generators/component/index.js +1 -51
- package/generators/module/index.js +1 -127
- package/generators/util/fs.js +1 -34
- package/package.json +83 -63
- package/templates/app/.browserslistrc +3 -3
- package/templates/app/.editorconfig +11 -11
- package/templates/app/.esdoc.json +23 -23
- package/templates/app/.lintstagedrc +4 -4
- package/templates/app/.prettierrc +5 -5
- package/templates/app/.storybook/main.ts +19 -0
- package/templates/app/.storybook/preview.ts +36 -0
- package/templates/app/.stylelintrc +5 -188
- package/templates/app/.yarnrc.yml +3 -0
- package/templates/app/_eslint.config.mjs +51 -0
- package/templates/app/{package.json → _package.json} +18 -18
- package/templates/app/_stories/SuspenseFallback.stories.tsx +17 -0
- package/templates/app/gitignore +3 -2
- package/templates/app/jest.config.js +15 -15
- 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.html +10 -10
- package/templates/app/src/{index.scss → index.nscss} +17 -16
- 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} +8 -7
- package/templates/app/src/sagas/application.ts +9 -0
- package/templates/app/src/sagas/{index.js → index.ts} +8 -7
- 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} +36 -36
- 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.test.js → index.test.tsx} +14 -14
- package/templates/{app/src/components/App.js → component/index.tsx} +16 -14
- package/templates/module/reducer/{index.js → index.ts} +20 -20
- package/templates/module/saga/{index.js → index.ts} +9 -9
- package/templates/app/.babelrc +0 -4
- package/templates/app/.eslintrc.js +0 -46
- 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 -7
- package/templates/app/src/index.js +0 -47
- 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.js +0 -19
- /package/templates/module/reducer/{index.test.js → index.test.ts} +0 -0
- /package/templates/module/saga/{index.test.js → index.test.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
|
@@ -1,51 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
import fileSystem from '../util/fs.js';
|
|
6
|
-
|
|
7
|
-
// we cannot use ES6 imports on this object, as it directly exports a class to
|
|
8
|
-
// module.exports - no default export nor a named export is present for us to use
|
|
9
|
-
const require = createRequire(import.meta.url);
|
|
10
|
-
const __dirname = fileURLToPath(import.meta.url);
|
|
11
|
-
const Generator = require('yeoman-generator');
|
|
12
|
-
|
|
13
|
-
const src = (...paths) => join('src', ...paths);
|
|
14
|
-
|
|
15
|
-
export default class extends Generator {
|
|
16
|
-
constructor(...args) {
|
|
17
|
-
super(...args);
|
|
18
|
-
|
|
19
|
-
this.sourceRoot(join(__dirname, '..', '..', 'templates', 'component'));
|
|
20
|
-
this.answers = {};
|
|
21
|
-
this.fileSystem = fileSystem(this);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async prompting() {
|
|
25
|
-
this.answers = await this.prompt([
|
|
26
|
-
{
|
|
27
|
-
type: 'input',
|
|
28
|
-
name: 'component.name',
|
|
29
|
-
message: 'Component name'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'confirm',
|
|
33
|
-
name: 'flags.addRedux',
|
|
34
|
-
message: 'Connect this component to the Redux store?',
|
|
35
|
-
default: false
|
|
36
|
-
}
|
|
37
|
-
]);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async writing() {
|
|
41
|
-
const {
|
|
42
|
-
component: { name }
|
|
43
|
-
} = this.answers;
|
|
44
|
-
const fileName = src('components', `${name}.js`);
|
|
45
|
-
const testName = src('components', `${name}.test.js`);
|
|
46
|
-
|
|
47
|
-
this.log(`Creating ${name} component`);
|
|
48
|
-
await this.fileSystem.copyTemplate('index.js', fileName);
|
|
49
|
-
await this.fileSystem.copyTemplate('index.test.js', testName);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
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,127 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
import fileSystem from '../util/fs.js';
|
|
6
|
-
|
|
7
|
-
// we cannot use ES6 imports on this object, as it directly exports a class to
|
|
8
|
-
// module.exports - no default export nor a named export is present for us to use
|
|
9
|
-
const require = createRequire(import.meta.url);
|
|
10
|
-
const __dirname = fileURLToPath(import.meta.url);
|
|
11
|
-
const Generator = require('yeoman-generator');
|
|
12
|
-
|
|
13
|
-
const src = (...paths) => join('src', ...paths);
|
|
14
|
-
|
|
15
|
-
export default class extends Generator {
|
|
16
|
-
constructor(...args) {
|
|
17
|
-
super(...args);
|
|
18
|
-
|
|
19
|
-
this.sourceRoot(join(__dirname, '..', '..', 'templates', 'module'));
|
|
20
|
-
this.answers = {};
|
|
21
|
-
this.fileSystem = fileSystem(this);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async prompting() {
|
|
25
|
-
this.answers = await this.prompt([
|
|
26
|
-
{
|
|
27
|
-
type: 'input',
|
|
28
|
-
name: 'module.name',
|
|
29
|
-
message: 'Module name'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
type: 'list',
|
|
33
|
-
name: 'directoryMode',
|
|
34
|
-
message: 'Choose a way of structuring the module.',
|
|
35
|
-
choices: [
|
|
36
|
-
{
|
|
37
|
-
name: 'Create a directory with the module name and an index.js file inside that.',
|
|
38
|
-
value: 'dir',
|
|
39
|
-
short: 'Directory'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'Create a file with the module name.',
|
|
43
|
-
value: 'file',
|
|
44
|
-
short: 'File'
|
|
45
|
-
}
|
|
46
|
-
]
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'confirm',
|
|
50
|
-
name: 'flags.createReducer',
|
|
51
|
-
message: 'Generate a reducer?',
|
|
52
|
-
default: true
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: 'confirm',
|
|
56
|
-
name: 'flags.createSaga',
|
|
57
|
-
message: 'Generate a saga?',
|
|
58
|
-
default: true
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
type: 'confirm',
|
|
62
|
-
name: 'flags.createSelector',
|
|
63
|
-
message: 'Generate a selector?',
|
|
64
|
-
default: true
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
type: 'confirm',
|
|
68
|
-
name: 'flags.addJest',
|
|
69
|
-
message: 'Generate test files?',
|
|
70
|
-
default: true
|
|
71
|
-
}
|
|
72
|
-
]);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
async writing() {
|
|
76
|
-
const {
|
|
77
|
-
directoryMode,
|
|
78
|
-
module: { name },
|
|
79
|
-
flags
|
|
80
|
-
} = this.answers;
|
|
81
|
-
|
|
82
|
-
this.log(`Creating module ${name}`);
|
|
83
|
-
|
|
84
|
-
const buildPaths = (ext) => {
|
|
85
|
-
const namePath = `${name}${ext}`;
|
|
86
|
-
const indexPath = `index${ext}`;
|
|
87
|
-
const destPath = [];
|
|
88
|
-
|
|
89
|
-
switch (directoryMode) {
|
|
90
|
-
default:
|
|
91
|
-
case 'file':
|
|
92
|
-
destPath.push(namePath);
|
|
93
|
-
break;
|
|
94
|
-
case 'dir':
|
|
95
|
-
destPath.push(name, indexPath);
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (flags.createReducer) {
|
|
100
|
-
this.fileSystem.copyTemplate(
|
|
101
|
-
join('reducer', indexPath),
|
|
102
|
-
src('reducers', ...destPath)
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (flags.createSaga) {
|
|
107
|
-
this.fileSystem.copyTemplate(
|
|
108
|
-
join('saga', indexPath),
|
|
109
|
-
src('sagas', ...destPath)
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (flags.createSelector) {
|
|
114
|
-
this.fileSystem.copyTemplate(
|
|
115
|
-
join('selector', indexPath),
|
|
116
|
-
src('selectors', ...destPath)
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
buildPaths('.js');
|
|
122
|
-
|
|
123
|
-
if (flags.addJest) {
|
|
124
|
-
buildPaths('.test.js');
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
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,34 +1 @@
|
|
|
1
|
-
import { mkdirp }
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
|
|
5
|
-
const __dirname = fileURLToPath(import.meta.url);
|
|
6
|
-
|
|
7
|
-
export default (gen) => ({
|
|
8
|
-
copy: (file) =>
|
|
9
|
-
gen.fs.copy(gen.templatePath(file), gen.destinationPath(file)),
|
|
10
|
-
copyTo: (src, dst) =>
|
|
11
|
-
gen.fs.copy(gen.templatePath(src), gen.destinationPath(dst)),
|
|
12
|
-
copyDirectory: (dir) =>
|
|
13
|
-
gen.fs.copyTpl(
|
|
14
|
-
gen.templatePath(`${dir}/**/*`),
|
|
15
|
-
gen.destinationPath(dir),
|
|
16
|
-
gen.answers
|
|
17
|
-
),
|
|
18
|
-
copyTemplate: (source, destination) =>
|
|
19
|
-
gen.fs.copyTpl(
|
|
20
|
-
gen.templatePath(source),
|
|
21
|
-
gen.destinationPath(destination),
|
|
22
|
-
gen.answers
|
|
23
|
-
),
|
|
24
|
-
copyTemplateInPlace: (file) =>
|
|
25
|
-
gen.fs.copyTpl(
|
|
26
|
-
gen.templatePath(file),
|
|
27
|
-
gen.destinationPath(file),
|
|
28
|
-
gen.answers
|
|
29
|
-
),
|
|
30
|
-
createFile: (file, contents) =>
|
|
31
|
-
gen.fs.write(gen.destinationPath(file), contents),
|
|
32
|
-
makeDirectory: mkdirp,
|
|
33
|
-
resolve: (...paths) => join(__dirname, '..', '..', '..', ...paths)
|
|
34
|
-
});
|
|
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,63 +1,83 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "generator-reackt",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Create an opinionated React-based web applcication",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"files": [
|
|
7
|
-
"generators",
|
|
8
|
-
"templates",
|
|
9
|
-
".prettierrc",
|
|
10
|
-
".stylelintrc"
|
|
11
|
-
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"yeoman-generator",
|
|
18
|
-
"generator",
|
|
19
|
-
"scaffold",
|
|
20
|
-
"frontend",
|
|
21
|
-
"
|
|
22
|
-
"webpack"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "generator-reackt",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Create an opinionated React-based web applcication",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"generators",
|
|
8
|
+
"templates",
|
|
9
|
+
".prettierrc",
|
|
10
|
+
".stylelintrc"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/ayan4m1/generator-reackt.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"yeoman-generator",
|
|
18
|
+
"generator",
|
|
19
|
+
"scaffold",
|
|
20
|
+
"frontend",
|
|
21
|
+
"react",
|
|
22
|
+
"webpack"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
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
|
+
},
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"provenance": true
|
|
36
|
+
},
|
|
37
|
+
"author": "ayan4m1 <andrew@bulletlogic.com>",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"date-fns": "^3.6.0",
|
|
41
|
+
"gulp-if": "^3.0.0",
|
|
42
|
+
"gulp-prettier": "^6.0.0",
|
|
43
|
+
"jsonfile": "^6.2.1",
|
|
44
|
+
"mem-fs": "^4.0.0",
|
|
45
|
+
"mkdirp": "^3.0.1",
|
|
46
|
+
"spdx-license-ids": "^3.0.23",
|
|
47
|
+
"yeoman-generator": "^8.3.0",
|
|
48
|
+
"yeoman-stylelint": "^1.0.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
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",
|
|
74
|
+
"rollup-plugin-auto-external": "^2.0.0",
|
|
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"
|
|
83
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
last 2 versions
|
|
2
|
-
not dead
|
|
3
|
-
> 1%
|
|
1
|
+
last 2 versions
|
|
2
|
+
not dead
|
|
3
|
+
> 1%
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
root = true
|
|
2
|
-
|
|
3
|
-
[*]
|
|
4
|
-
indent_style = space
|
|
5
|
-
indent_size = 2
|
|
6
|
-
charset = utf-8
|
|
7
|
-
trim_trailing_whitespace = true
|
|
8
|
-
insert_final_newline = true
|
|
9
|
-
|
|
10
|
-
[{*.md,*.snap}]
|
|
11
|
-
trim_trailing_whitespace = false
|
|
1
|
+
root = true
|
|
2
|
+
|
|
3
|
+
[*]
|
|
4
|
+
indent_style = space
|
|
5
|
+
indent_size = 2
|
|
6
|
+
charset = utf-8
|
|
7
|
+
trim_trailing_whitespace = true
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
|
|
10
|
+
[{*.md,*.snap}]
|
|
11
|
+
trim_trailing_whitespace = false
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"source": "./src",
|
|
3
|
-
"destination": "./docs",
|
|
4
|
-
"plugins": [
|
|
5
|
-
{
|
|
6
|
-
"name": "esdoc-standard-plugin",
|
|
7
|
-
"option": {
|
|
8
|
-
"test": {
|
|
9
|
-
"source": "./src/",
|
|
10
|
-
"interfaces": ["describe", "it", "context", "suite", "test"],
|
|
11
|
-
"includes": ["test\\.js$"]
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
{ "name": "esdoc-jsx-plugin" },
|
|
16
|
-
{
|
|
17
|
-
"name": "esdoc-ecmascript-proposal-plugin",
|
|
18
|
-
"option": {
|
|
19
|
-
"all": true
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
]
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"source": "./src",
|
|
3
|
+
"destination": "./docs",
|
|
4
|
+
"plugins": [
|
|
5
|
+
{
|
|
6
|
+
"name": "esdoc-standard-plugin",
|
|
7
|
+
"option": {
|
|
8
|
+
"test": {
|
|
9
|
+
"source": "./src/",
|
|
10
|
+
"interfaces": ["describe", "it", "context", "suite", "test"],
|
|
11
|
+
"includes": ["test\\.js$"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
{ "name": "esdoc-jsx-plugin" },
|
|
16
|
+
{
|
|
17
|
+
"name": "esdoc-ecmascript-proposal-plugin",
|
|
18
|
+
"option": {
|
|
19
|
+
"all": true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{
|
|
2
|
-
"*.
|
|
3
|
-
"*.scss": "stylelint"
|
|
4
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"*.{ts,tsx}": "eslint",
|
|
3
|
+
"*.scss": "stylelint"
|
|
4
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"singleQuote": true,
|
|
3
|
-
"trailingComma": "none",
|
|
4
|
-
"endOfLine": "auto"
|
|
5
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"singleQuote": true,
|
|
3
|
+
"trailingComma": "none",
|
|
4
|
+
"endOfLine": "auto"
|
|
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;
|