Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
333bd9df13 | ||
|
|
6be93daa2d | ||
|
|
06f93e61a8 | ||
|
|
7357038c42 | ||
|
|
04412d7cbc | ||
|
|
9204eb81be | ||
|
|
1fd65c6b86 |
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw-cef",
|
"name": "rage-fw-cef",
|
||||||
"version": "0.0.23-alpha.0",
|
"version": "0.0.27-alpha.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
# build
|
|
||||||
bin/
|
|
||||||
|
|
||||||
# deps
|
|
||||||
node_modules/
|
|
||||||
package-lock.json
|
|
||||||
yarn.lock
|
|
||||||
pnpm-lock.yaml
|
|
||||||
|
|
||||||
# dev
|
|
||||||
.vscode/
|
|
||||||
.idea/
|
|
||||||
+7
-4
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw",
|
"name": "create-rage-fw",
|
||||||
"version": "0.0.23",
|
"version": "0.0.27-alpha.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"rage-fw": "dist/index.js"
|
"rage-fw": "dist/index.js"
|
||||||
},
|
},
|
||||||
@@ -10,16 +10,19 @@
|
|||||||
"build": "tsup",
|
"build": "tsup",
|
||||||
"start": "npx ./dist create"
|
"start": "npx ./dist create"
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"dist/**/*"
|
||||||
|
],
|
||||||
"description": "CLI to scaffold a template project for RageFW",
|
"description": "CLI to scaffold a template project for RageFW",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "rilaxik",
|
"author": "rilaxik",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inquirer/prompts": "^5.0.5",
|
"@inquirer/prompts": "^5.0.5",
|
||||||
|
"axios": "^1.7.2",
|
||||||
"chalk": "4.1.2",
|
"chalk": "4.1.2",
|
||||||
"git-clone": "^0.2.0",
|
"git-clone": "^0.2.0",
|
||||||
"yargs": "^17.7.2",
|
"yargs": "^17.7.2"
|
||||||
"axios": "^1.7.2"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/git-clone": "^0.2.4",
|
"@types/git-clone": "^0.2.4",
|
||||||
|
|||||||
@@ -1,17 +1,43 @@
|
|||||||
import type { CommandModule } from 'yargs'
|
import type { CommandModule, Argv, ArgumentsCamelCase } from 'yargs'
|
||||||
import c from 'chalk'
|
import c from 'chalk'
|
||||||
import { input, select } from '@inquirer/prompts'
|
import { input, select } from '@inquirer/prompts'
|
||||||
import clone from 'git-clone'
|
import clone from 'git-clone'
|
||||||
import path from 'node:path'
|
import path from 'node:path'
|
||||||
|
|
||||||
// the handler function will be called when our command is executed
|
import { checkForUpdate } from '../utils/update'
|
||||||
// it will receive the command line arguments parsed by yargs
|
|
||||||
async function handler() {
|
function builder(yargs: Argv) {
|
||||||
const folder = await input({
|
return yargs
|
||||||
|
.option('projectName', {
|
||||||
|
alias: 'p',
|
||||||
|
description: 'Name of the folder to scaffold a project to',
|
||||||
|
type: 'string',
|
||||||
|
demandOption: false,
|
||||||
|
})
|
||||||
|
.option('template', {
|
||||||
|
alias: 't',
|
||||||
|
description: 'Frontend framework to use for CEF',
|
||||||
|
type: 'string',
|
||||||
|
demandOption: false,
|
||||||
|
})
|
||||||
|
.middleware(async () => await checkForUpdate())
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handler(args: ArgumentsCamelCase) {
|
||||||
|
let folder = (args.projectName as string) ?? args.p
|
||||||
|
let framework = (args.template as string) ?? args.t
|
||||||
|
|
||||||
|
if (!folder) {
|
||||||
|
folder = await input({
|
||||||
message: c.gray('Enter project name:'),
|
message: c.gray('Enter project name:'),
|
||||||
default: 'rage-fw',
|
default: 'rage-fw',
|
||||||
})
|
})
|
||||||
const framework = await select({
|
} else {
|
||||||
|
console.log(c.gray('Project name:'), folder)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!framework) {
|
||||||
|
framework = await select({
|
||||||
message: c.gray('Select frontend:'),
|
message: c.gray('Select frontend:'),
|
||||||
default: 'react',
|
default: 'react',
|
||||||
loop: true,
|
loop: true,
|
||||||
@@ -28,6 +54,9 @@ async function handler() {
|
|||||||
// },
|
// },
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
console.log(c.gray('Frontend:'), framework)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
c.gray('\nScaffolding template project into'),
|
c.gray('\nScaffolding template project into'),
|
||||||
@@ -56,11 +85,11 @@ async function handler() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// name and description for our command module
|
|
||||||
const init: CommandModule = {
|
const init: CommandModule = {
|
||||||
command: 'create [template]',
|
command: 'create [folderName] [template]',
|
||||||
aliases: 'c',
|
aliases: 'c',
|
||||||
describe: 'Scaffold a template project using RageFW',
|
describe: 'Scaffold a template project using RageFW',
|
||||||
|
builder,
|
||||||
handler,
|
handler,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -1,13 +1,11 @@
|
|||||||
import yargs from 'yargs'
|
import yargs from 'yargs'
|
||||||
|
|
||||||
import create from './commands/create'
|
import create from './commands/create'
|
||||||
import { checkForUpdate } from './utils/update'
|
|
||||||
|
|
||||||
yargs.middleware(checkForUpdate)
|
|
||||||
|
|
||||||
yargs
|
yargs
|
||||||
.usage('<cmd> [args]')
|
.usage('<cmd> [args]')
|
||||||
// .scriptName('rage-fw')
|
// .scriptName('rage-fw')
|
||||||
// .usage('$0 <cmd> [args]')
|
// .usage('$0 <cmd> [args]')
|
||||||
|
// @ts-ignore
|
||||||
.command(create)
|
.command(create)
|
||||||
.help().argv
|
.help().argv
|
||||||
|
|||||||
@@ -10,17 +10,20 @@ type Version = {
|
|||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function checkForUpdate() {
|
export async function checkForUpdate(): Promise<void> {
|
||||||
|
return new Promise(res => {
|
||||||
yargs.showVersion(version =>
|
yargs.showVersion(version =>
|
||||||
axios.get<Version[]>(latestVersionURL).then(({ data }) => {
|
axios
|
||||||
|
.get<Version[]>(latestVersionURL)
|
||||||
|
.then(({ data }) => {
|
||||||
const latestVersion = data[0].name
|
const latestVersion = data[0].name
|
||||||
|
|
||||||
if (!(latestVersion === version))
|
if (!(latestVersion === version))
|
||||||
notifyUserAboutUpdate(latestVersion)
|
notifyUserAboutUpdate(latestVersion)
|
||||||
|
})
|
||||||
return
|
.then(() => res()),
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifyUserAboutUpdate(version: string) {
|
function notifyUserAboutUpdate(version: string) {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw-client",
|
"name": "rage-fw-client",
|
||||||
"version": "0.0.23-alpha.0",
|
"version": "0.0.27-alpha.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"version": "0.0.23-alpha.0",
|
"version": "0.0.27-alpha.0",
|
||||||
"npmClient": "pnpm"
|
"npmClient": "pnpm"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+3594
-1290
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw-server",
|
"name": "rage-fw-server",
|
||||||
"version": "0.0.23-alpha.0",
|
"version": "0.0.27-alpha.0",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/src/index.d.ts",
|
"types": "dist/src/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rage-fw-shared-types",
|
"name": "rage-fw-shared-types",
|
||||||
"version": "0.0.23-alpha.0",
|
"version": "0.0.27-alpha.0",
|
||||||
"types": "types/types/index.d.ts",
|
"types": "types/types/index.d.ts",
|
||||||
"files": [
|
"files": [
|
||||||
"types/**/*"
|
"types/**/*"
|
||||||
|
|||||||
Reference in New Issue
Block a user