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

@based/cli

Package Overview
Dependencies
Maintainers
0
Versions
190
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/cli - npm Package Compare versions

Comparing version 8.0.0-alpha.4 to 8.0.0-alpha.5

dist/commands/backup/download/index.d.ts

6

dist/commands/deploy/index.d.ts

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

import { type BasedBundleOptions } from '@based/bundle';
import type { BasedFunctionConfig } from '@based/functions';

@@ -12,3 +13,8 @@ import type { Command } from 'commander';

files?: string[];
build?: Build;
};
type Build = {
watch: BasedBundleOptions['watch'];
plugins: BasedBundleOptions['plugins'];
};
type ConfigStore = {

@@ -15,0 +21,0 @@ config: Config;

16

dist/commands/deploy/index.js
import { readFile, readdir } from 'node:fs/promises';
import { isAbsolute, join, relative } from 'node:path';
import { bundle } from '@based/bundle';
import { bundle, } from '@based/bundle';
import { hash, hashCompact } from '@saulx/hash';

@@ -171,2 +171,6 @@ import { queued } from '@saulx/utils';

const browserEntryPoints = [];
let browserWatch = {
include: [],
};
const browserEsbuildPlugins = [];
const favicons = new Set();

@@ -191,5 +195,10 @@ const files = {};

}
// if (!('bundle' in config) || config.bundle) {
if (config.build?.plugins) {
browserEsbuildPlugins.push(...config.build.plugins);
}
configStore.app = abs(config.main, dir);
browserEntryPoints.push(configStore.app);
if (config.build?.watch) {
browserWatch = config.build?.watch;
}
if (config.favicon) {

@@ -200,3 +209,2 @@ configStore.favicon = abs(config.favicon, dir);

}
// }
}

@@ -255,2 +263,3 @@ if (config.files) {

entryPoints: browserEntryPoints,
watch: browserWatch,
sourcemap: true,

@@ -261,2 +270,3 @@ platform: 'browser',

plugins: [
...browserEsbuildPlugins,
replaceBasedConfigPlugin({

@@ -263,0 +273,0 @@ url: staticPath,

1

dist/commands/dev/index.js

@@ -213,3 +213,2 @@ import { networkInterfaces } from 'node:os';

[config.name]: {
// name 'smurk'
type: 'function',

@@ -216,0 +215,0 @@ async fn() {

@@ -215,3 +215,3 @@ import { tmpdir } from 'node:os';

// )),
context.i18n('commands.init.methods.summary.dependencies', project.dependencies?.join(', ')),
context.i18n('commands.init.methods.summary.dependencies', [...project.dependencies, ...project.devDependencies]?.join(', ')),
context.i18n('commands.init.methods.summary.saveIn', project.path),

@@ -261,3 +261,3 @@ ].filter(Boolean));

await saveAsFile(basedProjectTemplate, project.path, project.format);
context.spinner.stop('Project created!');
context.spinner.stop('<green>♥</green> Project created!');
const npm = await confirm({

@@ -264,0 +264,0 @@ message: 'Do you want to install your dependencies now?',

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

export {};
import { Command } from 'commander';
export declare const login: (program: Command) => Promise<void>;

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

export {};
import { login as loginFn } from '../../shared/login.js';
export const login = async (program) => {
const cmd = program.command('login');
cmd.action(async () => {
const { destroy } = await loginFn(program, true);
destroy();
});
};
//# sourceMappingURL=index.js.map

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

import { Command } from 'commander';
export declare const globalOptions: (program: Command) => Promise<void>;
export declare const globalOptions: (program: any) => Promise<void>;

@@ -47,8 +47,8 @@ import { findUp } from 'find-up';

program
.option('-c, --cluster <cluster>', 'Define the cluster to use', args.cluster)
.requiredOption('-o, --org <org>', 'Specify the organization', args.org)
.requiredOption('-p, --project <project>', 'Specify the project name', args.project)
.requiredOption('-e, --env <env>', 'Specify witch environment (can be a name or "#branch" if you want to deploy by branch)', args.env)
.option('-aK, --api-key <api-key>', 'API Key generated on Based.io for Service Account');
.option('-c, --cluster <cluster>', 'Based cluster', args.cluster)
.requiredOption('-o, --org <org>', 'Organization name', args.org)
.requiredOption('-p, --project <project>', 'Project name', args.project)
.requiredOption('-e, --env <env>', 'Environment name', args.env)
.option('--api-key <api-key>', 'API key for service account');
};
//# sourceMappingURL=globalOptions.js.map
import { BasedClient, BasedOpts } from '@based/client';
import { AppContext } from './AppContext.js';
export declare const getBasedClient: (context: AppContext, opts: BasedOpts) => BasedClient;
export declare const getBasedClient: (opts: BasedOpts) => BasedClient;
import { BasedClient } from '@based/client';
import { hashObjectIgnoreKeyOrderNest } from '@saulx/hash';
import { clearTimeout } from 'node:timers';
import { spinner } from './spinner.js';
const store = {};
class SharedBasedClient extends BasedClient {
context;
constructor(context, opts) {
super(opts);
this.context = context;
}
async setAuthState(args) {
// override async call(name, ...args) {
// const spinner = ora(name).start()
// const res = await super.call(name, ...args)
// spinner.succeed()
// return res
// }
async connect(...args) {
await super.connect(...args);
const [emoji, target] = this.opts.org === 'saulx' && this.opts.project === 'based-cloud'
? ['📡', 'Based Cloud']
: this.opts.optionalKey
? ['🌎', 'the environment manager']
: ['🪐', 'the environment'];
// this.context.print.loading(`Connecting to ${target}...`)
const timeout = setTimeout(() => {
this.context.print.stop().fail(`Could not connect. Check your '<b>based.json</b>' file or your arguments.`, true);
}, 5e3);
const authState = await super.setAuthState(args);
clearTimeout(timeout);
this.context.print.stop().success(`${emoji} Connected to ${target}.`);
return authState;
? ['📡', 'based cloud']
: ['🪐', 'environment'];
const timer = setTimeout(async () => {
spinner.text = `connecting ${target}`;
spinner.start();
await this.once('connect');
spinner.stop();
}, 1e3);
await this.once('connect');
clearTimeout(timer);
console.info(`${emoji} connected ${target}`);
}

@@ -37,7 +38,7 @@ async destroy() {

}
export const getBasedClient = (context, opts) => {
export const getBasedClient = (opts) => {
const key = String(hashObjectIgnoreKeyOrderNest(opts));
store[key] ??= {
users: 0,
client: new SharedBasedClient(context, opts),
client: new SharedBasedClient(opts),
};

@@ -44,0 +45,0 @@ store[key].users++;

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

import { type Ora } from 'ora';
export declare const spinner: Ora;
//# sourceMappingURL=spinner.d.ts.map
export declare const spinner: import("ora").Ora;
import ora from 'ora';
export const spinner = ora({ discardStdin: false, hideCursor: true });
export const spinner = ora();
//# sourceMappingURL=spinner.js.map
import { readJSON } from 'fs-extra/esm';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
import { AppContext } from './shared/index.js';
export const version = async (program) => {
const context = AppContext.getInstance(program);
const { version } = await readJSON(join(fileURLToPath(dirname(import.meta.url)), '../package.json'));
context.set('appName', 'Based CLI');
context.set('appVersion', version);
context.set('appTitle', `<b>Based CLI</b> <dim>${version}</dim>`);
context.print.info(context.get('appTitle'));
program.version(version, '-v, --version');
program.version(version);
};
//# sourceMappingURL=version.js.map
{
"name": "@based/cli",
"version": "8.0.0-alpha.4",
"version": "8.0.0-alpha.5",
"description": "based cli",

@@ -11,5 +11,5 @@ "type": "module",

"scripts": {
"docs": "ts-node --esm ./scripts/readme.ts",
"docs": "tsx ./scripts/readme.ts",
"dev": "node bin/cmd.js",
"build": "tsc -b",
"build": "npm run docs && tsc -b",
"watch": "tsc -b --watch"

@@ -35,11 +35,11 @@ },

"@types/ws": "^8.5.12",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"tsx": "^4.19.2",
"typescript": "^5.2.2",
"vitest": "^2.1.1"
},
"dependencies": {
"@based/bundle": "../bundle",
"@based/client": "^6.10.1",
"@based/bundle": "^0.3.0",
"@based/client": "^6.11.1",
"@based/i18n": "^0.2.0",
"@based/server": "^9.1.0",
"@based/server": "^9.1.2",
"@clack/prompts": "^0.7.0",

@@ -46,0 +46,0 @@ "@inquirer/prompts": "^6.0.1",

@@ -70,2 +70,8 @@ # @based/cli

### Disconnect
Disconnect your user locally.
_Example:_ `npx @based/cli disconnect`
### Auth

@@ -81,2 +87,16 @@

### Init
_Example:_ `npx @based/cli init [options]`
| Option | Description |
|--------|-------------|
| `-n, --name <name>` | Give a name to your project. |
| `-d, --description <description>` | Give a description to your project. |
| `--path <path>` | The path to save the Based Project File. |
| `--format <format>` | The extension of file you prefer (available formats: ts, js, json). |
| `-dp, --dependencies <packages...>` | Choose the dependencies you want to be added to your project (available tools: typescript, vitest, biome, react). |
| `--queries <queries...>` | You can pre-create your Based Query Functions. |
| `-f, --functions <functions...>` | You can pre-create your Based Cloud Functions. |
### Backups

@@ -188,4 +208,4 @@

|--------|-------------|
| `--path <path>` | The path to save the file. |
| `-n, --name <name>` | The name of your machine. |
| `-s, --standby` | Set the standby mode of your machines. |
| `-n, --name <name>` | Give a name to your machine. |
| `-d, --description <description>` | Give a description to your machine. |

@@ -196,3 +216,24 @@ | `-do, --domains <domains...>` | Your domains to be assigned to the machine. |

| `--max <max>` | The maximum number of machines that you want to scale your app. |
| `--path <path>` | The path to save the file. |
| `--format <format>` | The extension of file you prefer (available formats: ts, js, json). |
#### Get
To download your infra file in your repo.
| Option | Description |
|--------|-------------|
| `-m, --machine <machine>` | If you want to filter and get only a specific machine. |
| `--path <path>` | The path to save the file. |
| `--format <format>` | The extension of file you prefer (available formats: ts, js, json). |
#### Overview
Check the status from your infra, live connections, machines and services.
| Option | Description |
|--------|-------------|
| `--monitor` | To display the overview in an interactive UI. |
| `--stream` | To display the overview in real time. |
### Deploy

@@ -199,0 +240,0 @@

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

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

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

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