Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Merge branch 'v7.0.0-alpha-webpack-5' of https://github.com/americane…
Browse files Browse the repository at this point in the history
…xpress/one-app-cli into v7.0.0-alpha-webpack-5
  • Loading branch information
code-forger committed Dec 13, 2023
2 parents fcbb2a3 + cf65efa commit d5486a0
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
11 changes: 11 additions & 0 deletions packages/one-app-runner/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [6.16.1](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-runner@6.16.0...@americanexpress/one-app-runner@6.16.1) (2023-11-17)


### Bug Fixes

* disable native fetch in node ([#586](https://github.com/americanexpress/one-app-cli/issues/586)) ([4938125](https://github.com/americanexpress/one-app-cli/commit/49381256250c22e6a43585127d3fc304fe5a8d47))





# [6.16.0](https://github.com/americanexpress/one-app-cli/compare/@americanexpress/one-app-runner@6.15.0...@americanexpress/one-app-runner@6.16.0) (2023-10-03)


Expand Down
22 changes: 17 additions & 5 deletions packages/one-app-runner/__tests__/src/startApp.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('startApp', () => {
"one-app:5.0.0",
"/bin/sh",
"-c",
" node lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json ",
"npm config set update-notifier false && node --dns-result-order=ipv4first --no-experimental-fetch lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json ",
]
`);
});
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('startApp', () => {
'-v=/home/user/.one-app:/home/node/.one-app',
]);
expect(mockSpawn.calls[1].args[mockSpawn.calls[1].args.indexOf('-c') + 1]).toMatchInlineSnapshot(
'"npm run serve-module \'/opt/module-workspace/module-a\' &&npm run serve-module \'/opt/module-workspace/to-module-b\' && node lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json "'
'"npm config set update-notifier false && npm run serve-module \'/opt/module-workspace/module-a\' &&npm run serve-module \'/opt/module-workspace/to-module-b\' && node --dns-result-order=ipv4first --no-experimental-fetch lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json "'
);
});

Expand All @@ -156,7 +156,7 @@ describe('startApp', () => {
'-v=/home/user/.one-app:/home/node/.one-app',
]);
expect(mockSpawn.calls[1].args[mockSpawn.calls[1].args.indexOf('-c') + 1]).toMatchInlineSnapshot(
'"npm run serve-module \'/opt/module-workspace/module-a\' &&npm run serve-module \'/opt/module-workspace/to-module-b\' && node lib/server/index.js --root-module-name=frank-lloyd-root "'
'"npm config set update-notifier false && npm run serve-module \'/opt/module-workspace/module-a\' &&npm run serve-module \'/opt/module-workspace/to-module-b\' && node --dns-result-order=ipv4first --no-experimental-fetch lib/server/index.js --root-module-name=frank-lloyd-root "'
);
});

Expand All @@ -168,7 +168,7 @@ describe('startApp', () => {
moduleMapUrl: 'https://example.com/module-map.json', rootModuleName: 'frank-lloyd-root', appDockerImage: 'one-app:5.0.0', modulesToServe: ['/path/to/module-a'], parrotMiddlewareFile: '/path/to/module-a/dev.middleware.js',
});
expect(mockSpawn.calls[1].args[mockSpawn.calls[1].args.indexOf('-c') + 1]).toMatchInlineSnapshot(
'"npm run serve-module \'/opt/module-workspace/module-a\' && npm run set-middleware \'/opt/module-workspace/module-a/dev.middleware.js\' && node lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json -m "'
'"npm config set update-notifier false && npm run serve-module \'/opt/module-workspace/module-a\' && npm run set-middleware \'/opt/module-workspace/module-a/dev.middleware.js\' && node --dns-result-order=ipv4first --no-experimental-fetch lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json -m "'
);
});

Expand All @@ -180,7 +180,7 @@ describe('startApp', () => {
moduleMapUrl: 'https://example.com/module-map.json', rootModuleName: 'frank-lloyd-root', appDockerImage: 'one-app:5.0.0', modulesToServe: ['/path/to/module-a'], devEndpointsFile: '/path/to/module-a/dev.endpoints.js',
});
expect(mockSpawn.calls[1].args[mockSpawn.calls[1].args.indexOf('-c') + 1]).toMatchInlineSnapshot(
'"npm run serve-module \'/opt/module-workspace/module-a\' && npm run set-dev-endpoints \'/opt/module-workspace/module-a/dev.endpoints.js\' && node lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json "'
'"npm config set update-notifier false && npm run serve-module \'/opt/module-workspace/module-a\' && npm run set-dev-endpoints \'/opt/module-workspace/module-a/dev.endpoints.js\' && node --dns-result-order=ipv4first --no-experimental-fetch lib/server/index.js --root-module-name=frank-lloyd-root --module-map-url=https://example.com/module-map.json "'
);
});

Expand Down Expand Up @@ -346,6 +346,18 @@ describe('startApp', () => {
]);
});

it('suppresses npm update notifications', async () => {
expect.assertions(1);
const mockSpawn = makeMockSpawn();
childProcess.spawn.mockImplementation(mockSpawn);
await startApp({
moduleMapUrl: 'https://example.com/module-map.json', rootModuleName: 'frank-lloyd-root', appDockerImage: 'one-app:5.0.0', modulesToServe: ['/path/to/module-a'], dockerNetworkToJoin: 'one-test-environment-1234',
});
expect(mockSpawn.calls[1].args[mockSpawn.calls[1].args.indexOf('-c') + 1]).toMatch(
'npm config set update-notifier false'
);
});

it('applies inspect mode to node process when useDebug is passed', async () => {
expect.assertions(1);
const mockSpawn = makeMockSpawn();
Expand Down
2 changes: 1 addition & 1 deletion packages/one-app-runner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@americanexpress/one-app-runner",
"version": "6.16.0",
"version": "6.16.1",
"description": "CLI for running One App locally",
"license": "Apache-2.0",
"contributors": [
Expand Down
6 changes: 5 additions & 1 deletion packages/one-app-runner/src/startApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ const generateSetDevEndpointsCommand = (pathToDevEndpointsFile) => {

const generateUseMocksFlag = (shouldUseMocks) => (shouldUseMocks ? '-m' : '');

const generateNpmConfigCommands = () => 'npm config set update-notifier false &&';

const generateServeModuleCommands = (modules) => {
let command = '';
if (modules && modules.length > 0) {
Expand Down Expand Up @@ -190,12 +192,14 @@ module.exports = async function startApp({
}

const containerShellCommand = `${
generateNpmConfigCommands()
} ${
generateServeModuleCommands(modulesToServe)
} ${
generateSetMiddlewareCommand(parrotMiddlewareFile)
} ${
generateSetDevEndpointsCommand(devEndpointsFile)
} node ${
} node --dns-result-order=ipv4first --no-experimental-fetch ${
generateDebug(debugPort, useDebug)
} lib/server/index.js --root-module-name=${rootModuleName} ${
generateModuleMap(moduleMapUrl)
Expand Down

0 comments on commit d5486a0

Please sign in to comment.