Skip to content

Commit

Permalink
refactor: migrate all packages to nx packages
Browse files Browse the repository at this point in the history
  • Loading branch information
zuramai committed Nov 19, 2023
1 parent d8828a7 commit 120172f
Show file tree
Hide file tree
Showing 124 changed files with 1,648 additions and 312 deletions.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"inputs": ["default", "^default"]
},
"build-storybook": {
"cache": false
"cache": true
}
},
"affected": {
Expand Down
12 changes: 12 additions & 0 deletions packages/alert/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions packages/alert/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions packages/alert/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
import { mergeConfig } from 'vite';

const config = {
stories: ['../src/lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: ['@storybook/addon-essentials'],
framework: {
name: '@storybook/react-vite',
options: {},
},

viteFinal: async (config) =>
mergeConfig(config, {
plugins: [nxViteTsPaths()],
}),
};

export default config;

// To customize your Vite configuration you can use the viteFinal field.
// Check https://storybook.js.org/docs/react/builders/vite#configuration
// and https://nx.dev/recipes/storybook/custom-builder-configs
Empty file.
7 changes: 7 additions & 0 deletions packages/alert/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# alert

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test alert` to execute the unit tests via [Jest](https://jestjs.io).
17 changes: 0 additions & 17 deletions packages/alert/package.json

This file was deleted.

41 changes: 41 additions & 0 deletions packages/alert/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@bootwind/alert",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/alert/src",
"projectType": "library",
"tags": [],
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/alert/**/*.{ts,tsx,js,jsx}"]
}
},
"storybook": {
"executor": "@nx/storybook:storybook",
"options": {
"port": 4400,
"configDir": "packages/alert/.storybook"
},
"configurations": {
"ci": {
"quiet": true
}
}
},
"build-storybook": {
"executor": "@nx/storybook:build",
"outputs": ["{options.outputDir}"],
"options": {
"outputDir": "dist/storybook/alert",
"configDir": "packages/alert/.storybook"
},
"configurations": {
"ci": {
"quiet": true
}
}
}
}
}
3 changes: 3 additions & 0 deletions packages/alert/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Alert from "./lib/alert";

export default Alert;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Meta } from '@storybook/react';

import Title from '../../title/src/index';
import Alert from '../src/index';
import Title from '@bootwind/title';
import Alert from '../index';

export default {
title: 'Components/Alert/Types',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Meta } from '@storybook/react';

import Title from '../../title/src/index';
import Alert from '../src/index';
import Title from '@bootwind/title';
import Alert from '..';

export default {
title: 'Components/Alert/Variants',
Expand Down
20 changes: 18 additions & 2 deletions packages/alert/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.storybook.json"
}
],
"extends": "../../tsconfig.base.json"
}
24 changes: 24 additions & 0 deletions packages/alert/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"baseUrl": "./",
"outDir": "../../dist/out-tsc",
"types": [
"node",
"@nx/react/typings/cssmodule.d.ts",
"@nx/react/typings/image.d.ts"
],
},
"exclude": [
"jest.config.ts",
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.jsx",
"src/**/*.test.jsx",
],
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
}
30 changes: 30 additions & 0 deletions packages/alert/tsconfig.storybook.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"outDir": ""
},
"files": [
"../../node_modules/@nx/react/typings/styled-jsx.d.ts",
"../../node_modules/@nx/react/typings/cssmodule.d.ts",
"../../node_modules/@nx/react/typings/image.d.ts"
],
"exclude": [
"src/**/*.spec.ts",
"src/**/*.test.ts",
"src/**/*.spec.js",
"src/**/*.test.js",
"src/**/*.spec.tsx",
"src/**/*.test.tsx",
"src/**/*.spec.jsx",
"src/**/*.test.js"
],
"include": [
"src/**/*.stories.ts",
"src/**/*.stories.js",
"src/**/*.stories.jsx",
"src/**/*.stories.tsx",
"src/**/*.stories.mdx",
]
}
12 changes: 12 additions & 0 deletions packages/avatar/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@nx/react/babel",
{
"runtime": "automatic",
"useBuiltIns": "usage"
}
]
],
"plugins": []
}
18 changes: 18 additions & 0 deletions packages/avatar/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["plugin:@nx/react", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions packages/avatar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# avatar

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test avatar` to execute the unit tests via [Jest](https://jestjs.io).
17 changes: 0 additions & 17 deletions packages/avatar/package.json

This file was deleted.

32 changes: 32 additions & 0 deletions packages/avatar/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "@bootwind/avatar",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/avatar/src",
"projectType": "library",
"tags": [],
"targets": {
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/avatar/**/*.{ts,tsx,js,jsx}"]
}
},
"build": {
"executor": "@nx/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/packages/avatar"
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
}
}
}
}
1 change: 1 addition & 0 deletions packages/avatar/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib/avatar';
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface AvatarProps {
showPlaceholder?: boolean; // Tambahkan properti showPlaceholder
}

const Avatar: React.FC<AvatarProps> = ({
export const Avatar: React.FC<AvatarProps> = ({
src,
alt,
rounded = 'md',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Meta } from '@storybook/react';

import Avatar, { AvatarProps } from '../src/index';
import Title from '../../title/src/index';
import { Avatar, AvatarProps } from '../index';
import Title from '@bootwind/title';

export default {
title: 'Components/Avatar',
Expand Down
22 changes: 19 additions & 3 deletions packages/avatar/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
{
"extends": ["../../tsconfig.json"],
"include": ["src"]
}
"compilerOptions": {
"jsx": "react-jsx",
"allowJs": false,
"esModuleInterop": false,
"allowSyntheticDefaultImports": true,
"strict": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.storybook.json"
}
],
"extends": "../../tsconfig.base.json"
}
Loading

0 comments on commit 120172f

Please sign in to comment.