@solidlab/sdx
Advanced tools
Comparing version 0.0.2 to 0.0.3
#!/usr/bin/env node | ||
import chalk from "chalk"; | ||
import { Command } from "commander"; | ||
import { Initializer } from "./Initializer.js"; | ||
import { ProjectBuilder } from "./project-builder.js"; | ||
import { Local } from "./local.js"; | ||
import { Npm } from "./npm.js"; | ||
import { SOLID_PURPLE } from "./util.js"; | ||
import { LIB_VERSION } from './version.js'; | ||
// Remove warnings | ||
process.removeAllListeners('warning'); | ||
const program = new Command(); | ||
const init = new Initializer(); | ||
const projectBuilder = new ProjectBuilder(); | ||
const local = new Local(); | ||
const npm = new Npm(); | ||
// Main program | ||
program | ||
.version('0.0.0') | ||
.description(chalk.hex('#7C4DFF')('Solid Development eXperience toolkit')) | ||
.option('-t, --test', 'use @solidlab-types scope instead of @solid-types', false); | ||
.version(LIB_VERSION) | ||
.description(chalk.hex(SOLID_PURPLE)('Solid Development eXperience toolkit')); | ||
// init | ||
program.command('init') | ||
.description('initialize a new SDX project') | ||
.action((type, options) => init.initProject(options)); | ||
.option('-f, --force', 'Overwrite any package.json that might be present.', false) | ||
.action((options) => projectBuilder.initProject(options)); | ||
// search | ||
@@ -26,3 +26,3 @@ program.command('search') | ||
.argument('<type>', 'type to search for') | ||
.action((type, options) => npm.search(type, mergeOpts(options))); | ||
.action((type) => { }); | ||
// type | ||
@@ -38,12 +38,11 @@ const typeCommand = program.command('type').alias('types') | ||
.description('install a type (exact name match required)') | ||
.action((type, options) => npm.installType(type)); | ||
.action((type, options) => { }); | ||
// type uninstall | ||
typeCommand.command('uninstall') | ||
.description('uninstall a type (exact name match required)') | ||
.action((type, options) => npm.unInstallType(type)); | ||
.action((type, options) => { }); | ||
// type upgrade | ||
typeCommand.command('upgrade') | ||
.description('upgrade a type (within semantic version range)') | ||
.option('-f, --force', 'ignore semantic range and upgrade to latest available') | ||
.action((type, options) => npm.upgradeType(type, options)); | ||
.action((type, options) => { }); | ||
program.parse(process.argv); | ||
@@ -50,0 +49,0 @@ function mergeOpts(options) { |
import { createRequire } from "module"; | ||
import { Scope } from "./types.js"; | ||
import { noResults } from "./util.js"; | ||
@@ -7,6 +6,5 @@ const require = createRequire(import.meta.url); | ||
listTypes(options) { | ||
const scope = options.test ? Scope.TEST : Scope.PRODUCTION; | ||
const dependencies = require("../package.json").dependencies; | ||
const results = Object.entries(dependencies) | ||
.filter(dep => dep[0].startsWith(`@${scope}/`)) | ||
.filter(dep => dep[0].startsWith(`@solid-types/`)) | ||
.map(dep => ({ name: dep[0], version: dep[1] })); | ||
@@ -13,0 +11,0 @@ if (results.length === 0) { |
@@ -41,3 +41,3 @@ export interface NpmSearchResult { | ||
export interface ProgramOptions { | ||
test: boolean; | ||
force: boolean; | ||
} | ||
@@ -44,0 +44,0 @@ export declare enum Scope { |
@@ -5,1 +5,2 @@ /** | ||
export declare function noResults(extraPhrase?: string): void; | ||
export declare const SOLID_PURPLE = "#7C4DFF"; |
@@ -12,2 +12,3 @@ /** | ||
} | ||
export const SOLID_PURPLE = '#7C4DFF'; | ||
//# sourceMappingURL=util.js.map |
@@ -6,5 +6,6 @@ { | ||
"ignore": [ | ||
"dist/**/*" | ||
"dist/**/*", | ||
"src/version.ts" | ||
], | ||
"ext": "*.ts" | ||
} |
{ | ||
"name": "@solidlab/sdx", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Solid Development Experience toolkit", | ||
@@ -13,2 +13,3 @@ "main": "./dist/index.js", | ||
"dev": "npx nodemon --exec \"npm run buildInstall\"", | ||
"prebuild": "node -p \"'export const LIB_VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts", | ||
"build": "tsc -p .", | ||
@@ -32,2 +33,3 @@ "buildInstall": "npm run build && npm i -g", | ||
"@types/node": "^18.11.11", | ||
"@types/prompts": "^2.4.2", | ||
"nodemon": "^2.0.20", | ||
@@ -39,3 +41,4 @@ "ts-node": "^10.9.1", | ||
"chalk": "^5.1.2", | ||
"commander": "^9.4.1" | ||
"commander": "^9.4.1", | ||
"prompts": "^2.4.2" | ||
}, | ||
@@ -42,0 +45,0 @@ "publishConfig": { |
@@ -1,1 +0,27 @@ | ||
# sdx | ||
# Solid Development eXperience toolkit | ||
SDX makes development of SOLID applications more enjoyable. | ||
## Installation | ||
```bash | ||
npm i -g @solidlab/sdx | ||
``` | ||
Requires at least node 18.0.0 | ||
## Usage | ||
```bash | ||
sdx search <type> | ||
sdx type install <type> | ||
sdx help | ||
``` | ||
## Contributing | ||
Start the continuous development server with: | ||
```bash | ||
npm run dev | ||
``` |
@@ -5,5 +5,6 @@ #!/usr/bin/env node | ||
import { Command } from "commander"; | ||
import { Initializer } from "./Initializer.js"; | ||
import { ProjectBuilder } from "./project-builder.js"; | ||
import { Local } from "./local.js"; | ||
import { Npm } from "./npm.js"; | ||
import { SOLID_PURPLE } from "./util.js"; | ||
import { LIB_VERSION } from './version.js'; | ||
@@ -14,16 +15,16 @@ // Remove warnings | ||
const program = new Command(); | ||
const init = new Initializer(); | ||
const projectBuilder = new ProjectBuilder(); | ||
const local = new Local(); | ||
const npm = new Npm(); | ||
// Main program | ||
program | ||
.version('0.0.0') | ||
.description(chalk.hex('#7C4DFF')('Solid Development eXperience toolkit')) | ||
.option('-t, --test', 'use @solidlab-types scope instead of @solid-types', false) | ||
.version(LIB_VERSION) | ||
.description(chalk.hex(SOLID_PURPLE)('Solid Development eXperience toolkit')); | ||
// init | ||
program.command('init') | ||
.description('initialize a new SDX project') | ||
.action((type, options) => init.initProject(options)); | ||
.option('-f, --force', 'Overwrite any package.json that might be present.', false) | ||
.action((options) => projectBuilder.initProject(options)); | ||
@@ -34,3 +35,3 @@ // search | ||
.argument('<type>', 'type to search for') | ||
.action((type, options) => npm.search(type, mergeOpts(options))); | ||
.action((type) => { }); | ||
@@ -47,12 +48,11 @@ // type | ||
.description('install a type (exact name match required)') | ||
.action((type, options) => npm.installType(type)) | ||
.action((type, options) => { }) | ||
// type uninstall | ||
typeCommand.command('uninstall') | ||
.description('uninstall a type (exact name match required)') | ||
.action((type, options) => npm.unInstallType(type)) | ||
.action((type, options) => { }) | ||
// type upgrade | ||
typeCommand.command('upgrade') | ||
.description('upgrade a type (within semantic version range)') | ||
.option('-f, --force', 'ignore semantic range and upgrade to latest available') | ||
.action((type, options) => npm.upgradeType(type, options)) | ||
.action((type, options) => { }) | ||
@@ -59,0 +59,0 @@ |
@@ -10,6 +10,5 @@ import { createRequire } from "module"; | ||
listTypes(options: ProgramOptions): any { | ||
const scope = options.test ? Scope.TEST : Scope.PRODUCTION; | ||
const dependencies: Record<string, string> = require("../package.json").dependencies; | ||
const results = Object.entries(dependencies) | ||
.filter(dep => dep[0].startsWith(`@${scope}/`)) | ||
.filter(dep => dep[0].startsWith(`@solid-types/`)) | ||
.map(dep => ({ name: dep[0], version: dep[1] })); | ||
@@ -16,0 +15,0 @@ if (results.length === 0) { |
@@ -47,3 +47,3 @@ export interface NpmSearchResult { | ||
export interface ProgramOptions { | ||
test: boolean; | ||
force: boolean; | ||
} | ||
@@ -50,0 +50,0 @@ |
@@ -13,1 +13,3 @@ | ||
} | ||
export const SOLID_PURPLE = '#7C4DFF'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
26794
569
28
3
5
2
+ Addedprompts@^2.4.2
+ Addedkleur@3.0.3(transitive)
+ Addedprompts@2.4.2(transitive)
+ Addedsisteransi@1.0.5(transitive)