browser-extension-manager 1.3.25 → 1.3.27
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/commands/setup.js
CHANGED
|
@@ -14,6 +14,7 @@ const { minimatch } = require('minimatch');
|
|
|
14
14
|
const package = Manager.getPackage('main');
|
|
15
15
|
const project = Manager.getPackage('project');
|
|
16
16
|
const manifest = Manager.getManifest();
|
|
17
|
+
const rootPathProject = Manager.getRootPath('project');
|
|
17
18
|
|
|
18
19
|
// Dependency MAP
|
|
19
20
|
const DEPENDENCY_MAP = {
|
|
@@ -28,6 +29,7 @@ module.exports = async function (options) {
|
|
|
28
29
|
options.checkPeerDependencies = force(options.checkPeerDependencies || true, 'boolean');
|
|
29
30
|
options.setupScripts = force(options.setupScripts || true, 'boolean');
|
|
30
31
|
options.checkLocality = force(options.checkLocality || true, 'boolean');
|
|
32
|
+
options.migrate = options.migrate !== 'false';
|
|
31
33
|
|
|
32
34
|
// Log
|
|
33
35
|
logger.log(`Welcome to ${package.name} v${package.version}!`);
|
|
@@ -41,6 +43,11 @@ module.exports = async function (options) {
|
|
|
41
43
|
// Log current working directory
|
|
42
44
|
await logCWD();
|
|
43
45
|
|
|
46
|
+
// Run migrations
|
|
47
|
+
if (options.migrate) {
|
|
48
|
+
await migrate();
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
// Ensure this package is up-to-date
|
|
45
52
|
if (options.checkManager) {
|
|
46
53
|
await updateManager();
|
|
@@ -225,3 +232,56 @@ function logVersionCheck(name, installedVersion, latestVersion, isUpToDate) {
|
|
|
225
232
|
// Log
|
|
226
233
|
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')}`);
|
|
227
234
|
}
|
|
235
|
+
|
|
236
|
+
// Run migrations based on installed version
|
|
237
|
+
async function migrate() {
|
|
238
|
+
const installedVersion = project.devDependencies[package.name] || '0.0.0';
|
|
239
|
+
|
|
240
|
+
// Skip if using local version
|
|
241
|
+
if (installedVersion.startsWith('file:')) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Migrate hooks to nested structure (introduced in 0.0.185)
|
|
246
|
+
if (version.is(installedVersion, '<=', '1.0.0')) {
|
|
247
|
+
await migrateHooksToNestedStructure();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Migrate old hook files to new nested structure
|
|
252
|
+
async function migrateHooksToNestedStructure() {
|
|
253
|
+
const hooksDir = path.join(rootPathProject, 'hooks');
|
|
254
|
+
|
|
255
|
+
// Map of old file names to new paths
|
|
256
|
+
const migrations = [
|
|
257
|
+
{ old: 'build:post.js', new: 'build/post.js' },
|
|
258
|
+
{ old: 'build:pre.js', new: 'build/pre.js' },
|
|
259
|
+
{ old: 'middleware:request.js', new: 'middleware/request.js' },
|
|
260
|
+
];
|
|
261
|
+
|
|
262
|
+
let migratedCount = 0;
|
|
263
|
+
|
|
264
|
+
for (const migration of migrations) {
|
|
265
|
+
const oldPath = path.join(hooksDir, migration.old);
|
|
266
|
+
const newPath = path.join(hooksDir, migration.new);
|
|
267
|
+
|
|
268
|
+
// Check if old file exists
|
|
269
|
+
if (!jetpack.exists(oldPath)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Check if new file already exists
|
|
274
|
+
if (jetpack.exists(newPath)) {
|
|
275
|
+
logger.warn(`⚠️ Migrate ${migration.old}: ${migration.new} already exists`);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Move the file
|
|
279
|
+
jetpack.move(oldPath, newPath, { overwrite: true });
|
|
280
|
+
logger.log(`✅ Migrated hook: ${migration.old} → ${migration.new}`);
|
|
281
|
+
migratedCount++;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if (migratedCount > 0) {
|
|
285
|
+
logger.log(`✅ Migrated ${migratedCount} hook file(s) to new nested structure`);
|
|
286
|
+
}
|
|
287
|
+
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|