Review main Merged

73522[TASK] Use @typo3/ as ES6 module namespace

Benjamin Franzke CR +2 V +2 Impossible +46617 −46639 updated 02/16/22, 12:15

Commit message

Switch from TYPO3/CMS/ExtName/ to @typo3/ext-name/ module
namespace in all TypoScript modules in order to
use the common "scoped package" syntax as known from npmjs.

This will allow TYPO3 TypeScript declarations to be
published to @typo3/* packages on npmjs.com at some point,
allowing extension authors to require these as npm/yarn
dependencies to be able to use TypeScript type declarations
when developing against the TYPO3 JavaScript API.

While at it, the naming convention of JavaScript modules is
also switched to use lowercase-dashed form. This is to adhere
to the common used naming convention in the npm-world.
Also @typo3/core/ajax/ajax-request.js simply looks better than
a mixed form @typo3/core/Ajax/AjaxRequest.js would be.

All existing RequireJS module identifiers are mapped
to the new naming syntax in the requirejs-to-es6 bridge:
For example a requirejs call to
  TYPO3/CMS/T3editor/Element/CodeMirrorElement
will transparently be transformed to the new scheme:
  @typo3/t3editor/element/code-mirror-element.js

Manual modifications in:

  Build/Gruntfile.js
  Build/util/map-import.js
  Build/JSUnit/karma.conf.js
  Build/Sources/TypeScript/backend/Resources/Public/TypeScript/viewport/navigation-container.ts
  typo3/sysext/core/Resources/Public/JavaScript/requirejs-loader.js
  typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php
  typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package2/Configuration/JavaScriptModules.php
  typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package3/Configuration/JavaScriptModules.php
  typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php
  typo3/sysext/t3editor/Configuration/JavaScriptModules.php

All other changes have been automated with:

find Build/Sources/TypeScript/ -type f | \
    grep -v index.d.ts | \
    sed \
        -e 's:Build/Sources/TypeScript/:typo3/sysext/:' \
        -e 's:/Tests/:/Tests/JavaScript/:' \
        -e 's:/TypeScript/:/JavaScript/:' \
        -e 's:\.ts$:.js:' | \
    xargs git rm

find Build/Sources/TypeScript/ -type f | while read file
do
    newFilename=$(echo $file | sed \
        -e :loop1 -e 's:\(/Public/TypeScript\|/Tests\)\([0-9a-zA-Z/.]*\)/\([A-Z][A-Z]*\)\([0-9a-zA-Z/-]*\)\.ts:\1\2/\L\3\E\4.ts:' -e 't loop1' \
        -e :loop2 -e 's:\(/Public/TypeScript\|/Tests\)\([0-9a-zA-Z/.]*[a-z]\)\([A-Z][A-Z]*\)\([0-9a-zA-Z/-]*\)\.ts:\1\2-\L\3\E\4.ts:' -e 't loop2' \
        -e s:/Resources/Public/TypeScript/:/: \
        -e s:/Tests/:/tests/:
    )

    mkdir -p $(dirname "${newFilename}")
    [[ "$file" != "$newFilename" ]] && git mv "${file}" "${newFilename}"
done

cat << EOF > convert_uppercase_to_lowercase.sed
:loop1
s:\(TYPO3/CMS[0-9a-zA-Z/]*\)/\([A-Z]\)\([0-9a-zA-Z/-]*\.js\):\1/\l\2\3:
t loop1

:loop2
s:\(TYPO3/CMS[0-9a-zA-Z/]*[a-z]\)\([A-Z]\)\([0-9a-z/-]*\.js\):\1-\l\2\3:
t loop2

s:TYPO3/CMS/\([0-9a-z/-]*\.js\):@typo3/\1:g

:loop3
s:\(^import \|^import .* from \|import(\|declare module \)'\([0-9a-zA-Z/.]*\)/\([A-Z][A-Z]*\)\([0-9a-zA-Z/.-]*\)':\1'\2/\L\3\E\4':
t loop3

:loop4
s:\(^import \|^import .* from \|import(\|declare module \)'\([0-9a-zA-Z/.]*[a-z]\)\([A-Z][A-Z]*\)\([0-9a-z/.-]*\)':\1'\2-\L\3\E\4':
t loop4

:loop5
s:\(\* Module\:\{0,1\} \|\* @exports \|\* @module \)\([0-9a-zA-Z/.]*\)/\([A-Z][A-Z]*\)\([0-9a-zA-Z/.-]*\)$:\1\2/\L\3\E\4:
t loop5

:loop6
s:\(\* Module\:\{0,1\} \|\* @exports \|\* @module \)\([0-9a-zA-Z/.]*[a-z]\)\([A-Z][A-Z]*\)\([0-9a-z/.-]*\)$:\1\2-\L\3\E\4:
t loop6

s:\(^import '\|^import .* from '\|import('\|declare module '\|\* Module\:\{0,1\} \|\* @exports \|\* @module \)TYPO3/cms/\([0-9a-z/.-]*\):\1@typo3/\2:g

s:@typo3/rte_ckeditor:@typo3/rte-ckeditor:

s:TYPO3/CMS/Backend/Module/Iframe:@typo3/backend/module/iframe:
s:TYPO3/CMS/Backend/PageTree/PageTreeElement:@typo3/backend/page-tree/page-tree-element:
s:TYPO3/CMS/Backend/Tree/FileStorageTreeContainer:@typo3/backend/tree/file-storage-tree-container:
s:TYPO3/CMS/Impexp/ContextMenuActions:@typo3/impexp/context-menu-actions:
s:TYPO3/CMS/Install/chosen.jquery.min.js:@typo3/install/chosen.jquery.min.js:

s:Public/JavaScript/JavaScriptItemHandler.js:Public/JavaScript/java-script-item-handler.js:
s:Public/JavaScript/RequireJSConfigHandler.js:Public/JavaScript/require-jsconfig-handler.js:
s:Public/JavaScript/AdminPanel.js:Public/JavaScript/admin-panel.js:
EOF

git ls-tree --name-only -r HEAD | \
    grep -v dashboard/Documentation/ | \
    grep -v Documentation/Changelog/ | \
    grep -v Build/JSUnit/ | \
    xargs sed -i -f convert_uppercase_to_lowercase.sed

rm convert_uppercase_to_lowercase.sed

sed -i \
    -e 's:TYPO3/CMS/\([A-Z]\):@typo3/\l\1:' \
    -e 's:@typo3/rteCkeditor:@typo3/rte-ckeditor:' \
    typo3/sysext/*/Configuration/JavaScriptModules.php \
    typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/*/Configuration/JavaScriptModules.php

sed -i \
    -e "s/: \\(@typo3\\/.*\\)/: '\1\'/" \
    typo3/sysext/form/Configuration/Yaml/FormSetup.yaml

(cd Build; grunt build)

git add typo3/sysext/

Review

  • Code review CR +2 Done
    • Georg Ringer +2
    • Benni Mack +1
  • Verified V +2 Done
    • Georg Ringer +2
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 1232

Show 1212 more files

Review log 1526

Show 1 earlier messages
  1. Benjamin Franzke uploaded patch set 1 02/15/22, 13:25

  1. core-ci voted on patch set 1 V -1 02/15/22, 13:40 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23623

  2. Benjamin Franzke uploaded patch set 2 02/15/22, 14:18

  3. core-ci voted on patch set 2 V -1 02/15/22, 14:29 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23625

  4. Benjamin Franzke uploaded patch set 3 02/15/22, 15:01

  5. core-ci voted on patch set 3 V -1 02/15/22, 15:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23629

  6. core-ci commented on patch set 3 02/15/22, 15:30 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23629

  7. Benjamin Franzke uploaded patch set 4 02/15/22, 15:48

  8. core-ci voted on patch set 4 V +1 02/15/22, 16:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23633

  9. Benjamin Franzke updated the commit message in patch set 5 02/15/22, 16:11

  10. core-ci voted on patch set 5 V +1 02/15/22, 16:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23635

  11. Benjamin Franzke uploaded patch set 6 02/15/22, 17:00

  12. Benjamin Franzke uploaded patch set 7 02/15/22, 17:05

    Resolve Merge Conflict
  13. Benjamin Franzke wrote 02/15/22, 17:07

    Topic set to esm
  14. core-ci voted on patch set 6 V +1 02/15/22, 17:08 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23643

  15. core-ci voted on patch set 7 V +1 02/15/22, 17:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23644

  16. Benjamin Franzke uploaded patch set 8 02/15/22, 17:58

  17. core-ci voted on patch set 8 V -1 02/15/22, 18:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23648

  18. Benjamin Franzke uploaded patch set 9 02/15/22, 18:39

  19. core-ci voted on patch set 9 V +1 02/15/22, 18:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23650

  20. Benni Mack voted on patch set 9 V +1 CR +1 02/15/22, 20:35

  21. Benjamin Franzke uploaded patch set 10 02/16/22, 05:16

    Resolve Merge Conflict
  22. core-ci voted on patch set 10 V +1 02/16/22, 05:25 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/23702

  23. Benni Mack voted on patch set 10 V +1 CR +1 02/16/22, 06:54

  24. Georg Ringer voted on patch set 10 V +2 CR +2 02/16/22, 12:15

  25. Georg Ringer merged patch set 11 02/16/22, 12:15