@teambit/application 1.0.185 → 1.0.186
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/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_harmony_application-preview.js +1 -1
- package/artifacts/schema.json +11 -11
- package/dist/{preview-1709695009203.js → preview-1709781440634.js} +2 -2
- package/dist/run.cmd.d.ts +1 -3
- package/dist/run.cmd.js +7 -40
- package/dist/run.cmd.js.map +1 -1
- package/package.json +12 -15
- package/run.cmd.tsx +0 -90
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<testsuites tests="0" failures="0" errors="0" skipped="0">
|
|
3
|
-
<testsuite name="teambit.harmony/application@1.0.
|
|
3
|
+
<testsuite name="teambit.harmony/application@1.0.186" tests="0" failures="0" errors="0" skipped="0"/>
|
|
4
4
|
</testsuites>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/application-preview"]=t():e["teambit.harmony/application-preview"]=t()}(self,(()=>(()=>{"use strict";var e={
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/application-preview"]=t():e["teambit.harmony/application-preview"]=t()}(self,(()=>(()=>{"use strict";var e={47898:(e,t,o)=>{var n={id:"teambit.harmony/application@1.0.186",homepage:"https://bit.cloud/teambit/harmony/application",exported:!0};function r(){const e=i(o(41594));return r=function(){return e},e}function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=n,i.__bit_component=n;const a=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/app.svg"}));a.__bit_component=n,t.Logo=a},41594:e=>{e.exports=React}},t={};function o(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,o),i.exports}o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{o.r(n),o.d(n,{compositions:()=>l,compositions_metadata:()=>f,overview:()=>u});var e={};o.r(e),o.d(e,{default:()=>d});var t=o(47898);o(41594);const r=MdxJsReact,i=TeambitMdxUiMdxScopeContext;var a=["components"];function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e},p.apply(this,arguments)}var c={},s="wrapper";function d(e){var t=e.components,o=function(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)o=i[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}(e,a);return(0,r.mdx)(s,p({},c,o,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(i.MDXScopeProvider,{components:{},mdxType:"MDXScopeProvider"}))}d.isMDXComponent=!0;const l=[t],u=[e],f={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),n})()));
|
package/artifacts/schema.json
CHANGED
|
@@ -3143,7 +3143,7 @@
|
|
|
3143
3143
|
"_legacy": {
|
|
3144
3144
|
"scope": "teambit.harmony",
|
|
3145
3145
|
"name": "application",
|
|
3146
|
-
"version": "1.0.
|
|
3146
|
+
"version": "1.0.186"
|
|
3147
3147
|
},
|
|
3148
3148
|
"_scope": "teambit.harmony"
|
|
3149
3149
|
}
|
|
@@ -3497,7 +3497,7 @@
|
|
|
3497
3497
|
"_legacy": {
|
|
3498
3498
|
"scope": "teambit.harmony",
|
|
3499
3499
|
"name": "application",
|
|
3500
|
-
"version": "1.0.
|
|
3500
|
+
"version": "1.0.186"
|
|
3501
3501
|
},
|
|
3502
3502
|
"_scope": "teambit.harmony"
|
|
3503
3503
|
}
|
|
@@ -3983,7 +3983,7 @@
|
|
|
3983
3983
|
"_legacy": {
|
|
3984
3984
|
"scope": "teambit.harmony",
|
|
3985
3985
|
"name": "application",
|
|
3986
|
-
"version": "1.0.
|
|
3986
|
+
"version": "1.0.186"
|
|
3987
3987
|
},
|
|
3988
3988
|
"_scope": "teambit.harmony"
|
|
3989
3989
|
}
|
|
@@ -4731,7 +4731,7 @@
|
|
|
4731
4731
|
"_legacy": {
|
|
4732
4732
|
"scope": "teambit.harmony",
|
|
4733
4733
|
"name": "application",
|
|
4734
|
-
"version": "1.0.
|
|
4734
|
+
"version": "1.0.186"
|
|
4735
4735
|
},
|
|
4736
4736
|
"_scope": "teambit.harmony"
|
|
4737
4737
|
}
|
|
@@ -5217,7 +5217,7 @@
|
|
|
5217
5217
|
"_legacy": {
|
|
5218
5218
|
"scope": "teambit.harmony",
|
|
5219
5219
|
"name": "application",
|
|
5220
|
-
"version": "1.0.
|
|
5220
|
+
"version": "1.0.186"
|
|
5221
5221
|
},
|
|
5222
5222
|
"_scope": "teambit.harmony"
|
|
5223
5223
|
}
|
|
@@ -8609,7 +8609,7 @@
|
|
|
8609
8609
|
"_legacy": {
|
|
8610
8610
|
"scope": "teambit.harmony",
|
|
8611
8611
|
"name": "application",
|
|
8612
|
-
"version": "1.0.
|
|
8612
|
+
"version": "1.0.186"
|
|
8613
8613
|
},
|
|
8614
8614
|
"_scope": "teambit.harmony"
|
|
8615
8615
|
}
|
|
@@ -9174,7 +9174,7 @@
|
|
|
9174
9174
|
"_legacy": {
|
|
9175
9175
|
"scope": "teambit.harmony",
|
|
9176
9176
|
"name": "application",
|
|
9177
|
-
"version": "1.0.
|
|
9177
|
+
"version": "1.0.186"
|
|
9178
9178
|
},
|
|
9179
9179
|
"_scope": "teambit.harmony"
|
|
9180
9180
|
}
|
|
@@ -9660,7 +9660,7 @@
|
|
|
9660
9660
|
"_legacy": {
|
|
9661
9661
|
"scope": "teambit.harmony",
|
|
9662
9662
|
"name": "application",
|
|
9663
|
-
"version": "1.0.
|
|
9663
|
+
"version": "1.0.186"
|
|
9664
9664
|
},
|
|
9665
9665
|
"_scope": "teambit.harmony"
|
|
9666
9666
|
}
|
|
@@ -9863,7 +9863,7 @@
|
|
|
9863
9863
|
"_legacy": {
|
|
9864
9864
|
"scope": "teambit.harmony",
|
|
9865
9865
|
"name": "application",
|
|
9866
|
-
"version": "1.0.
|
|
9866
|
+
"version": "1.0.186"
|
|
9867
9867
|
},
|
|
9868
9868
|
"_scope": "teambit.harmony"
|
|
9869
9869
|
}
|
|
@@ -10349,7 +10349,7 @@
|
|
|
10349
10349
|
"_legacy": {
|
|
10350
10350
|
"scope": "teambit.harmony",
|
|
10351
10351
|
"name": "application",
|
|
10352
|
-
"version": "1.0.
|
|
10352
|
+
"version": "1.0.186"
|
|
10353
10353
|
},
|
|
10354
10354
|
"_scope": "teambit.harmony"
|
|
10355
10355
|
}
|
|
@@ -11278,7 +11278,7 @@
|
|
|
11278
11278
|
"componentId": {
|
|
11279
11279
|
"scope": "teambit.harmony",
|
|
11280
11280
|
"name": "application",
|
|
11281
|
-
"version": "1.0.
|
|
11281
|
+
"version": "1.0.186"
|
|
11282
11282
|
},
|
|
11283
11283
|
"taggedModuleExports": []
|
|
11284
11284
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.186/dist/application.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_application@1.0.186/dist/application.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/dist/run.cmd.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Command, CommandOptions } from '@teambit/cli';
|
|
3
2
|
import { Logger } from '@teambit/logger';
|
|
4
|
-
import type { RenderResult } from '@teambit/legacy/dist/cli/command';
|
|
5
3
|
import { ApplicationMain } from './application.main.runtime';
|
|
6
4
|
type RunOptions = {
|
|
7
5
|
dev: boolean;
|
|
@@ -32,6 +30,6 @@ export declare class RunCmd implements Command {
|
|
|
32
30
|
* access to the extension instance.
|
|
33
31
|
*/
|
|
34
32
|
application: ApplicationMain, logger: Logger);
|
|
35
|
-
|
|
33
|
+
wait([appName]: [string], { dev, watch, ssr, port: exactPort }: RunOptions): Promise<void>;
|
|
36
34
|
}
|
|
37
35
|
export {};
|
package/dist/run.cmd.js
CHANGED
|
@@ -4,28 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RunCmd = void 0;
|
|
7
|
-
function _react() {
|
|
8
|
-
const data = _interopRequireDefault(require("react"));
|
|
9
|
-
_react = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _pluralize() {
|
|
15
|
-
const data = _interopRequireDefault(require("pluralize"));
|
|
16
|
-
_pluralize = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
function _ink() {
|
|
22
|
-
const data = require("ink");
|
|
23
|
-
_ink = function () {
|
|
24
|
-
return data;
|
|
25
|
-
};
|
|
26
|
-
return data;
|
|
27
|
-
}
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
30
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
|
31
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
@@ -50,7 +28,7 @@ class RunCmd {
|
|
|
50
28
|
// ['', 'skip-watch', 'avoid running the watch process that compiles components in the background'],
|
|
51
29
|
['w', 'watch', 'watch and compile your components upon changes']]);
|
|
52
30
|
}
|
|
53
|
-
async
|
|
31
|
+
async wait([appName], {
|
|
54
32
|
dev,
|
|
55
33
|
watch,
|
|
56
34
|
ssr,
|
|
@@ -69,28 +47,17 @@ class RunCmd {
|
|
|
69
47
|
port: +exactPort
|
|
70
48
|
});
|
|
71
49
|
if (errors) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
50
|
+
const errStr =
|
|
51
|
+
// @ts-ignore fix once we have type for errors
|
|
52
|
+
errors && errors.length ? errors.map(err => err.toString()).join('\n') : 'unknown error occurred';
|
|
53
|
+
this.logger.console(errStr);
|
|
54
|
+
process.exit(1);
|
|
78
55
|
}
|
|
79
56
|
if (isOldApi) {
|
|
80
|
-
|
|
57
|
+
this.logger.console(`${appName} app is running on http://localhost:${port}`);
|
|
81
58
|
}
|
|
82
|
-
return /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null);
|
|
83
59
|
}
|
|
84
60
|
}
|
|
85
61
|
exports.RunCmd = RunCmd;
|
|
86
|
-
function ShowErrors({
|
|
87
|
-
errors
|
|
88
|
-
}) {
|
|
89
|
-
return /*#__PURE__*/_react().default.createElement(_react().default.Fragment, null, /*#__PURE__*/_react().default.createElement(_ink().Newline, null), /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
90
|
-
underline: true
|
|
91
|
-
}, "Fatal ", (0, _pluralize().default)('error', errors.length), ":"), errors.map((x, idx) => /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
92
|
-
key: idx
|
|
93
|
-
}, x.toString())));
|
|
94
|
-
}
|
|
95
62
|
|
|
96
63
|
//# sourceMappingURL=run.cmd.js.map
|
package/dist/run.cmd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["RunCmd","constructor","application","logger","_defineProperty","name","description","wait","appName","dev","watch","ssr","port","exactPort","off","errors","isOldApi","runApp","errStr","length","map","err","toString","join","console","process","exit","exports"],"sources":["run.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport { ApplicationMain } from './application.main.runtime';\n\ntype RunOptions = {\n dev: boolean;\n verbose: boolean;\n skipWatch: boolean;\n watch: boolean;\n ssr: boolean;\n port: string;\n};\n\nexport class RunCmd implements Command {\n name = 'run <app-name>';\n description = \"locally run an app component (independent of bit's dev server)\";\n helpUrl = 'reference/apps/apps-overview/';\n arguments = [\n {\n name: 'app-name',\n description:\n \"the app's name is registered by the app (run 'bit app list' to list the names of the available apps)\",\n },\n ];\n alias = 'c';\n group = 'apps';\n options = [\n ['d', 'dev', 'start the application in dev mode.'],\n ['p', 'port [port-number]', 'port to run the app on'],\n ['v', 'verbose', 'show verbose output for inspection and print stack trace'],\n // ['', 'skip-watch', 'avoid running the watch process that compiles components in the background'],\n ['w', 'watch', 'watch and compile your components upon changes'],\n ] as CommandOptions;\n\n constructor(\n /**\n * access to the extension instance.\n */\n private application: ApplicationMain,\n\n private logger: Logger\n ) {}\n\n async wait([appName]: [string], { dev, watch, ssr, port: exactPort }: RunOptions) {\n // remove wds logs until refactoring webpack to a worker through the Worker aspect.\n this.logger.off();\n const { port, errors, isOldApi } = await this.application.runApp(appName, {\n dev,\n watch,\n ssr,\n port: +exactPort,\n });\n\n if (errors) {\n const errStr =\n // @ts-ignore fix once we have type for errors\n errors && errors.length ? errors.map((err) => err.toString()).join('\\n') : 'unknown error occurred';\n this.logger.console(errStr);\n process.exit(1);\n }\n\n if (isOldApi) {\n this.logger.console(`${appName} app is running on http://localhost:${port}`);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAaO,MAAMA,MAAM,CAAoB;EAqBrCC,WAAWA;EACT;AACJ;AACA;EACYC,WAA4B,EAE5BC,MAAc,EACtB;IAAA,KAHQD,WAA4B,GAA5BA,WAA4B;IAAA,KAE5BC,MAAc,GAAdA,MAAc;IAAAC,eAAA,eA1BjB,gBAAgB;IAAAA,eAAA,sBACT,gEAAgE;IAAAA,eAAA,kBACpE,+BAA+B;IAAAA,eAAA,oBAC7B,CACV;MACEC,IAAI,EAAE,UAAU;MAChBC,WAAW,EACT;IACJ,CAAC,CACF;IAAAF,eAAA,gBACO,GAAG;IAAAA,eAAA,gBACH,MAAM;IAAAA,eAAA,kBACJ,CACR,CAAC,GAAG,EAAE,KAAK,EAAE,oCAAoC,CAAC,EAClD,CAAC,GAAG,EAAE,oBAAoB,EAAE,wBAAwB,CAAC,EACrD,CAAC,GAAG,EAAE,SAAS,EAAE,0DAA0D,CAAC;IAC5E;IACA,CAAC,GAAG,EAAE,OAAO,EAAE,gDAAgD,CAAC,CACjE;EASE;EAEH,MAAMG,IAAIA,CAAC,CAACC,OAAO,CAAW,EAAE;IAAEC,GAAG;IAAEC,KAAK;IAAEC,GAAG;IAAEC,IAAI,EAAEC;EAAsB,CAAC,EAAE;IAChF;IACA,IAAI,CAACV,MAAM,CAACW,GAAG,CAAC,CAAC;IACjB,MAAM;MAAEF,IAAI;MAAEG,MAAM;MAAEC;IAAS,CAAC,GAAG,MAAM,IAAI,CAACd,WAAW,CAACe,MAAM,CAACT,OAAO,EAAE;MACxEC,GAAG;MACHC,KAAK;MACLC,GAAG;MACHC,IAAI,EAAE,CAACC;IACT,CAAC,CAAC;IAEF,IAAIE,MAAM,EAAE;MACV,MAAMG,MAAM;MACV;MACAH,MAAM,IAAIA,MAAM,CAACI,MAAM,GAAGJ,MAAM,CAACK,GAAG,CAAEC,GAAG,IAAKA,GAAG,CAACC,QAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC,GAAG,wBAAwB;MACrG,IAAI,CAACpB,MAAM,CAACqB,OAAO,CAACN,MAAM,CAAC;MAC3BO,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB;IAEA,IAAIV,QAAQ,EAAE;MACZ,IAAI,CAACb,MAAM,CAACqB,OAAO,CAAE,GAAEhB,OAAQ,uCAAsCI,IAAK,EAAC,CAAC;IAC9E;EACF;AACF;AAACe,OAAA,CAAA3B,MAAA,GAAAA,MAAA"}
|
package/package.json
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/application",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.186",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/harmony/application",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.harmony",
|
|
8
8
|
"name": "application",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.186"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"chalk": "2.4.2",
|
|
13
13
|
"lodash": "4.17.21",
|
|
14
14
|
"p-map-series": "2.1.0",
|
|
15
|
-
"ink": "3.2.0",
|
|
16
|
-
"pluralize": "8.0.0",
|
|
17
15
|
"@teambit/lane-id": "0.0.311",
|
|
18
16
|
"@teambit/harmony": "0.4.6",
|
|
19
17
|
"@teambit/bit-error": "0.0.404",
|
|
20
|
-
"@teambit/builder": "1.0.
|
|
21
|
-
"@teambit/component": "1.0.
|
|
22
|
-
"@teambit/isolator": "1.0.
|
|
23
|
-
"@teambit/envs": "1.0.
|
|
24
|
-
"@teambit/logger": "0.0.
|
|
18
|
+
"@teambit/builder": "1.0.186",
|
|
19
|
+
"@teambit/component": "1.0.186",
|
|
20
|
+
"@teambit/isolator": "1.0.186",
|
|
21
|
+
"@teambit/envs": "1.0.186",
|
|
22
|
+
"@teambit/logger": "0.0.947",
|
|
25
23
|
"@teambit/cli-table": "0.0.48",
|
|
26
|
-
"@teambit/cli": "0.0.
|
|
27
|
-
"@teambit/aspect-loader": "1.0.
|
|
28
|
-
"@teambit/scope": "1.0.
|
|
29
|
-
"@teambit/watcher": "1.0.
|
|
30
|
-
"@teambit/workspace": "1.0.
|
|
24
|
+
"@teambit/cli": "0.0.854",
|
|
25
|
+
"@teambit/aspect-loader": "1.0.186",
|
|
26
|
+
"@teambit/scope": "1.0.186",
|
|
27
|
+
"@teambit/watcher": "1.0.186",
|
|
28
|
+
"@teambit/workspace": "1.0.186"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
31
|
"@types/lodash": "4.14.165",
|
|
34
|
-
"@types/pluralize": "0.0.29",
|
|
35
32
|
"@types/mocha": "9.1.0",
|
|
36
33
|
"chai": "4.3.0",
|
|
37
34
|
"@teambit/harmony.envs.core-aspect-env": "0.0.25"
|
package/run.cmd.tsx
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import pluralize from 'pluralize';
|
|
3
|
-
import { Command, CommandOptions } from '@teambit/cli';
|
|
4
|
-
import { Newline, Text } from 'ink';
|
|
5
|
-
import { Logger } from '@teambit/logger';
|
|
6
|
-
import type { RenderResult } from '@teambit/legacy/dist/cli/command';
|
|
7
|
-
import { ApplicationMain } from './application.main.runtime';
|
|
8
|
-
|
|
9
|
-
type RunOptions = {
|
|
10
|
-
dev: boolean;
|
|
11
|
-
verbose: boolean;
|
|
12
|
-
skipWatch: boolean;
|
|
13
|
-
watch: boolean;
|
|
14
|
-
ssr: boolean;
|
|
15
|
-
port: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export class RunCmd implements Command {
|
|
19
|
-
name = 'run <app-name>';
|
|
20
|
-
description = "locally run an app component (independent of bit's dev server)";
|
|
21
|
-
helpUrl = 'reference/apps/apps-overview/';
|
|
22
|
-
arguments = [
|
|
23
|
-
{
|
|
24
|
-
name: 'app-name',
|
|
25
|
-
description:
|
|
26
|
-
"the app's name is registered by the app (run 'bit app list' to list the names of the available apps)",
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
alias = 'c';
|
|
30
|
-
group = 'apps';
|
|
31
|
-
options = [
|
|
32
|
-
['d', 'dev', 'start the application in dev mode.'],
|
|
33
|
-
['p', 'port [port-number]', 'port to run the app on'],
|
|
34
|
-
['v', 'verbose', 'show verbose output for inspection and print stack trace'],
|
|
35
|
-
// ['', 'skip-watch', 'avoid running the watch process that compiles components in the background'],
|
|
36
|
-
['w', 'watch', 'watch and compile your components upon changes'],
|
|
37
|
-
] as CommandOptions;
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
/**
|
|
41
|
-
* access to the extension instance.
|
|
42
|
-
*/
|
|
43
|
-
private application: ApplicationMain,
|
|
44
|
-
|
|
45
|
-
private logger: Logger
|
|
46
|
-
) {}
|
|
47
|
-
|
|
48
|
-
async render(
|
|
49
|
-
[appName]: [string],
|
|
50
|
-
{ dev, watch, ssr, port: exactPort }: RunOptions
|
|
51
|
-
): Promise<React.ReactElement | RenderResult> {
|
|
52
|
-
// remove wds logs until refactoring webpack to a worker through the Worker aspect.
|
|
53
|
-
this.logger.off();
|
|
54
|
-
const { port, errors, isOldApi } = await this.application.runApp(appName, {
|
|
55
|
-
dev,
|
|
56
|
-
watch,
|
|
57
|
-
ssr,
|
|
58
|
-
port: +exactPort,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (errors) {
|
|
62
|
-
return {
|
|
63
|
-
code: 1,
|
|
64
|
-
data: <ShowErrors errors={errors} />,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (isOldApi) {
|
|
69
|
-
return (
|
|
70
|
-
<Text>
|
|
71
|
-
{appName} app is running on http://localhost:{port}
|
|
72
|
-
</Text>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return <></>;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function ShowErrors({ errors }: { errors: Error[] }) {
|
|
81
|
-
return (
|
|
82
|
-
<>
|
|
83
|
-
<Newline />
|
|
84
|
-
<Text underline>Fatal {pluralize('error', errors.length)}:</Text>
|
|
85
|
-
{errors.map((x, idx) => (
|
|
86
|
-
<Text key={idx}>{x.toString()}</Text>
|
|
87
|
-
))}
|
|
88
|
-
</>
|
|
89
|
-
);
|
|
90
|
-
}
|