browser-extension-manager 0.0.1 → 1.0.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.
- package/dist/assets/themes/bootstrap/5.3.3/css/bootstrap.css +12057 -0
- package/dist/assets/themes/bootstrap/5.3.3/css/bootstrap.css.map +1 -0
- package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.bundle.js +6314 -0
- package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.bundle.js.map +1 -0
- package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.js +4494 -0
- package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.js.map +1 -0
- package/dist/background.js +82 -0
- package/dist/build.js +19 -1
- package/dist/commands/clean.js +1 -0
- package/dist/config/manifest.json +8 -0
- package/dist/defaults/src/assets/css/options.scss +9 -0
- package/dist/defaults/src/assets/css/popup.scss +12 -0
- package/dist/defaults/src/assets/js/options.js +10 -0
- package/dist/defaults/src/assets/js/popup.js +3 -0
- package/dist/defaults/src/manifest.json +14 -0
- package/dist/defaults/src/pages/options.html +6 -1
- package/dist/defaults/src/pages/popup.html +6 -1
- package/dist/gulp/main.js +2 -1
- package/dist/gulp/tasks/_importer.js +35 -0
- package/dist/gulp/tasks/_package.js +171 -0
- package/dist/gulp/tasks/developmentRebuild.js +3 -2
- package/dist/gulp/tasks/distribute.js +3 -1
- package/dist/gulp/tasks/icons.js +14 -41
- package/dist/gulp/tasks/package.js +95 -46
- package/dist/gulp/tasks/sass.js +29 -3
- package/dist/gulp/tasks/serve.js +15 -164
- package/dist/gulp/tasks/test.js +2 -0
- package/dist/gulp/tasks/themes.js +75 -0
- package/dist/gulp/tasks/webpack.js +4 -1
- package/package.json +2 -1
- package/dist/assets/js copy/base.js +0 -7
- package/dist/assets/js copy/core.js +0 -81
- package/dist/assets/js copy/main.js +0 -10
- package/dist/defaults/src/assets/images/icons/icon.png +0 -0
|
@@ -10,6 +10,8 @@ const JSON5 = require('json5');
|
|
|
10
10
|
// Load package
|
|
11
11
|
const package = Manager.getPackage('main');
|
|
12
12
|
const project = Manager.getPackage('project');
|
|
13
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
14
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
13
15
|
|
|
14
16
|
// Glob
|
|
15
17
|
const input = [
|
|
@@ -19,22 +21,15 @@ const input = [
|
|
|
19
21
|
// Files to exclude
|
|
20
22
|
// '!dist/**',
|
|
21
23
|
];
|
|
22
|
-
const output = 'dist
|
|
24
|
+
const output = 'dist';
|
|
23
25
|
const delay = 250;
|
|
24
26
|
|
|
25
|
-
// Supported browsers
|
|
26
|
-
const BROWSERS = ['chrome', 'firefox', 'opera'];
|
|
27
|
-
|
|
28
|
-
// Environment Check
|
|
29
|
-
const targetBrowser = process.env.BROWSER;
|
|
30
|
-
const isSpecificBrowser = targetBrowser && BROWSERS.includes(targetBrowser);
|
|
31
|
-
|
|
32
27
|
// Special Compilation Task for manifest.json with default settings
|
|
33
|
-
async function compileManifest(
|
|
28
|
+
async function compileManifest(outputDir) {
|
|
34
29
|
try {
|
|
35
30
|
const manifestPath = path.join('dist', 'manifest.json');
|
|
36
|
-
const outputPath = path.join(
|
|
37
|
-
const configPath = path.join(
|
|
31
|
+
const outputPath = path.join(outputDir, 'manifest.json');
|
|
32
|
+
const configPath = path.join(rootPathPackage, 'dist', 'config', 'manifest.json');
|
|
38
33
|
|
|
39
34
|
// Read and parse using JSON5
|
|
40
35
|
const manifest = JSON5.parse(jetpack.read(manifestPath));
|
|
@@ -66,26 +61,25 @@ async function compileManifest(browser, complete) {
|
|
|
66
61
|
// Save as regular JSON
|
|
67
62
|
jetpack.write(outputPath, JSON.stringify(manifest, null, 2));
|
|
68
63
|
|
|
69
|
-
logger.log(`Manifest compiled with defaults
|
|
64
|
+
logger.log(`Manifest compiled with defaults`);
|
|
70
65
|
} catch (e) {
|
|
71
|
-
logger.error(`Error compiling manifest
|
|
66
|
+
logger.error(`Error compiling manifest`, e);
|
|
72
67
|
}
|
|
73
|
-
return complete();
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
// Special Compilation Task for _locales
|
|
77
|
-
async function compileLocales(
|
|
71
|
+
async function compileLocales(outputDir) {
|
|
78
72
|
try {
|
|
79
73
|
const localesDir = path.join('dist', '_locales');
|
|
80
|
-
const
|
|
74
|
+
const outputLocalesDir = path.join(outputDir, '_locales');
|
|
81
75
|
|
|
82
76
|
// Ensure the directory exists
|
|
83
|
-
jetpack.dir(
|
|
77
|
+
jetpack.dir(outputLocalesDir);
|
|
84
78
|
|
|
85
79
|
// Process each locale file
|
|
86
80
|
jetpack.find(localesDir, { matching: '**/*.json' }).forEach(filePath => {
|
|
87
81
|
const relativePath = path.relative(localesDir, filePath);
|
|
88
|
-
const outputPath = path.join(
|
|
82
|
+
const outputPath = path.join(outputLocalesDir, relativePath);
|
|
89
83
|
|
|
90
84
|
// Read and parse using JSON5
|
|
91
85
|
const localeData = JSON5.parse(jetpack.read(filePath));
|
|
@@ -96,51 +90,109 @@ async function compileLocales(browser, complete) {
|
|
|
96
90
|
logger.log(`Locale compiled and saved: ${outputPath}`);
|
|
97
91
|
});
|
|
98
92
|
} catch (e) {
|
|
99
|
-
logger.error(`Error compiling locales
|
|
93
|
+
logger.error(`Error compiling locales`, e);
|
|
100
94
|
}
|
|
101
|
-
return complete();
|
|
102
95
|
}
|
|
103
96
|
|
|
104
|
-
// Package Task for
|
|
105
|
-
async function
|
|
97
|
+
// Package Task for raw
|
|
98
|
+
async function packageRaw() {
|
|
106
99
|
// Log
|
|
107
|
-
logger.log(`Starting packaging
|
|
100
|
+
logger.log(`Starting raw packaging...`);
|
|
108
101
|
|
|
109
102
|
try {
|
|
110
|
-
const outputDir =
|
|
103
|
+
const outputDir = 'packaged/raw';
|
|
111
104
|
|
|
112
105
|
// Ensure the directory exists
|
|
113
106
|
jetpack.dir(outputDir);
|
|
114
107
|
|
|
115
|
-
//
|
|
116
|
-
// await execute(`npx bxm setup --browser=${browser}`);
|
|
117
|
-
|
|
118
|
-
// Copy files to browser-specific directory
|
|
108
|
+
// Copy files to raw package directory
|
|
119
109
|
await execute(`cp -r dist/* ${outputDir}`);
|
|
120
110
|
|
|
121
111
|
// Compile manifest and locales
|
|
122
|
-
await compileManifest(
|
|
123
|
-
await compileLocales(
|
|
124
|
-
|
|
125
|
-
// Create packed extension (.zip)
|
|
126
|
-
await execute(`zip -r ${outputDir}.zip ${outputDir}`);
|
|
112
|
+
await compileManifest(outputDir);
|
|
113
|
+
await compileLocales(outputDir);
|
|
127
114
|
|
|
128
115
|
// Log completion
|
|
129
|
-
logger.log(`Finished packaging
|
|
116
|
+
logger.log(`Finished raw packaging`);
|
|
130
117
|
} catch (e) {
|
|
131
|
-
logger.error(`Error
|
|
118
|
+
logger.error(`Error during raw packaging`, e);
|
|
132
119
|
}
|
|
120
|
+
}
|
|
133
121
|
|
|
134
|
-
|
|
122
|
+
// Create zipped version of raw package
|
|
123
|
+
async function packageZip() {
|
|
124
|
+
// Log
|
|
125
|
+
logger.log(`Zipping raw package...`);
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
const inputDir = 'packaged/raw';
|
|
129
|
+
const zipPath = 'packaged/extension.zip';
|
|
130
|
+
|
|
131
|
+
// Create packed extension (.zip)
|
|
132
|
+
if (Manager.isBuildMode()) {
|
|
133
|
+
await execute(`zip -r ${zipPath} ${inputDir}`);
|
|
134
|
+
logger.log(`Zipped package created at ${zipPath}`);
|
|
135
|
+
} else {
|
|
136
|
+
logger.log(`Skipping zip (not in build mode)`);
|
|
137
|
+
}
|
|
138
|
+
} catch (e) {
|
|
139
|
+
logger.error(`Error zipping package`, e);
|
|
140
|
+
}
|
|
135
141
|
}
|
|
136
142
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
function liveReload() {
|
|
144
|
+
// Log
|
|
145
|
+
logger.log('Reloading live server clients...');
|
|
146
|
+
|
|
147
|
+
// Quit if in build mode
|
|
148
|
+
if (Manager.isBuildMode()) {
|
|
149
|
+
return logger.log('Skipping live reload in non-build mode');
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Quit if no websocket server
|
|
153
|
+
if (!global.websocket) {
|
|
154
|
+
return logger.log('No live reload server found');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Reload each client
|
|
158
|
+
global.websocket.clients.forEach((client) => {
|
|
159
|
+
// Get client IP
|
|
160
|
+
const clientIp = client._socket?.remoteAddress || 'Unknown IP';
|
|
161
|
+
|
|
162
|
+
// Log
|
|
163
|
+
logger.log(`Sending to client at IP: ${clientIp}`);
|
|
164
|
+
|
|
165
|
+
// Send
|
|
166
|
+
client.send(JSON.stringify({ command: 'reload' }))
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// Complete
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Package Task
|
|
174
|
+
async function packageFn(complete) {
|
|
175
|
+
// Log
|
|
176
|
+
logger.log('Starting...');
|
|
177
|
+
|
|
178
|
+
// Run packageRaw
|
|
179
|
+
await packageRaw();
|
|
180
|
+
|
|
181
|
+
// Run packageZip
|
|
182
|
+
await packageZip();
|
|
183
|
+
|
|
184
|
+
// Run liveReload
|
|
185
|
+
liveReload();
|
|
186
|
+
|
|
187
|
+
// Log
|
|
188
|
+
logger.log('Finished!');
|
|
189
|
+
|
|
190
|
+
// Complete
|
|
191
|
+
return complete();
|
|
192
|
+
}
|
|
141
193
|
|
|
142
194
|
// Watcher Task
|
|
143
|
-
function
|
|
195
|
+
function packageFnWatcher(complete) {
|
|
144
196
|
// Quit if in build mode
|
|
145
197
|
if (Manager.isBuildMode()) {
|
|
146
198
|
logger.log('[watcher] Skipping watcher in build mode');
|
|
@@ -151,7 +203,7 @@ function packageWatcher(complete) {
|
|
|
151
203
|
logger.log('[watcher] Watching for changes...');
|
|
152
204
|
|
|
153
205
|
// Watch for changes in the dist folder
|
|
154
|
-
watch(input, { delay: delay },
|
|
206
|
+
watch(input, { delay: delay }, packageFn)
|
|
155
207
|
.on('change', function (path) {
|
|
156
208
|
logger.log(`[watcher] File ${path} was changed`);
|
|
157
209
|
});
|
|
@@ -161,7 +213,4 @@ function packageWatcher(complete) {
|
|
|
161
213
|
}
|
|
162
214
|
|
|
163
215
|
// Export tasks
|
|
164
|
-
module.exports = series(
|
|
165
|
-
parallel(...tasks),
|
|
166
|
-
packageWatcher
|
|
167
|
-
);
|
|
216
|
+
module.exports = series(packageFn, packageFnWatcher);
|
package/dist/gulp/tasks/sass.js
CHANGED
|
@@ -10,6 +10,8 @@ const rename = require('gulp-rename');
|
|
|
10
10
|
// Load package
|
|
11
11
|
const package = Manager.getPackage('main');
|
|
12
12
|
const project = Manager.getPackage('project');
|
|
13
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
14
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
13
15
|
|
|
14
16
|
// Glob
|
|
15
17
|
const input = [
|
|
@@ -17,9 +19,7 @@ const input = [
|
|
|
17
19
|
'src/assets/css/**/*.{css,scss,sass}',
|
|
18
20
|
|
|
19
21
|
// Main files
|
|
20
|
-
|
|
21
|
-
// path.join(__dirname, '..', '..', 'assets/css/main.scss'),
|
|
22
|
-
`${path.join(__dirname, '..', '..', 'assets/css')}/**/*`
|
|
22
|
+
`${rootPathPackage}/dist/assets/css/**/*`,
|
|
23
23
|
|
|
24
24
|
// Files to exclude
|
|
25
25
|
// '!dist/**',
|
|
@@ -35,6 +35,32 @@ function sass(complete) {
|
|
|
35
35
|
// Compile
|
|
36
36
|
return src(input)
|
|
37
37
|
.pipe(compiler({ outputStyle: 'compressed' }).on('error', compiler.logError))
|
|
38
|
+
// .pipe(
|
|
39
|
+
// compiler({
|
|
40
|
+
// outputStyle: 'compressed',
|
|
41
|
+
// // importer: alias.create({
|
|
42
|
+
// // // '@themes': path.resolve(rootPathProject, `node_modules/${package.name}/dist/assets`),
|
|
43
|
+
// // '@themes': '/node_modules/browser-extension-manager/dist/assets/themes',
|
|
44
|
+
// // }),
|
|
45
|
+
// // importers: [customAliasImporter],
|
|
46
|
+
// // includePaths: [
|
|
47
|
+
// // // path.resolve(rootPathProject, `node_modules/${package.name}/dist/assets`),
|
|
48
|
+
// // '/Users/ian/Developer/Repositories/Slinko/slinko-browser-extension/node_modules/browser-extension-manager/dist/assets',
|
|
49
|
+
// // ]
|
|
50
|
+
// // includePaths: [
|
|
51
|
+
// // path.join(__dirname, '..', '..', 'src'),
|
|
52
|
+
// // path.resolve(__dirname, '../../src/assets'),
|
|
53
|
+
// // path.resolve(__dirname, '../../src'),
|
|
54
|
+
// // ],
|
|
55
|
+
// // includePaths: [
|
|
56
|
+
// // path.resolve(__dirname, '../../'),
|
|
57
|
+
// // path.resolve(process.cwd(), '../../'),
|
|
58
|
+
// // ],
|
|
59
|
+
// // loadPaths: [
|
|
60
|
+
// // path.resolve(rootPathProject, `node_modules/${package.name}/dist/assets`),
|
|
61
|
+
// // ],
|
|
62
|
+
// }).on('error', compiler.logError)
|
|
63
|
+
// )
|
|
38
64
|
.pipe(cleanCSS())
|
|
39
65
|
.pipe(rename((path) => {
|
|
40
66
|
path.basename += '.bundle';
|
package/dist/gulp/tasks/serve.js
CHANGED
|
@@ -2,182 +2,33 @@
|
|
|
2
2
|
const Manager = new (require('../../build.js'));
|
|
3
3
|
const logger = Manager.logger('serve');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const
|
|
5
|
+
const WebSocket = require('ws');
|
|
6
6
|
|
|
7
7
|
// Load package
|
|
8
8
|
const package = Manager.getPackage('main');
|
|
9
9
|
const project = Manager.getPackage('project');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let localUrl;
|
|
13
|
-
let externalUrl;
|
|
14
|
-
|
|
15
|
-
// BrowserSync settings
|
|
16
|
-
const settings = {
|
|
17
|
-
port: 4000,
|
|
18
|
-
browser: 'default',
|
|
19
|
-
cors: true,
|
|
20
|
-
open: false,
|
|
21
|
-
ghostMode: false,
|
|
22
|
-
server: {
|
|
23
|
-
// TODO: FIX?
|
|
24
|
-
// baseDir: '_site',
|
|
25
|
-
baseDir: '_site',
|
|
26
|
-
middleware: async function (req, res, next) {
|
|
27
|
-
const url = new URL(`${localUrl}${req.url}`);
|
|
28
|
-
const pathname = url.pathname;
|
|
29
|
-
|
|
30
|
-
// Set the query object
|
|
31
|
-
req.query = {};
|
|
32
|
-
req.body = {};
|
|
33
|
-
|
|
34
|
-
// If the file has no ext, log it
|
|
35
|
-
if (!path.extname(pathname)) {
|
|
36
|
-
logger.log(`Serving ${pathname}`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Process the post request
|
|
40
|
-
if (pathname.match(/\/_process/)) {
|
|
41
|
-
const qsUrl = url.searchParams.get('url');
|
|
42
|
-
let lib;
|
|
43
|
-
|
|
44
|
-
// Set query
|
|
45
|
-
url.searchParams.forEach((value, key) => {
|
|
46
|
-
req.query[key] = value;
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
// Set body
|
|
50
|
-
if (req.method === 'POST') {
|
|
51
|
-
req.body = await receiveRequestBody(req);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Try to load the library
|
|
55
|
-
try {
|
|
56
|
-
// Clear the cache
|
|
57
|
-
delete require.cache[require.resolve(`../${qsUrl}`)];
|
|
58
|
-
|
|
59
|
-
// Load the library
|
|
60
|
-
lib = require(`../${qsUrl}`);
|
|
61
|
-
} catch (e) {
|
|
62
|
-
// Log the error
|
|
63
|
-
logger.error(`Error processing ${qsUrl}`);
|
|
64
|
-
|
|
65
|
-
// Set the status code
|
|
66
|
-
res.statusCode = 500;
|
|
67
|
-
|
|
68
|
-
// Return an error
|
|
69
|
-
return res.write(`Cannot find ${qsUrl}`);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Log
|
|
73
|
-
logger.log(`Processing ${qsUrl}`);
|
|
74
|
-
|
|
75
|
-
// Process the library
|
|
76
|
-
return await lib({
|
|
77
|
-
req: req,
|
|
78
|
-
res: res,
|
|
79
|
-
})
|
|
80
|
-
.then((r) => {
|
|
81
|
-
// Set the status code
|
|
82
|
-
res.statusCode = 200;
|
|
83
|
-
|
|
84
|
-
// Write the response (if it's JSON, set the content type)
|
|
85
|
-
try {
|
|
86
|
-
r = JSON.stringify(r);
|
|
87
|
-
res.setHeader('Content-Type', 'application/json');
|
|
88
|
-
} catch (e) {
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// End the response
|
|
92
|
-
res.write(r);
|
|
93
|
-
res.end();
|
|
94
|
-
})
|
|
95
|
-
.catch((e) => {
|
|
96
|
-
// Set the status code
|
|
97
|
-
res.statusCode = 500;
|
|
98
|
-
|
|
99
|
-
// Write the error
|
|
100
|
-
res.write(`Error processing ${qsUrl}: ${e}`);
|
|
101
|
-
res.end();
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// Check if the URL is missing a trailing slash and does not have an extension
|
|
106
|
-
if (!pathname.endsWith('/') && !path.extname(pathname)) {
|
|
107
|
-
// Get the new URL
|
|
108
|
-
const newURL = `${pathname}.html`;
|
|
109
|
-
|
|
110
|
-
// Log
|
|
111
|
-
// logger.log(`Rewriting ${pathname} to ${newURL}`);
|
|
112
|
-
|
|
113
|
-
// Rewrite it to serve the .html extension
|
|
114
|
-
req.url = newURL;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Special case: Rewrite /blog/ to blog.html since Jekyll fucks it up locally
|
|
118
|
-
if (pathname === '/blog/') {
|
|
119
|
-
req.url = '/blog.html';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Continue
|
|
123
|
-
return next();
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
}
|
|
10
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
11
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
127
12
|
|
|
128
13
|
// Task
|
|
129
14
|
module.exports = function serve(complete) {
|
|
130
15
|
// Log
|
|
131
16
|
logger.log('Starting...');
|
|
132
17
|
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
if (e) {
|
|
136
|
-
return logger.error(e);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Get URLs
|
|
140
|
-
localUrl = instance.options.get('urls').get('local');
|
|
141
|
-
externalUrl = instance.options.get('urls').get('external');
|
|
142
|
-
|
|
143
|
-
// Write the config file
|
|
144
|
-
// jetpack.write('.temp/_config_browsersync.yml', `url: ${externalUrl}`);
|
|
145
|
-
|
|
146
|
-
// Set global variable to access browserSync in other files
|
|
147
|
-
global.browserSync = browserSync;
|
|
18
|
+
// Get the local URL
|
|
19
|
+
const server = new WebSocket.Server({ port: Manager.getLiveReloadPort() })
|
|
148
20
|
|
|
149
|
-
|
|
150
|
-
|
|
21
|
+
// Log
|
|
22
|
+
logger.log(`LiveReload server started on port ${Manager.getLiveReloadPort()}`);
|
|
151
23
|
|
|
152
|
-
|
|
153
|
-
|
|
24
|
+
// Log connection
|
|
25
|
+
server.on('connection', (socket, request) => {
|
|
26
|
+
logger.log(`LiveReload client connected from local IP: ${request.socket.localAddress}`);
|
|
154
27
|
});
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
function receiveRequestBody(req) {
|
|
158
|
-
return new Promise((resolve, reject) => {
|
|
159
|
-
let body = [];
|
|
160
|
-
|
|
161
|
-
// Listen for data
|
|
162
|
-
req.on('data', (chunk) => {
|
|
163
|
-
body.push(chunk.toString());
|
|
164
|
-
});
|
|
165
28
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return reject(err);
|
|
169
|
-
});
|
|
29
|
+
// Set server
|
|
30
|
+
global.websocket = server;
|
|
170
31
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// Attempt to parse the body as JSON
|
|
176
|
-
try {
|
|
177
|
-
return resolve(JSON.parse(body));
|
|
178
|
-
} catch (e) {
|
|
179
|
-
return resolve(body);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
}
|
|
32
|
+
// Complete
|
|
33
|
+
return complete();
|
|
34
|
+
};
|
package/dist/gulp/tasks/test.js
CHANGED
|
@@ -5,6 +5,8 @@ const logger = Manager.logger('test');
|
|
|
5
5
|
// Load package
|
|
6
6
|
const package = Manager.getPackage('main');
|
|
7
7
|
const project = Manager.getPackage('project');
|
|
8
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
9
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
8
10
|
|
|
9
11
|
// Task
|
|
10
12
|
module.exports = function test(complete) {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
const Manager = new (require('../../build.js'));
|
|
3
|
+
const logger = Manager.logger('themes');
|
|
4
|
+
const { src, dest, watch, series } = require('gulp');
|
|
5
|
+
const through2 = require('through2');
|
|
6
|
+
const jetpack = require('fs-jetpack');
|
|
7
|
+
const path = require('path');
|
|
8
|
+
const { execute } = require('node-powertools');
|
|
9
|
+
|
|
10
|
+
// Load package
|
|
11
|
+
const package = Manager.getPackage('main');
|
|
12
|
+
const project = Manager.getPackage('project');
|
|
13
|
+
const manifest = Manager.getManifest();
|
|
14
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
15
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
16
|
+
|
|
17
|
+
// Glob
|
|
18
|
+
const input = [
|
|
19
|
+
// Files to include
|
|
20
|
+
`${rootPathPackage}/dist/assets/themes/**/*`,
|
|
21
|
+
|
|
22
|
+
// Files to exclude
|
|
23
|
+
// '!dist/**',
|
|
24
|
+
];
|
|
25
|
+
const output = 'src/assets/themes';
|
|
26
|
+
const delay = 250;
|
|
27
|
+
|
|
28
|
+
// Index
|
|
29
|
+
let index = -1;
|
|
30
|
+
|
|
31
|
+
// Main task
|
|
32
|
+
async function themes(complete) {
|
|
33
|
+
// Increment index
|
|
34
|
+
index++;
|
|
35
|
+
|
|
36
|
+
// Log
|
|
37
|
+
logger.log('Starting...');
|
|
38
|
+
|
|
39
|
+
// Complete
|
|
40
|
+
return src(input)
|
|
41
|
+
.pipe(dest(output))
|
|
42
|
+
.on('end', () => {
|
|
43
|
+
// Log
|
|
44
|
+
logger.log('Finished!');
|
|
45
|
+
|
|
46
|
+
// Complete
|
|
47
|
+
return complete();
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Watcher task
|
|
52
|
+
function themesWatcher(complete) {
|
|
53
|
+
// Quit if in build mode
|
|
54
|
+
if (Manager.isBuildMode()) {
|
|
55
|
+
logger.log('[watcher] Skipping watcher in build mode');
|
|
56
|
+
return complete();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Log
|
|
60
|
+
logger.log('[watcher] Watching for changes...');
|
|
61
|
+
|
|
62
|
+
// Watch for changes
|
|
63
|
+
watch(input, { delay: delay }, themes)
|
|
64
|
+
.on('change', function(path) {
|
|
65
|
+
logger.log(`[watcher] File ${path} was changed`);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Complete
|
|
69
|
+
return complete();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Default Task
|
|
73
|
+
module.exports = series(themes, themesWatcher);
|
|
74
|
+
|
|
75
|
+
|
|
@@ -13,6 +13,8 @@ const package = Manager.getPackage('main');
|
|
|
13
13
|
const project = Manager.getPackage('project');
|
|
14
14
|
const manifest = Manager.getManifest();
|
|
15
15
|
const config = Manager.getConfig();
|
|
16
|
+
const rootPathPackage = Manager.getRootPath('main');
|
|
17
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
16
18
|
|
|
17
19
|
// Load variables
|
|
18
20
|
const firebaseVersion = version.clean(require('web-manager/package.json').dependencies.firebase);
|
|
@@ -28,7 +30,7 @@ const input = [
|
|
|
28
30
|
'src/assets/js/background.js',
|
|
29
31
|
|
|
30
32
|
// Include UJ's dist files
|
|
31
|
-
|
|
33
|
+
`${rootPathPackage}/dist/assets/js/**/*`,
|
|
32
34
|
|
|
33
35
|
// Files to exclude
|
|
34
36
|
// '!dist/**',
|
|
@@ -50,6 +52,7 @@ const settings = {
|
|
|
50
52
|
|
|
51
53
|
// Specific
|
|
52
54
|
firebaseVersion: firebaseVersion,
|
|
55
|
+
liveReloadPort: Manager.getLiveReloadPort(),
|
|
53
56
|
}),
|
|
54
57
|
],
|
|
55
58
|
entry: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-extension-manager",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Browser Extension Manager dependency manager",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"webpack": "^5.98.0",
|
|
77
77
|
"wonderful-fetch": "^1.3.3",
|
|
78
78
|
"wonderful-version": "^1.3.2",
|
|
79
|
+
"ws": "^8.18.1",
|
|
79
80
|
"yargs": "^17.7.2"
|
|
80
81
|
},
|
|
81
82
|
"peerDependencies": {
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// Manager.log('Init main.js');
|
|
2
|
-
|
|
3
|
-
// var dom = Manager.dom();
|
|
4
|
-
// var url = window.location.href;
|
|
5
|
-
|
|
6
|
-
// // Load page specific scripts
|
|
7
|
-
// if (url.includes('/pricing')) {
|
|
8
|
-
// dom.loadScript({src: 'https://cdn.itwcreativeworks.com/assets/general/js/pricing-page-handler/index.js'})
|
|
9
|
-
// } else if (url.includes('/download')) {
|
|
10
|
-
// dom.loadScript({src: 'https://cdn.itwcreativeworks.com/assets/general/js/download-page-handler/index.js'})
|
|
11
|
-
// } else if (url.includes('/browser-extension') || url.includes('/extension')) {
|
|
12
|
-
// dom.loadScript({src: 'https://cdn.itwcreativeworks.com/assets/general/js/browser-extension-page-handler/index.js'})
|
|
13
|
-
// } else if (window.location.pathname.endsWith('.html')) {
|
|
14
|
-
// // Redirect and remove .html
|
|
15
|
-
// window.location.pathname = window.location.pathname.replace('.html', '');
|
|
16
|
-
// }
|
|
17
|
-
|
|
18
|
-
// // Load Slapform
|
|
19
|
-
// var slapform;
|
|
20
|
-
// dom.select('form.slapform')
|
|
21
|
-
// .each(function (el, i) {
|
|
22
|
-
|
|
23
|
-
// dom.select(el).on('submit', function (event) {
|
|
24
|
-
// event.preventDefault();
|
|
25
|
-
// import('./slapform-processor.js')
|
|
26
|
-
// .then(function (mod) {
|
|
27
|
-
// slapform = slapform || new mod.default;
|
|
28
|
-
// slapform.process(event);
|
|
29
|
-
// })
|
|
30
|
-
// });
|
|
31
|
-
|
|
32
|
-
// dom.select(el.querySelector('button[type="submit"]'))
|
|
33
|
-
// .removeAttribute('disabled')
|
|
34
|
-
// .removeClass('disabled');
|
|
35
|
-
// })
|
|
36
|
-
|
|
37
|
-
// // Setup Tracking
|
|
38
|
-
// var storage = Manager.storage();
|
|
39
|
-
// var auth = storage.get('user.auth') || {};
|
|
40
|
-
// var setup = false;
|
|
41
|
-
|
|
42
|
-
// if (auth && auth.uid && auth.email) {
|
|
43
|
-
// setupTracking(auth);
|
|
44
|
-
// }
|
|
45
|
-
|
|
46
|
-
// // Save user auth data
|
|
47
|
-
// Manager.auth().ready(function (user) {
|
|
48
|
-
// setupTracking(user);
|
|
49
|
-
|
|
50
|
-
// storage.set('user.auth.uid', user.uid);
|
|
51
|
-
// storage.set('user.auth.email', user.email);
|
|
52
|
-
// })
|
|
53
|
-
|
|
54
|
-
// function setupTracking(config) {
|
|
55
|
-
// if (setup) { return; }
|
|
56
|
-
|
|
57
|
-
// var tracking = window.Configuration.global.tracking;
|
|
58
|
-
// var phone = config.phone ? parseInt(config.phone.replace(/\+/ig, '')) : null;
|
|
59
|
-
|
|
60
|
-
// // Google Analytics
|
|
61
|
-
// gtag('set', 'user_id', config.uid);
|
|
62
|
-
|
|
63
|
-
// // Facebook Pixel
|
|
64
|
-
// fbq('init', tracking.facebookPixel, {
|
|
65
|
-
// external_id: config.uid,
|
|
66
|
-
// em: config.email,
|
|
67
|
-
// ph: phone,
|
|
68
|
-
// // fn: 'first_name',
|
|
69
|
-
// // ln: 'last_name',
|
|
70
|
-
// });
|
|
71
|
-
|
|
72
|
-
// // TikTok Pixel
|
|
73
|
-
// ttq.identify({
|
|
74
|
-
// external_id: config.uid || '',
|
|
75
|
-
// email: config.email || '',
|
|
76
|
-
// phone_number: phone ? '+' + phone : '',
|
|
77
|
-
// })
|
|
78
|
-
|
|
79
|
-
// setup = true;
|
|
80
|
-
// }
|
|
81
|
-
|