particle-commands 0.2.12 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.circleci/config.yml +68 -0
  2. package/.eslintrc +1 -2
  3. package/.nvmrc +1 -0
  4. package/CHANGELOG.md +11 -0
  5. package/README.md +93 -1
  6. package/dist/cmd/library_add.js +1 -14
  7. package/dist/cmd/library_contribute.js +0 -10
  8. package/dist/cmd/library_install.js +11 -26
  9. package/dist/cmd/library_migrate.js +3 -4
  10. package/dist/cmd/library_properties.js +3 -4
  11. package/dist/cmd/library_publish.js +0 -8
  12. package/dist/cmd/project_init.js +0 -3
  13. package/dist/cmd/project_properties.js +9 -12
  14. package/dist/cmd/templates/project/README.md +2 -2
  15. package/dist/index.js +9 -28
  16. package/package.json +20 -20
  17. package/src/cmd/library_add.js +2 -8
  18. package/src/cmd/library_contribute.js +0 -3
  19. package/src/cmd/library_install.js +7 -16
  20. package/src/cmd/library_publish.js +0 -3
  21. package/src/cmd/project_init.js +1 -3
  22. package/src/cmd/templates/project/README.md +2 -2
  23. package/src/index.js +0 -8
  24. package/test/cmd/library_install.spec.js +1 -1
  25. package/test/cmd/library_list.spec.js +5 -9
  26. package/test/cmd/library_publish.spec.js +1 -1
  27. package/test/cmd/project_init.spec.js +1 -4
  28. package/test/cmd/projects_spec.js +4 -4
  29. package/.idea/jsLibraryMappings.xml +0 -6
  30. package/.idea/misc.xml +0 -13
  31. package/.idea/modules.xml +0 -8
  32. package/.idea/particle-commands.iml +0 -12
  33. package/.idea/vcs.xml +0 -6
  34. package/.idea/workspace.xml +0 -222
  35. package/.npmignore +0 -1
  36. package/.travis.yml +0 -2
  37. package/dist/lib/analytics.js +0 -229
  38. package/dist/lib/settings.js +0 -410
  39. package/dist/lib/utilities.js +0 -27
  40. package/src/lib/analytics.js +0 -182
  41. package/src/lib/settings.js +0 -359
  42. package/src/lib/utilities.js +0 -24
  43. package/test/lib/analytics.spec.js +0 -158
  44. package/test/lib/settings.spec.js +0 -27
  45. package/yarn.lock +0 -4690
@@ -1,229 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
-
11
- var Analytics = require('analytics-node');
12
- var promisify = require('es6-promisify');
13
- var _ = require('lodash');
14
-
15
- var pipeline = require('when/pipeline');
16
-
17
- var CommandContext = function () {
18
- function CommandContext() {
19
- _classCallCheck(this, CommandContext);
20
- }
21
-
22
- _createClass(CommandContext, [{
23
- key: 'identifyUser',
24
- value: function identifyUser(particleApiClient) {
25
- if (particleApiClient.ready()) {
26
- return particleApiClient.trackingIdentity();
27
- } else {
28
- return Promise.reject();
29
- }
30
- }
31
-
32
- /**
33
- * Determine if the given user descriptor has the requisite identification for a tracking request.
34
- * @param {object} user The user object to check.
35
- * @returns {boolean} true if the identity contains the requisite fields (id, email)
36
- */
37
-
38
- }, {
39
- key: 'isIdentity',
40
- value: function isIdentity(user) {
41
- return Boolean(user && user.id && user.email);
42
- }
43
-
44
- /**
45
- * Retrieves the tracking details for the current logged in user.
46
- * @param {function(newValue)} trackingIdentity a fetch-update function for the cached tracking identity for the
47
- * current profile.
48
- * @param {object} apiClient The API Client that provides the tracking identity via "
49
- * @param {function(opts)} clientFactory synchronously create a client
50
- * @return {Promise<object>} promise to retrieve the tracking identity
51
- */
52
-
53
- }, {
54
- key: 'trackingUser',
55
- value: function trackingUser(trackingIdentity, apiClient) {
56
- var _this = this;
57
-
58
- var ident = trackingIdentity();
59
- if (this.isIdentity(ident)) {
60
- return Promise.resolve(ident);
61
- } else {
62
- return this.identifyUser(apiClient).then(function (user) {
63
- if (_this.isIdentity(user)) {
64
- trackingIdentity(user);
65
- return user;
66
- } else {
67
- return null;
68
- }
69
- });
70
- }
71
- }
72
- }, {
73
- key: 'buildContext',
74
- value: function buildContext(_ref) {
75
- var _this2 = this;
76
-
77
- var tool = _ref.tool;
78
- var api = _ref.api;
79
- var trackingIdentity = _ref.trackingIdentity;
80
- var apiClient = _ref.apiClient;
81
-
82
- // todo - allow the API key to be overridden in the environment so that CLI use during development/testing
83
- // is tracked against a distinct source
84
- return pipeline([function () {
85
- return _this2.trackingUser(trackingIdentity, apiClient);
86
- }, function (user) {
87
- return {
88
- user: user,
89
- tool: tool,
90
- api: api
91
- };
92
- }]);
93
- }
94
- }]);
95
-
96
- return CommandContext;
97
- }();
98
-
99
- var test = {
100
- CommandContext: CommandContext
101
- };
102
-
103
- /**
104
- *
105
- * @param {object} tool The tool definition { name, version }
106
- * @param {object} api The tracking api details { key }
107
- * @param {function(newValue)} trackingIdentity function to retrieve or update the cached user identity
108
- * @param {object} apiClient The Particle api client that provides a `trackingIdentity` method.
109
- * @returns {Promise<object>} promise to build the command context object containing the tool, api and user attributes.
110
- */
111
- function buildContext(_ref2) {
112
- var tool = _ref2.tool;
113
- var api = _ref2.api;
114
- var trackingIdentity = _ref2.trackingIdentity;
115
- var apiClient = _ref2.apiClient;
116
-
117
- return new CommandContext().buildContext({ tool: tool, api: api, trackingIdentity: trackingIdentity, apiClient: apiClient });
118
- }
119
-
120
- /**
121
- * Provides command oriented tracking for analytics. This establishes a convention for how
122
- * the calling tool specifies the user, any user traits, the tool name, event date time.
123
- */
124
-
125
- var analyticsCache = {};
126
-
127
- function analyticsFor(key) {
128
- var analytics = analyticsCache[key];
129
- if (!analytics) {
130
- analytics = new Analytics(key, { flushAfter: 10 });
131
- analyticsCache[key] = analytics;
132
- }
133
- return analytics;
134
- }
135
-
136
- function buildProperties(context, properties) {
137
- var tool = _.mapKeys(context.tool || {}, function (value, key) {
138
- return 'tool' + key;
139
- });
140
- return Object.assign(properties, tool);
141
- }
142
-
143
- function checkApiKey(context) {
144
- if (!context || !context.api || !context.api.key) {
145
- throw new Error('context.api.key not provided'); // todo - distinguish programming/caller errors from runtime errors?
146
- }
147
- return context.api.key;
148
- }
149
-
150
- function checkUserId(context) {
151
- var userId = context && context.user && context.user.id;
152
- var track = context && context.user && context.user.track;
153
- if (!userId && track !== false) {
154
- throw new Error('context.user.id not provided'); // todo - distinguish programming/caller errors from runtime errors?
155
- }
156
- return userId;
157
- }
158
-
159
- function makeAnalytics(context) {
160
- var key = checkApiKey(context);
161
- return analyticsFor(key);
162
- }
163
-
164
- /**
165
- *
166
- * @param {Command} command The command being executed. May be null for tracking events outside of a command
167
- * execution context.
168
- * @param {Object} context The command invocation context. The analytics property should contain
169
- * {tool, user, api}. The api property should include `key` as a minimum, to specify the Segment write key.
170
- * THe tool object must contain at least a `name` property to identify the tool being used. User traits must include
171
- * at least `id` and `name` properties, which are opaque and natural keys used to identify the current user.
172
- * If userTraits is falsey the event is logged anonymously.
173
- * @param {CommandSite} site The command site. This is presently unused but may be later used for context-specific
174
- * functionality.
175
- * @param {String} event The event name to track.
176
- * @param {Object} properties Additional data to log with the event.
177
- * @return {Promise} promise to track
178
- */
179
- function track(_ref3) {
180
- var command = _ref3.command;
181
- var context = _ref3.context;
182
- var site = _ref3.site;
183
- var event = _ref3.event;
184
- var properties = _ref3.properties;
185
-
186
- var userId = checkUserId(context);
187
- if (!userId) {
188
- return Promise.resolve();
189
- }
190
- var analytics = makeAnalytics(context);
191
- var allProperties = buildProperties(context, properties);
192
-
193
- var track = promisify(analytics.track, { thisArg: analytics });
194
- return track({
195
- userId: userId,
196
- event: event,
197
- allProperties: allProperties
198
- });
199
- }
200
-
201
- function identify(_ref4) {
202
- var command = _ref4.command;
203
- var context = _ref4.context;
204
- var site = _ref4.site;
205
- var traits = _ref4.traits;
206
-
207
- var analytics = makeAnalytics(context);
208
- var userId = checkUserId(context);
209
- var identify = promisify(analytics.identify, { thisArg: analytics });
210
- return identify({
211
- userId: userId,
212
- traits: traits
213
- });
214
- }
215
-
216
- /**
217
- * Ensure that any events have been sent. Returns a promise.
218
- * @return {Promise} to eventually flush
219
- */
220
- function flush() {
221
- return Promise.resolve();
222
- }
223
-
224
- exports.identify = identify;
225
- exports.track = track;
226
- exports.flush = flush;
227
- exports.buildProperties = buildProperties;
228
- exports.buildContext = buildContext;
229
- exports.test = test;
@@ -1,410 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
8
-
9
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
-
11
- var path = require('path');
12
- var _ = require('underscore');
13
- var utilities = require('./utilities');
14
- var fs = require('fs');
15
-
16
- var Settings = function () {
17
- function Settings() {
18
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
-
20
- var _ref$separateSettings = _ref.separateSettings;
21
- var separateSettings = _ref$separateSettings === undefined ? true : _ref$separateSettings;
22
- var _ref$settings = _ref.settings;
23
- var settings = _ref$settings === undefined ? [] : _ref$settings;
24
-
25
- _classCallCheck(this, Settings);
26
-
27
- this.settings = separateSettings ? {} : this; // current configuration settings
28
- this.profile = null; // current profile name
29
- this.profile_json = {}; // parsed contents of profile.json
30
- this.overrides = {}; // current overrides from the profile config file
31
- settings.unshift(this.settings); // add target as first argument
32
- _.extend.apply(_, settings);
33
- }
34
-
35
- _createClass(Settings, [{
36
- key: 'get',
37
- value: function get(name) {
38
- return name === undefined ? this.settings : this.settings[name];
39
- }
40
- }, {
41
- key: 'set',
42
- value: function set(key, value) {
43
- return this.override(null, key, value);
44
- }
45
-
46
- /**
47
- * Retrieve a value from the environment
48
- * @param {string} varName The name of the environment variable to retrieve
49
- * @param {string} defaultValue The value to return when the environment variable is not defined
50
- * @return {string} the value of the environment, or defaultValue if not defined
51
- */
52
-
53
- }, {
54
- key: 'envValue',
55
- value: function envValue(varName, defaultValue) {
56
- var value = process.env[varName];
57
- return typeof value === 'undefined' ? defaultValue : value;
58
- }
59
-
60
- /**
61
- * Fetches the value of an environment varaible interpreted as a boolean
62
- * @param {string} varName The environment variable name
63
- * @param {string} defaultValue The default boolean value to return when the environment
64
- * variable is not defined ir is not recognized as a boolean
65
- * @returns {boolean} The value of the environment variable when defined. defaultValue when not defined, or not
66
- * one of true, TRUE, 1, false, FALSE, 0
67
- */
68
-
69
- }, {
70
- key: 'envValueBoolean',
71
- value: function envValueBoolean(varName, defaultValue) {
72
- var value = this.envValue(varName);
73
- if (value === 'true' || value === 'TRUE' || value === '1') {
74
- return true;
75
- } else if (value === 'false' || value === 'FALSE' || value === '0') {
76
- return false;
77
- } else {
78
- return defaultValue;
79
- }
80
- }
81
-
82
- /**
83
- * Determine the user home path from the environment
84
- * @returns {string} The home path of the current user, or
85
- * the directory containing this file if it could not be determined.
86
- */
87
-
88
- }, {
89
- key: 'findHomePath',
90
- value: function findHomePath() {
91
- var fs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : require('fs');
92
-
93
- var envVars = ['home', 'HOME', 'HOMEPATH', 'USERPROFILE'];
94
-
95
- for (var i = 0; i < envVars.length; i++) {
96
- var dir = this.envValue(envVars[i]);
97
- if (dir && fs.existsSync(dir)) {
98
- return dir;
99
- }
100
- }
101
- return __dirname;
102
- }
103
-
104
- /**
105
- * Ensures that the particle folder in the home directory exists.
106
- * @returns {string} The location of the particle folder.
107
- */
108
-
109
- }, {
110
- key: 'ensureFolder',
111
- value: function ensureFolder() {
112
- var particleDir = path.join(this.findHomePath(), '.particle');
113
- if (!fs.existsSync(particleDir)) {
114
- fs.mkdirSync(particleDir);
115
- }
116
- return particleDir;
117
- }
118
-
119
- /**
120
- * Determine the location of a given profile configuratino file
121
- * @param {string} profile The name of the profile
122
- * @returns {string} the path of the overrides file
123
- */
124
-
125
- }, {
126
- key: 'findOverridesFile',
127
- value: function findOverridesFile(profile) {
128
- profile = this.defaultProfile(profile);
129
- var particleDir = this.ensureFolder();
130
- return path.join(particleDir, profile + '.config.json');
131
- }
132
- }, {
133
- key: 'defaultProfile',
134
- value: function defaultProfile(profile) {
135
- return profile || this.profile || 'particle';
136
- }
137
- }, {
138
- key: 'loadOverrides',
139
- value: function loadOverrides(profile) {
140
- profile = this.defaultProfile(profile);
141
-
142
- var filename = this.findOverridesFile(profile);
143
- try {
144
- if (fs.existsSync(filename)) {
145
- this.overrides = JSON.parse(fs.readFileSync(filename));
146
- // need to do an in-situ extend since external clients may have already obtained the settings object
147
- // this.settings = extend(this.settings, this.overrides);
148
- _.extend(this.settings, this.overrides);
149
- }
150
- } catch (ex) {
151
- console.error('There was an error reading ' + filename + ': ', ex);
152
- }
153
- return this;
154
- }
155
-
156
- /**
157
- * ?? Reads the default profile
158
- */
159
-
160
- }, {
161
- key: 'whichProfile',
162
- value: function whichProfile() {
163
- this.profile = 'particle';
164
- this.readProfileData();
165
- }
166
-
167
- /**
168
- * in another file in our user dir, we store a profile name that switches between setting override files
169
- * @param {string} profileName The name of the profile to switch to
170
- */
171
-
172
- }, {
173
- key: 'switchProfile',
174
- value: function switchProfile(profileName) {
175
- this.profile_json.name = profileName;
176
- this.saveProfileData();
177
- }
178
-
179
- /**
180
- * Reads "profile.json" and saves its content to profile_json
181
- * @return {undefined} nothing but keep the linter happy
182
- */
183
-
184
- }, {
185
- key: 'readProfileData',
186
- value: function readProfileData() {
187
- var fs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : require('fs');
188
-
189
- var particleDir = this.ensureFolder();
190
- var proFile = path.join(particleDir, 'profile.json'); //proFile, get it?
191
- if (fs.existsSync(proFile)) {
192
- try {
193
- var data = JSON.parse(fs.readFileSync(proFile));
194
- this.profile = data ? data.name : 'particle';
195
- this.profile_json = data;
196
- } catch (err) {
197
- throw new Error('Error parsing file ' + proFile + ': ' + err);
198
- }
199
- } else {
200
- this.profile = 'particle';
201
- this.profile_json = {};
202
- }
203
- }
204
-
205
- /**
206
- * Saves profile.json
207
- */
208
-
209
- }, {
210
- key: 'saveProfileData',
211
- value: function saveProfileData() {
212
- var fs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : require('fs');
213
-
214
- var particleDir = this.ensureFolder();
215
- var proFile = path.join(particleDir, 'profile.json'); //proFile, get it?
216
- fs.writeFileSync(proFile, JSON.stringify(this.profile_json, null, 2), { mode: '600' });
217
- }
218
-
219
- // this is here instead of utilities to prevent a require-loop
220
- // when files that utilties requires need settings
221
-
222
- }, {
223
- key: 'matchKey',
224
- value: function matchKey(needle, obj, caseInsensitive) {
225
- needle = caseInsensitive ? needle.toLowerCase() : needle;
226
- for (var key in obj) {
227
- var keyCopy = caseInsensitive ? key.toLowerCase() : key;
228
- if (keyCopy === needle) {
229
- return key; //return the original
230
- }
231
- }
232
- return null;
233
- }
234
- }, {
235
- key: 'override',
236
- value: function override(profile, key, value) {
237
- if (!this.overrides) {
238
- this.overrides = {};
239
- }
240
-
241
- if (this.settings[key] === undefined) {
242
- // find any key that matches our key, regardless of case
243
- var realKey = this.matchKey(key, this.settings, true);
244
- if (realKey) {
245
- //console.log("Using the setting \"" + realKey + "\" instead ");
246
- key = realKey;
247
- }
248
- }
249
-
250
- if (value === undefined) {
251
- delete this.settings[key];
252
- delete this.overrides[key];
253
- } else {
254
- //store the new value (redundant)
255
- this.settings[key] = value;
256
-
257
- //store that in overrides
258
- this.overrides[key] = value;
259
- }
260
- //make sure our overrides are in sync
261
- _.extend(this.settings, this.overrides);
262
-
263
- var filename = this.findOverridesFile(profile);
264
- try {
265
- fs.writeFileSync(filename, JSON.stringify(this.overrides, null, 2), { mode: '600' });
266
- } catch (ex) {
267
- console.error('There was an error writing ' + filename + ': ', ex);
268
- }
269
- }
270
- }, {
271
- key: 'transitionSparkProfiles',
272
- value: function transitionSparkProfiles() {
273
- var fs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : require('fs');
274
- var notifyTranslate = arguments[1];
275
-
276
- var sparkDir = path.join(this.findHomePath(), '.spark');
277
- var particleDir = path.join(this.findHomePath(), '.particle');
278
- if (fs.existsSync(sparkDir) && !fs.existsSync(particleDir)) {
279
- fs.mkdirSync(particleDir);
280
-
281
- if (notifyTranslate) {
282
- notifyTranslate(sparkDir, particleDir);
283
- }
284
-
285
- var files = fs.readdirSync(sparkDir);
286
- files.forEach(function (filename) {
287
- var data = fs.readFileSync(path.join(sparkDir, filename));
288
- var jsonData = void 0;
289
- try {
290
- jsonData = JSON.parse(data);
291
- } catch (ex) {
292
- // invalid JSON, don't transition
293
- return;
294
- }
295
-
296
- if (filename === 'profile.json') {
297
- if (jsonData.name === 'spark') {
298
- jsonData.name = 'particle';
299
- }
300
- }
301
-
302
- if (filename === 'spark.config.json') {
303
- filename = 'particle.config.json';
304
- }
305
-
306
- if (jsonData.apiUrl && jsonData.apiUrl.indexOf('.spark.io') > 0) {
307
- jsonData.apiUrl = jsonData.apiUrl.replace('.spark.io', '.particle.io');
308
- }
309
-
310
- var jsonString = JSON.stringify(jsonData, null, 2);
311
- fs.writeFileSync(path.join(particleDir, filename), jsonString, { mode: '600' });
312
- });
313
- }
314
- }
315
- }, {
316
- key: 'listConfigs',
317
- value: function listConfigs() {
318
- var particleDir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.ensureFolder();
319
-
320
- var files = utilities.globList(null, [path.join(particleDir, '*.config.json')]);
321
-
322
- return files.map(function (item) {
323
- var filename = path.basename(item);
324
- //strip the extension
325
- var name = filename.replace('.config.json', '');
326
- return name;
327
- });
328
- }
329
-
330
- /**
331
- * Retrieves a function that can retrieve or set a value.
332
- * @param {string} key The key of the setting to fetch/update
333
- * @returns {function(newValue)} A function that fetches the current value, or updates if an argument
334
- * is defined.
335
- */
336
-
337
- }, {
338
- key: 'fetchUpdate',
339
- value: function fetchUpdate(key) {
340
- function fetchUpdateKey(key, value) {
341
- if (value !== undefined) {
342
- this.set(key, value);
343
- return value;
344
- } else {
345
- return this.get(key);
346
- }
347
- }
348
- return fetchUpdateKey.bind(this, key);
349
- }
350
- }]);
351
-
352
- return Settings;
353
- }();
354
-
355
- var defaultSettings = {
356
- apiUrl: 'https://api.particle.io',
357
- buildUrl: 'https://build.particle.io',
358
- access_token: null,
359
-
360
- notSourceExtensions: ['.ds_store', '.jpg', '.gif', '.png', '.include', '.ignore', '.ds_store', '.git', '.bin'],
361
-
362
- dirIncludeFilename: 'particle.include',
363
- dirExcludeFilename: 'particle.ignore',
364
-
365
- knownApps: {
366
- 'deep_update_2014_06': true,
367
- 'cc3000': true,
368
- 'cc3000_1_14': true,
369
- 'tinker': true,
370
- 'voodoo': true
371
- },
372
- knownPlatforms: {
373
- 0: 'Core',
374
- 6: 'Photon',
375
- 8: 'P1',
376
- 10: 'Electron',
377
- 88: 'Duo',
378
- 103: 'Bluz'
379
- },
380
- updates: {
381
- '2b04:d006': {
382
- systemFirmwareOne: 'system-part1-0.6.1-photon.bin',
383
- systemFirmwareTwo: 'system-part2-0.6.1-photon.bin'
384
- },
385
- '2b04:d008': {
386
- systemFirmwareOne: 'system-part1-0.6.1-p1.bin',
387
- systemFirmwareTwo: 'system-part2-0.6.1-p1.bin'
388
- },
389
- '2b04:d00a': {
390
- // The bin files MUST be in this order to be flashed to the correct memory locations
391
- systemFirmwareOne: 'system-part2-0.6.1-electron.bin',
392
- systemFirmwareTwo: 'system-part3-0.6.1-electron.bin',
393
- systemFirmwareThree: 'system-part1-0.6.1-electron.bin'
394
- }
395
- }
396
- };
397
-
398
- function buildSettings(separateSettings, initialSettings, skipLoadProfile) {
399
- var settings = new Settings({ separateSettings: separateSettings, settings: [defaultSettings, initialSettings] });
400
- if (!skipLoadProfile) {
401
- settings.transitionSparkProfiles();
402
- settings.whichProfile();
403
- settings.loadOverrides();
404
- }
405
- return settings;
406
- }
407
-
408
- exports.buildSettings = buildSettings;
409
- exports.defaultSettings = defaultSettings;
410
- exports.Settings = Settings;
@@ -1,27 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- var glob = require('glob');
7
- var path = require('path');
8
-
9
- function globList(basepath, arr) {
10
- var line = void 0,
11
- found = void 0,
12
- files = [];
13
- for (var i = 0; i < arr.length; i++) {
14
- line = arr[i];
15
- if (basepath) {
16
- line = path.join(basepath, line);
17
- }
18
- found = glob.sync(line, { nodir: true, follow: true });
19
-
20
- if (found && found.length > 0) {
21
- files = files.concat(found);
22
- }
23
- }
24
- return files;
25
- }
26
-
27
- exports.globList = globList;