forked from Unitech/pm2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Unitech#4540 support ES import
- Loading branch information
Showing
13 changed files
with
181 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const PI = 3.14159265359; | ||
|
||
export function area(radius) { | ||
return (radius ** 2) * PI; | ||
} | ||
|
||
export function circumference(radius) { | ||
return 2 * radius * PI; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { area, circumference } from './circle.js'; | ||
|
||
const r = 3; | ||
|
||
console.log(`Circle with radius ${r} has | ||
area: ${area(r)}; | ||
circunference: ${circumference(r)}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "import", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type":"module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env bash | ||
|
||
SRC=$(cd $(dirname "$0"); pwd) | ||
source "${SRC}/include.sh" | ||
|
||
# Bootstrap one app | ||
cd $file_path/esmodules/mjs | ||
|
||
#### FORK MODE | ||
|
||
$pm2 delete all | ||
|
||
$pm2 start index.mjs | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 1 app' 'online' 1 | ||
should 'should have application in stable state' 'restart_time: 0' 1 | ||
|
||
$pm2 restart index | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 1 app' 'online' 1 | ||
should 'should have application in stable state' 'restart_time: 1' 1 | ||
|
||
$pm2 delete all | ||
|
||
cd $file_path/esmodules/packagemodule | ||
|
||
$pm2 start index.js | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 1 app' 'online' 1 | ||
should 'should have application in stable state' 'restart_time: 0' 1 | ||
|
||
$pm2 restart index | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 1 app' 'online' 1 | ||
should 'should have application in stable state' 'restart_time: 1' 1 | ||
|
||
#### CLUSTER MODE | ||
|
||
$pm2 delete all | ||
|
||
$pm2 start index.mjs -i 4 | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 4 apps' 'online' 4 | ||
should 'should have application in stable state' 'restart_time: 0' 4 | ||
|
||
$pm2 restart index | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 4 app' 'online' 4 | ||
should 'should have application in stable state' 'restart_time: 1' 4 | ||
|
||
$pm2 delete all | ||
|
||
cd $file_path/esmodules/packagemodule | ||
|
||
$pm2 start index.js -i 4 | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 4 apps' 'online' 4 | ||
should 'should have application in stable state' 'restart_time: 0' 4 | ||
|
||
$pm2 restart index | ||
sleep 2 | ||
should 'should have detected es module via .mjs file extension and started 4 app' 'online' 4 | ||
should 'should have application in stable state' 'restart_time: 1' 4 | ||
|
||
$pm2 delete all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const PI = 3.14159265359; | ||
|
||
export function area(radius) { | ||
return (radius ** 2) * PI; | ||
} | ||
|
||
export function circumference(radius) { | ||
return 2 * radius * PI; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { area, circumference } from './circle.mjs'; | ||
|
||
const r = 3; | ||
|
||
console.log(`Circle with radius ${r} has | ||
area: ${area(r)}; | ||
circunference: ${circumference(r)}`); | ||
|
||
setInterval(() => { | ||
}, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const PI = 3.14159265359; | ||
|
||
export function area(radius) { | ||
return (radius ** 2) * PI; | ||
} | ||
|
||
export function circumference(radius) { | ||
return 2 * radius * PI; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { area, circumference } from './circle.js'; | ||
|
||
const r = 3; | ||
|
||
console.log(`Circle with radius ${r} has | ||
area: ${area(r)}; | ||
circunference: ${circumference(r)}`); | ||
|
||
setInterval(() => { | ||
}, 1000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "import", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"type":"module", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC" | ||
} |