Giter VIP home page Giter VIP logo

one-app-cli's Introduction

One App CLI - One Amex

Tests lerna

A set of command line interface (CLI) tools for bundling One App, its modules, and property files(locale and environment specific files).

👩‍💻 Hiring 👨‍💻

Want to get paid for your contributions to one-app-cli?

Send your resume to [email protected]

📖 Table of Contents

📦 Packages

This codebase has the following packages:

Name Description
eslint-plugin-one-app eslint plugin that exports rules related to One App usage
one-app-bundler CLI to bundle one-app modules
one-app-dev-bundler An alternate ESBuild bundler for development environments. This is a sub-package of the one-app-bundler.
one-app-locale-bundler CLI to bundle locale and environment JSON files
one-app-runner CLI tool for running One App locally

🏆 Contributing

We welcome Your interest in the American Express Open Source Community on Github. Any Contributor to any Open Source Project managed by the American Express Open Source Community must accept and sign an Agreement indicating agreement to the terms below. Except for the rights granted in this Agreement to American Express and to recipients of software distributed by American Express, You reserve all right, title, and interest, if any, in and to Your Contributions. Please fill out the Agreement.

Please feel free to open pull requests and see CONTRIBUTING.md to learn how to get started contributing.

🗝️ License

Any contributions made under this project will be governed by the Apache License 2.0.

🗣️ Code of Conduct

This project adheres to the American Express Community Guidelines. By participating, you are expected to honor these guidelines.

one-app-cli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

one-app-cli's Issues

one-app-dev-bundler: externals support generates a lot of .esbuild-stats files

🐞 Bug Report

Describe the bug

With externals support in the one-app-dev-bundler, two .esbuild-stats files are created for every external and dumped in the top-level dir of your project. Even though they are prefixed with a dot and are hidden, many IDEs show all the hidden files.

To Reproduce

  1. Build a module with bundle-module --dev using this config:
    "bundler": {
      "requiredExternals": [
        "iguazu",
        "iguazu-holocron",
        "iguazu-rpc",
        "iguazu-rest"
      ]
    },
  1. These file are generated:
.esbuild-stats.browser.json
.esbuild-stats.iguazu-holocron.browser.json
.esbuild-stats.iguazu-holocron.node.json
.esbuild-stats.iguazu-rest.browser.json
.esbuild-stats.iguazu-rest.node.json
.esbuild-stats.iguazu-rpc.browser.json
.esbuild-stats.iguazu-rpc.node.json
.esbuild-stats.iguazu.browser.json
.esbuild-stats.iguazu.node.json
.esbuild-stats.node.json

Expected behavior

Ideally these build related filed would be placed in a hidden/ignored subdirectory.

Earlier versions of the dev bundler only generated two files total which was tolerable.

System information

└─┬ @americanexpress/[email protected]
  └── @americanexpress/[email protected]

one-app-runner: v6.16.1 does not work with older versions of One App

🐞 Bug Report

Describe the bug

When using the [email protected] docker image and [email protected], the one-app-runner gets an error when starting up the server.

> node scripts/set-dev-endpoints.js "/opt/module-workspace/my-module/dev.endpoints.js"

Successfully linked dev endpoints file to app
node: bad option: --dns-result-order=ipv4first
node: bad option: --no-experimental-fetch

[email protected] works fine.
[email protected] running on node 16 works fine.

This was probably caused by #586.

To Reproduce

  1. Set the dockerImage to "one-app-dev:5.11.6" in the package.json.
  2. Install @americanexpress/[email protected]
  3. Run a script that runs one-app-runner command.
  4. Error given above is shown and One App isn't started.

Expected behavior

One App should start up.

dev bundler error when run in production mode is unclear

🐞 Bug Report

Describe the bug

If the dev bundler is run when NODE_ENV is not set to "development", the error message says to raise an issue. It would be more helpful to suggest that you should set NODE_ENV to "development".

To Reproduce

$ unset NODE_ENV
$ npm run build
...
bundle-module --dev

Running dev bundler

  _____ _______ ____  _____  
 / ____|__   __/ __ \|  __ \ 
| (___    | | | |  | | |__) |
 \___ \   | | | |  | |  ___/ 
 ____) |  | | | |__| | |     
|_____/   |_|  \____/|_|     

This bundler is only enabled for local development. If you see this message please raise an issue

Expected behavior

This bundler is only enabled for local development.  Please verify that NODE_ENV variable is set to "development".

Bundling with semantic-ui-css breaks bundler

🐞 Bug Report

Describe the bug

While following the Get Started docs for semantic-ui-react, I ran into an issue with importing their css from their semantic-ui-css library.

To Reproduce

  1. Create a module (in my case I created a root module)
npx -p yo -p @americanexpress/generator-one-app-module -- yo @americanexpress/one-app-module
  1. npm i -S semantic-ui-react semantic-ui-css
  2. Inside your root module's .jsx file import the css import 'semantic-ui-css/semantic.min.css'
  3. Run npm run build or npm run watch:build
  4. See error in terminal

Expected behavior

As a developer using One App, I should be able to use semantic-ui-react along with their css library.

Actual Behavior

Show Error Stack
./node_modules/semantic-ui-css/themes/default/assets/fonts/icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 6:36-87
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/outline-icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 11:36-95
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/brand-icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 16:37-94
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 5:36-88
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/outline-icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 10:36-96
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/brand-icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 15:37-95
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
asset size limit: The following asset(s) exceed the recommended size limit (195 KiB).
This can impact web performance.
Assets: 
  suburbify-root.legacy.browser.js (4.43 MiB) undefined
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (4.43 MiB)
      suburbify-root.legacy.browser.js
 undefined
webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/ undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 6:36-87
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/outline-icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 11:36-95
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/brand-icons.woff
Module build failed (from ./node_modules/url-loader/dist/cjs.js):
Error: Cannot find module 'file-loader'
Require stack:
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js
- D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\cjs.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\loadLoader.js
- D:\Coding\suburbify\suburbify-root\node_modules\loader-runner\lib\LoaderRunner.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModule.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\NormalModuleFactory.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\Compiler.js
- D:\Coding\suburbify\suburbify-root\node_modules\webpack\lib\webpack.js
- D:\Coding\suburbify\suburbify-root\node_modules\@americanexpress\one-app-bundler\bin\bundle-module.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.loader (D:\Coding\suburbify\suburbify-root\node_modules\url-loader\dist\index.js:120:20)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 16:37-94
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/outline-icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 10:36-96
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 5:36-88
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
./node_modules/semantic-ui-css/themes/default/assets/fonts/brand-icons.woff2 1:4
Module parse failed: Unexpected character '' (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders    
(Source code omitted for this binary file)
 @ ./node_modules/semantic-ui-css/semantic.min.css (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/@americanexpress/purgecss-loader/loader.js??ref--8-2!./node_modules/sass-loader/dist/cjs.js??ref--8-3!./node_modules/semantic-ui-css/semantic.min.css) 15:37-95
 @ ./node_modules/semantic-ui-css/semantic.min.css
 @ ./src/index.js undefined
asset size limit: The following asset(s) exceed the recommended size limit (195 KiB).
This can impact web performance.
Assets: 
  suburbify-root.browser.js (4.41 MiB) undefined
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (4.41 MiB)
      suburbify-root.browser.js
 undefined
webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/ undefined

System information

System:

  • OS: Windows 10 10.0.19041
  • CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  • Memory: 4.65 GB / 15.95 GB

Binaries:

  • Node: 12.17.0 - C:\Program Files\nodejs\node.EXE
  • Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
  • npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD

Additional context

npmPackages:

  • @americanexpress/one-app-bundler: ^6.6.0 => 6.6.0
  • @americanexpress/one-app-ducks: ^4.1.0 => 4.1.0
  • @americanexpress/one-app-runner: ^6.6.0 => 6.6.0
  • @commitlint/cli: ^8.3.5 => 8.3.5
  • @commitlint/config-conventional: ^8.3.4 => 8.3.4
  • babel-preset-amex: ^3.4.0 => 3.4.0
  • content-security-policy-builder: ^2.1.0 => 2.1.0
  • eslint: ^7.2.0 => 7.2.0
  • eslint-config-amex: ^12.2.0 => 12.2.0
  • glob: ^7.1.6 => 7.1.6
  • holocron: ^1.0.0 => 1.1.0
  • holocron-module-route: ^1.0.0 => 1.1.0
  • husky: ^4.2.3 => 4.2.5
  • iguazu: ^3.0.2 => 3.0.2
  • iguazu-holocron: ^1.1.0 => 1.1.0
  • immutable: ^4.0.0-rc.12 => 4.0.0-rc.12
  • ip: ^1.1.5 => 1.1.5
  • prop-types: ^15.7.2 => 15.7.2
  • react: ^16.13.0 => 16.13.1
  • react-dom: ^16.13.0 => 16.13.1
  • react-helmet: ^6.0.0 => 6.0.0
  • react-intl: ^4.6.9 => 4.6.9
  • react-redux: ^7.2.0 => 7.2.0
  • redux: ^4.0.5 => 4.0.5
  • rimraf: ^3.0.2 => 3.0.2
  • semantic-ui-css: ^2.4.1 => 2.4.1
  • semantic-ui-react: ^0.88.2 => 0.88.2

npmGlobalPackages:

  • npm: 6.14.5
  • yarn: 1.22.4

one-app-bundler has dependency on old version of glob-parent

🐞 Bug Report

Describe the bug

@americanexpress/one-app-bundler is dependent on [email protected] which is six years old and has security vulnerabilities.

To Reproduce

Run npm ls glob-parent from a repo using one-app-bundler.

│ └─┬ [email protected]
│   └─┬ [email protected]
│     └─┬ [email protected]
│       └─┬ [email protected]
│         └── [email protected]

Expected behavior

The package should be dependent on more recent versions of dependencies, especially for non-dev deps.

Tree shaking does not work in One App module

I'm building a React component library that bundles with esbuild. My bundle is tree shakable in a create-react-app, but it is not tree shaken when imported into a One App module. I checked the browser build files and see unused components included in the bundle.

I discussed the issue with Michael Rochester, and he suggested I raise an issue to document this.

Holocron-dev-server moduleEntryRegExp doesn't recognise windows style paths

🐞 Bug Report

Describe the bug

When running under windows the holocron-dev-server doesn't match the path against the moduleEntryRegExp when looking for index.js because the regex is targetted at linux filesystems.

To Reproduce

Create a root module, add the dev server as per the instructions and run within Windows. Instead of loading the module correctly, a blank page is shown and an error in the console.

Expected behavior

The module should be rendered.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

node 14.18
OS: Windows
Version of holocron-dev-server: 0.0.1

Additional context

replacing the regex with this solves the problem:
export const moduleEntryRegExp = /[/\]src[/\]index.js$/;

Add a watch mode to one app runner

💡 Feature request

Is your feature request related to a problem? Please describe

When serving a module locally one has to have different tabs open in order to have watch mode for module changes. This is a pain.

Describe the solution you'd like

As a developer running one-app-runner I should have the option to enable watch mode and all the modules I am currently serving and working on. This should work for server side, client side, lang pack, and css changes.

feat(bundler): Allow bundler to conditionally omit legacy assets

💡 Feature request

Is your feature request related to a problem? Please describe

Currently, there is not a way to opt out of generating the legacy asset when building with one app bundler.
Build time for prod, watch:build and development is slower when generating the entire build collection produced today.
Including the legacy asset increases our bundle size limit because it includes the legacy bundle which does not always need to be supported for every project which can cause your module to exceed the bundle size limit even when that legacy bundle is never used.

Example

Stats generated from one of our modules.

Production Build Time: 11 seconds modern asset, 16-17 seconds with legacy asset.
Development Build Time: 16 seconds modern asset, 23-25 seconds with legacy asset.
watch:build Time: ~3-4 second reduction.

Describe the solution you'd like

Have the ability to pass a flag to the build command which will skip the legacy asset generation. Output will be: .node, .browser, .manifest.
An invalid flag or no flag will generate the entire asset bundle with .node, .browser, .legacyBrowser, .manifest.

Describe alternatives you've considered

N/A

Additional context

How to test:

Navigate to packages/one-app-bundler.
Run npm pack.
Install that package in your module.
Delete all the .webpack-* and .manifest files.
Update your package.json bundler config to use: "bundler": { "disableLegacy": true }
Run npm build.
Time the build times for production, development.
Repeat the steps, but without "bundler": { "disableLegacy": false }
Compare build times.

Remove legacy support from one app bundler

💡 Feature request

Is your feature request related to a problem? Please describe

A clear and concise description of what you want and what your use case is.
I would like to remove legacy support from the build in the one app bundler to help reduce unnecessary bundle size and increase performance.

Example

Please include a basic code example of the new feature. Skip this section if not applicable.
Our amex modules tend to become a little bloated even with a few techniques to reduce bundle size and the support from one app provides. Across a few internal teams, there has been a lot of support to remove the legacy support.

Describe the solution you'd like

A clear and concise description of what you want to happen.
Remove the legacy build from webpack configuration so we only generate the modern build. This will ideally help modules performance and bundle size.

Describe alternatives you've considered

A clear and concise description of any alternative solutions or features you've considered.
One App built in bundle support, dedupe, import techniques, tree shaking, modular imports, etc

Additional context

Add any other context or screenshots about the feature request here.💡

Path not handled correctly on Windows

🐞 Bug Report

Describe the bug

When running npm build where bundle-module is the only thing in that script on a Windows machine, it cannot resolve the path to css-base.js. You get the following error in the terminal Can't resolve 'D:Codingmy-apartmentmy-apartment-rootode_modules@americanexpressone-app-bundlerwebpackloadersssr-css-loadercss-base.js' in 'D:\Coding\my-apartment\my-apartment-root\src'

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to https://github.com/JamesSingleton/my-apartment-root
  2. Clone the repo on a Windows machine
  3. Run npm install
  4. Run npm build
  5. See error in terminal

Expected behavior

The build should build as expected.

System information

  • OS: Windows
  • Version of one-app-cli: 6.0.0 (one-app-bundler)
  • Node version: >= 12

Additional context

I believe this is due to not stringifying the path, everywhere it is included. JSON.stringify is used here: https://github.com/americanexpress/one-app-cli/blob/master/packages/one-app-bundler/webpack/loaders/ssr-css-loader/index.js#L19 but not here: https://github.com/americanexpress/one-app-cli/blob/master/packages/one-app-bundler/webpack/loaders/ssr-css-loader/index-style-loader.js#L17

one-app-runner: npm upgrade notice is printed on every launch

🐞 Bug Report

Describe the bug

npm prints an upgrade notice on every startup via one-app-runner.

> @americanexpress/[email protected] serve-module
> serve-module /opt/module-workspace/my-module

npm notice 
npm notice New major version of npm available! 9.6.7 -> 10.2.4
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.2.4
npm notice Run npm install -g [email protected] to update!
npm notice 

> @americanexpress/[email protected] set-middleware
> set-middleware /opt/module-workspace/my-module/dev.middleware.js

To Reproduce

  1. Start up One App 6.8.2 using one-app-runner.

Expected behavior

This shouldn't be printed since One App is running inside a docker container so there is no way for the user to upgrade the npm version.

Add "offline" mode to one-app-runner for using local docker image

💡 Feature request

Would be nice to be able to use a local docker image for one-app-runner, rather than always trying to pull an image from a registry.

Is your feature request related to a problem? Please describe

Current process blocks you from working offline, even if you already have downloaded the docker image. Same if you temporarily don't / no longer have access to the registry.

Describe the solution you'd like

A flag to use an "offline" mode, which doesn't run the docker pull part of the script.

one-app-dev-bundler has dependency on old major version of cssnano

🐞 Bug Report

Describe the bug

one-app-dev-bundler has a dependency on an old major version of cssnano which is was last updated in April 2021:
https://www.npmjs.com/package/cssnano/v/4.1.11

Current version:
https://www.npmjs.com/package/cssnano/v/6.0.0

This old version has an eventual dependency on a version of nth-check with a high sev CVE:
GHSA-rp65-9cf3-cjxr

│ ├─┬ @americanexpress/[email protected]
│ │ └─┬ [email protected]
│ │   └─┬ [email protected]
│ │     └─┬ [email protected]
│ │       └─┬ [email protected]
│ │         └─┬ [email protected]
│ │           └── [email protected]

To Reproduce

$ npm ls cssnano
...
└─┬ @americanexpress/[email protected]
  └─┬ @americanexpress/[email protected]
    └── [email protected]

Expected behavior

Direct dependencies should be on the current major version if at all possible.

Screenshots

If applicable, add screenshots to help explain your problem.

dev-bundler error reporting is too verbose

🐞 Bug Report

Describe the bug

If the dev-bundler catches an error, it prints a couple of lines of useful reporting, and four screens of useless stack traces pointing to esbuild code.

To Reproduce

  1. Run the bundler in dev mode.
  2. Change an import to point to an undefined file.
  3. See three lines of useful error trace followed by three screens of unrelated error traces.

Expected behavior

Only relevant errors should be logged.

Screenshots

Screen Shot 2023-04-04 at 12 16 20 PM

css imports are not bundled properly in tsx files

🐞 Bug Report

Describe the bug

Styles imported from css in tsx files are not being handled properly by the webpack based bundler.

To Reproduce

  1. Have code similar to this in a tsx file:
import styles from './styles.css';
...
  return (
    <div className={`${style.marginTop50} ${style.globalBackgroundHeight}`}>
      {children}
    </div>
  );
  1. Run the bundler.
  2. Output in the browser has a classname of "undefined undefined".

Expected behavior

CSS import should be handled properly by css loader.

If you change the extension from "tsx" to "jsx", it works properly.

locale-bundler should not stop on errors in watch mode

🐞 Bug Report

Describe the bug

When running locale-bundler in watch mode, it should not stop watching when there are errors.

To Reproduce

  1. Run bundle-module --dev --watch
  2. Edit the locale file to have invalid JSON.
  3. locale-bundler throws an error and stops monitoring.

(This most commonly happens when you are editing the JSON and you have an IDE that saves when you tab away.)

Expected behavior

The error should be logged but if the JSON is fixed, it should be bundled again.

one-app-bundler: eslint-loader is deprecated in favor of eslint-webpack-plugin

💡 Feature request

Deprecate eslint-loader in favor of eslint-webpack-plugin.

A clear and concise description of what you want and what your use case is.

Example

Please include a basic code example of the new feature. Skip this section if not applicable.

My team is undertaking dependency management and as part of that, we are attempting to upgrade to latest eslint. In that process we came to identify that one-app-bundler relies on eslint-loader 4.0.2 which is incompatible with eslint ^8. This is blocking our adoption of eslint v8.

A clear and concise description of what you want to happen.

Replace eslint-loader package with its successor, eslint-webpack-plugin.

A clear and concise description of any alternative solutions or features you've considered.

One alternative is to force install eslint-loader at the root of our project, however, while this will allow for successful install it creates other issues in the build process. Other than that, I do not know of any tractable alternate solutions.

one-app-runner-test timeout seems too long

🐞 Bug Report

Describe the bug

Per PR #474, one-app-runner-test waits 200,000 ms for the server to start up before exiting. That is 3.33 minutes which seems excessive, and also seems rather arbitrary.

To Reproduce

Run create-runner-env && one-app-runner-test with an error in the config that causes One App to fail to start.
Wait for process to exit.

Expected behavior

Process exits quickly since the failure is immediate.

one-app-dev-bundler has an old version of postcss dependency

🐞 Bug Report

Describe the bug

@americanexpress/one-app-dev-bundler is dependent on an older version of postcss with vulnerability, (PostCC line return parsing error, affecs linters to parse external CSS)

To Reproduce

Run npm ls postcss in one-app-dev-bundler

Expected behavior

Upgrade postcss to 8.4.31

feat(bundler): Add Support for Lodash Tree Shaking

💡 Feature request

Is your feature request related to a problem? Please describe

Currently we have the ability to add configuration to the .babelrc to help optimize and reduce bundle size. There is a catch as we lose tree shaking with required-externals and a module can become bloated if a required external has Lodash as a dependency. When using a common required external across numerous modules, Lodash ends up being a heavy addition to your bundle size.

Describe the solution you'd like

It would be great to see the integration of lodash-webpack-plugin so you easily get tree shaking support/cherry picked builds when Lodash is in a module.

Additional context

I have tested this by adding the plugin locally to one app bundler and verified that Lodash is cherry picked which provides us a ~50KB reduction in my tested module. This could greatly save more or less than 50KB depending on your module.

Before
image

After
image

Use latest version for packages in generated modules

💡 Feature request

I would like to use the latest tagged version in the preset dependencies generated by generator-one-app-module.

Is your feature request related to a problem? Please describe

Using the latest tag published will align best with the documentation of a package, can fall out of sync.

Describe the solution you'd like

We can use npm show {package} version to pull the latest tag and apply that. Possibly cap at major releases to preserve some consistency.

one-app-dev-bundler has dependencies on non-semver versions of packages

🐞 Bug Report

Describe the bug

These two packages are not using semver ranges:

"dependencies": {
    "@fullhuman/postcss-purgecss": "3.0.0",
    "postcss-modules": "3.2.2",
  },

This effectively locks [email protected].

To Reproduce

Install and see that you get those exact versions.

Expected behavior

Dependencies should use semver unless there is a reason they need to be pinned to a particular version.

Specify a test path runner will open in browser

💡 Feature request

Is your feature request related to a problem? Please describe

The runner pattern helps us to easily develop modules in isolation. However it can be difficult to know the best URL to be able to preview / test a module. Especially if a module has any required props.

This feature would allow you to specify a path and default query params within a modules code i.e package.json. Then use the runner CLI to open the defined path in a browser. It should be able with any OneApp module; to work on demand, or specifically when the one-app-runner instance is available to avoid delay in engineering.

Example

@JAdshead provided the following API example.

"one-amex": {
  "runner": {
    "modules": ["."],
    "startPath: "/demo",
    "startPathParams": {
       "campaignId": "12345",
       "theme": "centurion"    
    }
  }
}

"one-amex": {
  "runner": {
    "modules": ["."],
    "startPath: "/"
  }
}

ctrl + c does not terminate docker container on Windows

🐞 Bug Report

Describe the bug

While using one-app-runner on a Windows machine, doing ctrl+c to terminate the runner keeps the docker container running.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. On a Windows machine create a module
  2. Add one-app-runner
  3. Start the module
  4. ctrl+c to terminate the runner
  5. Open docker desktop and notice the docker container is still running

Expected behavior

ctrl+c should terminate the runner

Screenshots

docker_issue

System information

System:

  • OS: Windows 10 10.0.19042
  • CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  • Memory: 5.78 GB / 15.95 GB

Binaries:

  • Node: 12.18.2 - C:\Program Files\nodejs\node.EXE
  • Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
  • npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD

npmGlobalPackages:

  • lerna: 3.22.1
  • npm: 6.14.5
  • yarn: 1.22.4

Additional context

This works as expected on macOS

Tests fail on Windows

Not really a bug or anything, but running the tests on a Windows machine results in 45 failed tests out of 160. For example:

  ● webpack/app › always transpiles node_modules when env is production

    expect(received).toMatchSnapshot()

    Snapshot name: `webpack/app always transpiles node_modules when env is production 1`

    - Snapshot  - 5
    + Received  + 5

      Object {
    -   "exclude": /\^\\/node_modules\\/core-js/,
    +   "exclude": /\^D:\\node_modules\\core-js/,
        "include": Array [
    -     "/src",
    -     "/node_modules",
    +     "D:\\src",
    +     "D:\\node_modules",
        ],
        "test": /\\\.jsx\?\$/,
        "use": Array [
          Object {
            "loader": "babel-loader",
            "options": Object {
    -         "cacheDirectory": "/.build-cache",
    +         "cacheDirectory": "\\.build-cache",
              "envName": undefined,
    -         "extends": "/.babelrc",
    +         "extends": "\\.babelrc",
            },
          },
        ],
      }

Add a debug flag

💡 Feature request

Is your feature request related to a problem? Please describe

When utilized one-app-runner for a module that has server-side behavior it is not possible to debug the node process to debug issues.

Example

Tenant root modules often have page entry behavior that tests if a customer can enter or need to be redirected. Being able to easily turn on node debugger would be useful.

Describe the solution you'd like

I would like to pass a flag that enables the debugger on the default port. Optionally, I would like to override the port if I need more than one instance.

one-app-runner -- --use-debug
HTTP_ONE_APP_DEBUG_PORT=9221 one-app-runner --use-debug

Describe alternatives you've considered

Running the debugger manually requires setting up everything manually and, while possible, it's cumbersome.

ONE_CONFIG_ENV=development npm run start:inspect -- --root-module-name=axp-myca-root --module-map-url=https://cdaas-dev.aexp.com/cdaas/one-app/map/epaas-mycaapp-staging-mycaapp-staging-e1/module-map.json --use-middleware

one-app-bundler has dep on vulnerable version of loader-utils

🐞 Bug Report

Describe the bug

loader-utils has a critical vulnerability for < 1.4.1:
GHSA-76p3-8jx3-jpfq

This is brought in by html-webpack-plugin@3.

  ├─┬ [email protected]
  │ └── [email protected]

Looks like html-webpack-plugin@4 would bring loader-utils to v1 which would get security updates. This has quite a few breaking changes though:
https://github.com/jantimon/html-webpack-plugin/blob/4.x/CHANGELOG.md

Expected behavior

Dependencies should not have critical vulnerabilities

one-app-runner-test output is inaccurate

🐞 Bug Report

Describe the bug

The output when one-app-runner-test fails is not very clear or accurate:

Waiting for one app to start on port 40306
One app crashed in 200000ms

To Reproduce

Run one-app-runner-test and have One App fail to start up.

Expected behavior

Output should use proper product names.
Output should not say "crashed" when that is not an accurate description of the case where that message is shown.

Holocron Dev Server doesn't provide locale files under Windows

🐞 Bug Report

Describe the bug

The locale files are not correctly stored in the virtual filesystem on windows, when you try to fetch one you get a html (error) page instead.

To Reproduce

Use the dev server in a windows environment with a modules using locale files

Expected behavior

JSON locale files should be returned by the server

System information

Windows, node 16

Additional context

path separator hard coded as a forward slash in language-packs.js

Misleading error message when One App is killed

🐞 Bug Report

Describe the bug

When one-app is killed by SIGKILL, a message is printed that says "Error: Error running docker. Are you sure you have it installed?" This error message is not useful.

To Reproduce

Start one-app via one-app-runner, then stop the container.

...
error: still running after 10s, forcibly shutting down
error: shutting down, forcibly stopping node
<mydir>/node_modules/@americanexpress/one-app-runner/src/startApp.js:258
    throw new Error(
          ^

Error: Error running docker. Are you sure you have it installed? For installation and setup details see https://www.docker.com/products/docker-desktop
    at startApp (<mydir>/node_modules/@americanexpress/one-app-runner/src/startApp.js:258:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  [cause]: 137
}

Expected behavior

There is no need for an error to be printed here.

Broken one-app urls in documentation

🐞 Bug Report

Describe the bug

Certain One-App urls within documentation are broken, preventing users from accessing the them.

To Reproduce

Steps to reproduce the behaviour, please provide code snippets or a repository:

  1. Go to 'packages/one-app-runner'
  2. Click on 'Holocron Module'
  3. See error page
  4. Similar issues in 4 files.

Expected behavior

The correct one-app documentation should open i.e. https://github.com/americanexpress/one-app/tree/main/docs/api#modules

Screenshots

If applicable, add screenshots to help explain your problem.

error

System information

  • OS: [e.g. macOS, Windows]
  • Browser (if applies) [e.g. chrome, safari]
  • Version of one-app-cli: [e.g. 5.0.0]
  • Node version:[e.g 10.15.1]

Additional context

Updates in folder structure for docs in https://github.com/americanexpress/one-app has caused broken urls in certain files.

Update Travis config to not run release all the time

Currently, the Travis config looks like:

language: node_js
node_js:
  - 10
  - 12
  - 14
cache:
  directories:
  - node_modules
before_install:
  # Create a master branch for commitlint
  # https://github.com/conventional-changelog/commitlint/issues/6
  - git remote set-branches origin master && git fetch
before_deploy:
  echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> $HOME/.npmrc 2> /dev/null
jobs:
  include:
    # Define the release stage that publishes lerna to npm
    - stage: release
      deploy:
          on:
            branch: master
          provider: script
          skip_cleanup: true
          script:
            - npm run lerna:deploy -- "${TRAVIS_COMMIT_MESSAGE}"

The issue with this is that the release job runs on every PR that is merged into master. Furthermore, it looks like it might not like multi-line commit messages. As both https://travis-ci.org/github/americanexpress/one-app-cli/jobs/703641806, as well as https://travis-ci.org/github/americanexpress/one-app-cli/jobs/699376611, failed at the deploy job and causes a ❌with a failing build.

Possible Solution

Run the deploy job when there is a specific commit message which is usually something along the lines of chore(release): x.x.x

Add envinfo to help maintainers know what a user's environment is

💡 Feature request

Is your feature request related to a problem? Please describe

envinfo is a solid package that helps open source maintainers better understand what their users' environments are when they're reporting issues. I think it'd be helpful to integrate this into the cli so users can better report their environments when filing issues

Example

this would primarily be in the package.json

{
  "scripts": {
      "get-envinfo": "envinfo --flags --we --deem --relevant"
    }
}

## Describe the solution you'd like

Install envinfo and come up with what parts of a user's OS/environment we want (node/npm versions, browsers, etc)

Test suite exhibits non-deterministic behaviour

🐞 Bug Report

Describe the bug

The tests located under packages/one-app-runner/__tests__/bin/one-app-runner.spec.js will randomly fail from time to time without any modification to the repo.

To Reproduce

  1. Clone the repo
  2. npm install
  3. Run npm test or NODE_ENV=production npx jest multiple times (it takes me about 5 times on average to hit my first failed run)

Expected behavior

The tests should either fail every single time or pass every single time.

System information

  • OS: macOS Mojave
  • Browser: N/A
  • Version of one-app-cli: master
  • Node version: I was able to repro with all three of v14.x.x v12.x.x and v10.x.x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.