@csssr/core-scripts
Advanced tools
| .next/ | ||
| node_modules/ | ||
| .sonarlint/ | ||
| !.eslintrc.js | ||
| !.prettierrc.js |
| module.exports = { | ||
| env: { | ||
| browser: true, | ||
| node: true, | ||
| es6: true, | ||
| }, | ||
| rules: { | ||
| 'prettier/prettier': [ | ||
| 'error', | ||
| { | ||
| useTabs: false, | ||
| printWidth: 100, | ||
| semi: false, | ||
| singleQuote: true, | ||
| jsxSingleQuote: false, | ||
| trailingComma: 'all', | ||
| bracketSpacing: true, | ||
| }, | ||
| ], | ||
| }, | ||
| extends: '@csssr/eslint-config-core', | ||
| } |
| { | ||
| "editor.formatOnSave": true, | ||
| "eslint.autoFixOnSave": true | ||
| } |
+53
-16
@@ -17,3 +17,7 @@ const fs = require('fs-extra') | ||
| console.log('\n-----------------------') | ||
| console.log('\n\x1b[31m', 'Название компонента должно начинаться с заглавной буквы и быть написано в PascalCase', '\x1b[0m') | ||
| console.log( | ||
| '\n\x1b[31m', | ||
| 'Название компонента должно начинаться с заглавной буквы и быть написано в PascalCase', | ||
| '\x1b[0m', | ||
| ) | ||
| console.log('\n-----------------------') | ||
@@ -23,17 +27,46 @@ throw '' | ||
| const componentTemplatePath = path.resolve(__dirname, '../templates/components/Component', `Component.jsx.hbs`) | ||
| const componentStylesTemplatePath = path.resolve(__dirname, '../templates/components/Component', `Component.styles.js.hbs`) | ||
| const componentIndexTemplatePath = path.resolve(__dirname, '../templates/components/Component', `index.js.hbs`) | ||
| const componentTemplatePath = path.resolve( | ||
| __dirname, | ||
| '../templates/components/Component', | ||
| `Component.jsx.hbs`, | ||
| ) | ||
| const componentStylesTemplatePath = path.resolve( | ||
| __dirname, | ||
| '../templates/components/Component', | ||
| `Component.styles.js.hbs`, | ||
| ) | ||
| const componentIndexTemplatePath = path.resolve( | ||
| __dirname, | ||
| '../templates/components/Component', | ||
| `index.js.hbs`, | ||
| ) | ||
| const componentTemplate = compile(fs.readFileSync(componentTemplatePath, { encoding: 'utf8' })) | ||
| const componentStylesTemplate = compile(fs.readFileSync(componentStylesTemplatePath, { encoding: 'utf8' })) | ||
| const componentIndexTemplate = compile(fs.readFileSync(componentIndexTemplatePath, { encoding: 'utf8' })) | ||
| const componentStylesTemplate = compile( | ||
| fs.readFileSync(componentStylesTemplatePath, { encoding: 'utf8' }), | ||
| ) | ||
| const componentIndexTemplate = compile( | ||
| fs.readFileSync(componentIndexTemplatePath, { encoding: 'utf8' }), | ||
| ) | ||
| const componentPath = path.format({ dir: `components/${componentName}`, name: componentName, ext: '.jsx' }) | ||
| const componentStylesPath = path.format({ dir: `components/${componentName}`, name: componentName, ext: '.styles.js' }) | ||
| const componentIndexPath = path.format({ dir: `components/${componentName}`, name: 'index', ext: '.js' }) | ||
| const componentPath = path.format({ | ||
| dir: `components/${componentName}`, | ||
| name: componentName, | ||
| ext: '.jsx', | ||
| }) | ||
| const componentStylesPath = path.format({ | ||
| dir: `components/${componentName}`, | ||
| name: componentName, | ||
| ext: '.styles.js', | ||
| }) | ||
| const componentIndexPath = path.format({ | ||
| dir: `components/${componentName}`, | ||
| name: 'index', | ||
| ext: '.js', | ||
| }) | ||
| fs.outputFile( componentIndexPath, componentIndexTemplate({componentName}), (err) => { | ||
| if (err) { throw err } | ||
| fs.outputFile(componentIndexPath, componentIndexTemplate({ componentName }), err => { | ||
| if (err) { | ||
| throw err | ||
| } | ||
| console.log('\n-----------------------') | ||
@@ -43,9 +76,13 @@ console.log('Файл index для компонента был успешно создан! 🎉') | ||
| fs.outputFile( componentPath, componentTemplate({componentName}), (err) => { | ||
| if (err) { throw err } | ||
| fs.outputFile(componentPath, componentTemplate({ componentName }), err => { | ||
| if (err) { | ||
| throw err | ||
| } | ||
| console.log('Файл компонента был успешно создан! 🎉') | ||
| }) | ||
| fs.outputFile( componentStylesPath, componentStylesTemplate(), (err) => { | ||
| if (err) { throw err } | ||
| fs.outputFile(componentStylesPath, componentStylesTemplate(), err => { | ||
| if (err) { | ||
| throw err | ||
| } | ||
@@ -52,0 +89,0 @@ console.log('Файл стилей для компонента был успешно создан! 🎉') |
+8
-3
@@ -34,3 +34,3 @@ const path = require('path') | ||
| 'Неправильно введен адрес репозитория, он должен быть такого формата:', | ||
| 'git@github.com:palmflip/example-nextjs-sample.git' | ||
| 'git@github.com:palmflip/example-nextjs-sample.git', | ||
| ].join('\n') | ||
@@ -43,2 +43,3 @@ | ||
| // eslint-disable-line | ||
| const FILES_TO_CREATE = [ | ||
@@ -53,5 +54,9 @@ { | ||
| }, | ||
| './.eslintignore', | ||
| './.eslintrc.js', | ||
| './.vscode/settings.json', | ||
| answers.initRepo && { | ||
| path: './scripts/deploy.sh', | ||
| mode: 0777 & ~process.umask(), | ||
| // eslint-disable-next-line | ||
| mode: '0777' & ~process.umask(), | ||
| locals: ['repoAddress'], | ||
@@ -126,3 +131,3 @@ }, | ||
| console.log( | ||
| 'После того, как запустится сервер нужно открыть в браузере эту станицу: http://localhost:3000' | ||
| 'После того, как запустится сервер нужно открыть в браузере эту станицу: http://localhost:3000', | ||
| ) | ||
@@ -129,0 +134,0 @@ console.log('-----------------------') |
+2
-2
| { | ||
| "name": "@csssr/core-scripts", | ||
| "version": "0.6.2", | ||
| "version": "0.7.0", | ||
| "main": "index.js", | ||
@@ -22,3 +22,3 @@ "license": "MIT", | ||
| }, | ||
| "gitHead": "02dda806580d23439a086933bdca4fa338adfdb9" | ||
| "gitHead": "d5828d8afba1ad66da122a15267fd8ce7d51e5b9" | ||
| } |
@@ -11,3 +11,4 @@ { | ||
| "start": "next start", | ||
| "deploy": "npm run build && npm run export && ./scripts/deploy.sh" | ||
| "deploy": "npm run build && npm run export && ./scripts/deploy.sh", | ||
| "lint": "eslint . -c .eslintrc.js --ext js,jsx" | ||
| }, | ||
@@ -28,4 +29,9 @@ "dependencies": { | ||
| "devDependencies": { | ||
| "@csssr/eslint-config-core": "^1.0.2", | ||
| "eslint": "^6.0.1", | ||
| "eslint-plugin-prettier": "^3.1.0", | ||
| "eslint-plugin-react": "^7.14.2", | ||
| "prettier": "^1.18.2", | ||
| "file-loader": "^4.0.0" | ||
| } | ||
| } |
| import React from 'react' | ||
| import styled from '@emotion/styled' | ||
| const originPage = props => | ||
@@ -11,3 +10,3 @@ <div className={props.className}> | ||
| <p> | ||
| Мы можете начать изменять и заполнять компонентами из библиотеки <code>@csssr/core-design</code> эту страницу как вам угодно или создать новую. | ||
| Мы можете начать изменять и заполнять компонентами из библиотеки <code>@csssr/core-design</code> эту страницу как вам угодно или создать новую. | ||
| Документацию по существующим компонентам можно найти <a href="http://core-design.csssr.ru/" target="_blank" rel="noopener">тут</a>. | ||
@@ -14,0 +13,0 @@ </p> |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
31438
3.45%20
17.65%222
24.02%