This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NodePlopAPI } from 'plop' | |
export const libGenerator = (plop: NodePlopAPI) => { | |
const prompts = [ | |
{ | |
type: 'input', | |
name: 'libName', | |
message: 'Library name' | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NodePlopAPI } from 'plop' | |
export const appGenerator = (plop: NodePlopAPI) => { | |
const prompts = [ | |
{ | |
type: 'input', | |
name: 'appName', | |
message: 'App name' | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionConfig, NodePlopAPI } from 'plop' | |
import globby from 'globby' | |
import fse from 'fs-extra' | |
import replaceInFiles from 'replace-in-files' | |
export const copyFiles = async (answers: object, config: ActionConfig, plop: NodePlopAPI) => { | |
const configData = config.data as any | |
const allFiles = await globby([configData.source], { | |
gitignore: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { appGenerator } from './app-generator' | |
import { libGenerator } from './lib-generator' | |
import { NodePlopAPI } from 'plop' | |
import { copyFiles } from './actions' | |
module.exports = function (plop: NodePlopAPI) { | |
plop.setActionType('copy-files', copyFiles) | |
plop.setGenerator('app', appGenerator(plop)) | |
plop.setGenerator('lib', libGenerator(plop)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { NextPage } from 'next' | |
import { Button } from 'components/Button' | |
import { capitalize } from '@outsrc/functions' | |
const Index: NextPage = () => { | |
const handleClick = (): void => { | |
alert('World') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { capitalize } from './index' | |
describe('Functions', () => { | |
it('capitalize', () => { | |
expect(capitalize('john doe')).toBe('John Doe') | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const capitalize = (a: string): string => | |
a | |
.split(' ') | |
.map(p => p[0].toUpperCase() + p.substr(1).toLocaleLowerCase()) | |
.join(' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"extends": "../../../config/next.tsconfig.json", | |
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], | |
"compilerOptions": { | |
"baseUrl": "./src" | |
}, | |
"exclude": ["node_modules"] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "@outsrc/functions", | |
"version": "0.0.0", | |
"description": "Templated shared functions", | |
"main": "src/index.ts", | |
"scripts": { | |
"test": "jest --coverage --config ../../../jest.config.js ./src/*" | |
}, | |
"keywords": [], | |
"author": "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.parameters = { | |
actions: { argTypesRegex: '^on[A-Z].*' } | |
} |