-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: CRIMX <straybugs@gmail.com>
- Loading branch information
Showing
4 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# @wopjs/template | ||
|
||
[![Docs](https://img.shields.io/badge/Docs-read-%23fdf9f5)](https://wopjs.github.io/template) | ||
[![Build Status](https://github.com/wopjs/template/actions/workflows/build.yml/badge.svg)](https://github.com/wopjs/template/actions/workflows/build.yml) | ||
[![npm-version](https://img.shields.io/npm/v/@wopjs/template.svg)](https://www.npmjs.com/package/@wopjs/template) | ||
[![Coverage Status](https://img.shields.io/coverallsCoverage/github/wopjs/template)](https://coveralls.io/github/wopjs/template) | ||
[![minified-size](https://img.shields.io/bundlephobia/minzip/@wopjs/template)](https://bundlephobia.com/package/@wopjs/template) | ||
|
||
Collection of common utilities. | ||
|
||
## Install | ||
|
||
``` | ||
npm add @wopjs/template | ||
``` | ||
|
||
## License | ||
|
||
MIT @ [wopjs](https://github.com/wopjs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import fs from 'node:fs' | ||
import path from 'node:path' | ||
import cp from 'node:child_process' | ||
|
||
let user = 'wopjs' | ||
let name = path.basename(process.cwd()).toLowerCase() | ||
|
||
let docsURL = `https://${user.toLowerCase()}.github.io/${name}` | ||
let userLink = `[${user}](https://github.com/${user.toLowerCase()})` | ||
|
||
let pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')) | ||
pkg.name = `@${user.toLowerCase()}/${name}` | ||
pkg.description = name | ||
pkg.keywords = name.split('-') | ||
pkg.repository = `${user.toLowerCase()}/${name}` | ||
if (user !== 'wopjs') { | ||
pkg.maintainers = void 0 | ||
} | ||
pkg.scripts.postinstall = void 0 | ||
|
||
let readme = fs.readFileSync('README.template.md', 'utf8') | ||
readme = readme.replace(/wopjs\/template/g, `${user}/${name}`) | ||
readme = readme.replace('https://wopjs.github.io/template', docsURL) | ||
readme = readme.replace('Collection of common utilities.', `${name}.`) | ||
readme = readme.replace('[wopjs](https://github.com/wopjs)', userLink) | ||
|
||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n') | ||
fs.writeFileSync('README.md', readme) | ||
fs.rmSync('README.template.md') | ||
fs.rmSync('scripts/rename.mjs') | ||
|
||
const win = (bin) => process.platform === 'win32' ? `${bin}.cmd` : bin | ||
cp.spawnSync(win('npm'), ['install'], { stdio: 'inherit' }) |