browser-extension-manager 0.0.1

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 (55) hide show
  1. package/.nvmrc +1 -0
  2. package/CHANGELOG.md +20 -0
  3. package/LICENSE +21 -0
  4. package/README.md +56 -0
  5. package/TODO.md +0 -0
  6. package/bin/browser-extension-manager +7 -0
  7. package/dist/assets/css/fontawesome.scss +2 -0
  8. package/dist/assets/css/main.scss +3 -0
  9. package/dist/assets/js/main.js +4 -0
  10. package/dist/assets/js copy/base.js +7 -0
  11. package/dist/assets/js copy/core.js +81 -0
  12. package/dist/assets/js copy/main.js +10 -0
  13. package/dist/background.js +261 -0
  14. package/dist/build.js +92 -0
  15. package/dist/cli.js +70 -0
  16. package/dist/commands/clean.js +33 -0
  17. package/dist/commands/install.js +52 -0
  18. package/dist/commands/setup.js +484 -0
  19. package/dist/commands/version.js +12 -0
  20. package/dist/config/manifest.json +78 -0
  21. package/dist/content.js +52 -0
  22. package/dist/defaults/.nvmrc +1 -0
  23. package/dist/defaults/.vscode/settings.json +8 -0
  24. package/dist/defaults/_.gitignore +71 -0
  25. package/dist/defaults/hooks/build:post.js +8 -0
  26. package/dist/defaults/hooks/build:pre.js +8 -0
  27. package/dist/defaults/src/_locales/en/messages.json +14 -0
  28. package/dist/defaults/src/assets/css/content.scss +2 -0
  29. package/dist/defaults/src/assets/css/options.scss +2 -0
  30. package/dist/defaults/src/assets/css/popup.scss +2 -0
  31. package/dist/defaults/src/assets/images/_ +0 -0
  32. package/dist/defaults/src/assets/images/icons/icon.png +0 -0
  33. package/dist/defaults/src/assets/js/background.js +11 -0
  34. package/dist/defaults/src/assets/js/content.js +8 -0
  35. package/dist/defaults/src/assets/js/popup.js +7 -0
  36. package/dist/defaults/src/assets/vendor/_ +0 -0
  37. package/dist/defaults/src/manifest.json +86 -0
  38. package/dist/defaults/src/pages/options.html +21 -0
  39. package/dist/defaults/src/pages/popup.html +21 -0
  40. package/dist/gulp/main.js +50 -0
  41. package/dist/gulp/plugins/webpack/replace.js +52 -0
  42. package/dist/gulp/tasks/developmentRebuild.js +94 -0
  43. package/dist/gulp/tasks/distribute.js +163 -0
  44. package/dist/gulp/tasks/icons.js +149 -0
  45. package/dist/gulp/tasks/package.js +167 -0
  46. package/dist/gulp/tasks/sass.js +74 -0
  47. package/dist/gulp/tasks/serve.js +183 -0
  48. package/dist/gulp/tasks/test.js +16 -0
  49. package/dist/gulp/tasks/webpack.js +186 -0
  50. package/dist/index.js +27 -0
  51. package/dist/lib/affiliatizer.js +198 -0
  52. package/dist/lib/extension.js +104 -0
  53. package/dist/lib/logger.js +56 -0
  54. package/dist/lib/messaging.js +48 -0
  55. package/package.json +87 -0
@@ -0,0 +1,52 @@
1
+ // Libraries
2
+ const Manager = new (require('../build.js'));
3
+ const logger = Manager.logger('install');
4
+ const { execute } = require('node-powertools');
5
+ const os = require('os');
6
+
7
+ // Load package
8
+ const package = Manager.getPackage('main');
9
+ const project = Manager.getPackage('project');
10
+
11
+ module.exports = async function (options) {
12
+ // Log
13
+ logger.log(`Installing ${package.name}...`);
14
+
15
+ // Get type
16
+ const type = options._[1] || 'prod';
17
+
18
+ try {
19
+ // Install production
20
+ if (['prod', 'p', 'production'].includes(type)) {
21
+ // Log
22
+ logger.log('Installing production...');
23
+
24
+ // Install
25
+ await install(`npm uninstall ${package.name}`);
26
+ await install(`npm install ${package.name}@latest --save-dev`);
27
+
28
+ // Return
29
+ return logger.log('Production installation complete.');
30
+ }
31
+
32
+ // Install development
33
+ if (['dev', 'd', 'development', 'local', 'l'].includes(type)) {
34
+ // Log
35
+ logger.log('Installing development...');
36
+
37
+ // Install
38
+ await install(`npm uninstall ${package.name}`);
39
+ await install(`npm install ${os.homedir()}/Developer/Repositories/ITW-Creative-Works/${package.name} --save-dev`);
40
+
41
+ // Return
42
+ return logger.log('Development installation complete.');
43
+ }
44
+
45
+ } catch (e) {
46
+ logger.error(`Error during install:`, e);
47
+ }
48
+ };
49
+
50
+ function install(command) {
51
+ return execute(command, { log: true });
52
+ }
@@ -0,0 +1,484 @@
1
+ // Libraries
2
+ const Manager = new (require('../build.js'));
3
+ const logger = Manager.logger('setup');
4
+ const argv = Manager.getArguments();
5
+ const path = require('path');
6
+ const jetpack = require('fs-jetpack');
7
+ const version = require('wonderful-version');
8
+ const { execute, template, force } = require('node-powertools');
9
+ const NPM = require('npm-api');
10
+ const glob = require('glob').globSync;
11
+ const { minimatch } = require('minimatch');
12
+
13
+ // Load package
14
+ const package = Manager.getPackage('main');
15
+ const project = Manager.getPackage('project');
16
+ const manifest = Manager.getManifest();
17
+
18
+ // Load config
19
+ const templating = {
20
+ nodeVersion: version.major(package.engines.node),
21
+ };
22
+
23
+ // Dependency MAP
24
+ const DEPENDENCY_MAP = {
25
+ 'gulp': 'dev',
26
+ }
27
+
28
+ // File MAP
29
+ const FILE_MAP = {
30
+ // Files to skip overwrite
31
+ 'hooks/**/*': {
32
+ overwrite: false,
33
+ },
34
+ 'src/**/*': {
35
+ overwrite: false,
36
+ },
37
+ 'src/**/*.{html,md}': {
38
+ skip: (file) => {
39
+ // Get the name
40
+ const name = path.basename(file.name, path.extname(file.name));
41
+ const htmlFilePath = path.join(file.destination, `${name}.html`);
42
+ const mdFilePath = path.join(file.destination, `${name}.md`);
43
+ const htmlFileExists = jetpack.exists(htmlFilePath);
44
+ const mdFileExists = jetpack.exists(mdFilePath);
45
+ const eitherExists = htmlFileExists || mdFileExists;
46
+
47
+ // Skip if both files exist
48
+ return eitherExists;
49
+ },
50
+ },
51
+
52
+ // Files to rewrite path
53
+ // Removed because getting too confusing
54
+ // 'dist/pages/**/*': {
55
+ // path: (file) => file.source.replace('dist/pages', 'dist'),
56
+ // },
57
+ '_.gitignore': {
58
+ name: (file) => file.name.replace('_.gitignore', '.gitignore'),
59
+ },
60
+
61
+ // Files to run templating on
62
+ '.github/workflows/build.yml': {
63
+ template: templating,
64
+ },
65
+ '.nvmrc': {
66
+ template: templating,
67
+ },
68
+ }
69
+
70
+ module.exports = async function (options) {
71
+ // Fix options
72
+ options = options || {};
73
+ options.checkManager = force(options.checkManager || true, 'boolean');
74
+ options.checkNode = force(options.checkNode || true, 'boolean');
75
+ options.checkPeerDependencies = force(options.checkPeerDependencies || true, 'boolean');
76
+ options.setupScripts = force(options.setupScripts || true, 'boolean');
77
+ options.buildSiteFiles = force(options.buildSiteFiles || true, 'boolean');
78
+ options.buildSiteFilesInput = force(options.buildSiteFilesInput || ['**/*'], 'array');
79
+ options.checkLocality = force(options.checkLocality || true, 'boolean');
80
+
81
+ // Log
82
+ logger.log(`Welcome to ${package.name} v${package.version}!`);
83
+ logger.log(`options`, options);
84
+
85
+ // Prefix project
86
+ project.dependencies = project.dependencies || {};
87
+ project.devDependencies = project.devDependencies || {};
88
+
89
+ try {
90
+ // Log current working directory
91
+ await logCWD();
92
+
93
+ // Ensure this package is up-to-date
94
+ if (options.checkManager) {
95
+ await updateManager();
96
+ }
97
+
98
+ // Ensure proper node version
99
+ if (options.checkNode) {
100
+ await ensureNodeVersion();
101
+ }
102
+
103
+ // Run the setup
104
+ if (options.checkPeerDependencies) {
105
+ await ensurePeerDependencies();
106
+ }
107
+
108
+ // Setup scripts
109
+ if (options.setupScripts) {
110
+ await setupScripts();
111
+ }
112
+
113
+ // Build files
114
+ if (options.buildSiteFiles) {
115
+ await buildSiteFiles({ input: options.buildSiteFilesInput });
116
+ }
117
+
118
+ // Copy all files from src/defaults/dist on first run
119
+ // await copyDefaultDistFiles();
120
+
121
+ // Check which locality we are using
122
+ if (options.checkLocality) {
123
+ await checkLocality();
124
+ }
125
+ } catch (e) {
126
+ // Throw error
127
+ throw e;
128
+ }
129
+ };
130
+
131
+ async function logCWD() {
132
+ logger.log('Current working directory:', process.cwd());
133
+ // logger.log('Current working directory 2:', await execute('pwd'));
134
+ // logger.log('Current working directory 3:', await execute('ls -al'));
135
+ }
136
+
137
+ async function updateManager() {
138
+ const npm = new NPM();
139
+
140
+ // Get the latest version
141
+ const installedVersion = project.devDependencies[package.name];
142
+ const latestVersion = await npm.repo(package.name)
143
+ .package()
144
+ .then((pkg) => {
145
+ return pkg.version;
146
+ }, (e) => {
147
+ return '0.0.0';
148
+ });
149
+ const isUpToDate = version.is(installedVersion, '>=', latestVersion);
150
+ const levelDifference = version.levelDifference(installedVersion, latestVersion);
151
+
152
+ // Log
153
+ logVersionCheck(package.name, installedVersion, latestVersion, isUpToDate);
154
+
155
+ // Quit if local
156
+ if (installedVersion.startsWith('file:')) {
157
+ return;
158
+ }
159
+
160
+ // Check if we need to update
161
+ if (!isUpToDate) {
162
+ // Quit if major version difference
163
+ if (levelDifference === 'major') {
164
+ return logger.error(`Major version difference detected. Please update to ${latestVersion} manually.`);
165
+ }
166
+
167
+ // Install the latest version
168
+ await install(package.name, latestVersion);
169
+ }
170
+ }
171
+
172
+ async function ensureNodeVersion() {
173
+ const installedVersion = version.clean(process.version);
174
+ const requiredVersion = version.clean(package.engines.node);
175
+ const isUpToDate = version.is(installedVersion, '>=', requiredVersion);
176
+
177
+ // Log
178
+ logVersionCheck('Node.js', installedVersion, requiredVersion, isUpToDate);
179
+
180
+ // Check if we need to update
181
+ if (!isUpToDate) {
182
+ throw new Error(`Node version is out-of-date. Required version is ${requiredVersion}.`);
183
+ }
184
+ }
185
+ async function ensurePeerDependencies() {
186
+ const requiredPeerDependencies = package.peerDependencies || {};
187
+
188
+ // Loop through and make sure project has AT LEAST the required version
189
+ for (let [dependency, ver] of Object.entries(requiredPeerDependencies)) {
190
+ const projectDependencyVersion = version.clean(project.dependencies[dependency] || project.devDependencies[dependency]);
191
+ const location = DEPENDENCY_MAP[dependency] === 'dev' ? '--save-dev' : '';
192
+ const isUpToDate = version.is(projectDependencyVersion, '>=', ver);
193
+
194
+ // Clean version if needed
195
+ ver = version.clean(ver);
196
+
197
+ // Log
198
+ // logger.log('Checking peer dep:', dependency, '-->', projectDependencyVersion, '>=', ver);
199
+ logVersionCheck(dependency, projectDependencyVersion, ver, isUpToDate);
200
+
201
+ // Install if not found
202
+ if (
203
+ // Not found
204
+ !projectDependencyVersion
205
+ // Not the right version
206
+ || !isUpToDate
207
+ ) {
208
+ await install(dependency, ver, location);
209
+ }
210
+ }
211
+ }
212
+
213
+ function setupScripts() {
214
+ // Setup the scripts
215
+ project.scripts = project.scripts || {};
216
+
217
+ // Setup the scripts
218
+ Object.keys(package.projectScripts).forEach((key) => {
219
+ project.scripts[key] = package.projectScripts[key];
220
+ });
221
+
222
+ // Save the project
223
+ jetpack.write(path.join(process.cwd(), 'package.json'), project);
224
+ }
225
+
226
+ function checkLocality() {
227
+ const installedVersion = project.devDependencies[package.name];
228
+
229
+ if (installedVersion.startsWith('file:')) {
230
+ logger.warn(`⚠️⚠️⚠️ You are using the local version of ${package.name}. This WILL NOT WORK when published. ⚠️⚠️⚠️`);
231
+ }
232
+ }
233
+
234
+ function install(package, ver, location) {
235
+ // Default to latest
236
+ ver || 'latest';
237
+
238
+ // Clean version if needed
239
+ ver = ver === 'latest' ? ver : version.clean(ver);
240
+
241
+ // Build the command
242
+ let command = `npm install ${package}@${ver} ${location || '--save'}`;
243
+
244
+ // Log
245
+ logger.log('Installing:', command);
246
+
247
+ // Execute
248
+ return execute(command, { log: true })
249
+ .then(async () => {
250
+ // Read new project
251
+ const projectUpdated = jetpack.read(path.join(process.cwd(), 'package.json'), 'json');
252
+
253
+ // Log
254
+ logger.log('Installed:', package, ver);
255
+
256
+ // Update package object
257
+ project.dependencies = projectUpdated.dependencies;
258
+ project.devDependencies = projectUpdated.devDependencies;
259
+ });
260
+ }
261
+
262
+ function buildSiteFiles(options) {
263
+ options = options || {};
264
+ options.input = options.input || ['**/*'];
265
+
266
+ // Loop through all files in /defaults directory
267
+ const dir = path.join(__dirname, '..', 'defaults');
268
+ const input = [
269
+ // Files to include
270
+ // '**/*',
271
+ ...options.input,
272
+
273
+ // Files to exclude
274
+ // Dist files
275
+ // '!dist/**',
276
+ '!**/.DS_Store', // TODO: NOT WORKING
277
+ ]
278
+
279
+ // Get all files
280
+ const files = glob(input, {
281
+ cwd: dir,
282
+ dot: true,
283
+ nodir: true,
284
+ });
285
+
286
+ const debug = argv.debug
287
+ || true;
288
+
289
+ // Log
290
+ logger.log(`Preparing to copy ${files.length} default files...`);
291
+
292
+ // Loop
293
+ for (const file of files) {
294
+ // Build item
295
+ const item = {
296
+ source: null,
297
+ destination: null,
298
+ name: null,
299
+ }
300
+ // Get the destination
301
+ // const source = path.join(dir, file);
302
+ // let destination = path.join(process.cwd(), file.replace('defaults/', ''));
303
+ // const filename = path.basename(destination);
304
+
305
+ // Set the item properties
306
+ item.source = path.dirname(path.join(dir, file));
307
+ item.name = path.basename(file);
308
+ item.destination = path.dirname(path.join(process.cwd(), file.replace('defaults/', '')));
309
+
310
+ // Get options
311
+ const options = getFileOptions(file);
312
+ const ogName = item.name;
313
+
314
+ // Quit if file is '_'
315
+ // We have files like this to trigger the creation of directories without them being ignored by git
316
+ if (item.name === '_') {
317
+ // First, create the directory around the file
318
+ jetpack.dir(item.destination);
319
+
320
+ // Skip
321
+ continue;
322
+ }
323
+
324
+ // Resolve name
325
+ if (typeof options.name === 'function') {
326
+ item.name = options.name(item);
327
+ }
328
+
329
+ // Resolve path
330
+ if (typeof options.path === 'function') {
331
+ item.destination = options.path(item);
332
+ }
333
+
334
+ // Resolve overwrite
335
+ if (typeof options.overwrite === 'function') {
336
+ options.overwrite = options.overwrite(item);
337
+ }
338
+
339
+ // Resolve skip
340
+ if (typeof options.skip === 'function') {
341
+ options.skip = options.skip(item);
342
+ }
343
+
344
+ // Log
345
+ if (debug) {
346
+ logger.log(`Copying defaults...`);
347
+ logger.log(` name: ${item.name}`);
348
+ logger.log(` from: ${item.source}`);
349
+ logger.log(` to: ${item.destination}`);
350
+ logger.log(` overwrite: ${options.overwrite}`);
351
+ logger.log(` skip: ${options.skip}`);
352
+
353
+ // logger.log('File:', file);
354
+ // logger.log('filename:', filename);
355
+ // logger.log('options:', options);
356
+ // // logger.log('contents:', jetpack.read(source));
357
+ // logger.log('source:', source);
358
+ // logger.log('Destination:', destination);
359
+ console.log('\n');
360
+ }
361
+
362
+ // Skip if needed
363
+ if (options.skip) {
364
+ continue;
365
+ }
366
+
367
+ // Get final paths
368
+ const finalSource = path.join(item.source, ogName);
369
+ const finalDestination = path.join(item.destination, item.name);
370
+
371
+ // console.log('---finalSource', finalSource);
372
+ // console.log('---finalDestination', finalDestination);
373
+
374
+ // Check if the file exists
375
+ const exists = jetpack.exists(finalDestination);
376
+
377
+ // Skip if exists and we don't want to overwrite
378
+ if (!options.overwrite && exists) {
379
+ continue;
380
+ }
381
+
382
+ // Run templating if needed
383
+ if (options.template) {
384
+ // Log
385
+ // logger.log('Running templating on:', destination);
386
+
387
+ // Run the templating
388
+ const contents = jetpack.read(finalSource);
389
+ const templated = template(contents, options.template);
390
+
391
+ // Write the file
392
+ jetpack.write(finalDestination, templated);
393
+ } else {
394
+ // Copy the file
395
+ jetpack.copy(finalSource, finalDestination, { overwrite: true });
396
+ }
397
+ }
398
+ }
399
+
400
+ // Copy default dist files
401
+ // async function copyDefaultDistFiles() {
402
+ // // Get the directory
403
+ // const dir = path.join(__dirname, '..', '..', 'defaults', 'dist');
404
+
405
+ // // Log
406
+ // logger.log(`Copying default dist files from ${dir}`);
407
+
408
+ // // Copy the files
409
+ // jetpack.copy(dir, 'dist', { overwrite: true });
410
+ // }
411
+ // async function copyDefaultDistFiles() {
412
+ // // Loop through all files in /defaults directory
413
+ // const dir = path.join(__dirname, '..', '..', 'defaults', 'dist');
414
+ // const input = [
415
+ // // Files to include
416
+ // '**/*',
417
+
418
+ // // Files to exclude
419
+ // '!**/.DS_Store', // TODO: NOT WORKING
420
+ // ]
421
+
422
+ // // Get all files
423
+ // const files = glob(input, {
424
+ // cwd: dir,
425
+ // dot: true,
426
+ // nodir: true,
427
+ // });
428
+
429
+ // // Log
430
+ // logger.log(`Preparing to copy ${files.length} default dist files...`);
431
+
432
+ // for (const file of files) {
433
+ // // const relativePath = path.relative(path.join(__dirname, '..', '..', 'defaults', 'dist'), file);
434
+ // // const destination = path.join(__dirname, '..', '..', 'dist', relativePath.replace('pages', ''));
435
+ // const source = path.join(dir, file);
436
+ // const destination = path.join(process.cwd(), file.replace('dist/pages', 'dist'));
437
+
438
+ // // Log
439
+ // if (true) {
440
+ // logger.log(`Copying default dist file...`);
441
+ // logger.log(` file: ${file}`);
442
+ // logger.log(` from: ${source}`);
443
+ // logger.log(` to: ${destination}`);
444
+ // console.log('\n');
445
+ // }
446
+
447
+ // // Ensure the directory exists
448
+ // // await jetpack.dir(path.dirname(destination));
449
+
450
+ // // Copy the file
451
+ // // await jetpack.copy(file, destination, { overwrite: true });
452
+ // }
453
+ // }
454
+
455
+ function getFileOptions(filePath) {
456
+ const defaults = {
457
+ overwrite: true,
458
+ name: null,
459
+ path: null,
460
+ template: null,
461
+ skip: false,
462
+ };
463
+
464
+ let options = { ...defaults };
465
+
466
+ // Loop through all patterns
467
+ for (const pattern in FILE_MAP) {
468
+ if (minimatch(filePath, pattern)) {
469
+ options = { ...options, ...FILE_MAP[pattern] };
470
+ }
471
+ }
472
+
473
+ return options;
474
+ }
475
+
476
+ function logVersionCheck(name, installedVersion, latestVersion, isUpToDate) {
477
+ // Quit if local
478
+ if (installedVersion.startsWith('file:')) {
479
+ isUpToDate = true;
480
+ }
481
+
482
+ // Log
483
+ logger.log(`Checking if ${name} is up to date (${logger.format.bold(installedVersion)} >= ${logger.format.bold(latestVersion)}): ${isUpToDate ? logger.format.green('Yes') : logger.format.red('No')}`);
484
+ }
@@ -0,0 +1,12 @@
1
+ // Libraries
2
+ const Manager = new (require('../build.js'));
3
+ const logger = Manager.logger('version');
4
+
5
+ // Load package
6
+ const package = Manager.getPackage('main');
7
+ const project = Manager.getPackage('project');
8
+
9
+ module.exports = async function (options) {
10
+ // Log
11
+ logger.log(package.version);
12
+ };
@@ -0,0 +1,78 @@
1
+ {
2
+ // Basic info
3
+ version: '1.0.0',
4
+ manifest_version: 3,
5
+ name: '__MSG_appName__',
6
+ description: '__MSG_appDescription__',
7
+
8
+ // Icon
9
+ icons: {
10
+ '1024': 'assets/images/icons/icon-1024x.png',
11
+ '512': 'assets/images/icons/icon-512x.png',
12
+ '256': 'assets/images/icons/icon-256x.png',
13
+ '128': 'assets/images/icons/icon-128x.png',
14
+ '48': 'assets/images/icons/icon-48x.png',
15
+ '32': 'assets/images/icons/icon-32x.png',
16
+ '16': 'assets/images/icons/icon-16x.png',
17
+ },
18
+
19
+ // Default locale
20
+ default_locale: 'en',
21
+
22
+ // Background script
23
+ background: {
24
+ service_worker: 'assets/js/background.bundle.js',
25
+ },
26
+
27
+ // Permissions
28
+ permissions: [
29
+ ],
30
+ host_permissions: [
31
+ ],
32
+
33
+ // Options page
34
+ options_ui: {
35
+ page: 'pages/options.html',
36
+ },
37
+
38
+ // Content scripts
39
+ content_scripts: [
40
+ ],
41
+
42
+ // Browser action
43
+ action: {
44
+ default_icon: {
45
+ '48': 'assets/images/icons/icon-48x.png',
46
+ '32': 'assets/images/icons/icon-32x.png',
47
+ '16': 'assets/images/icons/icon-16x.png',
48
+ },
49
+ default_title: '__MSG_appName__',
50
+ default_popup: 'pages/popup.html',
51
+ },
52
+
53
+ // Content security policy
54
+ content_security_policy: {
55
+ extension_pages: "script-src 'self'; object-src 'self'; worker-src 'self';",
56
+ },
57
+
58
+ // Web accessible resources
59
+ externally_connectable: {
60
+ matches: [
61
+ 'http://localhost:4000/*',
62
+ ],
63
+ },
64
+
65
+ // Web accessible resources
66
+ web_accessible_resources: [
67
+ ],
68
+
69
+ // Commands
70
+ commands: {
71
+ },
72
+
73
+ // Sandbox
74
+ sandbox: {
75
+ pages: [
76
+ ],
77
+ },
78
+ }
@@ -0,0 +1,52 @@
1
+ // Libraries
2
+
3
+ // Class
4
+ function Manager() {
5
+ const self = this;
6
+
7
+ // Properties
8
+ self.affiliatizer = null;
9
+ self.extension = null;
10
+
11
+ // Return
12
+ return self;
13
+ }
14
+
15
+ // Initialize
16
+ Manager.prototype.initialize = function () {
17
+ const self = this;
18
+
19
+ return new Promise(function(resolve, reject) {
20
+ // Properties
21
+ self.affiliatizer = require('./lib/affiliatizer').initialize(self);
22
+ self.extension = require('./lib/extension');
23
+
24
+ // Log
25
+ self.log('Initialized!', self);
26
+
27
+ // Return
28
+ return resolve(self);
29
+ });
30
+ };
31
+
32
+ // Setup logger
33
+ ['log', 'error', 'warn', 'info', 'debug'].forEach(method => {
34
+ Manager.prototype[method] = function() {
35
+ // Get arguments
36
+ const time = new Date().toLocaleTimeString('en-US', {
37
+ hour12: false,
38
+ hour: '2-digit',
39
+ minute: '2-digit',
40
+ second: '2-digit'
41
+ });
42
+
43
+ // Add prefix
44
+ const args = [`[${time}] content:`, ...Array.from(arguments)];
45
+
46
+ // Call the original console method
47
+ console[method].apply(console, args);
48
+ };
49
+ });
50
+
51
+ // Export
52
+ module.exports = Manager;
@@ -0,0 +1 @@
1
+ v{nodeVersion}/*
@@ -0,0 +1,8 @@
1
+ // Workspace settings
2
+ {
3
+ // The following will hide certian files from the file explorer
4
+ "files.exclude": {
5
+ // Hide any files with /master/ in the path
6
+ // "**/master/**": true,
7
+ }
8
+ }