Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* 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
/* 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 format')
.then(function () {
ui.writeLine(chalk.green('Successfully formatted files.'));
})
.catch(function (/*error*/) {
ui.writeLine(chalk.red(
'Couldn\'t do \'npm run format\'. Please check this script exists in your package.json.'));
});
}
});
import * as mockFs from 'mock-fs';
import { expect } from 'chai';
import * as ts from 'typescript';
import * as fs from 'fs';
import { InsertChange, RemoveChange } from '../../addon/ng2/utilities/change';
import * as Promise from 'ember-cli/lib/ext/promise';
import {
findNodes,
insertAfterLastOccurrence,
addComponentToModule
} from '../../addon/ng2/utilities/ast-utils';
const readFile = Promise.denodeify(fs.readFile);
describe('ast-utils: findNodes', () => {
const sourceFile = 'tmp/tmp.ts';
beforeEach(() => {
let mockDrive = {
'tmp': {
'tmp.ts': `import * as myTest from 'tests' \n` +
'hello.'
}
};
mockFs(mockDrive);
});
afterEach(() => {
mockFs.restore();
var Promise = require('ember-cli/lib/ext/promise');
var mime = require('mime');
var join = require('path').join;
var put = require('request').put;
var readFile = Promise.denodeify(require('fs').readFile);
var GZIP = 'gzip';
var ERROR_THRESHOLD = 400;
module.exports = function(distDir, asset) {
var fullPath = join(distDir, asset.name);
return readFile(fullPath).then(function(file) {
return new Promise(function(resolve, reject) {
put({
url: asset.upload_url,
body: file,
headers: {
'Content-Encoding': GZIP,
'Content-Type': mime.lookup(fullPath)
}
var fs = require('fs');
var Promise = require('ember-cli/lib/ext/promise');
var realpath = Promise.denodeify(fs.realpath);
var readdirp = require('readdirp');
var requiring = require('requiring');
var readdirAsync = Promise.denodeify(readdirp);
/**
*
*
* @method readDirectory
* @param {String} dir The path of the directory to read
* @return {Array} files
*/
module.exports.readDirectory = function(dir) {
return readdirAsync({ root: dir })
.then(function(data) {
return data.files;
var fs = require('fs');
var Promise = require('ember-cli/lib/ext/promise');
var realpath = Promise.denodeify(fs.realpath);
var readdirp = require('readdirp');
var requiring = require('requiring');
var readdirAsync = Promise.denodeify(readdirp);
/**
*
*
* @method readDirectory
* @param {String} dir The path of the directory to read
* @return {Array} files
*/
module.exports.readDirectory = function(dir) {
return readdirAsync({ root: dir })
.then(function(data) {
return data.files;
}, function(err) {
throw err;
});
}
var chalk = require('chalk');
var cldr = require('cldr');
var fs = require('fs-extra');
var path = require('path');
var Blueprint = require('ember-cli/lib/models/blueprint');
var Promise = require('ember-cli/lib/ext/promise');
var serialize = require('serialize-javascript');
var SilentError = require('ember-cli/lib/errors/silent');
var removeFile = Promise.denodeify(fs.remove);
var writeFile = Promise.denodeify(fs.outputFile);
module.exports = Blueprint.extend({
description: 'Generate a locale with CLDR data',
normalizeEntityName: function(entityName) {
entityName = this._super.normalizeEntityName(entityName);
if (!this.isKnownLocaleCode(entityName)) {
throw new SilentError('The `ember generate locale` command does not ' +
'know locale `' + entityName + '`.');
}
return this.normalizeLocaleCode(entityName);
},
locals: function(options) {