WIP
This commit is contained in:
-33
@@ -1,33 +0,0 @@
|
|||||||
#!/usr/bin/env bun
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import { execute, settings } from '@oclif/core'
|
|
||||||
import { execSync } from 'child_process'
|
|
||||||
|
|
||||||
try {
|
|
||||||
// // Source asdf from your shell profile and capture environment variables
|
|
||||||
// const asdfEnv = execSync('source ~/.asdf/asdf.sh && env', { shell: '/bin/bash' })
|
|
||||||
// .toString()
|
|
||||||
// .split('\n')
|
|
||||||
// .reduce((acc, line) => {
|
|
||||||
// const [key, value] = line.split('=');
|
|
||||||
// if (key && value) acc[key] = value;
|
|
||||||
// return acc;
|
|
||||||
// }, {});
|
|
||||||
|
|
||||||
// // Add the asdf environment to the current process
|
|
||||||
// Object.assign(process.env, asdfEnv);
|
|
||||||
|
|
||||||
// // Now, asdf is available in process.env, and you can use it
|
|
||||||
// console.log(execSync('asdf list all nodejs').toString());
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error(`Failed to load asdf: ${error.message}`);
|
|
||||||
}
|
|
||||||
// process.env.DEBUG=""
|
|
||||||
|
|
||||||
|
|
||||||
settings.performanceEnabled = true
|
|
||||||
|
|
||||||
await execute({ dir: import.meta.url })
|
|
||||||
@@ -8,17 +8,6 @@
|
|||||||
},
|
},
|
||||||
"bugs": "https://github.com/https://github.com/jafarijason/jj/jj/issues",
|
"bugs": "https://github.com/https://github.com/jafarijason/jj/jj/issues",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oclif/core": "^4",
|
|
||||||
"@oclif/plugin-autocomplete": "^3.2.8",
|
|
||||||
"@oclif/plugin-commands": "^4.1.7",
|
|
||||||
"@oclif/plugin-help": "^6.2.16",
|
|
||||||
"@oclif/plugin-not-found": "^3.2.25",
|
|
||||||
"@oclif/plugin-plugins": "^5.4.15",
|
|
||||||
"@oclif/plugin-search": "^1.2.14",
|
|
||||||
"@oclif/plugin-update": "^4.6.10",
|
|
||||||
"@oclif/plugin-version": "^2.2.15",
|
|
||||||
"@oclif/plugin-warn-if-update-available": "^3.1.21",
|
|
||||||
"@oclif/plugin-which": "^3.2.17",
|
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
"flatted": "^3.3.1",
|
"flatted": "^3.3.1",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
@@ -32,8 +21,6 @@
|
|||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@oclif/prettier-config": "^0.2.1",
|
|
||||||
"@oclif/test": "^4",
|
|
||||||
"@types/chai": "^4",
|
"@types/chai": "^4",
|
||||||
"@types/mocha": "^10",
|
"@types/mocha": "^10",
|
||||||
"@types/node": "^18",
|
"@types/node": "^18",
|
||||||
@@ -51,11 +38,6 @@
|
|||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=18.0.0"
|
||||||
},
|
},
|
||||||
"files": [
|
|
||||||
"/bin",
|
|
||||||
"/dist",
|
|
||||||
"/oclif.manifest.json"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/https://github.com/jafarijason/jj/jj",
|
"homepage": "https://github.com/https://github.com/jafarijason/jj/jj",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"oclif"
|
"oclif"
|
||||||
@@ -63,33 +45,6 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"oclif": {
|
|
||||||
"bin": "jj",
|
|
||||||
"dirname": "jj",
|
|
||||||
"commands": "./src/commands",
|
|
||||||
"plugins": [
|
|
||||||
"@oclif/plugin-help",
|
|
||||||
"@oclif/plugin-plugins",
|
|
||||||
"@oclif/plugin-update",
|
|
||||||
"@oclif/plugin-warn-if-update-available",
|
|
||||||
"@oclif/plugin-which",
|
|
||||||
"@oclif/plugin-commands",
|
|
||||||
"@oclif/plugin-autocomplete",
|
|
||||||
"@oclif/plugin-search",
|
|
||||||
"@oclif/plugin-version"
|
|
||||||
],
|
|
||||||
"topicSeparator": " ",
|
|
||||||
"topics": {},
|
|
||||||
"theme": "theme.json",
|
|
||||||
"hooks": {
|
|
||||||
"prerun": [
|
|
||||||
"./src/hooks/prerun/customPreRun.ts"
|
|
||||||
],
|
|
||||||
"postrun": [
|
|
||||||
"./src/hooks/postrun/customPostRun.ts"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"repository": "https://github.com/jafarijason/jj/jj",
|
"repository": "https://github.com/jafarijason/jj/jj",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": " ",
|
"build": " ",
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import {Args, Command, Flags} from '@oclif/core'
|
|
||||||
|
|
||||||
export default class Hello extends Command {
|
|
||||||
static args = {
|
|
||||||
person: Args.string({description: 'Person to say hello to', required: true}),
|
|
||||||
}
|
|
||||||
|
|
||||||
static description = 'Say hello'
|
|
||||||
|
|
||||||
static examples = [
|
|
||||||
`<%= config.bin %> <%= command.id %> friend --from oclif
|
|
||||||
hello friend from oclif! (./src/commands/hello/index.ts)
|
|
||||||
`,
|
|
||||||
]
|
|
||||||
|
|
||||||
static flags = {
|
|
||||||
from: Flags.string({char: 'f', description: 'Who is saying hello', required: true}),
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(): Promise<void> {
|
|
||||||
const {args, flags} = await this.parse(Hello)
|
|
||||||
|
|
||||||
this.log(`hello ${args.person} from ${flags.from}! (./src/commands/hello/index.ts)`)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import {Command} from '@oclif/core'
|
|
||||||
import { jjConfigs } from '@src/index'
|
|
||||||
|
|
||||||
export default class World extends Command {
|
|
||||||
static args = {}
|
|
||||||
|
|
||||||
static description = 'Say hello world'
|
|
||||||
|
|
||||||
static examples = [
|
|
||||||
`<%= config.bin %> <%= command.id %>
|
|
||||||
hello world! (./src/commands/hello/world.ts)
|
|
||||||
`,
|
|
||||||
]
|
|
||||||
|
|
||||||
static flags = {}
|
|
||||||
|
|
||||||
async run(): Promise<void> {
|
|
||||||
console.log(jjConfigs)
|
|
||||||
this.log('hello world! (./src/commands/hello/world.ts)')
|
|
||||||
this.warn('warn')
|
|
||||||
this.debug('jjjjjjj')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import { Hook } from '@oclif/core'
|
|
||||||
|
|
||||||
const hook: Hook<'postrun'> = async function (opts: any) {
|
|
||||||
|
|
||||||
|
|
||||||
// srmVersion
|
|
||||||
// console.log(opts.Command.flags)
|
|
||||||
// console.log(opts.Command.args)
|
|
||||||
// console.log(opts.Command.name)
|
|
||||||
// console.log(opts)
|
|
||||||
// process.stdout.write(`example hook running ${opts?.id}\n`)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export default hook
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
import { Hook, Command } from '@oclif/core'
|
|
||||||
import fs from 'fs-extra';
|
|
||||||
import _ from 'lodash';
|
|
||||||
import { jjEnsure } from '@helpers/jjEnsure';
|
|
||||||
import { jjConfigs } from '@src/index';
|
|
||||||
|
|
||||||
|
|
||||||
const hook: Hook<'prerun'> = async function (opts) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await jjEnsure(opts)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Object.assign(process.env, jjConfigs.processEnvs);
|
|
||||||
|
|
||||||
|
|
||||||
// srmVersion
|
|
||||||
// console.log(opts.Command.flags)
|
|
||||||
// console.log(opts.Command.args)
|
|
||||||
// console.log(opts.Command.name)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default hook
|
|
||||||
Reference in New Issue
Block a user