Skip to content

Commit

Permalink
base con el nombre de andreani
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonyF-Andreani committed Jun 9, 2021
1 parent a3f51b8 commit 216e60b
Show file tree
Hide file tree
Showing 28 changed files with 211 additions and 22 deletions.
5 changes: 3 additions & 2 deletions .plop/app-generator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NodePlopAPI } from 'plop'
import { PlopGeneratorConfig } from './types'

export const appGenerator = (plop: NodePlopAPI) => {
export const appGenerator = (plop: NodePlopAPI): PlopGeneratorConfig => {
const prompts = [
{
type: 'input',
Expand Down Expand Up @@ -31,7 +32,7 @@ export const appGenerator = (plop: NodePlopAPI) => {
source: 'packages/app/template',
dest: `packages/app/${appName}`,
replaceInFiles: {
'@outsrc/template': `@outsrc/${appName}`,
'@andreani/template': `@andreani/${appName}`,
'3010': port,
'Frontend App Template': description,
'/template': appPath,
Expand Down
7 changes: 4 additions & 3 deletions .plop/lib-generator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { NodePlopAPI } from 'plop'
import { PlopGeneratorConfig } from './types'

export const libGenerator = (plop: NodePlopAPI) => {
export const libGenerator = (plop: NodePlopAPI): PlopGeneratorConfig => {
const prompts = [
{
type: 'input',
Expand All @@ -21,7 +22,7 @@ export const libGenerator = (plop: NodePlopAPI) => {
source: 'packages/shared/functions',
dest: `packages/shared/${libName}`,
replaceInFiles: {
'@outsrc/functions': `@outsrc/${libName}`,
'@andreani/functions': `@andreani/${libName}`,
'Templated shared functions': description
}
}
Expand All @@ -32,6 +33,6 @@ export const libGenerator = (plop: NodePlopAPI) => {
return {
description: 'Shared Module Generator',
prompts,
actions
actions,
}
}
5 changes: 5 additions & 0 deletions .plop/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface PlopGeneratorConfig {
description: string;
prompts: any;
actions: any;
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"workbench.colorCustomizations": {
"activityBar.background": "#16340C",
"titleBar.activeBackground": "#1F4910",
"titleBar.activeForeground": "#F6FDF4"
}
}
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ yarn storybook
Local Application Storybook

```
$ yarn workspace @outsrc/template storybook
$ yarn workspace @andreani/template storybook
```

## Tests
Expand All @@ -53,9 +53,9 @@ $ yarn test
Run Application / Shared Module only tests

```
$ yarn workspace @outsrc/template test
$ yarn workspace @andreani/template test
$ yarn workspace @outsrc/functions test
$ yarn workspace @andreani/functions test
```

## Running Applications
Expand All @@ -72,7 +72,7 @@ To run all applications using dev mode for some
$ yarn start --dev template
```

_(You can now make changes to the @outsrc/template application and see changes hot reloading on the browser)_
_(You can now make changes to the @andreani/template application and see changes hot reloading on the browser)_

To stop all applications

Expand All @@ -85,5 +85,5 @@ $ yarn stop
If you want to make this repo yours start by using the `change-org` script.

```
$ yarn change-org --from @outsrc --to @yourcompany
$ yarn change-org --from @andreani --to @yourcompany
```
1 change: 0 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
module.exports = {
presets: ['next/babel']
}

2 changes: 1 addition & 1 deletion config/next.tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"jsx": "preserve",
"strictNullChecks": true,
"paths": {
"@outsrc/*": ["../packages/shared/*"]
"@andreani/*": ["../packages/shared/*"]
}
}
}
Expand Down
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ module.exports = {
'\\.(css|scss)$': 'identity-obj-proxy'
}
}

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@outsrc/monorepo",
"name": "@andreani/monorepo",
"version": "1.0.0",
"description": "",
"main": "index.js",
Expand All @@ -9,8 +9,7 @@
"lint": "eslint --ext .ts,.tsx,.js packages",
"generate": "plop --plopfile .plop/plopfile.ts",
"start": "ts-node -P tsconfig.json .scripts/start.ts",
"stop": "ts-node -P tsconfig.json .scripts/stop.ts",
"change-org": "ts-node -P tsconfig.json .scripts/change-org.ts"
"stop": "ts-node -P tsconfig.json .scripts/stop.ts"
},
"keywords": [],
"author": "",
Expand Down
29 changes: 29 additions & 0 deletions packages/app/prueba/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const path = require('path')

module.exports = {
stories: ['../**/*.stories.mdx', '../**/*.stories.@(js|jsx|ts|tsx)'],
addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.

// Make whatever fine-grained changes you need
config.module.rules.push({
test: /\.scss$/,
use: [
{ loader: 'style-loader' },
{
loader: 'css-loader',
options: { modules: true }
},
{ loader: 'sass-loader' }
],
include: path.resolve(__dirname, '../')
})

// Return the altered config
return config
}
}

4 changes: 4 additions & 0 deletions packages/app/prueba/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports.parameters = {
actions: { argTypesRegex: '^on[A-Z].*' }
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots prueba/Button Regular 1`] = `
<button
className="Button"
data-testid="button"
onClick={[Function]}
>
This is a Button
</button>
`;
3 changes: 3 additions & 0 deletions packages/app/prueba/__tests__/storyshoots/storyshots.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import initStoryshots from '@storybook/addon-storyshots'

initStoryshots()
3 changes: 3 additions & 0 deletions packages/app/prueba/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference types="next" />
/// <reference types="next/types/global" />

19 changes: 19 additions & 0 deletions packages/app/prueba/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { dependencies } = require('./package.json')

const withTM = require('next-transpile-modules')(
Object.keys(dependencies || []).filter(dependency => dependency.startsWith('@andreani/'))
)

const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
})

module.exports = withBundleAnalyzer(
withTM({
trailingSlash: process.env.NODE_ENV === 'production',
env: {
NEXT_PUBLIC_BUILD_REVISION: process.env.BUILD_REVISION || 'DEVELOP'
},
basePath: '/prueba'
})
)
25 changes: 25 additions & 0 deletions packages/app/prueba/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@andreani/prueba",
"version": "0.0.0",
"description": "prueba",
"scripts": {
"dev": "next -p 3000",
"build": "yarn clean && next build && next export",
"clean": "rimraf .next && rimraf out",
"storybook": "start-storybook -p 6006",
"test": "jest --coverage --config ../../../jest.config.js ./src/**/* ./__tests__/**/*",
"start": "yarn build && cd out && ws -p 3000"
},
"config": {
"port": 3000,
"path": "/prueba"
},
"author": "",
"license": "ISC",
"dependencies": {
"@andreani/functions": "0.0.0"
},
"devDependencies": {
"@storybook/react": "^6.1.2"
}
}
8 changes: 8 additions & 0 deletions packages/app/prueba/src/components/Button/Button.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.Button {
background-color: cornflowerblue;
color: white;
border: none;
border-radius: 6px;
padding: 3px 10px;
}

10 changes: 10 additions & 0 deletions packages/app/prueba/src/components/Button/Button.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from 'react'
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import { Button } from './Button'

test('loads and displays greeting', async () => {
render(<Button label='Click Here' onClick={jest.fn()} />)

expect(screen.getByTestId('button')).toHaveTextContent('Click Here')
})
23 changes: 23 additions & 0 deletions packages/app/prueba/src/components/Button/Button.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { action } from '@storybook/addon-actions'
import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks'
import { Button } from './Button'

<Meta title='prueba/Button' component={Button} />

# Button

With `MDX` we can define a story for `Button` right in the middle of our
Markdown documentation.

<Canvas>
<Story
name='Regular'
args={{
label: 'This is a Button',
onClick: action('clicked')
}}
>
{args => <Button {...args} />}
</Story>
</Canvas>

15 changes: 15 additions & 0 deletions packages/app/prueba/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as React from 'react'
import css from './Button.module.scss'

interface ButtonProps {
label: string
onClick: () => void
}

export const Button: React.FC<ButtonProps> = ({ label, onClick }) => {
return (
<button data-testid='button' onClick={onClick} className={css.Button}>
{label}
</button>
)
}
1 change: 1 addition & 0 deletions packages/app/prueba/src/components/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Button'
18 changes: 18 additions & 0 deletions packages/app/prueba/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react'
import { NextPage } from 'next'
import { Button } from 'components/Button'
import { capitalize } from '@andreani/functions'

const Index: NextPage = () => {
const handleClick = (): void => {
alert('World')
}

return (
<div>
<Button label={capitalize('hello prueba')} onClick={handleClick} />
</div>
)
}

export default Index
9 changes: 9 additions & 0 deletions packages/app/prueba/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../config/next.tsconfig.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"baseUrl": "./src"
},
"exclude": ["node_modules"]
}

2 changes: 1 addition & 1 deletion packages/app/template/next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { dependencies } = require('./package.json')

const withTM = require('next-transpile-modules')(
Object.keys(dependencies || []).filter(dependency => dependency.startsWith('@outsrc/'))
Object.keys(dependencies || []).filter(dependency => dependency.startsWith('@andreani/'))
)

const withBundleAnalyzer = require('@next/bundle-analyzer')({
Expand Down
4 changes: 2 additions & 2 deletions packages/app/template/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@outsrc/template",
"name": "@andreani/template",
"version": "0.0.0",
"description": "Frontend App Template",
"scripts": {
Expand All @@ -17,7 +17,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@outsrc/functions": "0.0.0"
"@andreani/functions": "0.0.0"
},
"devDependencies": {
"@storybook/react": "^6.1.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/app/template/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { NextPage } from 'next'
import { Button } from 'components/Button'
import { capitalize } from '@outsrc/functions'
import { capitalize } from '@andreani/functions'

const Index: NextPage = () => {
const handleClick = (): void => {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/functions/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@outsrc/functions",
"name": "@andreani/functions",
"version": "0.0.0",
"description": "Templated shared functions",
"main": "src/index.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/functions/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": "../../../config/next.tsconfig.json",
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"compilerOptions": {
"baseUrl": "./src"
"baseUrl": "./src",
},
"exclude": ["node_modules"]
}

0 comments on commit 216e60b

Please sign in to comment.