Skip to content

Commit

Permalink
[refact] alias setting and path fix (#22)
Browse files Browse the repository at this point in the history
* [refact] alias setting and path fix

* [fix]: common forder -> Common uppercase

---------

Co-authored-by: winju <[email protected]>
VictoryJu and winju authored Jun 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent fc79c2a commit afc6345
Showing 15 changed files with 89 additions and 43 deletions.
14 changes: 14 additions & 0 deletions gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -70,6 +70,20 @@ const config: GatsbyConfig = {
policy: [{ userAgent: '*', allow: '/' }],
},
},
{
resolve: `gatsby-plugin-alias-imports`,
options: {
alias: {
'@src': 'src',
'@api': 'src/api',
'@components': 'src/components',
'@images': 'src/images',
'@pages': 'src/pages',
'@styles': 'src/styles',
},
extensions: [],
},
},
],
};

22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
"gatsby"
],
"scripts": {
"develop": "gatsby develop",
"dev": "gatsby develop",
"start": "gatsby develop",
"build": "gatsby build",
"serve": "gatsby serve",
@@ -36,6 +36,7 @@
"@types/node": "^20.11.19",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"gatsby-plugin-alias-imports": "^1.0.5",
"typescript": "^5.3.3"
}
}
4 changes: 2 additions & 2 deletions src/components/Alliance/AllianceContact/AllianceContact.tsx
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@ import * as styles from './AllianceContact.module.scss';
import AllianceInputField from '../BaseComponents/AllianceInputField';
import { StaticImage } from 'gatsby-plugin-image';
import AllianceDropdown from '../AllianceDropdown/AllianceDropdown';
import { ContactInfoType } from '../../../api/types';
import allianceApi from '../../../api/alliance';
import { ContactInfoType } from '@api/types';
import allianceApi from '@api/alliance';

const PlatformList = ['업체 홈페이지', '네이버 블로그', '인스타그램', '구글 폼', '전화예약'];
const { applyContactInfo } = allianceApi();
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import Nav from './Nav/Nav';
import * as styles from './Layout.module.scss';
import Footer from './Footer/Footer';
import { Link } from 'gatsby';
import ApplyLink from '../common/ApplyLink';
import ApplyLink from '../Common/ApplyLink';
type LayoutProps = {
children: React.ReactNode;
};
@@ -14,11 +14,9 @@ const Layout = ({ children }: LayoutProps) => {
<Nav />
{children}
<Footer />
{
typeof window !== 'undefined' &&
window.location.pathname === '/' &&
<ApplyLink className={styles.LayoutMobileApplyLink} />
}
{typeof window !== 'undefined' && window.location.pathname === '/' && (
<ApplyLink className={styles.LayoutMobileApplyLink} />
)}
</div>
);
};
12 changes: 5 additions & 7 deletions src/components/Layout/Nav/Nav.tsx
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@ import { Link } from 'gatsby';
import { StaticImage } from 'gatsby-plugin-image';
import React from 'react';
import * as styles from './Nav.module.scss';
import NavbarMenuLink from '../../common/NavbarMenuLink';
import ApplyLink from '../../common/ApplyLink';
import NavbarMenuLink from '@components/Common/NavbarMenuLink';
import ApplyLink from '@components/Common/ApplyLink';

const Nav = () => {
return (
@@ -25,11 +25,9 @@ const Nav = () => {
</li>
</div>
<li>
{
typeof window !== 'undefined' &&
window.location.pathname === '/' &&
<ApplyLink className={styles.BenefitButton} />
}
{typeof window !== 'undefined' && window.location.pathname === '/' && (
<ApplyLink className={styles.BenefitButton} />
)}
</li>
</ul>
</div>
3 changes: 1 addition & 2 deletions src/components/Lending/LendingApply/LedingApply.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import * as styles from './LendingApply.module.scss';
import { StaticImage } from 'gatsby-plugin-image';
import ApplyLink from '../../common/ApplyLink';
import ApplyLink from '../../Common/ApplyLink';

const LedingApply = () => {

return (
<section className={styles.LendingApplyWrapper}>
<main className={styles.LendingApplyContainer}>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import * as styles from './LendingReservation.module.scss';
import Reservation1 from '../../../images/lending/lending_reservation_1.inline.svg';
import Reservation2 from '../../../images/lending/lending_reservation_2.inline.svg';
import Reservation3 from '../../../images/lending/lending_reservation_3.inline.svg';
import Reservation1 from '@images/lending/lending_reservation_1.inline.svg';
import Reservation2 from '@images/lending/lending_reservation_2.inline.svg';
import Reservation3 from '@images/lending/lending_reservation_3.inline.svg';

const LendingReservation = () => {
return (
4 changes: 2 additions & 2 deletions src/components/Lending/LendingStore/LendingStore.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import * as styles from './LendingStore.module.scss';
import LendingFlexContent from '../BaseComponents/LendingFlexContent';
import ReviewMbSvg from '../../../images/lending/lending_review_mbReview.inline.svg';
import ReviewPcSvg from '../../../images/lending/lending_review_pcReview.inline.svg';
import ReviewMbSvg from '@images/lending/lending_review_mbReview.inline.svg';
import ReviewPcSvg from '@images/lending/lending_review_pcReview.inline.svg';

const LendingStore = () => {
return (
10 changes: 5 additions & 5 deletions src/pages/alliance/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, { useState } from 'react';
import { HeadFC, PageProps } from 'gatsby';
import LedingApply from '../../components/Lending/LendingApply/LedingApply';
import AllianceBenefit from '../../components/Alliance/AllianceBenefit/AllianceBenefit';
import AllianceMain from '../../components/Alliance/AllianceMain/AllianceMain';
import AllianceContact from '../../components/Alliance/AllianceContact/AllianceContact';
import Layout from '../../components/Layout/Layout';
import LedingApply from '@components/Lending/LendingApply/LedingApply';
import AllianceBenefit from '@components/Alliance/AllianceBenefit/AllianceBenefit';
import AllianceMain from '@components/Alliance/AllianceMain/AllianceMain';
import AllianceContact from '@components/Alliance/AllianceContact/AllianceContact';
import Layout from '@components/Layout/Layout';

type CustomLocationType = {
shouldScrollToContact: boolean;
8 changes: 4 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import type { HeadFC, PageProps } from 'gatsby';
import LedingApply from '../components/Lending/LendingApply/LedingApply';
import LendingReservation from '../components/Lending/LendingReservation/LendingReservation';
import LendingStore from '../components/Lending/LendingStore/LendingStore';
import Layout from '../components/Layout/Layout';
import LedingApply from '@components/Lending/LendingApply/LedingApply';
import LendingReservation from '@components/Lending/LendingReservation/LendingReservation';
import LendingStore from '@components/Lending/LendingStore/LendingStore';
import Layout from '@components/Layout/Layout';

const IndexPage: React.FC<PageProps> = () => {
return (
4 changes: 4 additions & 0 deletions src/types/png.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.png' {
const content: any;
export default content;
}
32 changes: 21 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -11,9 +11,12 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"lib": ["dom", "esnext"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
"jsx": "react", /* Specify what JSX code is generated. */
"target": "esnext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"lib": [
"dom",
"esnext"
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
"jsx": "react" /* Specify what JSX code is generated. */,
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
@@ -24,11 +27,18 @@
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */

/* Modules */
"module": "esnext", /* Specify what module code is generated. */
"module": "esnext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"baseUrl": "./" /* Specify the base directory to resolve non-relative module names. */,
"paths": {
"@src/*": ["src/*"],
"@api/*": ["src/api/*"],
"@components/*": ["src/components/*"],
"@images/*": ["src/images/*"],
"@pages/*": ["src/pages/*"],
"@styles/*": ["src/styles/*"]
} /* Specify a set of entries that re-map imports to additional lookup locations. */,
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
@@ -69,12 +79,12 @@
/* Interop Constraints */
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
@@ -96,7 +106,7 @@

/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": ["./src/**/*", "./gatsby-node.ts", "./gatsby-config.ts", "./plugins/**/*"]
}

0 comments on commit afc6345

Please sign in to comment.