piral-cli 1.0.0-pre.2217 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +30 -7
- package/lib/api.js +23 -23
- package/lib/api.js.map +1 -1
- package/lib/apps/add-piral-instance-pilet.d.ts +26 -0
- package/lib/apps/add-piral-instance-pilet.js +53 -0
- package/lib/apps/add-piral-instance-pilet.js.map +1 -0
- package/lib/apps/build-pilet.d.ts +33 -2
- package/lib/apps/build-pilet.js +159 -32
- package/lib/apps/build-pilet.js.map +1 -1
- package/lib/apps/build-piral.d.ts +18 -1
- package/lib/apps/build-piral.js +68 -52
- package/lib/apps/build-piral.js.map +1 -1
- package/lib/apps/debug-pilet.d.ts +38 -2
- package/lib/apps/debug-pilet.js +150 -108
- package/lib/apps/debug-pilet.js.map +1 -1
- package/lib/apps/debug-piral.d.ts +23 -0
- package/lib/apps/debug-piral.js +63 -52
- package/lib/apps/debug-piral.js.map +1 -1
- package/lib/apps/declaration-piral.js +5 -3
- package/lib/apps/declaration-piral.js.map +1 -1
- package/lib/apps/index.d.ts +3 -0
- package/lib/apps/index.js +8 -1
- package/lib/apps/index.js.map +1 -1
- package/lib/apps/new-pilet.d.ts +7 -3
- package/lib/apps/new-pilet.js +47 -52
- package/lib/apps/new-pilet.js.map +1 -1
- package/lib/apps/new-piral.d.ts +7 -3
- package/lib/apps/new-piral.js +33 -23
- package/lib/apps/new-piral.js.map +1 -1
- package/lib/apps/pack-pilet.d.ts +9 -0
- package/lib/apps/pack-pilet.js +6 -13
- package/lib/apps/pack-pilet.js.map +1 -1
- package/lib/apps/publish-pilet.d.ts +23 -3
- package/lib/apps/publish-pilet.js +112 -62
- package/lib/apps/publish-pilet.js.map +1 -1
- package/lib/apps/publish-piral.d.ts +6 -2
- package/lib/apps/publish-piral.js +30 -26
- package/lib/apps/publish-piral.js.map +1 -1
- package/lib/apps/remove-piral-instance-pilet.d.ts +22 -0
- package/lib/apps/remove-piral-instance-pilet.js +52 -0
- package/lib/apps/remove-piral-instance-pilet.js.map +1 -0
- package/lib/apps/run-emulator-piral.d.ts +34 -0
- package/lib/apps/run-emulator-piral.js +91 -0
- package/lib/apps/run-emulator-piral.js.map +1 -0
- package/lib/apps/upgrade-pilet.d.ts +6 -2
- package/lib/apps/upgrade-pilet.js +41 -43
- package/lib/apps/upgrade-pilet.js.map +1 -1
- package/lib/apps/upgrade-piral.d.ts +2 -2
- package/lib/apps/upgrade-piral.js +21 -20
- package/lib/apps/upgrade-piral.js.map +1 -1
- package/lib/apps/validate-pilet.js +30 -36
- package/lib/apps/validate-pilet.js.map +1 -1
- package/lib/apps/validate-piral.js +13 -10
- package/lib/apps/validate-piral.js.map +1 -1
- package/lib/build/bundler-calls.d.ts +3 -0
- package/lib/build/bundler-calls.js +117 -0
- package/lib/build/bundler-calls.js.map +1 -0
- package/lib/build/run-build-pilet.d.ts +1 -0
- package/lib/build/run-build-pilet.js +65 -0
- package/lib/build/run-build-pilet.js.map +1 -0
- package/lib/build/run-build-piral.d.ts +1 -0
- package/lib/build/run-build-piral.js +67 -0
- package/lib/build/run-build-piral.js.map +1 -0
- package/lib/build/run-debug-mono-piral.d.ts +1 -0
- package/lib/build/run-debug-mono-piral.js +70 -0
- package/lib/build/run-debug-mono-piral.js.map +1 -0
- package/lib/build/run-debug-pilet.d.ts +1 -0
- package/lib/build/run-debug-pilet.js +89 -0
- package/lib/build/run-debug-pilet.js.map +1 -0
- package/lib/build/run-debug-piral.d.ts +1 -0
- package/lib/build/run-debug-piral.js +85 -0
- package/lib/build/run-debug-piral.js.map +1 -0
- package/lib/bundler.js +75 -26
- package/lib/bundler.js.map +1 -1
- package/lib/cli.js +7 -4
- package/lib/cli.js.map +1 -1
- package/lib/commands.js +266 -46
- package/lib/commands.js.map +1 -1
- package/lib/common/archive.d.ts +4 -0
- package/lib/common/archive.js +31 -10
- package/lib/common/archive.js.map +1 -1
- package/lib/common/browser.d.ts +2 -1
- package/lib/common/browser.js +17 -8
- package/lib/common/browser.js.map +1 -1
- package/lib/common/clients/index.d.ts +21 -0
- package/lib/common/clients/index.js +48 -0
- package/lib/common/clients/index.js.map +1 -0
- package/lib/common/clients/lerna.d.ts +7 -1
- package/lib/common/clients/lerna.js +93 -7
- package/lib/common/clients/lerna.js.map +1 -1
- package/lib/common/clients/npm.d.ts +6 -1
- package/lib/common/clients/npm.js +66 -18
- package/lib/common/clients/npm.js.map +1 -1
- package/lib/common/clients/pnp.d.ts +7 -0
- package/lib/common/clients/pnp.js +104 -0
- package/lib/common/clients/pnp.js.map +1 -0
- package/lib/common/clients/pnpm.d.ts +5 -0
- package/lib/common/clients/pnpm.js +55 -6
- package/lib/common/clients/pnpm.js.map +1 -1
- package/lib/common/clients/rush.d.ts +7 -0
- package/lib/common/clients/rush.js +127 -0
- package/lib/common/clients/rush.js.map +1 -0
- package/lib/common/clients/yarn.d.ts +5 -0
- package/lib/common/clients/yarn.js +57 -6
- package/lib/common/clients/yarn.js.map +1 -1
- package/lib/common/compatibility.js +14 -9
- package/lib/common/compatibility.js.map +1 -1
- package/lib/common/config.d.ts +52 -1
- package/lib/common/config.js +10 -30
- package/lib/common/config.js.map +1 -1
- package/lib/common/constants.d.ts +10 -2
- package/lib/common/constants.js +22 -4
- package/lib/common/constants.js.map +1 -1
- package/lib/common/declaration.d.ts +2 -1
- package/lib/common/declaration.js +113 -56
- package/lib/common/declaration.js.map +1 -1
- package/lib/common/emoji.d.ts +8 -0
- package/lib/common/emoji.js +10 -1
- package/lib/common/emoji.js.map +1 -1
- package/lib/common/emulator.d.ts +2 -2
- package/lib/common/emulator.js +45 -32
- package/lib/common/emulator.js.map +1 -1
- package/lib/common/enums.d.ts +0 -4
- package/lib/common/enums.js +1 -6
- package/lib/common/enums.js.map +1 -1
- package/lib/common/envs.js +16 -5
- package/lib/common/envs.js.map +1 -1
- package/lib/common/hash.d.ts +1 -0
- package/lib/common/hash.js +8 -3
- package/lib/common/hash.js.map +1 -1
- package/lib/common/http.d.ts +5 -2
- package/lib/common/http.js +65 -23
- package/lib/common/http.js.map +1 -1
- package/lib/common/importmap.d.ts +2 -0
- package/lib/common/importmap.js +202 -0
- package/lib/common/importmap.js.map +1 -0
- package/lib/common/index.d.ts +10 -0
- package/lib/common/index.js +15 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/info.d.ts +5 -0
- package/lib/common/info.js +9 -2
- package/lib/common/info.js.map +1 -1
- package/lib/common/injectors.d.ts +36 -8
- package/lib/common/injectors.js +46 -19
- package/lib/common/injectors.js.map +1 -1
- package/lib/common/inspect.d.ts +5 -3
- package/lib/common/inspect.js +15 -15
- package/lib/common/inspect.js.map +1 -1
- package/lib/common/interactive.d.ts +9 -0
- package/lib/common/interactive.js +60 -1
- package/lib/common/interactive.js.map +1 -1
- package/lib/common/io.d.ts +9 -3
- package/lib/common/io.js +219 -116
- package/lib/common/io.js.map +1 -1
- package/lib/common/language.d.ts +9 -6
- package/lib/common/language.js +68 -12
- package/lib/common/language.js.map +1 -1
- package/lib/common/log.d.ts +5 -3
- package/lib/common/log.js +34 -48
- package/lib/common/log.js.map +1 -1
- package/lib/common/npm.d.ts +17 -16
- package/lib/common/npm.js +262 -158
- package/lib/common/npm.js.map +1 -1
- package/lib/common/pack.js +47 -26
- package/lib/common/pack.js.map +1 -1
- package/lib/common/package.d.ts +43 -20
- package/lib/common/package.js +377 -213
- package/lib/common/package.js.map +1 -1
- package/lib/common/parallel.d.ts +1 -0
- package/lib/common/parallel.js +29 -0
- package/lib/common/parallel.js.map +1 -0
- package/lib/common/patcher.js +20 -20
- package/lib/common/patcher.js.map +1 -1
- package/lib/common/platform.d.ts +13 -0
- package/lib/common/platform.js +29 -0
- package/lib/common/platform.js.map +1 -0
- package/lib/common/port.d.ts +1 -0
- package/lib/common/port.js +14 -4
- package/lib/common/port.js.map +1 -1
- package/lib/common/rules.js +4 -4
- package/lib/common/rules.js.map +1 -1
- package/lib/common/scaffold.d.ts +18 -4
- package/lib/common/scaffold.js +59 -36
- package/lib/common/scaffold.js.map +1 -1
- package/lib/common/scripts.js +8 -8
- package/lib/common/scripts.js.map +1 -1
- package/lib/common/shell.d.ts +2 -0
- package/lib/common/shell.js +33 -0
- package/lib/common/shell.js.map +1 -0
- package/lib/common/spec.d.ts +29 -0
- package/lib/common/spec.js +69 -0
- package/lib/common/spec.js.map +1 -0
- package/lib/common/template.d.ts +1 -2
- package/lib/common/template.js +23 -22
- package/lib/common/template.js.map +1 -1
- package/lib/common/url.d.ts +1 -0
- package/lib/common/url.js +17 -0
- package/lib/common/url.js.map +1 -0
- package/lib/common/utils.d.ts +1 -0
- package/lib/common/utils.js +8 -0
- package/lib/common/utils.js.map +1 -0
- package/lib/common/version.d.ts +2 -0
- package/lib/common/version.js +130 -0
- package/lib/common/version.js.map +1 -0
- package/lib/common/watcher.d.ts +13 -0
- package/lib/common/watcher.js +78 -0
- package/lib/common/watcher.js.map +1 -0
- package/lib/external/index.js +59413 -57862
- package/lib/helpers.d.ts +6 -6
- package/lib/helpers.js +10 -25
- package/lib/helpers.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/inject.js +2 -2
- package/lib/inject.js.map +1 -1
- package/lib/injectors/pilet-injector.d.ts +75 -0
- package/lib/injectors/pilet-injector.js +246 -0
- package/lib/injectors/pilet-injector.js.map +1 -0
- package/lib/injectors/{piral.d.ts → piral-injector.d.ts} +10 -2
- package/lib/injectors/piral-injector.js +97 -0
- package/lib/injectors/piral-injector.js.map +1 -0
- package/lib/messages.d.ts +567 -47
- package/lib/messages.js +638 -51
- package/lib/messages.js.map +1 -1
- package/lib/pb-cli.js +1 -1
- package/lib/pb-cli.js.map +1 -1
- package/lib/pilet-cli.js +1 -1
- package/lib/pilet-cli.js.map +1 -1
- package/lib/piral-cli.js +1 -1
- package/lib/piral-cli.js.map +1 -1
- package/lib/platforms/node.d.ts +8 -0
- package/lib/platforms/node.js +30 -0
- package/lib/platforms/node.js.map +1 -0
- package/lib/platforms/web.d.ts +8 -0
- package/lib/platforms/web.js +120 -0
- package/lib/platforms/web.js.map +1 -0
- package/lib/plugin.js +36 -11
- package/lib/plugin.js.map +1 -1
- package/lib/questionnaire.d.ts +1 -1
- package/lib/questionnaire.js +9 -4
- package/lib/questionnaire.js.map +1 -1
- package/lib/release.d.ts +1 -1
- package/lib/release.js +38 -6
- package/lib/release.js.map +1 -1
- package/lib/resolvers.js +13 -13
- package/lib/resolvers.js.map +1 -1
- package/lib/rules/index.js +8 -8
- package/lib/rules/index.js.map +1 -1
- package/lib/rules/pilet-has-externals-as-peers.d.ts +1 -1
- package/lib/rules/pilet-has-externals-as-peers.js +9 -7
- package/lib/rules/pilet-has-externals-as-peers.js.map +1 -1
- package/lib/rules/pilet-has-no-self-reference.d.ts +1 -1
- package/lib/rules/pilet-has-no-self-reference.js +2 -2
- package/lib/rules/pilet-has-no-self-reference.js.map +1 -1
- package/lib/rules/pilet-has-no-third-party-dependency.d.ts +1 -1
- package/lib/rules/pilet-stays-small.d.ts +1 -1
- package/lib/rules/pilet-stays-small.js +4 -4
- package/lib/rules/pilet-stays-small.js.map +1 -1
- package/lib/rules/pilet-uses-latest-piral.d.ts +1 -1
- package/lib/rules/pilet-uses-latest-piral.js +18 -9
- package/lib/rules/pilet-uses-latest-piral.js.map +1 -1
- package/lib/rules/piral-depends-on-piral.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.d.ts +1 -1
- package/lib/rules/piral-entry-ends-with-html.js +1 -1
- package/lib/rules/piral-entry-ends-with-html.js.map +1 -1
- package/lib/rules/piral-has-valid-devDependencies.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.d.ts +1 -1
- package/lib/rules/piral-has-valid-externals.js +10 -24
- package/lib/rules/piral-has-valid-externals.js.map +1 -1
- package/lib/rules/piral-has-valid-files.d.ts +1 -1
- package/lib/rules/piral-has-valid-files.js +5 -5
- package/lib/rules/piral-has-valid-files.js.map +1 -1
- package/lib/rules/piral-has-valid-scripts.d.ts +1 -1
- package/lib/runner.js +1 -1
- package/lib/runner.js.map +1 -1
- package/lib/select.js +6 -6
- package/lib/select.js.map +1 -1
- package/lib/types/common.d.ts +88 -8
- package/lib/types/common.js.map +1 -1
- package/lib/types/index.js +5 -1
- package/lib/types/index.js.map +1 -1
- package/lib/types/internal.d.ts +12 -13
- package/lib/types/public.d.ts +89 -23
- package/package.json +19 -16
- package/src/apps/add-piral-instance-pilet.ts +98 -0
- package/src/apps/build-pilet.ts +286 -38
- package/src/apps/build-piral.test.ts +20 -7
- package/src/apps/build-piral.ts +90 -39
- package/src/apps/debug-pilet.ts +229 -123
- package/src/apps/debug-piral.ts +121 -68
- package/src/apps/declaration-piral.ts +4 -2
- package/src/apps/index.ts +3 -0
- package/src/apps/new-pilet.test.ts +28 -11
- package/src/apps/new-pilet.ts +60 -48
- package/src/apps/new-piral.test.ts +25 -13
- package/src/apps/new-piral.ts +43 -19
- package/src/apps/pack-pilet.test.ts +2 -2
- package/src/apps/pack-pilet.ts +12 -10
- package/src/apps/publish-pilet.ts +148 -43
- package/src/apps/publish-piral.ts +38 -11
- package/src/apps/remove-piral-instance-pilet.ts +92 -0
- package/src/apps/run-emulator-piral.ts +154 -0
- package/src/apps/upgrade-pilet.ts +37 -31
- package/src/apps/upgrade-piral.ts +9 -7
- package/src/apps/validate-pilet.ts +30 -22
- package/src/apps/validate-piral.ts +5 -2
- package/src/build/bundler-calls.ts +133 -0
- package/src/build/run-build-pilet.ts +91 -0
- package/src/build/run-build-piral.ts +93 -0
- package/src/build/run-debug-mono-piral.ts +86 -0
- package/src/build/run-debug-pilet.ts +116 -0
- package/src/build/run-debug-piral.ts +105 -0
- package/src/bundler.test.ts +86 -68
- package/src/bundler.ts +74 -19
- package/src/cli.ts +6 -2
- package/src/commands.ts +273 -44
- package/src/common/archive.test.ts +51 -45
- package/src/common/archive.ts +28 -1
- package/src/common/browser.test.ts +20 -10
- package/src/common/browser.ts +13 -6
- package/src/common/clients/index.ts +41 -0
- package/src/common/clients/lerna.ts +85 -1
- package/src/common/clients/npm.ts +56 -14
- package/src/common/clients/pnp.ts +84 -0
- package/src/common/clients/pnpm.ts +45 -1
- package/src/common/clients/rush.ts +118 -0
- package/src/common/clients/yarn.ts +49 -3
- package/src/common/compatibility.ts +8 -1
- package/src/common/config.ts +57 -22
- package/src/common/constants.ts +21 -3
- package/src/common/declaration.ts +124 -50
- package/src/common/emoji.ts +9 -0
- package/src/common/emulator.ts +43 -23
- package/src/common/enums.ts +0 -5
- package/src/common/envs.ts +15 -3
- package/src/common/hash.ts +5 -0
- package/src/common/http.test.ts +76 -64
- package/src/common/http.ts +88 -24
- package/src/common/importmap.ts +242 -0
- package/src/common/index.ts +10 -0
- package/src/common/info.ts +9 -1
- package/src/common/injectors.ts +49 -22
- package/src/common/inspect.ts +13 -14
- package/src/common/interactive.test.ts +6 -0
- package/src/common/interactive.ts +69 -1
- package/src/common/io.ts +199 -82
- package/src/common/language.ts +87 -10
- package/src/common/log.ts +32 -46
- package/src/common/npm.test.ts +187 -166
- package/src/common/npm.ts +263 -119
- package/src/common/pack.test.ts +11 -13
- package/src/common/pack.ts +60 -21
- package/src/common/package.test.ts +59 -49
- package/src/common/package.ts +406 -167
- package/src/common/parallel.test.ts +28 -0
- package/src/common/parallel.ts +21 -0
- package/src/common/platform.ts +31 -0
- package/src/common/port.test.ts +4 -1
- package/src/common/port.ts +10 -0
- package/src/common/rules.test.ts +3 -3
- package/src/common/scaffold.ts +69 -41
- package/src/common/scripts.ts +5 -4
- package/src/common/shell.ts +34 -0
- package/src/common/spec.ts +69 -0
- package/src/common/template.ts +20 -18
- package/src/common/url.test.ts +28 -0
- package/src/common/url.ts +15 -0
- package/src/common/utils.ts +3 -0
- package/src/common/version.test.ts +233 -0
- package/src/common/version.ts +142 -0
- package/src/common/watcher.ts +89 -0
- package/src/external/index.test.ts +2 -2
- package/src/external/index.ts +7 -3
- package/src/external/resolve.ts +29 -0
- package/src/helpers.test.ts +2 -22
- package/src/helpers.ts +21 -30
- package/src/injectors/{pilet.test.ts → pilet-injector.test.ts} +13 -4
- package/src/injectors/pilet-injector.ts +346 -0
- package/src/injectors/{piral.test.ts → piral-injector.test.ts} +14 -5
- package/src/injectors/piral-injector.ts +130 -0
- package/src/messages.ts +649 -63
- package/src/platforms/node.ts +16 -0
- package/src/platforms/web.ts +148 -0
- package/src/plugin.ts +34 -5
- package/src/questionnaire.ts +17 -3
- package/src/release.ts +47 -5
- package/src/rules/index.ts +1 -1
- package/src/rules/pilet-has-externals-as-peers.test.ts +3 -2
- package/src/rules/pilet-has-externals-as-peers.ts +9 -7
- package/src/rules/pilet-has-no-self-reference.ts +1 -1
- package/src/rules/pilet-stays-small.ts +1 -1
- package/src/rules/pilet-uses-latest-piral.ts +22 -12
- package/src/rules/piral-has-valid-externals.ts +10 -29
- package/src/types/common.ts +99 -9
- package/src/types/internal.ts +14 -14
- package/src/types/public.ts +93 -27
- package/lib/external/child.js +0 -144
- package/lib/external/classes.trie +0 -0
- package/lib/external/xdg-open +0 -1066
- package/lib/injectors/pilet.d.ts +0 -47
- package/lib/injectors/pilet.js +0 -187
- package/lib/injectors/pilet.js.map +0 -1
- package/lib/injectors/piral.js +0 -62
- package/lib/injectors/piral.js.map +0 -1
- package/src/injectors/pilet.ts +0 -219
- package/src/injectors/piral.ts +0 -76
- package/templates/piral-index.js.ejs +0 -16
package/src/common/npm.test.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { resolve } from 'path';
|
|
2
|
+
import { clients } from './clients';
|
|
2
3
|
import {
|
|
3
4
|
dissectPackageName,
|
|
4
|
-
|
|
5
|
-
detectNpm,
|
|
6
|
-
detectPnpm,
|
|
7
|
-
detectYarn,
|
|
5
|
+
installNpmPackage,
|
|
8
6
|
isMonorepoPackageRef,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
createPackage,
|
|
13
|
-
findTarball,
|
|
7
|
+
installNpmDependencies,
|
|
8
|
+
createNpmPackage,
|
|
9
|
+
findNpmTarball,
|
|
14
10
|
findSpecificVersion,
|
|
15
11
|
findLatestVersion,
|
|
16
12
|
isLocalPackage,
|
|
@@ -25,26 +21,42 @@ import {
|
|
|
25
21
|
getPackageVersion,
|
|
26
22
|
isGitPackage,
|
|
27
23
|
makeExternals,
|
|
24
|
+
findPackageRoot,
|
|
28
25
|
} from './npm';
|
|
29
26
|
|
|
30
27
|
jest.mock('child_process');
|
|
31
28
|
|
|
32
29
|
jest.mock('../external', () => ({
|
|
30
|
+
...jest.requireActual('../external'),
|
|
33
31
|
rc() {},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
ora() {
|
|
33
|
+
return {
|
|
34
|
+
succeed(msg) {
|
|
35
|
+
console.warn(msg);
|
|
36
|
+
},
|
|
37
|
+
warn(msg) {
|
|
38
|
+
console.warn(msg);
|
|
39
|
+
},
|
|
40
|
+
info(msg) {
|
|
41
|
+
console.info(msg);
|
|
42
|
+
},
|
|
43
|
+
fail(msg) {
|
|
44
|
+
console.error(msg);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
getModulePath(root, moduleName) {
|
|
49
|
+
return require.resolve(moduleName, {
|
|
50
|
+
paths: [root],
|
|
51
|
+
});
|
|
41
52
|
},
|
|
42
53
|
}));
|
|
43
54
|
|
|
44
55
|
let specialCase = false;
|
|
56
|
+
let shouldFind = true;
|
|
45
57
|
let wrongCase = false;
|
|
46
|
-
const jsonValueString = JSON.stringify({
|
|
47
|
-
const jsonValueStringWrong = JSON.stringify(
|
|
58
|
+
const jsonValueString = JSON.stringify([{ name: 'npm' }]);
|
|
59
|
+
const jsonValueStringWrong = JSON.stringify([]);
|
|
48
60
|
|
|
49
61
|
jest.mock('./scripts', () => ({
|
|
50
62
|
runCommand: (exe: string, args: Array<string>, cwd: string, output?: NodeJS.WritableStream) => {
|
|
@@ -56,31 +68,42 @@ jest.mock('./scripts', () => ({
|
|
|
56
68
|
}));
|
|
57
69
|
|
|
58
70
|
jest.mock('fs', () => ({
|
|
59
|
-
|
|
60
|
-
F_OK: 1,
|
|
61
|
-
},
|
|
62
|
-
createReadStream() {
|
|
63
|
-
return undefined;
|
|
64
|
-
},
|
|
71
|
+
...jest.requireActual('fs'),
|
|
65
72
|
exists: (file: string, cb: (status: boolean) => void) =>
|
|
66
|
-
cb(
|
|
73
|
+
cb(
|
|
74
|
+
shouldFind &&
|
|
75
|
+
!file.endsWith('package.json') &&
|
|
76
|
+
!(specialCase && (file.endsWith('lerna.json') || file.endsWith('yarn.lock'))),
|
|
77
|
+
),
|
|
67
78
|
existsSync: (file: string) => {
|
|
68
79
|
return true;
|
|
69
80
|
},
|
|
70
|
-
readFile: (file: string, type: string, callback: (err: NodeJS.ErrnoException, data: string) => void) => {
|
|
81
|
+
readFile: (file: string, type: string, callback: (err: NodeJS.ErrnoException | undefined, data: string) => void) => {
|
|
82
|
+
const fs = jest.requireActual('fs');
|
|
83
|
+
|
|
84
|
+
if (fs.existsSync(file)) {
|
|
85
|
+
return fs.readFile(file, type, callback);
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
return callback(undefined, '');
|
|
72
89
|
},
|
|
90
|
+
realpathSync: () => ({}),
|
|
73
91
|
readFileSync: () => '',
|
|
74
|
-
access: (path: string, mode: number, callback: (err: NodeJS.ErrnoException) => void) => {
|
|
75
|
-
if (path.includes('test')) {
|
|
76
|
-
return callback(undefined);
|
|
77
|
-
} else {
|
|
78
|
-
return callback(new Error('bla'));
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
92
|
}));
|
|
82
93
|
|
|
83
|
-
describe('
|
|
94
|
+
describe('npm Module', () => {
|
|
95
|
+
it('findPackageRoot correctly resolves the package root of parcel-bundler', () => {
|
|
96
|
+
const dir = process.cwd();
|
|
97
|
+
const version = findPackageRoot('webpack', dir);
|
|
98
|
+
expect(version).toBe(resolve(dir, 'node_modules', 'webpack', 'package.json'));
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('findPackageRoot returns undefined for invalid package', () => {
|
|
102
|
+
const dir = process.cwd();
|
|
103
|
+
const version = findPackageRoot('foo-bar-not-exist', dir);
|
|
104
|
+
expect(version).toBeUndefined();
|
|
105
|
+
});
|
|
106
|
+
|
|
84
107
|
it('dissects a fully qualified name with latest correctly', async () => {
|
|
85
108
|
wrongCase = false;
|
|
86
109
|
const [name, version, hadVersion, type] = await dissectPackageName(process.cwd(), 'foo@latest');
|
|
@@ -171,57 +194,68 @@ describe('NPM Module', () => {
|
|
|
171
194
|
expect(type).toBe('registry');
|
|
172
195
|
});
|
|
173
196
|
|
|
174
|
-
it('installs a package using the
|
|
197
|
+
it('installs a package using the npm command line tool without a target', async () => {
|
|
175
198
|
wrongCase = false;
|
|
176
|
-
await
|
|
199
|
+
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).toEqual(jsonValueString));
|
|
177
200
|
wrongCase = true;
|
|
178
|
-
await
|
|
201
|
+
await installNpmPackage('npm', 'foo', 'latest').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
179
202
|
});
|
|
180
203
|
|
|
181
|
-
it('installs a package using the
|
|
204
|
+
it('installs a package using the npm command line tool without a version', async () => {
|
|
182
205
|
wrongCase = false;
|
|
183
|
-
await
|
|
206
|
+
await installNpmPackage('npm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
184
207
|
wrongCase = true;
|
|
185
|
-
await
|
|
208
|
+
await installNpmPackage('npm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
186
209
|
});
|
|
187
210
|
|
|
188
211
|
it('installs a package using the Yarn command line tool without a version', async () => {
|
|
189
212
|
wrongCase = false;
|
|
190
|
-
await
|
|
213
|
+
await installNpmPackage('yarn', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
191
214
|
wrongCase = true;
|
|
192
|
-
await
|
|
215
|
+
await installNpmPackage('yarn', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
193
216
|
});
|
|
194
217
|
|
|
195
218
|
it('installs a package using the Pnpm command line tool without a version', async () => {
|
|
196
219
|
wrongCase = false;
|
|
197
|
-
await
|
|
220
|
+
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
198
221
|
wrongCase = true;
|
|
199
|
-
await
|
|
222
|
+
await installNpmPackage('pnpm', 'foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
200
223
|
});
|
|
201
224
|
|
|
202
|
-
it('installs a package using the
|
|
225
|
+
it('installs a package using the npm command line tool with some flag', async () => {
|
|
203
226
|
wrongCase = false;
|
|
204
|
-
await
|
|
227
|
+
await installNpmPackage('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
228
|
+
expect(result).toEqual(jsonValueString),
|
|
229
|
+
);
|
|
205
230
|
wrongCase = true;
|
|
206
|
-
await
|
|
231
|
+
await installNpmPackage('npm', 'foo', '1.3', '.', '--a=b').then((result) =>
|
|
207
232
|
expect(result).not.toEqual(jsonValueString),
|
|
208
233
|
);
|
|
209
234
|
});
|
|
210
235
|
|
|
211
236
|
it('detectNpm finds package-lock.json', async () => {
|
|
212
|
-
|
|
213
|
-
await
|
|
237
|
+
shouldFind = true;
|
|
238
|
+
await clients.npm.detectClient('test').then((result) => expect(result).toBeTruthy());
|
|
239
|
+
shouldFind = false;
|
|
240
|
+
await clients.npm.detectClient('toast').then((result) => expect(result).toBeFalsy());
|
|
241
|
+
shouldFind = true;
|
|
214
242
|
});
|
|
215
243
|
|
|
216
|
-
it('detectPnpm finds
|
|
217
|
-
|
|
218
|
-
await
|
|
244
|
+
it('detectPnpm finds pnpm-lock.yaml', async () => {
|
|
245
|
+
shouldFind = true;
|
|
246
|
+
await clients.pnpm.detectClient('test').then((result) => expect(result).toBeTruthy());
|
|
247
|
+
shouldFind = false;
|
|
248
|
+
await clients.pnpm.detectClient('toast').then((result) => expect(result).toBeFalsy());
|
|
249
|
+
shouldFind = true;
|
|
219
250
|
});
|
|
220
251
|
|
|
221
252
|
it('detectYarn finds yarn.lock', async () => {
|
|
222
|
-
|
|
253
|
+
shouldFind = true;
|
|
254
|
+
await clients.yarn.detectClient('test').then((result) => expect(result).toBeTruthy());
|
|
255
|
+
shouldFind = false;
|
|
223
256
|
specialCase = true;
|
|
224
|
-
await
|
|
257
|
+
await clients.yarn.detectClient('toast').then((result) => expect(result).toBeFalsy());
|
|
258
|
+
shouldFind = true;
|
|
225
259
|
specialCase = false;
|
|
226
260
|
});
|
|
227
261
|
|
|
@@ -232,59 +266,46 @@ describe('NPM Module', () => {
|
|
|
232
266
|
await isMonorepoPackageRef('npm', './').then((result) => expect(result).toBeFalsy());
|
|
233
267
|
});
|
|
234
268
|
|
|
235
|
-
it('verifies whether lerna config path is valid', async () => {
|
|
236
|
-
wrongCase = false;
|
|
237
|
-
await detectMonorepo('./').then((result) => {
|
|
238
|
-
expect(result).toBe('lerna');
|
|
239
|
-
});
|
|
240
|
-
wrongCase = true;
|
|
241
|
-
specialCase = true;
|
|
242
|
-
await detectMonorepo('./').then((result) => {
|
|
243
|
-
expect(result).toBe('none');
|
|
244
|
-
});
|
|
245
|
-
specialCase = false;
|
|
246
|
-
});
|
|
247
|
-
|
|
248
269
|
it('verifies whether lerna bootstrap ran', async () => {
|
|
249
270
|
wrongCase = false;
|
|
250
|
-
await
|
|
271
|
+
await clients.lerna.installDependencies().then((result) => expect(result).toEqual(jsonValueString));
|
|
251
272
|
wrongCase = true;
|
|
252
|
-
await
|
|
273
|
+
await clients.lerna.installDependencies().then((result) => expect(result).not.toEqual(jsonValueString));
|
|
253
274
|
});
|
|
254
275
|
|
|
255
276
|
it('install dependencies with npm client', async () => {
|
|
256
277
|
wrongCase = false;
|
|
257
|
-
await
|
|
278
|
+
await installNpmDependencies('npm').then((result) => expect(result).toEqual(jsonValueString));
|
|
258
279
|
wrongCase = true;
|
|
259
|
-
await
|
|
280
|
+
await installNpmDependencies('npm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
260
281
|
});
|
|
261
282
|
|
|
262
283
|
it('install dependencies with pnpm client', async () => {
|
|
263
284
|
wrongCase = false;
|
|
264
|
-
await
|
|
285
|
+
await installNpmDependencies('pnpm').then((result) => expect(result).toEqual(jsonValueString));
|
|
265
286
|
wrongCase = true;
|
|
266
|
-
await
|
|
287
|
+
await installNpmDependencies('pnpm').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
267
288
|
});
|
|
268
289
|
|
|
269
290
|
it('install dependencies with yarn client', async () => {
|
|
270
291
|
wrongCase = false;
|
|
271
|
-
await
|
|
292
|
+
await installNpmDependencies('yarn').then((result) => expect(result).toEqual(jsonValueString));
|
|
272
293
|
wrongCase = true;
|
|
273
|
-
await
|
|
294
|
+
await installNpmDependencies('yarn').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
274
295
|
});
|
|
275
296
|
|
|
276
297
|
it('create npm package', async () => {
|
|
277
298
|
wrongCase = false;
|
|
278
|
-
await
|
|
299
|
+
await createNpmPackage().then((result) => expect(result).toEqual(jsonValueString));
|
|
279
300
|
wrongCase = true;
|
|
280
|
-
await
|
|
301
|
+
await createNpmPackage().then((result) => expect(result).not.toEqual(jsonValueString));
|
|
281
302
|
});
|
|
282
303
|
|
|
283
304
|
it('find npm tarball', async () => {
|
|
284
305
|
wrongCase = false;
|
|
285
|
-
await
|
|
306
|
+
await findNpmTarball('foo').then((result) => expect(result).toEqual(jsonValueString));
|
|
286
307
|
wrongCase = true;
|
|
287
|
-
await
|
|
308
|
+
await findNpmTarball('foo').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
288
309
|
});
|
|
289
310
|
|
|
290
311
|
it('find latest version', async () => {
|
|
@@ -301,23 +322,67 @@ describe('NPM Module', () => {
|
|
|
301
322
|
await findSpecificVersion('foo', '1.0.0').then((result) => expect(result).not.toEqual(jsonValueString));
|
|
302
323
|
});
|
|
303
324
|
|
|
304
|
-
it('check if package is local', () => {
|
|
305
|
-
|
|
325
|
+
it('check if package from full file is local', () => {
|
|
326
|
+
const result = isLocalPackage('./', 'file://foo.tgz');
|
|
306
327
|
expect(result).toBeTruthy();
|
|
307
|
-
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('check if package from current dir is local', () => {
|
|
331
|
+
const result = isLocalPackage('./', './');
|
|
308
332
|
expect(result).toBeTruthy();
|
|
309
|
-
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('check if package from file is local', () => {
|
|
336
|
+
const result = isLocalPackage('./', 'foo.tgz');
|
|
310
337
|
expect(result).toBeTruthy();
|
|
311
|
-
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('check if package from nothing is not local', () => {
|
|
341
|
+
const result = isLocalPackage('./', '');
|
|
342
|
+
expect(result).toBeFalsy();
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('check if package from tilde version is not local', () => {
|
|
346
|
+
const result = isLocalPackage('./', '~12.2.2');
|
|
347
|
+
expect(result).toBeFalsy();
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it('check if package from caret version is not local', () => {
|
|
351
|
+
const result = isLocalPackage('./', '^12.2.2');
|
|
352
|
+
expect(result).toBeFalsy();
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it('check if package from star version is not local', () => {
|
|
356
|
+
const result = isLocalPackage('./', '*');
|
|
357
|
+
expect(result).toBeFalsy();
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
it('check if package from greater than is not local', () => {
|
|
361
|
+
const result = isLocalPackage('./', '>=1.0.0');
|
|
312
362
|
expect(result).toBeFalsy();
|
|
313
363
|
});
|
|
314
364
|
|
|
365
|
+
it('check if package from home dir is local', () => {
|
|
366
|
+
const result = isLocalPackage('./', '~/foo/bar');
|
|
367
|
+
expect(result).toBeTruthy();
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
it('check if package from zero is not local', () => {
|
|
371
|
+
const result = isLocalPackage('./', '.0');
|
|
372
|
+
expect(result).toBeFalsy();
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('check if package from absolute dir is local', () => {
|
|
376
|
+
const result = isLocalPackage('./', '/0');
|
|
377
|
+
expect(result).toBeTruthy();
|
|
378
|
+
});
|
|
379
|
+
|
|
315
380
|
it('check if package is coming from git', () => {
|
|
316
381
|
let result = isGitPackage('https://.foo.git');
|
|
317
382
|
expect(result).toBeTruthy();
|
|
318
383
|
result = isGitPackage('git+');
|
|
319
384
|
expect(result).toBeTruthy();
|
|
320
|
-
result = isGitPackage(
|
|
385
|
+
result = isGitPackage('');
|
|
321
386
|
expect(result).toBeFalsy();
|
|
322
387
|
});
|
|
323
388
|
|
|
@@ -337,35 +402,36 @@ describe('NPM Module', () => {
|
|
|
337
402
|
});
|
|
338
403
|
|
|
339
404
|
it('verify whether package is linked', () => {
|
|
340
|
-
|
|
405
|
+
const target = process.cwd();
|
|
406
|
+
let result = isLinkedPackage('foo', 'registry', false, target);
|
|
341
407
|
expect(result).toBeFalsy();
|
|
342
|
-
result = isLinkedPackage('foo', 'file', false);
|
|
408
|
+
result = isLinkedPackage('foo', 'file', false, target);
|
|
343
409
|
expect(result).toBeFalsy();
|
|
344
|
-
result = isLinkedPackage('foo', 'git', false);
|
|
410
|
+
result = isLinkedPackage('foo', 'git', false, target);
|
|
345
411
|
expect(result).toBeFalsy();
|
|
346
412
|
});
|
|
347
413
|
|
|
348
414
|
it('combine package refernce', () => {
|
|
349
415
|
let result = combinePackageRef('foo', '1.0.0', 'registry');
|
|
350
416
|
expect(result).toBe('foo@1.0.0');
|
|
351
|
-
result = combinePackageRef('foo',
|
|
417
|
+
result = combinePackageRef('foo', '', 'registry');
|
|
352
418
|
expect(result).toBe('foo@latest');
|
|
353
|
-
result = combinePackageRef('foo',
|
|
419
|
+
result = combinePackageRef('foo', '', 'file');
|
|
354
420
|
expect(result).toBe('foo');
|
|
355
|
-
result = combinePackageRef('foo',
|
|
421
|
+
result = combinePackageRef('foo', '', 'git');
|
|
356
422
|
expect(result).toBe('foo');
|
|
357
423
|
});
|
|
358
424
|
|
|
359
|
-
it('retrieve package name', () => {
|
|
425
|
+
it('retrieve package name', async () => {
|
|
360
426
|
let result = getPackageName('./', 'foo', 'file');
|
|
361
427
|
expect(result).toBeInstanceOf(Promise);
|
|
362
|
-
result.then((message) => expect(message).toBeUndefined());
|
|
428
|
+
await result.then((message) => expect(message).toBeUndefined());
|
|
363
429
|
result = getPackageName('./', 'foo', 'git');
|
|
364
430
|
expect(result).toBeInstanceOf(Promise);
|
|
365
|
-
result.then((message) => expect(message).toBeUndefined());
|
|
431
|
+
await result.then((message) => expect(message).toBeUndefined());
|
|
366
432
|
result = getPackageName('./', 'foo', 'registry');
|
|
367
433
|
expect(result).toBeInstanceOf(Promise);
|
|
368
|
-
result.then((name) => expect(name).toEqual('foo'));
|
|
434
|
+
await result.then((name) => expect(name).toEqual('foo'));
|
|
369
435
|
});
|
|
370
436
|
|
|
371
437
|
it('gets path to file package', () => {
|
|
@@ -383,113 +449,68 @@ describe('NPM Module', () => {
|
|
|
383
449
|
expect(result).toEqual('1.0.0');
|
|
384
450
|
result = getPackageVersion(false, 'foo', '1.0.0', 'registry', './');
|
|
385
451
|
expect(result).toBeFalsy();
|
|
386
|
-
result = getPackageVersion(true, './foo.tgz',
|
|
452
|
+
result = getPackageVersion(true, './foo.tgz', '', 'file', './');
|
|
387
453
|
expect(result).toEqual('file:foo.tgz');
|
|
388
|
-
result = getPackageVersion(true, 'git+https://.foo.git',
|
|
454
|
+
result = getPackageVersion(true, 'git+https://.foo.git', '', 'git', '');
|
|
389
455
|
expect(result).toEqual('git+https://.foo.git');
|
|
390
456
|
});
|
|
391
457
|
|
|
392
|
-
it('gets path to git package', () => {
|
|
393
|
-
const result = getCurrentPackageDetails('./', './foo.tgz',
|
|
394
|
-
result.then(([path, version]) => {
|
|
458
|
+
it('gets path to git package', async () => {
|
|
459
|
+
const result = getCurrentPackageDetails('./', './foo.tgz', '', 'file://foo.tgz', './');
|
|
460
|
+
await result.then(([path, version]) => {
|
|
395
461
|
expect(path).not.toBeUndefined();
|
|
396
462
|
});
|
|
397
|
-
const result2 = getCurrentPackageDetails('./', './foo.tgz',
|
|
398
|
-
result2.then(([path, version]) => {
|
|
463
|
+
const result2 = getCurrentPackageDetails('./', './foo.tgz', '', 'git+https://.foo.git', './');
|
|
464
|
+
await result2.then(([path, version]) => {
|
|
399
465
|
expect(path).not.toBeUndefined();
|
|
400
466
|
});
|
|
401
467
|
const result3 = getCurrentPackageDetails('./', './foo.tgz', '1.0.0', 'latest', './');
|
|
402
|
-
result3.then(([path, version]) => {
|
|
468
|
+
await result3.then(([path, version]) => {
|
|
403
469
|
expect(path).toEqual('./foo.tgz@latest');
|
|
404
470
|
expect(version).toEqual('latest');
|
|
405
471
|
});
|
|
406
472
|
});
|
|
407
473
|
|
|
408
|
-
it('makeExternals without externals returns coreExternals', () => {
|
|
409
|
-
const externals = makeExternals();
|
|
410
|
-
expect(externals).toEqual([
|
|
411
|
-
'@dbeining/react-atom',
|
|
412
|
-
'@libre/atom',
|
|
413
|
-
'history',
|
|
414
|
-
'react',
|
|
415
|
-
'react-dom',
|
|
416
|
-
'react-router',
|
|
417
|
-
'react-router-dom',
|
|
418
|
-
'tslib',
|
|
419
|
-
'path-to-regexp',
|
|
420
|
-
]);
|
|
474
|
+
it('makeExternals without externals returns coreExternals', async () => {
|
|
475
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, []);
|
|
476
|
+
expect(externals).toEqual(['react', 'react-dom', 'react-router', 'react-router-dom', 'tslib']);
|
|
421
477
|
});
|
|
422
478
|
|
|
423
|
-
it('makeExternals with no externals returns coreExternals', () => {
|
|
424
|
-
const externals = makeExternals([]);
|
|
425
|
-
expect(externals).toEqual([
|
|
426
|
-
'@dbeining/react-atom',
|
|
427
|
-
'@libre/atom',
|
|
428
|
-
'history',
|
|
429
|
-
'react',
|
|
430
|
-
'react-dom',
|
|
431
|
-
'react-router',
|
|
432
|
-
'react-router-dom',
|
|
433
|
-
'tslib',
|
|
434
|
-
'path-to-regexp',
|
|
435
|
-
]);
|
|
479
|
+
it('makeExternals with no externals returns coreExternals', async () => {
|
|
480
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, []);
|
|
481
|
+
expect(externals).toEqual(['react', 'react-dom', 'react-router', 'react-router-dom', 'tslib']);
|
|
436
482
|
});
|
|
437
483
|
|
|
438
|
-
it('makeExternals with exclude coreExternals returns empty set', () => {
|
|
439
|
-
const externals = makeExternals(['!*']);
|
|
484
|
+
it('makeExternals with exclude coreExternals returns empty set', async () => {
|
|
485
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, ['!*']);
|
|
440
486
|
expect(externals).toEqual([]);
|
|
441
487
|
});
|
|
442
488
|
|
|
443
|
-
it('makeExternals with externals concats coreExternals', () => {
|
|
444
|
-
const externals = makeExternals(['foo', 'bar']);
|
|
489
|
+
it('makeExternals with externals concats coreExternals', async () => {
|
|
490
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, ['foo', 'bar']);
|
|
445
491
|
expect(externals).toEqual([
|
|
446
492
|
'foo',
|
|
447
493
|
'bar',
|
|
448
|
-
'@dbeining/react-atom',
|
|
449
|
-
'@libre/atom',
|
|
450
|
-
'history',
|
|
451
494
|
'react',
|
|
452
495
|
'react-dom',
|
|
453
496
|
'react-router',
|
|
454
497
|
'react-router-dom',
|
|
455
498
|
'tslib',
|
|
456
|
-
'path-to-regexp',
|
|
457
499
|
]);
|
|
458
500
|
});
|
|
459
501
|
|
|
460
|
-
it('makeExternals with external duplicate only reflects coreExternals', () => {
|
|
461
|
-
const externals = makeExternals(['react', 'foo']);
|
|
462
|
-
expect(externals).toEqual([
|
|
463
|
-
'react',
|
|
464
|
-
'foo',
|
|
465
|
-
'@dbeining/react-atom',
|
|
466
|
-
'@libre/atom',
|
|
467
|
-
'history',
|
|
468
|
-
'react-dom',
|
|
469
|
-
'react-router',
|
|
470
|
-
'react-router-dom',
|
|
471
|
-
'tslib',
|
|
472
|
-
'path-to-regexp',
|
|
473
|
-
]);
|
|
502
|
+
it('makeExternals with external duplicate only reflects coreExternals', async () => {
|
|
503
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, ['react', 'foo']);
|
|
504
|
+
expect(externals).toEqual(['react', 'foo', 'react-dom', 'react-router', 'react-router-dom', 'tslib']);
|
|
474
505
|
});
|
|
475
506
|
|
|
476
|
-
it('makeExternals with explicit include and exclude', () => {
|
|
477
|
-
const externals = makeExternals(['react', 'react-calendar', '!
|
|
478
|
-
expect(externals).toEqual([
|
|
479
|
-
'react',
|
|
480
|
-
'react-calendar',
|
|
481
|
-
'@dbeining/react-atom',
|
|
482
|
-
'@libre/atom',
|
|
483
|
-
'react-dom',
|
|
484
|
-
'react-router',
|
|
485
|
-
'react-router-dom',
|
|
486
|
-
'tslib',
|
|
487
|
-
'path-to-regexp',
|
|
488
|
-
]);
|
|
507
|
+
it('makeExternals with explicit include and exclude', async () => {
|
|
508
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, ['react', 'react-calendar', '!tslib']);
|
|
509
|
+
expect(externals).toEqual(['react', 'react-calendar', 'react-dom', 'react-router', 'react-router-dom']);
|
|
489
510
|
});
|
|
490
511
|
|
|
491
|
-
it('makeExternals with all exclude and explicit include', () => {
|
|
492
|
-
const externals = makeExternals(['react', 'react-router-dom', '!*']);
|
|
512
|
+
it('makeExternals with all exclude and explicit include', async () => {
|
|
513
|
+
const externals = await makeExternals(process.cwd(), { piral: '*' }, ['react', 'react-router-dom', '!*']);
|
|
493
514
|
expect(externals).toEqual(['react', 'react-router-dom']);
|
|
494
515
|
});
|
|
495
516
|
});
|