Skip to content

Fixes #270 - Unable to generate static subscriptions when using npm package

Anton Smirnov requested to merge 270-scripts_as_dep into master

Blocked by adblockpluscore!649 (merged).

The changes helps the fs referencing issue as it's npm who creates a symlinks and uses them with "npm exec".

The public API stays the same.

This is how it can be tested:

echo "{}" > package.json
npm i git+https://gitlab.com/eyeo/adblockplus/abc/webext-sdk.git#25d9d47a3d5ced39e02720143877ecc72bf5fc47
npm run --prefix node_modules/@eyeo/webext-sdk subs-init
npm run --prefix node_modules/@eyeo/webext-sdk subs-merge
npm run --prefix node_modules/@eyeo/webext-sdk subs-fetch
npm run --prefix node_modules/@eyeo/webext-sdk subs-convert
npm run --prefix node_modules/@eyeo/webext-sdk subs-generate

or (equivalent)

npm exec updateSubscriptions -- -t mv3
npm exec mergeSubscriptions
npm exec fetchSubscriptions
npm exec convertSubscriptions
npm exec generateSubscriptionsFragment

It will generate DNR files in "./node_modules/@eyeo/webext-sdk/subscriptions" and json template file "./node_modules/@eyeo/webext-sdk/subscriptions/rules.json.tpl" to be added to "manifest.json".

Note: all the rulesets are disabled by default. We're going to write an additional code to enable the subscriptions that correspond to the current user's locale (similar to what is done for MV2). For now it requires manual editing of the file (replace "enabled": false, to "enabled": true,).

For the full actual testing you might edit the fetched rules and add a rule from testpages for instance, pack the webext, deploy it to browser and navigate to testpage. The expectedly blocked element should be hidden as usual.

This is my output:

/tmp/270-bin asmirnov
> npm run --prefix node_modules/@eyeo/webext-sdk subs-init

> @eyeo/webext-sdk@0.4.0 subs-init
> npm exec updateSubscriptions -- -t mv3

Downloading https://filter-delivery-staging.eyeo.com/v3/index.json to build/data/subscriptions_mv3.json ...
Subscriptions file (build/data/subscriptions_mv3.json) generated.
/tmp/270-bin asmirnov
> npm run --prefix node_modules/@eyeo/webext-sdk subs-merge

> @eyeo/webext-sdk@0.4.0 subs-merge
> npm exec mergeSubscriptions -- -i build/data/subscriptions_mv3.json -o ./custom-subscriptions.json

/tmp/270-bin asmirnov
> npm run --prefix node_modules/@eyeo/webext-sdk subs-fetch

> @eyeo/webext-sdk@0.4.0 subs-fetch
> npm exec fetchSubscriptions -- -i ./custom-subscriptions.json

Downloading started
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easyprivacy.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/fanboy-notifications.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/exceptionrules.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/abpindo.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/abpvn.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/bulgarian_list.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/dandelion_sprouts_nordic_filters.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistczechslovak.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistdutch.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistgermany.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistitaly.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistlithuania.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistpolish.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistportuguese.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistspanish.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/fanboy-social.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/i_dont_care_about_cookies.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/indianlist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/israellist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_israellist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/koreanlist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/latvianlist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/liste_ar.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/liste_fr.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/rolist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_rolist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/ruadlist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistspanish+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/ruadlist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/liste_fr+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistportuguese+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistgermany+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistpolish+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistitaly+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistczechslovak+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/liste_ar+liste_fr+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/abpvn+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistdutch+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/koreanlist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/rolist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/abpindo+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/israellist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistlithuania+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/bulgarian_list+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/latvianlist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/dandelion_sprouts_nordic_filters+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/indianlist+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/exceptionrules-privacy-friendly.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt ...
Downloading https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/nocoin.txt to build/data/subscriptions/ABP/https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistchina.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/easylistchina+easylist.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/abp-filters-anti-cv.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/cjx-annoyance.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt ...
Downloading https://easylist-downloads.adblockplus.org/v3/full/fanboy-annoyance.txt to build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt ...
Downloading finished
/tmp/270-bin asmirnov
> 
/tmp/270-bin asmirnov
> 
/tmp/270-bin asmirnov
> npm run --prefix node_modules/@eyeo/webext-sdk subs-convert

> @eyeo/webext-sdk@0.4.0 subs-convert
> node scripts/convertSubscriptions.js -i build/data/subscriptions/ABP/

Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_israellist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_israellist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_rolist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_rolist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt.json ...
Converting build/data/subscriptions/ABP/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt to subscriptions/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt.json ...
Converting build/data/subscriptions/ABP/https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt to subscriptions/https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt.json ...
/tmp/270-bin asmirnov
> npm run --prefix node_modules/@eyeo/webext-sdk subs-generate

> @eyeo/webext-sdk@0.4.0 subs-generate
> node scripts/generateSubscriptionsFragment.js

Web extension manifest fragment file (subscriptions/rules.json.tpl) generated.
/tmp/270-bin asmirnov
> find . -name rules.json.tpl
./node_modules/@eyeo/webext-sdk/subscriptions/rules.json.tpl
/tmp/270-bin asmirnov
> cat ./node_modules/@eyeo/webext-sdk/subscriptions/rules.json.tpl
{
  "rule_resources": [
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_israellist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_israellist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_rolist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_rolist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt.json"
    },
    {
      "id": "https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt",
      "enabled": false,
      "path": "subscriptions/https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt.json"
    },
    {
      "id": "https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt",
      "enabled": false,
      "path": "subscriptions/https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt.json"
    }
  ]
}/tmp/270-bin asmirnov
> subl node_modules/@eyeo/webext-sdk/subscriptions
/tmp/270-bin asmirnov
> ls node_modules/@eyeo/webext-sdk/subscriptions
.
..
https___easylist_downloads_adblockplus_org_v3_full_abp_filters_anti_cv_txt.json
https___easylist_downloads_adblockplus_org_v3_full_abpindo_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_abpindo_txt.json
https___easylist_downloads_adblockplus_org_v3_full_abpvn_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_abpvn_txt.json
https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_bulgarian_list_txt.json
https___easylist_downloads_adblockplus_org_v3_full_cjx_annoyance_txt.json
https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_dandelion_sprouts_nordic_filters_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistchina_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistchina_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistczechslovak_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistdutch_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistgermany_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistitaly_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistlithuania_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistpolish_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistportuguese_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easylistspanish_txt.json
https___easylist_downloads_adblockplus_org_v3_full_easyprivacy_txt.json
https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_privacy_friendly_txt.json
https___easylist_downloads_adblockplus_org_v3_full_exceptionrules_txt.json
https___easylist_downloads_adblockplus_org_v3_full_fanboy_annoyance_txt.json
https___easylist_downloads_adblockplus_org_v3_full_fanboy_notifications_txt.json
https___easylist_downloads_adblockplus_org_v3_full_fanboy_social_txt.json
https___easylist_downloads_adblockplus_org_v3_full_i_dont_care_about_cookies_txt.json
https___easylist_downloads_adblockplus_org_v3_full_indianlist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_indianlist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_israellist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_israellist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_koreanlist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_koreanlist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_latvianlist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_latvianlist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_liste_ar_liste_fr_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_liste_ar_txt.json
https___easylist_downloads_adblockplus_org_v3_full_liste_fr_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_liste_fr_txt.json
https___easylist_downloads_adblockplus_org_v3_full_rolist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_rolist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_ruadlist_easylist_txt.json
https___easylist_downloads_adblockplus_org_v3_full_ruadlist_txt.json
https___raw_githubusercontent_com_hoshsadiq_adblock_nocoin_list_master_nocoin_txt.json
rules.json.tpl
/tmp/270-bin asmirnov

Note customizing the script argument is a bit tricky. If you try to override the passed argument it will not work as it will be handled by "yargs" as array passed for the key, eg (-o overriden):

npm run --prefix node_modules/@eyeo/webext-sdk subs-merge -- -o /tmp/output.json

> @eyeo/webext-sdk@0.4.0 subs-merge
> npm exec mergeSubscriptions -- -i build/data/subscriptions_mv3.json -o ./custom-subscriptions.json "-o" "/tmp/output.json"

node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received an instance of Array
    at open (node:internal/fs/promises:503:10)
    at writeFile (node:internal/fs/promises:824:20)
    at merge (/private/tmp/270-bin2/node_modules/adblockpluscore/scripts/mergeSubscriptions.js:42:9)
    at async main (/private/tmp/270-bin2/node_modules/adblockpluscore/scripts/mergeSubscriptions.js:85:3) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v17.9.0

But in some particular cases it will work (as it's indeed an array is accepted originally):

npm run --prefix node_modules/@eyeo/webext-sdk subs-merge -- -i /tmp/subscriptions_mv3.json

> @eyeo/webext-sdk@0.4.0 subs-merge
> npm exec mergeSubscriptions -- -i build/data/subscriptions_mv3.json -o ./custom-subscriptions.json "-i" "/tmp/subscriptions_mv3.json"

Above is an example which is very likely to happen on practise.

Closes #270 (closed)

Edited by Anton Smirnov

Merge request reports