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

@datacamp/learn-vm-scripts

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datacamp/learn-vm-scripts - npm Package Compare versions

Comparing version 0.0.1-rc.1 to 0.0.1-rc.2

dist/cloudLoginService.js

2

dist/awsLogin.js
import chalk from 'chalk';
import ora from 'ora';
import { ensureHttps } from './utils.js';
import { ensureHttps } from './utils';
export async function loginToAWS({ url, username, page, password, }) {

@@ -5,0 +5,0 @@ const spinner = ora('Launching browser...').start();

import chalk from 'chalk';
import ora from 'ora';
import { AZURE_LOGIN_URL, ensureHttps } from './utils.js';
import { AZURE_LOGIN_URL, ensureHttps } from './utils';
export async function loginToAzure({ url, username, page, password, }) {

@@ -5,0 +5,0 @@ const spinner = ora('Launching browser...').start();

@@ -1,5 +0,4 @@

/* eslint-disable @typescript-eslint/no-unused-vars */
import chalk from 'chalk';
import ora from 'ora';
import { ensureHttps } from './utils.js';
import { ensureHttps } from './utils';
export async function loginToDatabricks({ url, page, }) {

@@ -6,0 +5,0 @@ const spinner = ora('Navigating to Databricks login page...').start();

@@ -1,59 +0,10 @@

import chalk from 'chalk';
import yargs from 'yargs';
import { loginToAWS } from './awsLogin.js';
import { loginToAzure } from './azureLogin.js';
import { loginToDatabricks } from './databricksLogin.js';
import { setupBrowser } from './setup.js';
const SUPPORTED_CLOUD_PROVIDERS = ['aws', 'azure', 'databricks'];
import { startInputWatcher } from './startInputWatcher';
const argv = yargs(process.argv.slice(2))
.options({
cloudProvider: {
demandOption: true,
choices: SUPPORTED_CLOUD_PROVIDERS,
type: 'string',
},
password: { demandOption: true, type: 'string' },
url: { demandOption: false, type: 'string' },
username: { demandOption: true, type: 'string' },
inputFilePath: { demandOption: true, type: 'string' },
outputFilePath: { demandOption: true, type: 'string' },
})
.parseSync();
(async () => {
const { url, password, username, cloudProvider } = argv;
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { browser, page } = await setupBrowser();
switch (cloudProvider) {
case 'azure':
await loginToAzure({ url, username, page, password });
break;
case 'aws':
if (!url) {
console.error(chalk.red('AWS URL is required'));
process.exit(1);
}
await loginToAWS({ url, username, page, password });
break;
case 'databricks':
if (!url) {
console.error(chalk.red('Databricks URL is required'));
process.exit(1);
}
await loginToAzure({
url: undefined,
username,
page,
password,
});
await loginToDatabricks({ url, page });
break;
default:
console.error(chalk.red('Unsupported cloud provider'));
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
}
catch (error) {
console.error(chalk.red(`Error: ${error.message}`));
}
await new Promise(() => { });
})();
void startInputWatcher(argv);
//# sourceMappingURL=index.js.map

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

import dotenv from 'dotenv';
import * as dotenv from 'dotenv';
import puppeteer from 'puppeteer-core';

@@ -15,8 +15,8 @@ const envFile = process.env.NODE_ENV === 'production' ? '.env' : '.env.development';

const pages = await browser.pages();
if (pages[0] === undefined) {
const page = await browser.newPage();
return { browser, page };
if (pages[0] !== undefined) {
return { browser, page: pages[0] };
}
return { browser, page: pages[0] };
const page = await browser.newPage();
return { browser, page };
}
//# sourceMappingURL=setup.js.map
{
"name": "@datacamp/learn-vm-scripts",
"version": "0.0.1-rc.1",
"version": "0.0.1-rc.2",
"repository": "git@github.com:datacamp-engineering/learn-vm-scripts.git",

@@ -19,3 +19,4 @@ "description": "Scripts used by VMs in learn.",

"deduplicate": "yarn-deduplicate",
"cli": "node dist/index.js"
"cli": "node dist/index.js",
"test": "vitest"
},

@@ -31,3 +32,4 @@ "keywords": [],

"puppeteer-core": "^22.14.0",
"yargs": "^17.7.2"
"yargs": "^17.7.2",
"zod": "^3.23.8"
},

@@ -50,4 +52,5 @@ "devDependencies": {

"typescript": "^5.5.4",
"vitest": "^2.0.5",
"yarn-deduplicate": "^6.0.2"
}
}

@@ -34,14 +34,26 @@ ## learn-vm-scripts frontend repo

The CLI tool accepts the following arguments:
This project contains a program that logs in to a cloud provider using Puppeteer.
- `--url`: The URL of the service to log in to.
- `--username`: The username for login.
- `--password`: The password for login.
To build:
### Example
```sh
yarn build
```
To log in to AWS:
To start the file watcher:
```sh
yarn cli -- --url "http://example.aws.amazon.com" --username "yourUsername" --password "yourPassword"
yarn cli -- --inputFile <path-to-input-file> --outputFile <path-to-output-file>
```
The program watches the input file for changes.
To log in to a cloud provider, write the following JSON object to the input file:
```json
{ "url": "<url-to-login-page>", "username": "<your-username>", "password": "<your-password>", "cloudProvider": "<cloud-provider>"}
```
❗️The input has to be written to a single line.
Each line is parsed individually.
When the login process is complete, the program writes a line to the output file.

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