Release v.0.1.0 #2
@ -1,12 +1,14 @@
|
||||
{
|
||||
"name": "rage-framework-cli",
|
||||
"name": "rage-fw",
|
||||
"version": "0.0.23",
|
||||
"bin": {
|
||||
"rage-fw": "bin/index.js"
|
||||
"rage-fw": "dist/index.js"
|
||||
},
|
||||
"main": "bin/index.js",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"watch": "tsc -w"
|
||||
"watch": "tsc -w",
|
||||
"build": "tsup",
|
||||
"start": "npx ./dist create"
|
||||
},
|
||||
"description": "CLI to scaffold a template project for RageFW",
|
||||
"keywords": [],
|
||||
@ -16,7 +18,8 @@
|
||||
"@inquirer/prompts": "^5.0.5",
|
||||
"chalk": "4.1.2",
|
||||
"git-clone": "^0.2.0",
|
||||
"yargs": "^17.7.2"
|
||||
"yargs": "^17.7.2",
|
||||
"axios": "^1.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/git-clone": "^0.2.4",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import type { CommandModule, ArgumentsCamelCase } from 'yargs'
|
||||
import type { CommandModule } from 'yargs'
|
||||
import c from 'chalk'
|
||||
import { input, select } from '@inquirer/prompts'
|
||||
import clone from 'git-clone'
|
||||
|
@ -1,6 +1,9 @@
|
||||
import yargs from 'yargs'
|
||||
|
||||
import create from './commands/create'
|
||||
import { checkForUpdate } from './utils/update'
|
||||
|
||||
yargs.middleware(checkForUpdate)
|
||||
|
||||
yargs
|
||||
.usage('<cmd> [args]')
|
||||
|
28
cli/src/utils/update.ts
Normal file
28
cli/src/utils/update.ts
Normal file
@ -0,0 +1,28 @@
|
||||
import axios from 'axios'
|
||||
import c from 'chalk'
|
||||
import yargs from 'yargs'
|
||||
|
||||
const latestVersionURL =
|
||||
'https://git.entityseven.com/api/v1/repos/entityseven/rage-framework/tags?page=1&limit=1'
|
||||
|
||||
type Version = {
|
||||
name: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export async function checkForUpdate() {
|
||||
yargs.showVersion(version =>
|
||||
axios.get<Version[]>(latestVersionURL).then(({ data }) => {
|
||||
const latestVersion = data[0].name
|
||||
|
||||
if (!(latestVersion === version))
|
||||
notifyUserAboutUpdate(latestVersion)
|
||||
|
||||
return
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
function notifyUserAboutUpdate(version: string) {
|
||||
console.log(c.green(`Update available. New version: ${version}`))
|
||||
}
|
10
cli/tsup.config.ts
Normal file
10
cli/tsup.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import { defineConfig } from 'tsup'
|
||||
|
||||
export default defineConfig({
|
||||
entry: ['src/index.ts'],
|
||||
outDir: './dist',
|
||||
bundle: true,
|
||||
splitting: false,
|
||||
sourcemap: false,
|
||||
clean: true,
|
||||
})
|
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@ -65,6 +65,9 @@ importers:
|
||||
'@inquirer/prompts':
|
||||
specifier: ^5.0.5
|
||||
version: 5.0.5
|
||||
axios:
|
||||
specifier: ^1.7.2
|
||||
version: 1.7.2
|
||||
chalk:
|
||||
specifier: 4.1.2
|
||||
version: 4.1.2
|
||||
|
Loading…
Reference in New Issue
Block a user