adobe / aio-cli-plugin-asset-compute

Asset Compute Plugin for Adobe I/O Command Line Interface
Apache License 2.0
1 stars 7 forks source link

NUI-1501 make plugin compatible with new aio-cli v8 #66

Closed jdelbick closed 2 years ago

jdelbick commented 2 years ago

Description

Fixes # https://jira.corp.adobe.com/browse/NUI-1501

Note: goal of this PR (along with this fix) is to fix the plugin to work with the new aio structure, fixing the broken integration-tests. Follow up PRs will convert all the test projects and existing custom workers into the new aio structure.

Background

The new aio-cli v8 introduced breaking changes in our cli plugin:

$ aio app test                                                              
Using local project's @adobe/aio-cli-plugin-asset-compute version 1.5.0dx/asset-compute/worker/1/* (hook) - running tests...
No worker tests found in 'test/asset-compute/*'app:test results:
    √ dx/asset-compute/worker/1/* (hook)

These changes are mostly due to the new file structure introduced.

new-aio-filte-structure

From aio team:

The app structure is more flexible now, multiple extensions can be defined in the same root folder, and users can move configuration and code around. This means that asset-compute, just like aio app needs to support:

  • migrated legacy NUI apps
  • apps with NUI extensions generated in the src/dx-asset-compute-1/ subfolder after a fresh aio app init
  • apps with NUI extensions moved to another folder post init, as said users can reorganize all their code and configuration, there is no guarantee that the NUI code will be stored in the root or even under src/dx-asset-compute-1/, it can be anywhere!

Thankfully, we implemented a config loader that abstracts those corner cases away and exposes the needed paths and configuration bits https://github.com/adobe/aio-cli-plugin-app/blob/master/src/lib/config-loader.js

Changes

Heavily inspired by suggestions here: https://github.com/adobe/generator-aio-app/issues/157#issuecomment-891682315

Types of changes

Checklist:

adobe-bot commented 2 years ago
Sizewatcher found no problematic size increases.

git +0.2% (1.96 MB => 1.96 MB)
Largest files in new changes:
756380428f1c  728KiB package-lock.json
796234645a6d 706KiB package-lock.json
e86343d498e2 88KiB test-projects/aio-v8-multiple-workers/src/dx-asset-compute-worker-1/test/asset-compute/worker-1/test-worker-1/file.jpg
9061282845ad 20KiB test/commands/test-worker.test.js
40669c457832 18KiB test/commands/test-worker.test.js
c8117b9afc22 18KiB test/commands/test-worker.test.js
da88828b82ae 11KiB test/commands/run-worker.test.js
7b9a843cf3e6 11KiB test/commands/run-worker.test.js
a43de312d664 6.8KiB src/base-command.js
9c6de4237a2f 6.7KiB src/base-command.js
2a2b236f4589 6.7KiB src/base-command.js
c693810eb74c 6.6KiB src/base-command.js
6ca0c9c758fc 5.3KiB src/commands/asset-compute/test-worker.js
c8d53e241c59 2.8KiB test-projects/aio-v8-multiple-workers/README.md
3b24bc214d8d 2.5KiB package.json
659446117981 2.4KiB package.json
82698a3bb5d1 765B test-projects/aio-v8-multiple-workers/src/dx-asset-compute-worker-1/actions/worker-1/index.js
ea1a9d856627 742B test-projects/aio-v8-multiple-workers/src/dx-asset-compute-worker-1/ext.config.yaml
91b96bcdf9f2 520B test-projects/aio-v8-single-worker/src/dx-asset-compute-worker-1/ext.config.yaml
b8328121431f 450B test-projects/aio-v8-project/package.json
5182fb6c491d 387B test-projects/aio-v8-project/.gitignore
cd41f8e95ae0 134B test-projects/aio-v8-multiple-workers/package.json
be40fcbffd2d 101B test-projects/aio-v8-multiple-workers/app.config.yaml
f50928100a2b 66B test-projects/aio-v8-single-worker/src/dx-asset-compute-worker-1/test/asset-compute/worker/corrupt-input/params.json
12d73a0b8066 17B test-projects/aio-v8-multiple-workers/src/dx-asset-compute-worker-1/test/asset-compute/worker-1/test-worker-1/params.json
node_modules +0.4% (449 MB => 451 MB)
Largest production node modules:
┌───────────────────────────────┬────────────┬────────┐
│ name │ children │ size │
├───────────────────────────────┼────────────┼────────┤
│ @adobe/asset-compute-devtool │ 0 │ 18.32M │
├───────────────────────────────┼────────────┼────────┤
│ request │ 0 │ 0.54M │
├───────────────────────────────┼────────────┼────────┤
│ @adobe/aio-lib-runtime │ 0 │ 0.45M │
├───────────────────────────────┼────────────┼────────┤
│ js-yaml │ 0 │ 0.28M │
├───────────────────────────────┼────────────┼────────┤
│ @oclif/config │ 0 │ 0.15M │
├───────────────────────────────┼────────────┼────────┤
│ @oclif/plugin-help │ 0 │ 0.11M │
├───────────────────────────────┼────────────┼────────┤
│ @oclif/command │ 0 │ 0.06M │
├───────────────────────────────┼────────────┼────────┤
│ glob │ 0 │ 0.05M │
├───────────────────────────────┼────────────┼────────┤
│ requestretry │ 0 │ 0.05M │
├───────────────────────────────┼────────────┼────────┤
│ @adobe/aio-cli-lib-app-config │ 0 │ 0.04M │
├───────────────────────────────┼────────────┼────────┤
│ + 7 modules │ │ │
├───────────────────────────────┼────────────┼────────┤
│ 17 modules │ 0 children │ 20.17M │
└───────────────────────────────┴────────────┴────────┘
npm_package +2.2% (27.8 kB => 28.4 kB)
Package contents:
📦  @adobe/aio-cli-plugin-asset-compute@1.5.0
=== Tarball Contents ===
171B COPYRIGHT
11.3kB LICENSE
846B bin/run
12.9kB src/lib/actionrunner.js
6.8kB src/base-command.js
3.0kB src/lib/cloudfiles.js
1.8kB src/commands/asset-compute/devtool.js
1.0kB src/commands/asset-compute/index.js
3.1kB src/hooks/init.js
5.5kB src/lib/mockserver.js
7.7kB src/commands/asset-compute/run-worker.js
5.4kB src/commands/asset-compute/test-worker.js
4.7kB src/lib/testresults.js
21.2kB src/lib/testrunner.js
5.1kB src/lib/util.js
1.4kB src/lib/workerrunner.js
3.2kB oclif.manifest.json
2.5kB package.json
3.2kB CODE_OF_CONDUCT.md
5.8kB README.md
1.3kB src/lib/mock-crt/CertificateAuthorityCertificate.pem
=== Tarball Details ===
name: @adobe/aio-cli-plugin-asset-compute
version: 1.5.0
package size: 28.4 kB
unpacked size: 108.1 kB
shasum: 8e199c16483d0282c44697650a1230c38dc0f3b6
integrity: sha512-av0JNulID4L49[...]LTfIukZlOPfqQ==
total files: 21
Notes
- PR branch: `NUI-1501` @ fbee94eeb04dd1a5f78ebc2212f44266305dde7b - Base branch: `master` - Sizewatcher v1.2.0 - Effective Configuration: ```yaml limits: fail: 100% warn: 30% ok: '-10%' report: githubComment: true githubStatus: false comparators: {} ```

codecov[bot] commented 2 years ago

Codecov Report

Merging #66 (c59b405) into master (e917155) will increase coverage by 0.23%. The diff coverage is 96.87%.

:exclamation: Current head c59b405 differs from pull request most recent head fbee94e. Consider uploading reports for the commit fbee94e to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master      #66      +/-   ##
==========================================
+ Coverage   90.59%   90.82%   +0.23%     
==========================================
  Files          13       13              
  Lines         829      850      +21     
==========================================
+ Hits          751      772      +21     
  Misses         78       78              
Impacted Files Coverage Δ
src/base-command.js 93.50% <95.65%> (+1.70%) :arrow_up:
src/commands/asset-compute/test-worker.js 96.29% <100.00%> (+0.37%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a13a83a...fbee94e. Read the comment docs.

purplecabbage commented 2 years ago

This looks good to me!

adobe-bot commented 2 years ago

:tada: This PR is included in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: