Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solidlab/sdx

Package Overview
Dependencies
Maintainers
6
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solidlab/sdx - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

dist/Initializer.d.ts

34

dist/index.js
#!/usr/bin/env node
import chalk from "chalk";
import figlet from "figlet";
import { Command } from "commander";
import { Initializer } from "./Initializer.js";
import { Local } from "./local.js";
import { Npm } from "./npm.js";

@@ -9,9 +10,14 @@ // Remove warnings

const program = new Command();
const init = new Initializer();
const local = new Local();
const npm = new Npm();
console.log(chalk.hex('#7C4DFF')(figlet.textSync('sdx - Solid Development eXperience', { horizontalLayout: 'full' })));
// Main program
program
.version('0.0.0')
.description('Solid Development Experience toolkit');
.description(chalk.hex('#7C4DFF')('Solid Development eXperience toolkit'));
// init
program.command('init')
.description('initialize a new SDX project');
.description('initialize a new SDX project')
.action((type, options) => init.initProject());
// search
program.command('search')

@@ -21,3 +27,23 @@ .description('search for a type')

.action((type, options) => npm.search(type));
// type
const typeCommand = program.command('type').alias('types')
.description('standard operations on types');
// type list
typeCommand.command('list')
.description('list all installed types')
.action((type, options) => local.listTypes());
// type install
typeCommand.command('install')
.description('install a type (exact name match required)')
.action((type, options) => npm.installType(type));
// type uninstall
typeCommand.command('uninstall')
.description('uninstall a type (exact name match required)')
.action((type, options) => npm.unInstallType(type));
// type upgrade
typeCommand.command('upgrade')
.description('upgrade a type (within semantic version range)')
.argument('--force, -f', 'ignore semantic range and upgrade to latest available')
.action((type, options) => npm.upgradeType(type, options));
program.parse();
//# sourceMappingURL=index.js.map

@@ -0,1 +1,2 @@

export declare const SCOPE: 'solid' | 'solidlab';
export declare class Npm {

@@ -5,5 +6,17 @@ readonly registryUrl = "https://registry.npmjs.org";

constructor();
search(name: string): Promise<void>;
/**
* Search for a type on NPM under the configured scope (@solid or @solidlab normally)
* @param type Name of the type
*/
search(type: string): Promise<void>;
installType(type: string): Promise<void>;
unInstallType(type: string): Promise<void>;
upgradeType(type: string, options: any): Promise<void>;
/**
* Fetch last weeks downloads number for a list of packages.
* @param names Names of the types
* @returns
*/
private fetchDownloads;
private trim;
}

@@ -1,2 +0,3 @@

const scope = 'solid';
import { noResults } from "./util.js";
export const SCOPE = 'solid';
export class Npm {

@@ -7,7 +8,16 @@ constructor() {

}
async search(name) {
/**
* Search for a type on NPM under the configured scope (@solid or @solidlab normally)
* @param type Name of the type
*/
async search(type) {
const path = [this.registryUrl, '-/v1/search'].join('/');
const url = `${path}?text=scope:${scope} ${name}&quality=0.7&popularity=1.0&maintenance=0`;
const url = `${path}?text=scope:${SCOPE} ${type}&quality=0.7&popularity=1.0&maintenance=0`;
const json = await (await fetch(url)).json();
const packages = json.objects.map(obj => obj.package);
// No results: stop here
if (packages.length === 0) {
noResults('Maybe try broadening your search?');
return;
}
const downloads = await this.fetchDownloads(packages.map(p => p.name));

@@ -17,2 +27,13 @@ const results = packages.map(p => ({ name: p.name, version: p.version, description: this.trim(p.description), downloads: downloads[p.name] }));

}
async installType(type) {
}
async unInstallType(type) {
}
async upgradeType(type, options) {
}
/**
* Fetch last weeks downloads number for a list of packages.
* @param names Names of the types
* @returns
*/
async fetchDownloads(names) {

@@ -19,0 +40,0 @@ const path = [this.apiUrl, 'downloads/point/last-month'].join('/');

13

package.json
{
"name": "@solidlab/sdx",
"version": "0.0.0",
"version": "0.0.1",
"description": "Solid Development Experience toolkit",

@@ -11,6 +11,6 @@ "main": "./dist/index.js",

"scripts": {
"start": "node dist/index.js --",
"start": "npx sdx",
"dev": "npx nodemon --exec \"npm run buildInstall\"",
"build": "tsc -p .",
"local": "sudo npm i -g && sdx",
"refresh": "rm -rf ./node_modules ./package-lock.json && npm install",
"buildInstall": "npm run build && npm i -g",
"test": "echo \"Error: no test specified\" && exit 0"

@@ -31,4 +31,2 @@ },

"devDependencies": {
"@types/clear": "^0.1.2",
"@types/figlet": "^1.5.5",
"@types/node": "^18.11.11",

@@ -41,4 +39,3 @@ "nodemon": "^2.0.20",

"chalk": "^5.1.2",
"commander": "^9.4.1",
"figlet": "^1.5.2"
"commander": "^9.4.1"
},

@@ -45,0 +42,0 @@ "publishConfig": {

#!/usr/bin/env node
import chalk from "chalk";
import figlet from "figlet";
import { Command } from "commander";
import { Initializer } from "./Initializer.js";
import { Local } from "./local.js";
import { Npm } from "./npm.js";

@@ -12,13 +13,17 @@

const program = new Command();
const init = new Initializer();
const local = new Local();
const npm = new Npm();
console.log(chalk.hex('#7C4DFF')(figlet.textSync('sdx - Solid Development eXperience', { horizontalLayout: 'full' })));
// Main program
program
.version('0.0.0')
.description('Solid Development Experience toolkit')
.description(chalk.hex('#7C4DFF')('Solid Development eXperience toolkit'))
// init
program.command('init')
.description('initialize a new SDX project')
.action((type, options) => init.initProject());
// search
program.command('search')

@@ -29,2 +34,24 @@ .description('search for a type')

// type
const typeCommand = program.command('type').alias('types')
.description('standard operations on types');
// type list
typeCommand.command('list')
.description('list all installed types')
.action((type, options) => local.listTypes())
// type install
typeCommand.command('install')
.description('install a type (exact name match required)')
.action((type, options) => npm.installType(type))
// type uninstall
typeCommand.command('uninstall')
.description('uninstall a type (exact name match required)')
.action((type, options) => npm.unInstallType(type))
// type upgrade
typeCommand.command('upgrade')
.description('upgrade a type (within semantic version range)')
.argument('--force, -f', 'ignore semantic range and upgrade to latest available')
.action((type, options) => npm.upgradeType(type, options))
program.parse();
import { NpmDownloadsPointResult, NpmSearchResult } from "./types.js";
import { noResults } from "./util.js";
const scope = 'solid'
export const SCOPE: 'solid' | 'solidlab' = 'solid';

@@ -11,7 +12,18 @@ export class Npm {

async search(name: string): Promise<void> {
/**
* Search for a type on NPM under the configured scope (@solid or @solidlab normally)
* @param type Name of the type
*/
async search(type: string): Promise<void> {
const path = [this.registryUrl, '-/v1/search'].join('/');
const url = `${path}?text=scope:${scope} ${name}&quality=0.7&popularity=1.0&maintenance=0`;
const url = `${path}?text=scope:${SCOPE} ${type}&quality=0.7&popularity=1.0&maintenance=0`;
const json: NpmSearchResult = await (await fetch(url)).json() as NpmSearchResult;
const packages = json.objects.map(obj => obj.package);
// No results: stop here
if (packages.length === 0) {
noResults('Maybe try broadening your search?');
return;
}
const downloads = await this.fetchDownloads(packages.map(p => p.name));

@@ -22,2 +34,20 @@ const results = packages.map(p => ({ name: p.name, version: p.version, description: this.trim(p.description), downloads: downloads[p.name] }))

async installType(type: string) {
}
async unInstallType(type: string) {
}
async upgradeType(type: string, options: any) {
}
/**
* Fetch last weeks downloads number for a list of packages.
* @param names Names of the types
* @returns
*/
private async fetchDownloads(names: string[]): Promise<Record<string, number>> {

@@ -24,0 +54,0 @@ const path = [this.apiUrl, 'downloads/point/last-month'].join('/');

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc