Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'ember-cli' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
init: function() {
CoreObject.prototype.init.apply(this, arguments);
if (!this.config) {
return Promise.reject(new SilentError('You have to pass a config!'));
}
var config = this.config.assets;
// be transparant to either passing a connectionString or the storageAccount + storageAccessKey
if(config.connectionString) {
this.client = azure.createBlobService(config.connectionString);
} else if (config.storageAccount && config.storageAccessKey) {
this.client = azure.createBlobService(config.storageAccount, config.storageAccessKey);
} else {
console.error("No connection string or storage account plus access key set for this Azure deployment.");
return Promise.reject(new SilentError('No connection string or storage account plus access key set for this Azure deployment.'));
}
// if a storage container name is defined in the config, use it instead of the default
if(config.containerName) {
AZURE_CONTAINER_NAME = config.containerName;
}
},
// Close this driver, remove it from the lookup.
driver.quit().thenFinally(function() {
delete drivers[browser];
// If we're all out of drivers, we're done capturing.
var driverCount = o_keys(drivers).length;
if (driverCount === 0) {
app.emit('done');
}
});
});
return app;
}
module.exports = Task.extend({
captureServer: function(options) {
if (this._captureServer) {
return this._captureServer;
}
this._drivers = getDrivers(options);
this._captureServer = createServer(this._drivers, options);
var captureServerURL = 'http://' + this.displayHost(options.captureHost) + ':' + options.capturePort + '/';
var serverURL = 'http' + (options.ssl ? 's' : '') + '://' + this.displayHost(options.host) + ':' + options.port + cleanBaseURL(options.baseURL) + options.testPage;
// Bind to the expressServer being ready before kicking off.
this.expressServer.on('listening', function() {
o_keys(this._drivers).forEach(function(browser) {
var driver = this._drivers[browser];
/* eslint-env node */
'use strict';
var Command = require('ember-cli/lib/models/command');
function cleanupVersion(rawVersion) {
return 'v' + rawVersion.replace(/[~^]/, '');
}
module.exports = Command.extend({
name: 'update',
description: 'Update your ember-cli package.json from current version to the specified version',
works: 'insideProject',
run: function(commandOptions, rawArgs) {
var path = require('path');
var toTag = rawArgs.shift();
if (!toTag) {
this.ui.writeError('Usage: ember update ');
return;
}
if (!/^v/.test(toTag)) {
toTag = 'v' + toTag;
}
'use strict';
const Command = require('ember-cli/lib/models/command');
const ElectronTask = require('../tasks/electron');
const ElectronMakeTask = require('../tasks/make');
const ElectronPackageTask = require('../tasks/package');
const YarnOrNpmTask = require('../tasks/yarn-or-npm');
const prepareRunCommand = require('../utils/prepare-run-command');
module.exports = Command.extend({
init() {
this._super(...arguments);
Object.assign(this.tasks, {
'Electron': ElectronTask,
'ElectronMake': ElectronMakeTask,
'ElectronPackage': ElectronPackageTask,
'YarnOrNpm': YarnOrNpmTask
});
},
async prepareRun() {
// Set up the yarn/npm environment variable so forge uses the right package
// manager
await this.runTask('YarnOrNpm');
await prepareRunCommand(this.project);
module.exports = function(defaults) {
var app = new EmberApp(defaults, {
// Add options here
sourcemaps: {
enabled: EmberApp.env() !== 'production',
extensions: ['js']
},
lessOptions: {
paths: [
'bower_components/semantic-ui'
]
},
//TODO: these are broken in semantic-ui 2.0.1, change values in config/environment too
SemanticUI: {
// These flags allow you do turn on or off auto imports for Semantic UI
import: {
css: false,
javascript: true,
images: false,
fonts: true
module.exports = function(defaults) {
let environment = EmberApp.env();
let isProduction = environment === 'production';
let app = new EmberApp(defaults, {
// Add options here
'ember-cli-babel': {
includePolyfill: false,
disablePresetEnv: true,
disableDebugTooling: isProduction,
includeExternalHelpers: true,
// Will not build if uncommented:
// disableEmberModulesAPIPolyfill: true
// compileModules: false,
},
});
/* jshint node: true */
'use strict';
var Promise = require('ember-cli/lib/ext/promise');
var Task = require('ember-cli/lib/models/task');
var exec = Promise.denodeify(require('child_process').exec);
module.exports = Task.extend({
run: function () {
var chalk = require('chalk');
var ui = this.ui;
return exec('npm run lint')
.then(function () {
ui.writeLine(chalk.green('Successfully linted files.'));
})
.catch(function (/*error*/) {
ui.writeLine(chalk.red(
'Couldn\'t do \'npm run lint\'. Please check this script exists in your package.json.'));
});
}
});
function createZip (pkg, options) {
const ee = pkg['ember-electron']
const access = PromiseExt.denodeify(fs.access)
const unlink = PromiseExt.denodeify(fs.unlink)
const name = options.name || ee.name || pkg.name
const platform = options.platform || ee.platform
const arch = options.arch || ee.arch
const basePath = path.resolve('electron-builds')
const input = path.join(basePath, `${name}-${platform}-${arch}`)
const output = path.join(basePath, 'installers', `${name}.zip`)
return access(output)
.then(() => unlink(output))
.finally(() => {
// ht electron-builder/src/targets/archive: https://github.com/electron-userland/electron-builder/blob/master/src/targets/archive.ts#L41-L80
const zipArgs = [
'a', '-bd', '-bb0', // ht electron-builder/src/util/util#debug7zargs https://github.com/electron-userland/electron-builder/blob/master/src/util/util.ts#L230-L239
'-mm=Deflate',
/* jshint node: true */
'use strict';
var assign = require('lodash/object/assign');
var path = require('path');
var Command = require('ember-cli/lib/models/command');
var Promise = require('ember-cli/lib/ext/promise');
var SilentError = require('silent-error');
var PortFinder = require('portfinder');
var win = require('ember-cli/lib/utilities/windows-admin');
var EOL = require('os').EOL;
var CaptureTask = require('../tasks/capture');
PortFinder.basePort = 49152;
var getPort = Promise.denodeify(PortFinder.getPort);
var defaultPort = process.env.PORT || 4200;
var defaultCapturePort = process.env.CAPTUREPORT || 3000;
module.exports = Command.extend({
name: 'capture',
description: 'Captures all states of your application.',
availableOptions: [
// generic
{ name: 'environment', type: String, default: 'capture', aliases: ['e', { 'dev': 'development' }, { 'prod': 'production' }] },
// ember serve options
{ name: 'port', type: Number, default: defaultPort, aliases: ['p'] },
{ name: 'host', type: String, aliases: ['H'], description: 'Listens on all interfaces by default' },
{ name: 'proxy', type: String, aliases: ['pr', 'pxy'] },
{ name: 'insecure-proxy', type: Boolean, default: false, aliases: ['inspr'], description: 'Set false to proxy self-signed SSL certificates' },
function createZip (pkg, options) {
const ee = pkg['ember-electron']
const access = PromiseExt.denodeify(fs.access)
const unlink = PromiseExt.denodeify(fs.unlink)
const name = options.name || ee.name || pkg.name
const platform = options.platform || ee.platform
const arch = options.arch || ee.arch
const basePath = path.resolve('electron-builds')
const input = path.join(basePath, `${name}-${platform}-${arch}`)
const output = path.join(basePath, 'installers', `${name}.zip`)
return access(output)
.then(() => unlink(output))
.finally(() => {
// ht electron-builder/src/targets/archive: https://github.com/electron-userland/electron-builder/blob/master/src/targets/archive.ts#L41-L80
const zipArgs = [
'a', '-bd', '-bb0', // ht electron-builder/src/util/util#debug7zargs https://github.com/electron-userland/electron-builder/blob/master/src/util/util.ts#L230-L239