-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate create command to standalone package (#27)
* feat: migrate create command to standalone package * feat: cancel pkg config * feat: delete main create and move template * feat: 迁移 * feat: format * feat: change release templates pkg dependencies version * feat: dep * chore: improve * chore: improve * chore: update pnpm-lock.yaml * chore: add changelog * chore: update --------- Co-authored-by: sorrycc <[email protected]>
- Loading branch information
Showing
25 changed files
with
180 additions
and
11 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,6 @@ | ||
--- | ||
'create-tnf': patch | ||
'@umijs/tnf': patch | ||
--- | ||
|
||
use standalone create-tnf package |
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
/examples/*/src/.tailwindcss | ||
/examples/*/dist | ||
/examples/*/node_modules | ||
/create-tnf/node_modules | ||
/create-tnf/dist |
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
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,8 @@ | ||
import { defineConfig } from 'father'; | ||
|
||
export default defineConfig({ | ||
cjs: { | ||
input: 'src', | ||
output: 'dist', | ||
}, | ||
}); |
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,15 @@ | ||
# create-tnf | ||
|
||
Create a new TNF project. | ||
|
||
## Usage | ||
|
||
```bash | ||
$ npm create tnf | ||
# Create a new project with the given name and template | ||
$ npm create tnf <project-name> --template=<template-name> | ||
``` | ||
|
||
## LICENSE | ||
|
||
MIT |
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,3 @@ | ||
#!/usr/bin/env node | ||
|
||
require('../dist/cli'); |
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,36 @@ | ||
{ | ||
"name": "create-tnf", | ||
"version": "0.0.0-alpha.0", | ||
"homepage": "https://github.com/umijs/tnf/tree/master/create-tnf", | ||
"bugs": "https://github.com/umijs/tnf/issues", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/umijs/tnf" | ||
}, | ||
"bin": { | ||
"create-tnf": "bin/create-tnf.js" | ||
}, | ||
"scripts": { | ||
"build": "father build", | ||
"doctor": "father doctor", | ||
"release": "tsx ../scripts/releasePackage.ts --pkg create-tnf" | ||
}, | ||
"files": [ | ||
"bin", | ||
"dist", | ||
"templates" | ||
], | ||
"dependencies": { | ||
"@types/yargs-parser": "^21.0.3", | ||
"@clack/prompts": "^0.7.0", | ||
"yargs-parser": "^21.1.1" | ||
}, | ||
"devDependencies": { | ||
"father": "^4.5.1", | ||
"tsx": "^4.19.2", | ||
"typescript": "^5.6.3" | ||
}, | ||
"engines": { | ||
"node": ">=18.13" | ||
} | ||
} |
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,16 @@ | ||
import yargsParser from 'yargs-parser'; | ||
import { create } from './create.js'; | ||
|
||
async function run(cwd: string) { | ||
const argv = yargsParser(process.argv.slice(1)); | ||
return create({ | ||
cwd: cwd, | ||
name: argv._[0] as string | undefined, | ||
template: argv.template, | ||
}); | ||
} | ||
|
||
run(process.cwd()).catch((err) => { | ||
console.error(err.message); | ||
process.exit(1); | ||
}); |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,8 @@ | ||
{ | ||
"extends": "@total-typescript/tsconfig/bundler/no-dom", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"rootDir": "./src" | ||
}, | ||
"include": ["src"] | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
packages: | ||
- "." | ||
- "create-tnf" | ||
- "examples/*" |
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 assert from 'assert'; | ||
import 'zx/globals'; | ||
|
||
(async () => { | ||
const pkg = argv.pkg; | ||
assert(pkg, 'pkg is required, specify with --pkg <pkg-name>'); | ||
const pkgDir = path.join(__dirname, '../', pkg); | ||
assert(fs.existsSync(pkgDir), `pkg ${pkg} not found: ${pkgDir}`); | ||
|
||
console.log('Building package...'); | ||
await $`cd ${pkgDir} && npm run build`; | ||
|
||
console.log('Bumping version...'); | ||
const npmVersion = argv.minor ? 'minor' : 'patch'; | ||
await $`cd ${pkgDir} && npm version ${npmVersion}`; | ||
|
||
console.log('Publishing package...'); | ||
await $`cd ${pkgDir} && npm publish`; | ||
|
||
console.log('Adding to git...'); | ||
await $`pnpm install`; | ||
const newVersion = require(path.join(pkgDir, 'package.json')).version; | ||
await $`git add ${pkgDir}`; | ||
await $`git commit -m "release: ${pkg}@${newVersion}"`; | ||
|
||
console.log('Pushing to git...'); | ||
await $`git push`; | ||
|
||
console.log(`Published ${pkg}@${newVersion}`); | ||
})().catch((err) => { | ||
console.error(err); | ||
process.exit(1); | ||
}); |
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