{"_id":"@1-/new","_rev":"3-16b6459109ee201a95d6aa1998688617","name":"@1-/new","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@1-/new","version":"0.1.0","keywords":["scaffolding","template","initializer","project","generator"],"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","_id":"@1-/new@0.1.0","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/webc-site/npm/tree/main/new","bugs":{"url":"https://github.com/webc-site/npm/issues"},"bin":{"new":"src/new.js"},"dist":{"shasum":"e8845bb6ee4e8b262f305f2b58d8bf0c683d0a8f","tarball":"https://registry.npmjs.org/@1-/new/-/new-0.1.0.tgz","fileCount":4,"integrity":"sha512-OYD+0KJtqW01LFV4kM8XfphXuhYRLDjk72qE2ittCSJaHmpo5YqxwkclBa3v26TNYlqA3xBntYd2HNG5wSOABQ==","signatures":[{"sig":"MEQCIBzbaq/RjUhy4nwDU8fJ79E+ESLejRlMoOIMvTu+5LtaAiAHk0oG3H2NVxfUQgSlDZmQ2VDY6iM8FPPSplVyJJOSXQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":6974},"type":"module","exports":{".":"./_.js","./*":"./*"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/webc-site/npm.git","type":"git"},"_npmVersion":"11.13.0","description":"Template-based project initializer with name replacement / 基于模板与名称替换的项目初始化工具","directories":{},"_nodeVersion":"26.2.0","dependencies":{"yargs":"^18.0.0","@3-/log":"^0.1.9","@1-/walk":"^0.1.0","@1-/findgit":"^0.1.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/new_0.1.0_1780971444144_0.04067922276094649","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@1-/new","version":"0.1.1","keywords":["scaffolding","template","initializer","project","generator"],"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","_id":"@1-/new@0.1.1","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://github.com/webc-site/npm/tree/main/new","bugs":{"url":"https://github.com/webc-site/npm/issues"},"bin":{"new":"src/new.js"},"dist":{"shasum":"c4280a84b2a13bed402eb4b275331498cfcc36ec","tarball":"https://registry.npmjs.org/@1-/new/-/new-0.1.1.tgz","fileCount":4,"integrity":"sha512-h+J9CAV7XPYF979S3qKSqG3QSq5KmwDyIdYDX/iOoHynCFc7DK/WjDLlBKX21thpPLLXym6H/PxO9eB6LsAduQ==","signatures":[{"sig":"MEUCIQDB2NMxddxiXGEwRM9DX28VbK1riKwecZQk+aFz6CUflwIgC9mCiPwToGIcrJk+F5FL/bM6urdhBLiIwyY52sSm028=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":5977},"type":"module","exports":{".":"./_.js","./*":"./*"},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"repository":{"url":"git+https://github.com/webc-site/npm.git","type":"git"},"_npmVersion":"11.13.0","description":"Template-based project initializer with name replacement / 基于模板与名称替换的项目初始化工具","directories":{},"_nodeVersion":"26.2.0","dependencies":{"yargs":"^18.0.0","@3-/log":"^0.1.9","@1-/walk":"^0.1.1","@1-/findgit":"^0.1.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/new_0.1.1_1780981018927_0.4686003139201167","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@1-/new","version":"0.1.2","description":"Template-based project initializer with name replacement / 基于模板与名称替换的项目初始化工具","keywords":["generator","initializer","project","scaffolding","template"],"homepage":"https://github.com/webc-site/npm/tree/main/new","license":"MulanPSL-2.0","author":{"name":"x-at-01@googlegroups.com"},"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"bin":{"new":"new.js"},"type":"module","exports":{".":"./_.js","./*":"./*"},"dependencies":{"@1-/findgit":"^0.1.2","@1-/read":"^0.1.1","@1-/walk":"^0.1.2","@3-/log":"^0.1.9","yargs":"^18.0.0"},"_id":"@1-/new@0.1.2","bugs":{"url":"https://github.com/webc-site/npm/issues"},"_nodeVersion":"26.2.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-vLy+SDS8lqaaQNRDNhJhSkcGVhZ+1tUAmjhr9MrbXGmklvpHywRNE3BRTL6bEt1sPiCrWN5/uFb9G6+zmTH8Lw==","shasum":"a0ce607332a7e9f9a705b89dd5e85f8046c88cf4","tarball":"https://registry.npmjs.org/@1-/new/-/new-0.1.2.tgz","fileCount":4,"unpackedSize":7686,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCiZLKa26nFBY9bTfmetPiVQauDVoI6EFrTxcEiM5KFdwIgaH6Alv6PNhkPg0sisvQ6wBsSb+L1+8N5P9os9HNxqAM="}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/new_0.1.2_1782926654874_0.2981858120986931"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-09T02:17:23.918Z","modified":"2026-07-01T17:24:15.139Z","0.1.0":"2026-06-09T02:17:24.395Z","0.1.1":"2026-06-09T04:56:59.046Z","0.1.2":"2026-07-01T17:24:15.012Z"},"bugs":{"url":"https://github.com/webc-site/npm/issues"},"author":{"name":"x-at-01@googlegroups.com"},"license":"MulanPSL-2.0","homepage":"https://github.com/webc-site/npm/tree/main/new","keywords":["generator","initializer","project","scaffolding","template"],"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"description":"Template-based project initializer with name replacement / 基于模板与名称替换的项目初始化工具","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"[English](#en) | [中文](#zh)\n\n---\n\n<a id=\"en\"></a>\n# @1-/new : Template-based project initializer with name replacement\n\n- [@1-/new : Template-based project initializer with name replacement](#1-new-template-based-project-initializer-with-name-replacement)\n  - [Features](#features)\n  - [Usage](#usage)\n    - [Command Line Interface (CLI)](#command-line-interface-cli)\n    - [Application Programming Interface (API)](#application-programming-interface-api)\n  - [Design Flow](#design-flow)\n  - [Tech Stack](#tech-stack)\n  - [Code Structure](#code-structure)\n  - [History](#history)\n  - [About](#about)\n\n## Features\n\n- **Directory Copy**: Recursively copies template directory to destination path\n- **Name Replacement**: Walks target directory and replaces `tmpl` placeholder with project name using word-boundary regex `\\btmpl\\b` (avoids false positives like \"template\")\n- **Git Integration**: Executes `git add .` in destination directory; failures are silently ignored\n- **Template Resolution**: Resolves `_tmpl` directory in order of priority: ① Git root of current working directory ② Git root of module directory ③ `../../_tmpl` relative to module; supports custom template paths\n\n## Usage\n\n### Command Line Interface (CLI)\n\n```bash\nbun x @1-/new <PROJECT_NAME>\n```\n\nIf destination path exists, program logs warning and exits.\n\n### Application Programming Interface (API)\n\n```javascript\nimport newProj from \"@1-/new\";\n\nawait newProj(dst, name, tmpl);\n```\n\n- `dst`: Destination path\n- `name`: Project name\n- `tmpl`: Optional template path\n\n## Design Flow\n\n![](https://fastly.jsdelivr.net/gh/webc-fs/-@h8/AHxbeo--jEXUGOZMrqIg.svg)\n\n## Tech Stack\n\n- Runtime: Bun\n- Dependencies: `@1-/findgit`, `@1-/read`, `@1-/walk`, `@3-/log`, `yargs`\n- Core APIs: `node:fs/promises`, `node:child_process`, `node:path`, `node:util`\n\n## Code Structure\n\n```\n.\n├── src/\n│   ├── _.js       # API implementation (core logic)\n│   └── new.js     # CLI entry point (argument parsing & error handling)\n├── test/\n│   └── _.test.js  # Test suite (verifies template copying and word-boundary replacement)\n└── package.json   # Package metadata (module exports and dependency declarations)\n```\n\n## History\n\nIn 2004, Ruby on Rails introduced \"Convention over Configuration\" philosophy, utilizing generators to scaffold model, view, and controller structures.\n\nIn 2012, Yeoman project was introduced at Google I/O, establishing template scaffolding standards for JavaScript client-side development.\n\nModern architectures demand reduced overhead. `@1-/new` focuses on core directory copying and placeholder replacement.\n## About\n\nThis library is developed by [WebC.site](https://webc.site).\n\n[WebC.site](https://webc.site): A new paradigm of web development for AI\n\n\n---\n\n<a id=\"zh\"></a>\n# @1-/new : 基于模板与名称替换的项目初始化工具\n\n- [@1-/new : 基于模板与名称替换的项目初始化工具](#1-new-基于模板与名称替换的项目初始化工具)\n  - [功能介绍](#功能介绍)\n  - [使用演示](#使用演示)\n    - [命令行界面 (CLI)](#命令行界面-cli)\n    - [应用程序接口 (API)](#应用程序接口-api)\n  - [设计思路](#设计思路)\n  - [技术栈](#技术栈)\n  - [代码结构](#代码结构)\n  - [历史故事](#历史故事)\n  - [关于](#关于)\n\n## 功能介绍\n\n- 目录复制：递归复制模板目录至目标路径\n- 名称替换：遍历目标目录文件，使用词边界正则表达式 `\\btmpl\\b` 替换文本中独立的 `tmpl` 占位符为项目名称（避免误替换如 \"template\"）\n- Git 集成：在目标目录执行 `git add .` 命令，失败时静默忽略\n- 模板定位：按优先级查找 `_tmpl` 目录：① 当前工作目录 Git 根目录 ② 模块目录 Git 根目录 ③ 模块目录上级两级路径；支持通过参数指定自定义模板路径\n\n## 使用演示\n\n### 命令行界面 (CLI)\n\n```bash\nbun x @1-/new <项目名称>\n```\n\n若目标路径已存在，输出警告信息并终止进程。\n\n### 应用程序接口 (API)\n\n```javascript\nimport newProj from \"@1-/new\";\n\nawait newProj(dst, name, tmpl);\n```\n\n- `dst`：目标路径\n- `name`：项目名称\n- `tmpl`：可选模板路径\n\n## 设计思路\n\n![](https://fastly.jsdelivr.net/gh/webc-fs/-@J7/voOOeIxZNO6mG5lQwTPQ.svg)\n\n## 技术栈\n\n- 运行时：Bun\n- 依赖项：`@1-/findgit`、`@1-/read`、`@1-/walk`、`@3-/log`、`yargs`\n- 内置模块：`node:fs/promises`、`node:child_process`、`node:path`、`node:util`\n\n## 代码结构\n\n```\n.\n├── src/\n│   ├── _.js       # API 实现（核心逻辑）\n│   └── new.js     # CLI 入口（参数解析与错误处理）\n├── test/\n│   └── _.test.js  # 单元测试（验证模板复制与词边界替换）\n└── package.json   # 项目配置（模块导出与依赖声明）\n```\n\n## 历史故事\n\n2004 年 Ruby on Rails 框架发布，推广 \"约定优于配置\" (Convention over Configuration) 哲学，利用生成器自动创建模型、视图与控制器结构。\n\n2012 年 Google 工程师团队在 I/O 大会展示 Yeoman 项目，为客户端 JavaScript 生态奠定模板脚手架工具标准。\n\n随着单页应用与微服务架构兴起，轻量化项目初始化需求增加，`@1-/new` 类工具通过精简逻辑提供初始化方案。\n## 关于\n\n本库由 [WebC.site](https://webc.site) 开发。\n\n[WebC.site](https://webc.site) : 面向人工智能的网站开发新范式\n\n","readmeFilename":"README.md"}