create-open-action
Advanced tools
Comparing version 0.0.1 to 0.0.2
99
cli.js
@@ -11,2 +11,3 @@ #!/usr/bin/env node | ||
import childProcess from 'child_process' | ||
import select from '@inquirer/select' | ||
@@ -37,3 +38,3 @@ const log = console.log | ||
const spinner = ora({ | ||
text: 'Creating smart post.' | ||
text: 'Creating Open Action.' | ||
}) | ||
@@ -44,5 +45,5 @@ try { | ||
program | ||
.name('Create Smart Post') | ||
.description('Create a new Lens Smart Post with a single command.') | ||
.option('-n, --name <name of smart post>', 'Set the name of the Smart Post.') | ||
.name('Create Open Action') | ||
.description('Create a new Lens Open Action with a single command.') | ||
.option('-n, --name <name of Open Action>', 'Set the name of the Open Action.') | ||
@@ -56,7 +57,7 @@ program.parse(process.argv) | ||
appName = await input({ | ||
message: 'Enter your smart post name', | ||
default: 'my-smart-post', | ||
message: 'Enter your Open Action name', | ||
default: 'my-open-action', | ||
validate: d => { | ||
if(!kebabRegez.test(d)) { | ||
return 'please enter your smart post name in the format of my-smart-post-name' | ||
return 'Please enter your Open Action name in the format of my-open-action-name' | ||
} | ||
@@ -95,36 +96,62 @@ return true | ||
let packageJson = fs.readFileSync(`${appName}/frontend/package.json`, 'utf8') | ||
const packageObj = JSON.parse(packageJson) | ||
packageObj.name = appName | ||
packageJson = JSON.stringify(packageObj, null, 2) | ||
console.log('packageJson: ', packageJson) | ||
fs.writeFileSync(`${appName}/frontend/package.json`, packageJson) | ||
if (type === 'scaffold-lens') { | ||
let packageJson = fs.readFileSync(`${appName}/package.json`, 'utf8') | ||
const packageObj = JSON.parse(packageJson) | ||
packageObj.name = appName | ||
packageJson = JSON.stringify(packageObj, null, 2) | ||
console.log('packageJson: ', packageJson) | ||
fs.writeFileSync(`${appName}/package.json`, packageJson) | ||
process.chdir(path.join(process.cwd(), appName, 'frontend')) | ||
spinner.text = '' | ||
let startCommand = '' | ||
process.chdir(path.join(process.cwd(), appName)) | ||
spinner.text = '' | ||
let startCommand = '' | ||
if (isYarnInstalled()) { | ||
await execaCommand('yarn').pipeStdout(process.stdout) | ||
} else { | ||
spinner.text = 'Installing dependencies' | ||
await execa('npm', ['install', '--verbose']).pipeStdout(process.stdout) | ||
spinner.text = '' | ||
} | ||
if (isBunInstalled()) { | ||
spinner.text = 'Installing dependencies' | ||
await execaCommand('bun install').pipeStdout(process.stdout) | ||
spinner.text = '' | ||
startCommand = 'bun dev' | ||
console.log('\n') | ||
} else if (isYarnInstalled()) { | ||
await execaCommand('yarn').pipeStdout(process.stdout) | ||
startCommand = 'yarn dev' | ||
spinner.stop() | ||
log(`${green.bold('Success!')} Created ${appName}. \n`) | ||
log(`To learn more, check out Scaffold Lens documentation here https://github.com/iPaulPro/scaffold-lens`) | ||
} else { | ||
spinner.text = 'Installing dependencies' | ||
await execa('npm', ['install', '--verbose']).pipeStdout(process.stdout) | ||
let packageJson = fs.readFileSync(`${appName}/frontend/package.json`, 'utf8') | ||
const packageObj = JSON.parse(packageJson) | ||
packageObj.name = appName | ||
packageJson = JSON.stringify(packageObj, null, 2) | ||
console.log('packageJson: ', packageJson) | ||
fs.writeFileSync(`${appName}/frontend/package.json`, packageJson) | ||
process.chdir(path.join(process.cwd(), appName, 'frontend')) | ||
spinner.text = '' | ||
startCommand = 'npm run dev' | ||
let startCommand = '' | ||
if (isBunInstalled()) { | ||
spinner.text = 'Installing dependencies' | ||
await execaCommand('bun install').pipeStdout(process.stdout) | ||
spinner.text = '' | ||
startCommand = 'bun dev' | ||
console.log('\n') | ||
} else if (isYarnInstalled()) { | ||
await execaCommand('yarn').pipeStdout(process.stdout) | ||
startCommand = 'yarn dev' | ||
} else { | ||
spinner.text = 'Installing dependencies' | ||
await execa('npm', ['install', '--verbose']).pipeStdout(process.stdout) | ||
spinner.text = '' | ||
startCommand = 'npm run dev' | ||
} | ||
// process.chdir(path.join(process.cwd(), appName)) | ||
spinner.stop() | ||
log(`${green.bold('Success!')} Created ${appName}. \n`) | ||
log(`To get started: \n | ||
1. Change into the ${chalk.cyan("contracts")} directory and configure your environment variables by copying the ${chalk.cyan(".env.example")} file to ${chalk.cyan(".env")} and filling in the values. \n | ||
2. Run script to deploy ${chalk.cyan("HelloWorld.sol")} and ${chalk.cyan("HelloWorldOpenAction.sol")} to Mumbai: \n\n ${chalk.magentaBright("forge script script/HelloWorld.s.sol:HelloWorldScript --rpc-url $MUMBAI_RPC_URL --broadcast --verify -vvvv")} \n | ||
3. In a separate window, change into the frontend directory and configure the deployed contract addresses in ${chalk.cyan('frontend/src/constants.ts')} \n | ||
4. Run ${chalk.cyan(startCommand)}`) | ||
} | ||
// process.chdir(path.join(process.cwd(), appName)) | ||
spinner.stop() | ||
log(`${green.bold('Success!')} Created ${appName}. \n`) | ||
log(`To get started: \n | ||
1. Change into the ${chalk.cyan("contracts")} directory and configure your environment variables by copying the ${chalk.cyan(".env.example")} file to ${chalk.cyan(".env")} and filling in the values. \n | ||
2. Run script to deploy ${chalk.cyan("HelloWorld.sol")} and ${chalk.cyan("HelloWorldOpenAction.sol")} to Mumbai: \n\n ${chalk.magentaBright("forge script script/HelloWorld.s.sol:HelloWorldScript --rpc-url $MUMBAI_RPC_URL --broadcast --verify -vvvv")} \n | ||
3. In a separate window, change into the frontend directory and configure the deployed contract addresses in ${chalk.cyan('frontend/src/constants.ts')} \n | ||
4. Run ${chalk.cyan(startCommand)}`) | ||
} catch (err) { | ||
@@ -131,0 +158,0 @@ console.log('error: ', err) |
{ | ||
"name": "create-open-action", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Scaffold a new Lens Open Action", | ||
@@ -16,2 +16,3 @@ "main": "index.js", | ||
"@inquirer/prompts": "^3.2.0", | ||
"@inquirer/select": "^2.0.0", | ||
"chalk": "^5.3.0", | ||
@@ -18,0 +19,0 @@ "cli-spinners": "^2.9.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7076
139
7
+ Added@inquirer/select@^2.0.0
+ Added@inquirer/core@9.2.1(transitive)
+ Added@inquirer/figures@1.0.8(transitive)
+ Added@inquirer/select@2.5.0(transitive)
+ Added@inquirer/type@2.0.0(transitive)
+ Added@types/node@22.10.0(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedyoctocolors-cjs@2.1.2(transitive)