-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Rettend/v1-alpha
V1 alpha
- Loading branch information
Showing
13 changed files
with
490 additions
and
252 deletions.
There are no files selected for viewing
This file was deleted.
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
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,12 @@ | ||
#!/bin/sh | ||
LOCAL_PATH=$(npm root) | ||
NODE_PATH=$(npm root -g) | ||
|
||
if [ -f "$LOCAL_PATH/eemoji/bin/eemoji.mjs" ]; then | ||
node "$LOCAL_PATH/eemoji/bin/eemoji.mjs" run $1 | ||
elif [ -f "$NODE_PATH/eemoji/bin/eemoji.mjs" ]; then | ||
node "$NODE_PATH/eemoji/bin/eemoji.mjs" run $1 | ||
else | ||
echo "eemoji is not properly installed locally or globally" | ||
exit 1 | ||
fi |
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,68 @@ | ||
import * as fs from 'node:fs' | ||
import path from 'node:path' | ||
import { defineCommand } from 'citty' | ||
import { consola } from 'consola' | ||
import { ConfigObject } from '../config' | ||
import { name } from '../../package.json' | ||
|
||
const C = new ConfigObject() | ||
|
||
export default defineCommand({ | ||
meta: { | ||
name: 'cleanup', | ||
description: 'Cleanup git hook and settings.json', | ||
}, | ||
async run() { | ||
consola.start('Removing git hook...') | ||
|
||
if (fs.existsSync(C.hookFile)) { | ||
fs.unlinkSync(C.hookFile) | ||
consola.success(`Removed ${C.hookFile}`) | ||
} | ||
else { | ||
consola.info(`No ${C.hookFile} found`) | ||
} | ||
|
||
consola.start('Removing VSCode settings...') | ||
|
||
if (fs.existsSync(C.vscodeSettingsFile)) { | ||
const settings = JSON.parse(fs.readFileSync(C.vscodeSettingsFile, 'utf-8')) | ||
if (settings['json.schemas']) { | ||
settings['json.schemas'] = settings['json.schemas'].filter((schema: any) => { | ||
return schema.url !== `https://rettend.github.io/${name}/${name}-config-schema.json` | ||
}) | ||
if (settings['json.schemas'].length === 0) | ||
delete settings['json.schemas'] | ||
} | ||
if (Object.keys(settings).length === 0) { | ||
fs.unlinkSync(C.vscodeSettingsFile) | ||
fs.rmdirSync(path.dirname(C.vscodeSettingsFile)) | ||
consola.success(`Removed ${C.vscodeSettingsFile}`) | ||
} | ||
else { | ||
fs.writeFileSync(C.vscodeSettingsFile, JSON.stringify(settings, null, 2)) | ||
consola.info(`Updated ${C.vscodeSettingsFile}`) | ||
} | ||
} | ||
else { | ||
consola.info(`No ${C.vscodeSettingsFile} found`) | ||
} | ||
|
||
consola.start('Removing config files...') | ||
let removedFiles = false | ||
|
||
;[...C.jsFiles, ...C.jsonFiles.filter(file => file !== 'package.json')].forEach((file: string) => { | ||
if (fs.existsSync(file)) { | ||
fs.unlinkSync(file) | ||
consola.success(`Removed ${file}`) | ||
removedFiles = true | ||
} | ||
}) | ||
|
||
if (!removedFiles) | ||
consola.info('No config files found') | ||
|
||
else | ||
consola.success('Cleanup complete!') | ||
}, | ||
}) |
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,9 @@ | ||
import type { CommandDef } from 'citty' | ||
|
||
const _rDefault = (r: any) => (r.default || r) as Promise<CommandDef> | ||
|
||
export const commands = { | ||
init: () => import('./init').then(_rDefault), | ||
run: () => import('./run').then(_rDefault), | ||
cleanup: () => import('./cleanup').then(_rDefault), | ||
} as const |
Oops, something went wrong.