11const repo = require ( './repository' ) ;
2- const { setArchiveBaseDir, createPackagesForTag, createPackageForTag} = require ( './package-modules' ) ;
3- const { compareTags, httpSlurp} = require ( './utils' ) ;
4-
5- /**
6- * package(s) | from | modules-folder | repo url
7- * ------------------------------------------------------------------------------------------------------------------
8- * magento core packages | 2.4.0 | 'app/code/Magento' | https://github.com/mage-os/mirror-magento2.git
9- * magento base package | | '' | special folder and exclude config
10- * magento framework packages | | ~ 'lib/internal' | special folders and exclude config
11- * ------------------------------------------------------------------------------------------------------------------
12- * magento security packages | 1.0.0 | '' | https://github.com/mage-os/mirror-security-package.git
13- * ------------------------------------------------------------------------------------------------------------------
14- * magento inventory packages | 1.0.3 | 'app/code/Magento' | https://github.com/mage-os/mirror-inventory.git
15- * | | | special exclude until 1.1.4
16- * magento inventory packages | 1.1.5 | '' | https://github.com/mage-os/mirror-inventory.git
17- * ------------------------------------------------------------------------------------------------------------------
18- * magento/zendframework1 | 1.13.0 | '' | https://github.com/mage-os/mirror-zf1.git
19- * | | | single package, but requires exclude config
20- * | | | version not in release composer.json files
21- * ------------------------------------------------------------------------------------------------------------------
22- */
23-
2+ const { compareTags} = require ( './utils' ) ;
3+ const {
4+ setArchiveBaseDir,
5+ createPackagesForTag,
6+ createPackageForTag,
7+ createMagentoCommunityEditionMetapackage,
8+ createMagentoCommunityEditionProject
9+ } = require ( './package-modules' ) ;
2410
2511const archiveBaseDir = 'archives' ;
2612
@@ -30,8 +16,24 @@ async function listTagsFrom(url, from) {
3016 return ( await repo . listTags ( url ) ) . filter ( tag => compareTags ( tag , from ) >= 0 ) ;
3117}
3218
19+ async function createMetaPackagesSinceTag ( url , from ) {
20+ const tags = await listTagsFrom ( url , from ) ;
21+ for ( const tag of tags ) {
22+ await createMagentoCommunityEditionMetapackage ( url , tag ) ;
23+ }
24+ return tags ;
25+ }
26+
27+ async function createProjectPackagesSinceTag ( url , from ) {
28+ const tags = await listTagsFrom ( url , from ) ;
29+ for ( const tag of tags ) {
30+ await createMagentoCommunityEditionProject ( url , tag ) ;
31+ }
32+ return tags ;
33+ }
34+
3335async function createPackagesSinceTag ( url , from , modulesPath , excludes ) {
34- const tags = await listTagsFrom ( url , from ) ;
36+ const tags = await listTagsFrom ( url , from ) ;
3537 for ( const tag of tags ) {
3638 await createPackagesForTag ( url , modulesPath , excludes , tag ) ;
3739 }
@@ -41,44 +43,61 @@ async function createPackagesSinceTag(url, from, modulesPath, excludes) {
4143async function createPackageSinceTag ( url , from , modulesPath , excludes , composerJsonUrl ) {
4244 const tags = await listTagsFrom ( url , from ) ;
4345 for ( const tag of tags ) {
44- await createPackageForTag ( url , modulesPath , excludes , tag , composerJsonUrl . replace ( '{{version}}' , tag ) ) ;
46+ await createPackageForTag ( url , modulesPath , excludes , tag , ( composerJsonUrl || '' ) . replace ( '{{version}}' , tag ) ) ;
4547 }
4648 return tags ;
4749}
4850
4951( async function ( ) {
5052 let tags , exclude , composerJsonUrl ;
5153
52- exclude = [ ] ;
53- tags = await createPackagesSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , 'app/code/Magento' , exclude )
54- console . log ( 'app/code/Magento modules' , tags )
55-
56- exclude = [ ".github/" , "app/code/" , "app/design/frontend/" , "app/design/adminhtml/" , "app/i18n/" , "lib/internal/Magento/Framework/" , "composer.lock" ] ;
57- composerJsonUrl = 'https://raw.githubusercontent.com/mage-os/magento2-base-composer-json/main/{{version}}/magento2-base/composer.json' ;
58- tags = await createPackageSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , '' , exclude , composerJsonUrl )
59- console . log ( 'magento/magento2-base' , tags )
60-
61- exclude = [ 'lib/internal/Magento/Framework/Amqp/' , 'lib/internal/Magento/Framework/Bulk/' , 'lib/internal/Magento/Framework/MessageQueue/' ] ;
62- tags = await createPackageSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , 'lib/internal/Magento/Framework' , exclude )
63- console . log ( 'magento/framework' , tags )
64-
65- exclude = [ ] ;
66- tags = await createPackageSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , 'lib/internal/Magento/Framework/Amqp' , exclude )
67- console . log ( 'magento/framework-amqp' , tags )
68-
69- exclude = [ ] ;
70- tags = await createPackageSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , 'lib/internal/Magento/Framework/Bulk' , exclude )
71- console . log ( 'magento/framework-bulk' , tags ) ;
72-
73- exclude = [ ] ;
74- tags = await createPackageSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' , 'lib/internal/Magento/Framework/MessageQueue' , exclude )
75- console . log ( 'magento/framework-message-queue' , tags )
76-
77- exclude = [ '.github/' , '_metapackage/' ] ;
78- tags = await createPackagesSinceTag ( 'https://github.com/mage-os/mirror-security-package.git' , '1.0.0' , '' , exclude )
79- console . log ( 'security packages' , tags )
54+ // exclude = [];
55+ // tags = await createPackagesSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', 'app/code/Magento', exclude)
56+ // console.log('app/code/Magento modules', tags)
57+ //
58+ // exclude = [".github/", "app/code/", "app/design/frontend/", "app/design/adminhtml/", "app/i18n/", "lib/internal/Magento/Framework/", "composer.lock"];
59+ // composerJsonUrl = 'https://raw.githubusercontent.com/mage-os/magento2-base-composer-json/main/{{version}}/magento2-base/composer.json';
60+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', '', exclude, composerJsonUrl)
61+ // console.log('magento/magento2-base', tags)
62+ //
63+ // exclude = ['lib/internal/Magento/Framework/Amqp/', 'lib/internal/Magento/Framework/Bulk/', 'lib/internal/Magento/Framework/MessageQueue/'];
64+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', 'lib/internal/Magento/Framework', exclude)
65+ // console.log('magento/framework', tags)
66+ //
67+ // exclude = [];
68+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', 'lib/internal/Magento/Framework/Amqp', exclude)
69+ // console.log('magento/framework-amqp', tags)
70+ //
71+ // exclude = [];
72+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', 'lib/internal/Magento/Framework/Bulk', exclude)
73+ // console.log('magento/framework-bulk', tags);
74+ //
75+ // exclude = [];
76+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-magento2.git', '2.4.0', 'lib/internal/Magento/Framework/MessageQueue', exclude)
77+ // console.log('magento/framework-message-queue', tags)
78+ //
79+ // exclude = ['.github/', '_metapackage/'];
80+ // tags = await createPackagesSinceTag('https://github.com/mage-os/mirror-security-package.git', '1.0.0', '', exclude)
81+ // console.log('security packages', tags)
82+ //
83+ // exclude = ['.github/', '_metapackage/', 'dev/'];
84+ // tags = await createPackagesSinceTag('https://github.com/mage-os/mirror-inventory.git', '1.1.5', '', exclude)
85+ // console.log('inventory packages', tags)
86+
87+ // exclude = [];
88+ // tags = await createPackageSinceTag('https://github.com/mage-os/mirror-composer-root-update-plugin.git', '1.0.0', 'src/Magento/ComposerRootUpdatePlugin', exclude)
89+ // console.log('mirror-composer-root-update-plugin', tags)
90+ //
91+ // exclude = [];
92+ // tags = await createPackageSinceTag('https://github.com/mage-os/composer-dependency-version-audit-plugin.git', '0.1.0', '', exclude)
93+ // console.log('composer-dependency-version-audit-plugin', tags)
94+
95+ // create metapackage
96+ tags = await createMetaPackagesSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' ) ;
97+ console . log ( 'product-community-edition metapackage' , tags ) ;
98+
99+ // create project package
100+ tags = await createProjectPackagesSinceTag ( 'https://github.com/mage-os/mirror-magento2.git' , '2.4.0' ) ;
101+ console . log ( 'project-community-edition' , tags ) ;
80102
81- exclude = [ '.github/' , '_metapackage/' , 'dev/' ] ;
82- tags = await createPackagesSinceTag ( 'https://github.com/mage-os/mirror-inventory.git' , '1.1.5' , '' , exclude )
83- console . log ( 'inventory packages' , tags )
84103} ) ( )
0 commit comments