How to use ember-cli - 10 common examples

To help you get started, we’ve selected a few ember-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duizendnegen / ember-cli-deploy-azure / lib / azure-assets.js View on Github external
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;
    }
  },
github nathanhammond / ember-capture / lib / tasks / server / capture-server.js View on Github external
// 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];
github mvdwg / ember-cli-updater / lib / commands / update.js View on Github external
/* 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;
    }
github adopted-ember-addons / ember-electron / lib / commands / base.js View on Github external
'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);
github nickschot / ember-lux-starter-app / client / ember-cli-build.js View on Github external
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
github NullVoxPopuli / ember-three-boxes-demo / ember-cli-build.js View on Github external
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,
    },
  });
github angular / angular-cli / addon / ng2 / tasks / lint.js View on Github external
/* 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.'));
      });
  }
});
github adopted-ember-addons / ember-electron / lib / utils / ship-mac.js View on Github external
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',
github nathanhammond / ember-capture / lib / commands / capture.js View on Github external
/* 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' },
github adopted-ember-addons / ember-electron / lib / utils / ship-mac.js View on Github external
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