11 Commits

Author SHA1 Message Date
github-actions[bot]
ebc688022e chore(main): release 0.4.2 (#66)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-28 12:33:13 +05:30
renovate[bot]
810763837c chore(deps): lock file maintenance (#65)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-25 13:26:49 +05:30
renovate[bot]
fa331ae0c0 chore(deps): lock file maintenance (#64)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-25 08:37:41 +05:30
Evo
6c034a568f refactor(init): improve node version check (#63) 2022-07-22 19:22:54 +05:30
EvolutionX
9158e66bb4 chore(init): update naming of variable 2022-07-21 23:15:27 +05:30
renovate[bot]
af593bf84a chore(deps): update actions/setup-node digest to 2fddd88 (#60)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-18 09:39:56 +05:30
renovate[bot]
f84e7ac8f5 chore(deps): lock file maintenance (#61)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2022-07-18 09:24:27 +05:30
renovate[bot]
08b8a13d16 chore(deps): lock file maintenance (#59) 2022-07-11 15:28:32 +05:30
Evo
c4f8e45bdc feat: switch to undici (#58) 2022-07-10 11:09:22 +05:30
EvolutionX
83e841a341 chore: update scripts 2022-07-07 23:05:47 +05:30
EvolutionX
ab2f8016b6 chore: remove standard-version 2022-07-07 23:05:00 +05:30
11 changed files with 191 additions and 6991 deletions

View File

@@ -15,7 +15,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Use Node.js
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17
registry-url: 'https://registry.npmjs.org/'

View File

@@ -18,7 +18,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Set up Node.js
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17
registry-url: 'https://registry.npmjs.org'

View File

@@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Set up Node.js
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17
@@ -40,7 +40,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Set up Node.js
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17

View File

@@ -13,7 +13,7 @@ jobs:
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Set up Node.js
uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17
registry-url: 'https://registry.npmjs.org'

View File

@@ -14,7 +14,7 @@ jobs:
bump-patch-for-minor-pre-major: true
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3
- uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 17
registry-url: 'https://registry.npmjs.org'

View File

@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
## [0.4.2](https://github.com/sern-handler/cli/compare/v0.4.1...v0.4.2) (2022-07-28)
### Features
* switch to undici ([#58](https://github.com/sern-handler/cli/issues/58)) ([c4f8e45](https://github.com/sern-handler/cli/commit/c4f8e45bdc0af5a3bbd394d2b9f852f4a946114c))
## [0.4.1](https://github.com/sern-handler/cli/compare/v0.4.0...v0.4.1) (2022-07-07)

7106
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@sern/cli",
"version": "0.4.1",
"version": "0.4.2",
"description": "A CLI for @sern/handler",
"exports": "./src/index.js",
"bin": {
@@ -9,9 +9,6 @@
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"release": "standard-version",
"preview": "standard-version --dry-run",
"push": "git push --follow-tags",
"format": "prettier --check .",
"fix": "prettier --write ."
},
@@ -33,26 +30,18 @@
},
"homepage": "https://sern-handler.js.org",
"dependencies": {
"axios": "^0.27.2",
"colorette": "^2.0.16",
"commander": "^9.3.0",
"execa": "^6.1.0",
"find-up": "6.3.0",
"ora": "^6.1.0",
"prompts": "2.4.2"
"prompts": "2.4.2",
"undici": "^5.6.1"
},
"devDependencies": {
"@favware/npm-deprecate": "1.0.4",
"@types/prompts": "2.0.14",
"cz-conventional-changelog": "3.3.0",
"eslint": "8.19.0",
"prettier": "2.7.1",
"standard-version": "9.5.0"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
"prettier": "2.7.1"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/",

View File

@@ -24,11 +24,15 @@ const { prompt } = prompts;
*/
export async function init(flags) {
// * Check if node version is valid
const node = await execa('node', ['--version']);
if (/v1(([0-6]\.[2-9])|([0-5]\.[0-9]))/gm.test(node.stdout)) {
const { version } = process;
const [major, minor] = version.split('.');
const majorNum = parseInt(major.slice(1));
const minorNum = parseInt(minor);
if (majorNum < 16 || (majorNum === 16 && minorNum < 10)) {
console.log(
yellowBright(
`\nYou are using Node ${node.stdout}\nPlease upgrade to Node 16.10.x or higher!\n`
`\nYou are using Node ${version}\nPlease upgrade to Node 16.10.x or higher!\n`
)
);
@@ -69,9 +73,9 @@ export async function init(flags) {
const requiredData = flags.sync !== undefined ? 3 : 4;
const receivedData = Object.keys(data).length;
const hasRequiredData = receivedData < requiredData;
const incompleteDataCondition = receivedData < requiredData;
if (hasRequiredData) process.exit(1);
if (incompleteDataCondition) process.exit(1);
if (!flags.sync) await cloneRepo(data.lang, data.name);

View File

@@ -1,6 +1,6 @@
import { pluginsQ } from '../prompts/plugin.js';
import prompts from 'prompts';
import axios from 'axios';
import { fetch } from 'undici';
import fs from 'fs';
import { greenBright } from 'colorette';
const { prompt } = prompts;
@@ -31,14 +31,18 @@ export async function plugins() {
* @returns File
*/
async function download(url) {
const res = await axios.default.get(url);
const data = res.data;
const data = await fetch(url, { method: 'GET' })
.then((res) => res.text())
.catch(() => null);
if (!data) throw new Error('Download failed! Kindly contact developers');
const dir = `${process.cwd()}/src/plugins`;
const filedir = `${process.cwd()}/src/plugins/${url.split('/').pop()}`;
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true });
}
const file = fs.writeFileSync(filedir, data);
return file;
}

View File

@@ -1,13 +1,17 @@
import axios from 'axios';
import { fetch } from 'undici';
import { getLang } from '../utilities/getLang.js';
async function gimmechoices() {
const lang =
(await getLang()) === 'typescript' ? 'TypeScript' : 'JavaScript';
(await getLang().catch(() => null)) === 'typescript'
? 'TypeScript'
: 'JavaScript';
const link = `https://api.github.com/repos/sern-handler/awesome-plugins/contents/${lang}`;
const resp = await axios.default.get(link).catch(() => null);
const resp = await fetch(link).catch(() => null);
if (!resp) return { title: 'No plugins found!', value: '', disabled: true };
const { data } = resp;
const data = await resp.json();
const choices = data.map(
(/** @type {{ name: string; download_url: string; }} */ e) => ({
title: e.name,