New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-chromium

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-chromium - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

29

download-chrome.js

@@ -13,3 +13,2 @@ #!/usr/bin/env node

const config = require('./config');
const utils = require('./utils');

@@ -21,3 +20,3 @@

function getOsCdnUrl() {
function getOsCdnUrl () {
let url = 'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/';

@@ -47,3 +46,3 @@

function getCurrentOs() {
function getCurrentOs () {
const platform = process.platform;

@@ -67,3 +66,3 @@

function getExactChromeVersionNumber() {
function getExactChromeVersionNumber () {
return new Promise((resolve, reject) => {

@@ -89,3 +88,3 @@ const url = 'https://omahaproxy.appspot.com/history.json?channel=' + (process.env.CHROMIUM_CHANNEL || 'dev') + '&os=' + getCurrentOs();

resolve(versionNumber);
return resolve(versionNumber);
}

@@ -95,2 +94,4 @@ }

.catch(err => {
console.log('custom loggin');
console.error(err);
console.log('An error occured while trying to retrieve latest revision number', err);

@@ -102,3 +103,3 @@ reject(err);

function getChromiumBranchingPoint(versionNumber) {
function getChromiumBranchingPoint (versionNumber) {
return new Promise((resolve, reject) => {

@@ -127,7 +128,6 @@ const url = 'https://omahaproxy.appspot.com/deps.json?version=' + versionNumber;

});
});
}
function createTempFile() {
function createTempFile () {
return new Promise((resolve, reject) => {

@@ -145,3 +145,3 @@ tmp.file((error, path) => {

function downloadChromiumRevision(revision) {
async function downloadChromiumRevision (revision) {
return new Promise((resolve, reject) => {

@@ -171,3 +171,3 @@ createTempFile()

function unzipArchive(archivePath, outputFolder) {
function unzipArchive (archivePath, outputFolder) {
console.log('Started extracting archive', archivePath);

@@ -188,4 +188,7 @@ return new Promise((resolve, reject) => {

module.exports = (function () {
const chromiumPath = utils.getBinaryPath();
if (chromiumPath) {
const {execPath, binPath} = utils.getBinaryPath();
const exists = fs.existsSync(execPath);
if (exists) {
console.log('Chrome is already installed');

@@ -197,5 +200,5 @@ } else {

.then(downloadChromiumRevision)
.then(path => unzipArchive(path, config.BIN_OUT_PATH))
.then(path => unzipArchive(path, binPath))
.catch(err => console.error('An error occurred while trying to setup Chromium. Resolve all issues and restart the process', err));
}
})();

@@ -6,6 +6,5 @@ /* global require, module */

const utils = require('./utils');
const fs = require('fs');
const utils = require('./utils');
let defaultChromiumArgs = [

@@ -17,3 +16,3 @@ "--disable-gpu",

function getTestemConfig(chromiumArgs) {
function getTestemConfig (chromiumArgs) {
if (!chromiumArgs) {

@@ -23,4 +22,4 @@ chromiumArgs = defaultChromiumArgs;

const chromiumPath = utils.getBinaryPath();
if (!chromiumPath) {
const {execPath} = utils.getBinaryPath();
if (!fs.existsSync(execPath)) {
console.error('Chromium does not appear to be installed, testem cannot run.'); // eslint-disable-line

@@ -36,3 +35,3 @@ process.exit(1); // for some reason this doesn't stop testem from continuing in server mode

chromium: {
exe: chromiumPath,
exe: execPath,
args: chromiumArgs,

@@ -42,3 +41,3 @@ protocol: 'browser'

chromium_headless: {
exe: chromiumPath,
exe: execPath,
args: ['--headless', ...chromiumArgs],

@@ -50,4 +49,4 @@ protocol: 'browser'

launch_in_ci: ['chromium_headless'],
launch_in_dev: ['chromium'],
}
launch_in_dev: ['chromium']
};
}

@@ -54,0 +53,0 @@

/* global require */
/* eslint no-console: 0 */
const chrome = require('./scripts/index/');
const chrome = require('./index/');

@@ -6,0 +6,0 @@ if (chrome.path) {

{
"name": "ember-chromium",
"version": "2.0.0",
"version": "3.0.0",
"description": "One place to hold all the logic to download and run ember tests in chromium",
"main": "index.js",
"scripts": {
"postinstall": "node download-chrome.js",
"test": "echo \"Error: no test specified\" && exit 1"

@@ -8,0 +9,0 @@ },

@@ -6,46 +6,45 @@ #!/usr/bin/env node

const path = require('path');
const fs = require('fs');
const config = require('./config');
const childProcess = require('child_process');
module.exports = {
getBinaryPath() {
const path = this.getOsChromiumBinPath();
function getBinaryPath () {
const buffer = childProcess.execSync('npm bin -g');
const result = String.fromCharCode.apply(null, buffer);
const globalPath = result.replace(/\n$/, '');
let binPath = globalPath;
let execPath;
if (fs.existsSync(path)) {
return path;
}
const platform = process.platform;
const folderName = getOsChromiumFolderName();
return undefined;
},
if (platform === 'linux') {
execPath = path.join(binPath, folderName, 'chrome');
} else if (platform === 'win32') {
execPath = path.join(binPath, folderName, 'chrome.exe');
} else if (platform === 'darwin') {
execPath = path.join(binPath, folderName, 'Chromium.app/Contents/MacOS/Chromium');
} else {
console.error('Unsupported platform or architecture found:', process.platform, process.arch);
throw new Error('Unsupported platform');
}
getOsChromiumFolderName() {
const platform = process.platform;
console.log(`checking for chromium at: ${execPath.toString()}`);
let archivePlatformPrefix = platform;
return {binPath, execPath};
}
if (platform === 'darwin') {
archivePlatformPrefix = 'mac';
}
function getOsChromiumFolderName () {
const platform = process.platform;
return `chrome-${archivePlatformPrefix}`;
},
let archivePlatformPrefix = platform;
getOsChromiumBinPath() {
let binPath = path.join(config.BIN_OUT_PATH, this.getOsChromiumFolderName());
if (platform === 'darwin') {
archivePlatformPrefix = 'mac';
}
const platform = process.platform;
return `chrome-${archivePlatformPrefix}`;
}
if (platform === 'linux') {
binPath = path.join(binPath, 'chrome');
} else if (platform === 'win32') {
binPath = path.join(binPath, 'chrome.exe');
} else if (platform === 'darwin') {
binPath = path.join(binPath, 'Chromium.app/Contents/MacOS/Chromium');
} else {
console.error('Unsupported platform or architecture found:', process.platform, process.arch);
throw new Error('Unsupported platform');
}
return binPath;
}
module.exports = {
getBinaryPath,
getOsChromiumFolderName
};
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