Overview of the next-pathmap Library

Lee has introduced a library for uniformly managing meta information on every page in Next.js projects.

Creation of next-pathmap

Lee and the team at 한국신용데이터 have built a library, next-pathmap, which parses the project folder according to the page directory or extension pattern and creates a JSON object containing meta information for each path. This was developed to manage page names for PV event tracking, PV tracking status, and service categories consistently in a single file and to avoid omissions.

Key Features

Feature 1: Utilizing Next.js File System-Based Routing

next-pathmap makes the most of the file system structure of pages in the Next.js framework to parse page component files and organize them in a structured format.

Feature 2: Library Setup via Prompt Input or Configuration File

The library allows customization of various settings such as the root location, pathmap saving location and filename, parsing scope, mapping of meta data structure for pages, and aliases for top-level route categories.

module.exports = PathmapConfig;

Feature 3: Outputting the pathmap as JSON

The result of the library's parsing is a JSON file that includes essential data like aliases, tracking status, categories, and queries for each route.

{
  "/insurance/join/[:product]": {
    "alias": "보험/가입/{{product}}",
    "trackPageView": true,
    "categories": ["금융/보험"],
    "query": ["product"]
  }
}

Feature 4: Automation Integration

The next-pathmap library is designed for simplicity: it parses the file system and outputs a JSON formatted data file. Lee's objective was to make pathmap generation automatic, linked to git hooks or CI tools, to enforce consistent management of pages and related events.

Problem-Solving Approach

After encountering issues with Korean pathname conventions derived from directory structures and issues related to Next.js routing especially with Korean pathnames not being supported, necessitating additional mapping, Lee envisioned a tool that could automatically convert filesystem structure into a pathmap.

The library aims to solve problems such as link breakages due to double encoding, tracking PageView events in Korean names, and discrepancies between managed rules and actual codebase when there are changes in page creation or route names.

Development of next-pathmap

The development involves parsing the project's directory and file names beneath the routes, including dynamic segments like [param]/index.js and saving the complete pathmap to the specified location.

The library uses other libraries like globby, inquirer, and json-format to achieve its goal.

Configuration Options

next-pathmap offers two ways for configuration—via a .config.js file or via an interactive command-line interface.

Execution with npx Command

To make the library executable through the npx command, a script file that can run on Node.js interpreter is written, and its reference is provided in the package.json with the "bin" key.

Setting Up next-pathmap in a Project

Setting up next-pathmap involves creating a config file at the root of the project, setting up scripts to execute next-pathmap, and running the library to parse and generate the pathmap.

Git Hook Integration

The library can be integrated with git hooks to ensure that page meta information is not omitted before pushing changes.

Developer Reflection

Lee reflects on the importance of asset and source code management in service development. By considering enhancements and more efficient management methods, developers can grow and contribute to better development practices.

In essence, next-pathmap is a tool created to address the complexities of managing meta information for pages within Next.js applications, offering automation and consistency, driving improved asset management and development workflow.


Tags:

  • Next.js
  • Library
  • Automation
  • Configuration
  • Pathmap

https://www.blog.kcd.co.kr/직접-만든-라이브러리로-next-js-페이지-메타-정보-관리하기-4e71a830b41d

Atua: Instant ChatGPT Access for Mac

Unlock the potential of AI assistance on your Mac with Atua. This innovative application allows you to integrate ChatGPT seamlessly into your workflow with a simple hotkey.

Main Features of Atua

Easy Access with a Shortcut Key

Atua offers a unique feature allowing users to open ChatGPT instantly using a shortcut key. This eliminates the need to switch between applications, providing instant AI assistance directly within your current app.

Customizable Commands

With Atua, you can customize predefined commands to fit your specific needs. Assign hotkeys for tasks such as rephrasing, grammar correction, or content expansion, making your workflow more efficient and tailored to individual requirements.

Text Selection and Processing

Select any text from your current application, press the shortcut, and Atua applies your custom ChatGPT commands to the selected text. It simplifies the text editing process and saves time.

Conversation History

Atua saves your conversation history. This means you can revisit previous interactions, providing a useful reference for continuous work or learning.

Versatile Use Cases

Whether you're engaging in content writing, code refactoring, or any other task, Atua's integration of ChatGPT allows for a wide array of applications.

Requirements and Availability

  • Compatibility: Requires Mac OSX version 10.12 or higher.
  • OpenAI API Key: An OpenAI license key is necessary for functionality.

Economic Offer

Purchase Atua now to take advantage of a 60% discount, paying only $19 instead of the standard $49. The offer includes lifetime access, a 7-day money-back guarantee, and future updates.

FAQ Highlights

  • Installation and Setup: Install Atua, enter received license and OpenAI keys, and start using it.
  • Shortcut Key Functionality: Create commands, assign keyboard shortcuts, and process text from any Mac window.
  • Platform Support: Currently available for Mac, with future support for Windows and Linux planned.
  • Billing Information: OpenAI API charges are separate from ChatGPT Plus subscriptions. API usage is $0.002 per 1,000 tokens.
  • Privacy: All data is saved locally; privacy is a foremost concern.
  • Team Licenses: Available upon contacting support.
  • Refunds: 7-day refund policy.
  • Support: Contact at contact@atua.app for assistance.

Conclusion

Atua offers a streamlined method of accessing ChatGPT services on Mac, with a focus on simplicity, efficiency, and customization. Get Atua today and enhance your productivity without breaking the bank.


Tags: #Atua, #ChatGPTAccess, #MacApplication, #AIAssistance

https://atua.app/