crankscript 0.12.0 → 0.13.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/package.json +1 -1
- package/src/commands/NewCommand/components/New.js +25 -2
- package/src/commands/NewCommand/components/New.js.map +1 -1
- package/src/commands/NewLibCommand/NewLibCommand.d.ts +10 -0
- package/src/commands/NewLibCommand/NewLibCommand.js +35 -0
- package/src/commands/NewLibCommand/NewLibCommand.js.map +1 -0
- package/src/commands/NewLibCommand/components/NewLib.d.ts +8 -0
- package/src/commands/NewLibCommand/components/NewLib.js +49 -0
- package/src/commands/NewLibCommand/components/NewLib.js.map +1 -0
- package/src/commands/NewLibCommand/index.d.ts +1 -0
- package/src/commands/NewLibCommand/index.js +3 -0
- package/src/commands/NewLibCommand/index.js.map +1 -0
- package/src/commands/SimulatorCommand/components/Simulator.js +5 -0
- package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -1
- package/src/commands/TranspileCommand/TranspileCommand.d.ts +1 -0
- package/src/commands/TranspileCommand/TranspileCommand.js +12 -2
- package/src/commands/TranspileCommand/TranspileCommand.js.map +1 -1
- package/src/commands/TranspileCommand/components/Transpile.d.ts +3 -1
- package/src/commands/TranspileCommand/components/Transpile.js +3 -2
- package/src/commands/TranspileCommand/components/Transpile.js.map +1 -1
- package/src/commands/TranspileCommand/fn/transpile.d.ts +3 -1
- package/src/commands/TranspileCommand/fn/transpile.js +12 -4
- package/src/commands/TranspileCommand/fn/transpile.js.map +1 -1
- package/src/commands/TranspileCommand/fn/validateExitPoint.d.ts +5 -0
- package/src/commands/TranspileCommand/fn/validateExitPoint.js +26 -0
- package/src/commands/TranspileCommand/fn/validateExitPoint.js.map +1 -0
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.d.ts +3 -1
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.js +3 -2
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.js.map +1 -1
- package/src/commands/TranspileCommand/model/ValidatedExitPoint.d.ts +11 -0
- package/src/commands/TranspileCommand/model/ValidatedExitPoint.js +3 -0
- package/src/commands/TranspileCommand/model/ValidatedExitPoint.js.map +1 -0
- package/src/components/CheckList/Item.js +1 -1
- package/src/components/CheckList/Item.js.map +1 -1
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/types.d.ts +3 -0
- package/src/types.js +4 -0
- package/src/types.js.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
+
import { exec } from 'node:child_process';
|
2
|
+
import { join } from 'node:path';
|
3
|
+
import { promisify } from 'node:util';
|
1
4
|
import React, { useMemo } from 'react';
|
2
5
|
import tiged from 'tiged';
|
3
6
|
import { CheckList } from '../../../components/CheckList/index.js';
|
7
|
+
const execPromise = promisify(exec);
|
4
8
|
export const New = ({ name, template })=>{
|
5
9
|
const items = useMemo(()=>{
|
6
10
|
return [
|
@@ -14,12 +18,31 @@ export const New = ({ name, template })=>{
|
|
14
18
|
runningDescription: `Creating a new project named "${name}" using the "${template}" template`,
|
15
19
|
finishedDescription: ()=>`Created a new project named "${name}" using the "${template}" template`,
|
16
20
|
errorDescription: `Failed to create project named "${name}" using the "${template}" template`
|
21
|
+
},
|
22
|
+
{
|
23
|
+
ready: true,
|
24
|
+
runner: async ()=>{
|
25
|
+
const projectPath = join(process.cwd(), name);
|
26
|
+
await execPromise(`npm install`, {
|
27
|
+
cwd: projectPath
|
28
|
+
});
|
29
|
+
await execPromise(`npm install --save-exact @crankscript/core@latest @crankscript/types@latest crankscript@latest`, {
|
30
|
+
cwd: projectPath
|
31
|
+
});
|
32
|
+
},
|
33
|
+
waitingDescription: `About to install dependencies for "${name}"`,
|
34
|
+
runningDescription: `Installing dependencies for "${name}"`,
|
35
|
+
finishedDescription: ()=>`Installed dependencies for "${name}"`,
|
36
|
+
errorDescription: `Failed to install dependencies for "${name}"`
|
17
37
|
}
|
18
38
|
];
|
19
|
-
}, [
|
39
|
+
}, [
|
40
|
+
name,
|
41
|
+
template
|
42
|
+
]);
|
20
43
|
return /*#__PURE__*/ React.createElement(CheckList, {
|
21
44
|
items: items,
|
22
|
-
onFinish: ()=>process.exit
|
45
|
+
onFinish: ()=>process.exit()
|
23
46
|
});
|
24
47
|
};
|
25
48
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/NewCommand/components/New.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport tiged from 'tiged';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { CheckListItem, TemplateName } from '@/cli/types.js';\n\ninterface Props {\n name: string;\n template: TemplateName;\n}\n\nexport const New = ({ name, template }: Props) => {\n const items = useMemo(() => {\n return [\n {\n ready: true,\n runner: async () => {\n const task = tiged(`crankscript/template-${template}`);\n\n await task.clone(name);\n },\n waitingDescription: `About to create a new project named \"${name}\" using the \"${template}\" template`,\n runningDescription: `Creating a new project named \"${name}\" using the \"${template}\" template`,\n finishedDescription: () =>\n `Created a new project named \"${name}\" using the \"${template}\" template`,\n errorDescription: `Failed to create project named \"${name}\" using the \"${template}\" template`,\n },\n ];\n }, []) satisfies CheckListItem<unknown>[];\n\n return <CheckList items={items} onFinish={() => process.exit} />;\n};\n"],"names":["React","useMemo","tiged","CheckList","New","name","template","items","ready","runner","task","clone","waitingDescription","runningDescription","finishedDescription","errorDescription","
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/NewCommand/components/New.tsx"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { join } from 'node:path';\nimport { promisify } from 'node:util';\nimport React, { useMemo } from 'react';\nimport tiged from 'tiged';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { CheckListItem, TemplateName } from '@/cli/types.js';\n\nconst execPromise = promisify(exec);\n\ninterface Props {\n name: string;\n template: TemplateName;\n}\n\nexport const New = ({ name, template }: Props) => {\n const items = useMemo(() => {\n return [\n {\n ready: true,\n runner: async () => {\n const task = tiged(`crankscript/template-${template}`);\n\n await task.clone(name);\n },\n waitingDescription: `About to create a new project named \"${name}\" using the \"${template}\" template`,\n runningDescription: `Creating a new project named \"${name}\" using the \"${template}\" template`,\n finishedDescription: () =>\n `Created a new project named \"${name}\" using the \"${template}\" template`,\n errorDescription: `Failed to create project named \"${name}\" using the \"${template}\" template`,\n },\n {\n ready: true,\n runner: async () => {\n const projectPath = join(process.cwd(), name);\n\n await execPromise(`npm install`, {\n cwd: projectPath,\n });\n\n await execPromise(\n `npm install --save-exact @crankscript/core@latest @crankscript/types@latest crankscript@latest`,\n {\n cwd: projectPath,\n },\n );\n },\n waitingDescription: `About to install dependencies for \"${name}\"`,\n runningDescription: `Installing dependencies for \"${name}\"`,\n finishedDescription: () =>\n `Installed dependencies for \"${name}\"`,\n errorDescription: `Failed to install dependencies for \"${name}\"`,\n },\n ];\n }, [name, template]) satisfies CheckListItem<unknown>[];\n\n return <CheckList items={items} onFinish={() => process.exit()} />;\n};\n"],"names":["exec","join","promisify","React","useMemo","tiged","CheckList","execPromise","New","name","template","items","ready","runner","task","clone","waitingDescription","runningDescription","finishedDescription","errorDescription","projectPath","process","cwd","onFinish","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,SAAS,QAAQ,YAAY;AACtC,OAAOC,SAASC,OAAO,QAAQ,QAAQ;AACvC,OAAOC,WAAW,QAAQ;AAC1B,SAASC,SAAS,QAAQ,sCAAsC;AAGhE,MAAMC,cAAcL,UAAUF;AAO9B,OAAO,MAAMQ,MAAM,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAS;IACzC,MAAMC,QAAQP,QAAQ;QAClB,OAAO;YACH;gBACIQ,OAAO;gBACPC,QAAQ;oBACJ,MAAMC,OAAOT,MAAM,CAAC,qBAAqB,EAAEK,SAAS,CAAC;oBAErD,MAAMI,KAAKC,KAAK,CAACN;gBACrB;gBACAO,oBAAoB,CAAC,qCAAqC,EAAEP,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBACpGO,oBAAoB,CAAC,8BAA8B,EAAER,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBAC7FQ,qBAAqB,IACjB,CAAC,6BAA6B,EAAET,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBAC5ES,kBAAkB,CAAC,gCAAgC,EAAEV,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;YACjG;YACA;gBACIE,OAAO;gBACPC,QAAQ;oBACJ,MAAMO,cAAcnB,KAAKoB,QAAQC,GAAG,IAAIb;oBAExC,MAAMF,YAAY,CAAC,WAAW,CAAC,EAAE;wBAC7Be,KAAKF;oBACT;oBAEA,MAAMb,YACF,CAAC,8FAA8F,CAAC,EAChG;wBACIe,KAAKF;oBACT;gBAER;gBACAJ,oBAAoB,CAAC,mCAAmC,EAAEP,KAAK,CAAC,CAAC;gBACjEQ,oBAAoB,CAAC,6BAA6B,EAAER,KAAK,CAAC,CAAC;gBAC3DS,qBAAqB,IACjB,CAAC,4BAA4B,EAAET,KAAK,CAAC,CAAC;gBAC1CU,kBAAkB,CAAC,oCAAoC,EAAEV,KAAK,CAAC,CAAC;YACpE;SACH;IACL,GAAG;QAACA;QAAMC;KAAS;IAEnB,qBAAO,oBAACJ;QAAUK,OAAOA;QAAOY,UAAU,IAAMF,QAAQG,IAAI;;AAChE,EAAE"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
3
|
+
import { LibraryTemplateName } from '../../types.js';
|
4
|
+
export declare class NewLibCommand extends RenderableCommand {
|
5
|
+
static paths: string[][];
|
6
|
+
static usage: import("clipanion").Usage;
|
7
|
+
name: string;
|
8
|
+
template: LibraryTemplateName;
|
9
|
+
render(): React.JSX.Element;
|
10
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { Command, Option } from 'clipanion';
|
2
|
+
import React from 'react';
|
3
|
+
import * as t from 'typanion';
|
4
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
5
|
+
import { LibraryTemplateName } from '../../types.js';
|
6
|
+
import { NewLib } from './components/NewLib.js';
|
7
|
+
const defaultTemplate = LibraryTemplateName.Blank;
|
8
|
+
export class NewLibCommand extends RenderableCommand {
|
9
|
+
render() {
|
10
|
+
return /*#__PURE__*/ React.createElement(NewLib, {
|
11
|
+
name: this.name,
|
12
|
+
template: this.template
|
13
|
+
});
|
14
|
+
}
|
15
|
+
constructor(...args){
|
16
|
+
super(...args);
|
17
|
+
this.name = Option.String({
|
18
|
+
name: 'name'
|
19
|
+
});
|
20
|
+
this.template = Option.String('-t,--template', defaultTemplate, {
|
21
|
+
description: `The template to use, defaults to "${defaultTemplate}"`,
|
22
|
+
validator: t.isEnum(LibraryTemplateName)
|
23
|
+
});
|
24
|
+
}
|
25
|
+
}
|
26
|
+
NewLibCommand.paths = [
|
27
|
+
[
|
28
|
+
'new-lib'
|
29
|
+
]
|
30
|
+
];
|
31
|
+
NewLibCommand.usage = Command.Usage({
|
32
|
+
description: 'Create a new crankscript library'
|
33
|
+
});
|
34
|
+
|
35
|
+
//# sourceMappingURL=NewLibCommand.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/cli/src/commands/NewLibCommand/NewLibCommand.tsx"],"sourcesContent":["import { Command, Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { LibraryTemplateName } from '@/cli/types.js';\nimport { NewLib } from './components/NewLib.js';\n\nconst defaultTemplate = LibraryTemplateName.Blank;\n\nexport class NewLibCommand extends RenderableCommand {\n static override paths = [['new-lib']];\n\n static override usage = Command.Usage({\n description: 'Create a new crankscript library',\n });\n\n name = Option.String({\n name: 'name',\n });\n\n template = Option.String('-t,--template', defaultTemplate, {\n description: `The template to use, defaults to \"${defaultTemplate}\"`,\n validator: t.isEnum(LibraryTemplateName),\n });\n\n override render() {\n return <NewLib name={this.name} template={this.template} />;\n }\n}\n"],"names":["Command","Option","React","t","RenderableCommand","LibraryTemplateName","NewLib","defaultTemplate","Blank","NewLibCommand","render","name","template","String","description","validator","isEnum","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,YAAYC,OAAO,WAAW;AAC9B,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,mBAAmB,QAAQ,iBAAiB;AACrD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,MAAMC,kBAAkBF,oBAAoBG,KAAK;AAEjD,OAAO,MAAMC,sBAAsBL;IAgBtBM,SAAS;QACd,qBAAO,oBAACJ;YAAOK,MAAM,IAAI,CAACA,IAAI;YAAEC,UAAU,IAAI,CAACA,QAAQ;;IAC3D;;;aAXAD,OAAOV,OAAOY,MAAM,CAAC;YACjBF,MAAM;QACV;aAEAC,WAAWX,OAAOY,MAAM,CAAC,iBAAiBN,iBAAiB;YACvDO,aAAa,CAAC,kCAAkC,EAAEP,gBAAgB,CAAC,CAAC;YACpEQ,WAAWZ,EAAEa,MAAM,CAACX;QACxB;;AAKJ;AAnBaI,cACOQ,QAAQ;IAAC;QAAC;KAAU;CAAC;AAD5BR,cAGOS,QAAQlB,QAAQmB,KAAK,CAAC;IAClCL,aAAa;AACjB"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { exec } from 'node:child_process';
|
2
|
+
import { join } from 'node:path';
|
3
|
+
import { promisify } from 'node:util';
|
4
|
+
import React, { useMemo } from 'react';
|
5
|
+
import tiged from 'tiged';
|
6
|
+
import { CheckList } from '../../../components/CheckList/index.js';
|
7
|
+
const execPromise = promisify(exec);
|
8
|
+
export const NewLib = ({ name, template })=>{
|
9
|
+
const items = useMemo(()=>{
|
10
|
+
return [
|
11
|
+
{
|
12
|
+
ready: true,
|
13
|
+
runner: async ()=>{
|
14
|
+
const task = tiged(`crankscript/lib-template-${template}`);
|
15
|
+
await task.clone(name);
|
16
|
+
},
|
17
|
+
waitingDescription: `About to create a new library named "${name}" using the "${template}" template`,
|
18
|
+
runningDescription: `Creating a new library named "${name}" using the "${template}" template`,
|
19
|
+
finishedDescription: ()=>`Created a new library named "${name}" using the "${template}" template`,
|
20
|
+
errorDescription: `Failed to create library named "${name}" using the "${template}" template`
|
21
|
+
},
|
22
|
+
{
|
23
|
+
ready: true,
|
24
|
+
runner: async ()=>{
|
25
|
+
const projectPath = join(process.cwd(), name);
|
26
|
+
await execPromise(`npm install`, {
|
27
|
+
cwd: projectPath
|
28
|
+
});
|
29
|
+
await execPromise(`npm install --save-exact @crankscript/core@latest @crankscript/types@latest crankscript@latest`, {
|
30
|
+
cwd: projectPath
|
31
|
+
});
|
32
|
+
},
|
33
|
+
waitingDescription: `About to install dependencies for "${name}"`,
|
34
|
+
runningDescription: `Installing dependencies for "${name}"`,
|
35
|
+
finishedDescription: ()=>`Installed dependencies for "${name}"`,
|
36
|
+
errorDescription: `Failed to install dependencies for "${name}"`
|
37
|
+
}
|
38
|
+
];
|
39
|
+
}, [
|
40
|
+
name,
|
41
|
+
template
|
42
|
+
]);
|
43
|
+
return /*#__PURE__*/ React.createElement(CheckList, {
|
44
|
+
items: items,
|
45
|
+
onFinish: ()=>process.exit()
|
46
|
+
});
|
47
|
+
};
|
48
|
+
|
49
|
+
//# sourceMappingURL=NewLib.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/NewLibCommand/components/NewLib.tsx"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { join } from 'node:path';\nimport { promisify } from 'node:util';\nimport React, { useMemo } from 'react';\nimport tiged from 'tiged';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { CheckListItem, LibraryTemplateName } from '@/cli/types.js';\n\nconst execPromise = promisify(exec);\n\ninterface Props {\n name: string;\n template: LibraryTemplateName;\n}\n\nexport const NewLib = ({ name, template }: Props) => {\n const items = useMemo(() => {\n return [\n {\n ready: true,\n runner: async () => {\n const task = tiged(`crankscript/lib-template-${template}`);\n\n await task.clone(name);\n },\n waitingDescription: `About to create a new library named \"${name}\" using the \"${template}\" template`,\n runningDescription: `Creating a new library named \"${name}\" using the \"${template}\" template`,\n finishedDescription: () =>\n `Created a new library named \"${name}\" using the \"${template}\" template`,\n errorDescription: `Failed to create library named \"${name}\" using the \"${template}\" template`,\n },\n {\n ready: true,\n runner: async () => {\n const projectPath = join(process.cwd(), name);\n\n await execPromise(`npm install`, {\n cwd: projectPath,\n });\n\n await execPromise(\n `npm install --save-exact @crankscript/core@latest @crankscript/types@latest crankscript@latest`,\n {\n cwd: projectPath,\n },\n );\n },\n waitingDescription: `About to install dependencies for \"${name}\"`,\n runningDescription: `Installing dependencies for \"${name}\"`,\n finishedDescription: () =>\n `Installed dependencies for \"${name}\"`,\n errorDescription: `Failed to install dependencies for \"${name}\"`,\n },\n ];\n }, [name, template]) satisfies CheckListItem<unknown>[];\n\n return <CheckList items={items} onFinish={() => process.exit()} />;\n};\n"],"names":["exec","join","promisify","React","useMemo","tiged","CheckList","execPromise","NewLib","name","template","items","ready","runner","task","clone","waitingDescription","runningDescription","finishedDescription","errorDescription","projectPath","process","cwd","onFinish","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,qBAAqB;AAC1C,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,SAAS,QAAQ,YAAY;AACtC,OAAOC,SAASC,OAAO,QAAQ,QAAQ;AACvC,OAAOC,WAAW,QAAQ;AAC1B,SAASC,SAAS,QAAQ,sCAAsC;AAGhE,MAAMC,cAAcL,UAAUF;AAO9B,OAAO,MAAMQ,SAAS,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAS;IAC5C,MAAMC,QAAQP,QAAQ;QAClB,OAAO;YACH;gBACIQ,OAAO;gBACPC,QAAQ;oBACJ,MAAMC,OAAOT,MAAM,CAAC,yBAAyB,EAAEK,SAAS,CAAC;oBAEzD,MAAMI,KAAKC,KAAK,CAACN;gBACrB;gBACAO,oBAAoB,CAAC,qCAAqC,EAAEP,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBACpGO,oBAAoB,CAAC,8BAA8B,EAAER,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBAC7FQ,qBAAqB,IACjB,CAAC,6BAA6B,EAAET,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;gBAC5ES,kBAAkB,CAAC,gCAAgC,EAAEV,KAAK,aAAa,EAAEC,SAAS,UAAU,CAAC;YACjG;YACA;gBACIE,OAAO;gBACPC,QAAQ;oBACJ,MAAMO,cAAcnB,KAAKoB,QAAQC,GAAG,IAAIb;oBAExC,MAAMF,YAAY,CAAC,WAAW,CAAC,EAAE;wBAC7Be,KAAKF;oBACT;oBAEA,MAAMb,YACF,CAAC,8FAA8F,CAAC,EAChG;wBACIe,KAAKF;oBACT;gBAER;gBACAJ,oBAAoB,CAAC,mCAAmC,EAAEP,KAAK,CAAC,CAAC;gBACjEQ,oBAAoB,CAAC,6BAA6B,EAAER,KAAK,CAAC,CAAC;gBAC3DS,qBAAqB,IACjB,CAAC,4BAA4B,EAAET,KAAK,CAAC,CAAC;gBAC1CU,kBAAkB,CAAC,oCAAoC,EAAEV,KAAK,CAAC,CAAC;YACpE;SACH;IACL,GAAG;QAACA;QAAMC;KAAS;IAEnB,qBAAO,oBAACJ;QAAUK,OAAOA;QAAOY,UAAU,IAAMF,QAAQG,IAAI;;AAChE,EAAE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from './NewLibCommand.js';
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/cli/src/commands/NewLibCommand/index.ts"],"sourcesContent":["export * from './NewLibCommand.js';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,qBAAqB"}
|
@@ -10,6 +10,7 @@ import { validateEntryPoint } from '../../../commands/TranspileCommand/fn/valida
|
|
10
10
|
import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
|
11
11
|
import { CheckList } from '../../../components/CheckList/index.js';
|
12
12
|
import { isMac, isWindows } from '../../../utils/platform.js';
|
13
|
+
import { validateExitPoint } from '../../TranspileCommand/fn/validateExitPoint.js';
|
13
14
|
export const Simulator = ({ environment, path, watch = false, recompileOnly = false, background = false })=>{
|
14
15
|
const watcher = useRef(null);
|
15
16
|
const [isWatching, setIsWatching] = useState(false);
|
@@ -19,6 +20,10 @@ export const Simulator = ({ environment, path, watch = false, recompileOnly = fa
|
|
19
20
|
entryPoint: validateEntryPoint({
|
20
21
|
projectPath: path,
|
21
22
|
entryFile: join(path, 'src', 'index.ts')
|
23
|
+
}),
|
24
|
+
exitPoint: validateExitPoint({
|
25
|
+
projectPath: path,
|
26
|
+
exitFile: join(path, 'src', 'index.lua')
|
22
27
|
})
|
23
28
|
});
|
24
29
|
const compileTasks = useCompileTasks(getPdcPathFromEnvironment(environment));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/SimulatorCommand/components/Simulator.tsx"],"sourcesContent":["import { FSWatcher, watch as watchDir } from 'node:fs';\nimport { join } from 'node:path';\nimport { StatusMessage } from '@inkjs/ui';\nimport open from 'open';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { getPdcPathFromEnvironment } from '@/cli/commands/CompileCommand/fn/getPdcPathFromEnvironment.js';\nimport { useCompileTasks } from '@/cli/commands/CompileCommand/hooks/useCompileTasks.js';\nimport { getSimulatorPathFromEnvironment } from '@/cli/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js';\nimport { validateEntryPoint } from '@/cli/commands/TranspileCommand/fn/validateEntryPoint.js';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { CheckList, CheckListProps } from '@/cli/components/CheckList/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\nimport { isMac, isWindows } from '@/cli/utils/platform.js';\n\ninterface Props {\n environment: Environment;\n path: string;\n watch?: boolean;\n recompileOnly?: boolean;\n background?: boolean;\n}\n\nexport const Simulator = ({\n environment,\n path,\n watch = false,\n recompileOnly = false,\n background = false,\n}: Props) => {\n const watcher = useRef<FSWatcher | null>(null);\n const [isWatching, setIsWatching] = useState(false);\n const [hasChanged, setHasChanged] = useState(false);\n const [hasChangedMessage, setHasChangedMessage] = useState(false);\n const transpileTasks = useTranspileTasks({\n entryPoint: validateEntryPoint({\n projectPath: path,\n entryFile: join(path, 'src', 'index.ts'),\n }),\n });\n const compileTasks = useCompileTasks(\n getPdcPathFromEnvironment(environment),\n );\n const didRun = useRef(false);\n const [hasFailure, setHasFailure] = useState(false);\n\n useEffect(() => {\n if (hasChanged) {\n setHasChanged(false);\n }\n }, [hasChanged, setHasChanged]);\n\n const handleFinish = useCallback(\n (hasFailure => {\n setHasFailure(hasFailure);\n if (didRun.current && recompileOnly) {\n return;\n }\n\n didRun.current = true;\n\n open('Game.pdx', {\n background,\n app: isMac\n ? undefined\n : {\n name: getSimulatorPathFromEnvironment(environment),\n },\n }).then(() => {\n if (!watch) {\n if (!isWindows) {\n process.exit();\n }\n\n // Wait for the simulator to start\n // See https://github.com/sindresorhus/open/issues/298\n setTimeout(process.exit, 1000);\n } else {\n setHasChangedMessage(false);\n\n if (watcher.current) {\n watcher.current.close();\n }\n\n setIsWatching(true);\n\n watcher.current = watchDir(\n join(path, 'src'),\n { recursive: true },\n () => {\n setHasChanged(true);\n setHasChangedMessage(true);\n setIsWatching(false);\n },\n );\n }\n });\n }) satisfies CheckListProps['onFinish'],\n [watch, setHasChanged, setIsWatching],\n );\n\n const tasks = useMemo(() => {\n return [...transpileTasks, ...compileTasks];\n }, [transpileTasks, compileTasks]);\n\n return (\n <>\n {!hasChanged && <CheckList items={tasks} onFinish={handleFinish} />}\n {isWatching && !hasChangedMessage && (\n <>\n {hasFailure && (\n <StatusMessage variant=\"warning\">\n Some steps failed.\n </StatusMessage>\n )}\n <StatusMessage variant=\"info\">\n Watching for changes...\n </StatusMessage>\n </>\n )}\n {hasChangedMessage && (\n <StatusMessage variant=\"info\">Change detected</StatusMessage>\n )}\n </>\n );\n};\n"],"names":["watch","watchDir","join","StatusMessage","open","React","useCallback","useEffect","useMemo","useRef","useState","getPdcPathFromEnvironment","useCompileTasks","getSimulatorPathFromEnvironment","validateEntryPoint","useTranspileTasks","CheckList","isMac","isWindows","Simulator","environment","path","recompileOnly","background","watcher","isWatching","setIsWatching","hasChanged","setHasChanged","hasChangedMessage","setHasChangedMessage","transpileTasks","entryPoint","projectPath","entryFile","compileTasks","didRun","hasFailure","setHasFailure","handleFinish","current","app","undefined","name","then","process","exit","setTimeout","close","recursive","tasks","items","onFinish","variant"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/SimulatorCommand/components/Simulator.tsx"],"sourcesContent":["import { FSWatcher, watch as watchDir } from 'node:fs';\nimport { join } from 'node:path';\nimport { StatusMessage } from '@inkjs/ui';\nimport open from 'open';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { getPdcPathFromEnvironment } from '@/cli/commands/CompileCommand/fn/getPdcPathFromEnvironment.js';\nimport { useCompileTasks } from '@/cli/commands/CompileCommand/hooks/useCompileTasks.js';\nimport { getSimulatorPathFromEnvironment } from '@/cli/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js';\nimport { validateEntryPoint } from '@/cli/commands/TranspileCommand/fn/validateEntryPoint.js';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { CheckList, CheckListProps } from '@/cli/components/CheckList/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\nimport { isMac, isWindows } from '@/cli/utils/platform.js';\nimport { validateExitPoint } from '../../TranspileCommand/fn/validateExitPoint.js';\n\ninterface Props {\n environment: Environment;\n path: string;\n watch?: boolean;\n recompileOnly?: boolean;\n background?: boolean;\n}\n\nexport const Simulator = ({\n environment,\n path,\n watch = false,\n recompileOnly = false,\n background = false,\n}: Props) => {\n const watcher = useRef<FSWatcher | null>(null);\n const [isWatching, setIsWatching] = useState(false);\n const [hasChanged, setHasChanged] = useState(false);\n const [hasChangedMessage, setHasChangedMessage] = useState(false);\n const transpileTasks = useTranspileTasks({\n entryPoint: validateEntryPoint({\n projectPath: path,\n entryFile: join(path, 'src', 'index.ts'),\n }),\n exitPoint: validateExitPoint({\n projectPath: path,\n exitFile: join(path, 'src', 'index.lua'),\n }),\n });\n const compileTasks = useCompileTasks(\n getPdcPathFromEnvironment(environment),\n );\n const didRun = useRef(false);\n const [hasFailure, setHasFailure] = useState(false);\n\n useEffect(() => {\n if (hasChanged) {\n setHasChanged(false);\n }\n }, [hasChanged, setHasChanged]);\n\n const handleFinish = useCallback(\n (hasFailure => {\n setHasFailure(hasFailure);\n if (didRun.current && recompileOnly) {\n return;\n }\n\n didRun.current = true;\n\n open('Game.pdx', {\n background,\n app: isMac\n ? undefined\n : {\n name: getSimulatorPathFromEnvironment(environment),\n },\n }).then(() => {\n if (!watch) {\n if (!isWindows) {\n process.exit();\n }\n\n // Wait for the simulator to start\n // See https://github.com/sindresorhus/open/issues/298\n setTimeout(process.exit, 1000);\n } else {\n setHasChangedMessage(false);\n\n if (watcher.current) {\n watcher.current.close();\n }\n\n setIsWatching(true);\n\n watcher.current = watchDir(\n join(path, 'src'),\n { recursive: true },\n () => {\n setHasChanged(true);\n setHasChangedMessage(true);\n setIsWatching(false);\n },\n );\n }\n });\n }) satisfies CheckListProps['onFinish'],\n [watch, setHasChanged, setIsWatching],\n );\n\n const tasks = useMemo(() => {\n return [...transpileTasks, ...compileTasks];\n }, [transpileTasks, compileTasks]);\n\n return (\n <>\n {!hasChanged && <CheckList items={tasks} onFinish={handleFinish} />}\n {isWatching && !hasChangedMessage && (\n <>\n {hasFailure && (\n <StatusMessage variant=\"warning\">\n Some steps failed.\n </StatusMessage>\n )}\n <StatusMessage variant=\"info\">\n Watching for changes...\n </StatusMessage>\n </>\n )}\n {hasChangedMessage && (\n <StatusMessage variant=\"info\">Change detected</StatusMessage>\n )}\n </>\n );\n};\n"],"names":["watch","watchDir","join","StatusMessage","open","React","useCallback","useEffect","useMemo","useRef","useState","getPdcPathFromEnvironment","useCompileTasks","getSimulatorPathFromEnvironment","validateEntryPoint","useTranspileTasks","CheckList","isMac","isWindows","validateExitPoint","Simulator","environment","path","recompileOnly","background","watcher","isWatching","setIsWatching","hasChanged","setHasChanged","hasChangedMessage","setHasChangedMessage","transpileTasks","entryPoint","projectPath","entryFile","exitPoint","exitFile","compileTasks","didRun","hasFailure","setHasFailure","handleFinish","current","app","undefined","name","then","process","exit","setTimeout","close","recursive","tasks","items","onFinish","variant"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAoBA,SAASC,QAAQ,QAAQ,UAAU;AACvD,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,aAAa,QAAQ,YAAY;AAC1C,OAAOC,UAAU,OAAO;AACxB,OAAOC,SACHC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AACf,SAASC,yBAAyB,QAAQ,gEAAgE;AAC1G,SAASC,eAAe,QAAQ,yDAAyD;AACzF,SAASC,+BAA+B,QAAQ,wEAAwE;AACxH,SAASC,kBAAkB,QAAQ,2DAA2D;AAC9F,SAASC,iBAAiB,QAAQ,6DAA6D;AAC/F,SAASC,SAAS,QAAwB,sCAAsC;AAEhF,SAASC,KAAK,EAAEC,SAAS,QAAQ,0BAA0B;AAC3D,SAASC,iBAAiB,QAAQ,iDAAiD;AAUnF,OAAO,MAAMC,YAAY,CAAC,EACtBC,WAAW,EACXC,IAAI,EACJtB,QAAQ,KAAK,EACbuB,gBAAgB,KAAK,EACrBC,aAAa,KAAK,EACd;IACJ,MAAMC,UAAUhB,OAAyB;IACzC,MAAM,CAACiB,YAAYC,cAAc,GAAGjB,SAAS;IAC7C,MAAM,CAACkB,YAAYC,cAAc,GAAGnB,SAAS;IAC7C,MAAM,CAACoB,mBAAmBC,qBAAqB,GAAGrB,SAAS;IAC3D,MAAMsB,iBAAiBjB,kBAAkB;QACrCkB,YAAYnB,mBAAmB;YAC3BoB,aAAaZ;YACba,WAAWjC,KAAKoB,MAAM,OAAO;QACjC;QACAc,WAAWjB,kBAAkB;YACzBe,aAAaZ;YACbe,UAAUnC,KAAKoB,MAAM,OAAO;QAChC;IACJ;IACA,MAAMgB,eAAe1B,gBACjBD,0BAA0BU;IAE9B,MAAMkB,SAAS9B,OAAO;IACtB,MAAM,CAAC+B,YAAYC,cAAc,GAAG/B,SAAS;IAE7CH,UAAU;QACN,IAAIqB,YAAY;YACZC,cAAc;QAClB;IACJ,GAAG;QAACD;QAAYC;KAAc;IAE9B,MAAMa,eAAepC,YAChBkC,CAAAA;QACGC,cAAcD;QACd,IAAID,OAAOI,OAAO,IAAIpB,eAAe;YACjC;QACJ;QAEAgB,OAAOI,OAAO,GAAG;QAEjBvC,KAAK,YAAY;YACboB;YACAoB,KAAK3B,QACC4B,YACA;gBACIC,MAAMjC,gCAAgCQ;YAC1C;QACV,GAAG0B,IAAI,CAAC;YACJ,IAAI,CAAC/C,OAAO;gBACR,IAAI,CAACkB,WAAW;oBACZ8B,QAAQC,IAAI;gBAChB;gBAEA,kCAAkC;gBAClC,sDAAsD;gBACtDC,WAAWF,QAAQC,IAAI,EAAE;YAC7B,OAAO;gBACHlB,qBAAqB;gBAErB,IAAIN,QAAQkB,OAAO,EAAE;oBACjBlB,QAAQkB,OAAO,CAACQ,KAAK;gBACzB;gBAEAxB,cAAc;gBAEdF,QAAQkB,OAAO,GAAG1C,SACdC,KAAKoB,MAAM,QACX;oBAAE8B,WAAW;gBAAK,GAClB;oBACIvB,cAAc;oBACdE,qBAAqB;oBACrBJ,cAAc;gBAClB;YAER;QACJ;IACJ,GACA;QAAC3B;QAAO6B;QAAeF;KAAc;IAGzC,MAAM0B,QAAQ7C,QAAQ;QAClB,OAAO;eAAIwB;eAAmBM;SAAa;IAC/C,GAAG;QAACN;QAAgBM;KAAa;IAEjC,qBACI,0CACK,CAACV,4BAAc,oBAACZ;QAAUsC,OAAOD;QAAOE,UAAUb;QAClDhB,cAAc,CAACI,mCACZ,0CACKU,4BACG,oBAACrC;QAAcqD,SAAQ;OAAU,qCAIrC,oBAACrD;QAAcqD,SAAQ;OAAO,6BAKrC1B,mCACG,oBAAC3B;QAAcqD,SAAQ;OAAO;AAI9C,EAAE"}
|
@@ -5,6 +5,7 @@ import * as t from 'typanion';
|
|
5
5
|
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
6
6
|
import { Transpile } from '../../commands/TranspileCommand/components/Transpile.js';
|
7
7
|
import { validateEntryPoint } from '../../commands/TranspileCommand/fn/validateEntryPoint.js';
|
8
|
+
import { validateExitPoint } from './fn/validateExitPoint.js';
|
8
9
|
export const projectPathOption = Option.String('-p,--path', process.cwd(), {
|
9
10
|
description: `Where to find the project. Defaults to the current working directory ("${process.cwd()}")`,
|
10
11
|
validator: t.isString()
|
@@ -15,16 +16,25 @@ export class TranspileCommand extends RenderableCommand {
|
|
15
16
|
projectPath: this.projectPath,
|
16
17
|
entryFile: this.entryFile
|
17
18
|
});
|
19
|
+
const validatedExitPoint = validateExitPoint({
|
20
|
+
projectPath: this.projectPath,
|
21
|
+
exitFile: this.exitFile
|
22
|
+
});
|
18
23
|
return /*#__PURE__*/ React.createElement(Transpile, {
|
19
|
-
entryPoint: validatedEntryPoint
|
24
|
+
entryPoint: validatedEntryPoint,
|
25
|
+
exitPoint: validatedExitPoint
|
20
26
|
});
|
21
27
|
}
|
22
28
|
constructor(...args){
|
23
29
|
super(...args);
|
24
|
-
this.entryFile = Option.String('-
|
30
|
+
this.entryFile = Option.String('-i,--input', 'src/index.ts', {
|
25
31
|
description: 'The entry point to transpile',
|
26
32
|
validator: t.isString()
|
27
33
|
});
|
34
|
+
this.exitFile = Option.String('-o,--output', 'Source/main.lua', {
|
35
|
+
description: 'The output bundle',
|
36
|
+
validator: t.isString()
|
37
|
+
});
|
28
38
|
this.projectPath = projectPathOption;
|
29
39
|
}
|
30
40
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"sourcesContent":["import process from 'node:process';\nimport { Command, Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { Transpile } from '@/cli/commands/TranspileCommand/components/Transpile.js';\nimport { validateEntryPoint } from '@/cli/commands/TranspileCommand/fn/validateEntryPoint.js';\n\nexport const projectPathOption = Option.String('-p,--path', process.cwd(), {\n description: `Where to find the project. Defaults to the current working directory (\"${process.cwd()}\")`,\n validator: t.isString(),\n});\n\nexport class TranspileCommand extends RenderableCommand {\n static override paths = [['transpile']];\n\n static override usage = Command.Usage({\n description: 'Transpile TypeScript files to Lua',\n });\n\n entryFile = Option.String('-
|
1
|
+
{"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"sourcesContent":["import process from 'node:process';\nimport { Command, Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { Transpile } from '@/cli/commands/TranspileCommand/components/Transpile.js';\nimport { validateEntryPoint } from '@/cli/commands/TranspileCommand/fn/validateEntryPoint.js';\nimport { validateExitPoint } from './fn/validateExitPoint.js';\n\nexport const projectPathOption = Option.String('-p,--path', process.cwd(), {\n description: `Where to find the project. Defaults to the current working directory (\"${process.cwd()}\")`,\n validator: t.isString(),\n});\n\nexport class TranspileCommand extends RenderableCommand {\n static override paths = [['transpile']];\n\n static override usage = Command.Usage({\n description: 'Transpile TypeScript files to Lua',\n });\n\n entryFile = Option.String('-i,--input', 'src/index.ts', {\n description: 'The entry point to transpile',\n validator: t.isString(),\n });\n\n exitFile = Option.String('-o,--output', 'Source/main.lua', {\n description: 'The output bundle',\n validator: t.isString(),\n });\n\n projectPath = projectPathOption;\n\n override render() {\n const validatedEntryPoint = validateEntryPoint({\n projectPath: this.projectPath,\n entryFile: this.entryFile,\n });\n\n const validatedExitPoint = validateExitPoint({\n projectPath: this.projectPath,\n exitFile: this.exitFile,\n });\n\n return (\n <Transpile\n entryPoint={validatedEntryPoint}\n exitPoint={validatedExitPoint}\n />\n );\n }\n}\n"],"names":["process","Command","Option","React","t","RenderableCommand","Transpile","validateEntryPoint","validateExitPoint","projectPathOption","String","cwd","description","validator","isString","TranspileCommand","render","validatedEntryPoint","projectPath","entryFile","validatedExitPoint","exitFile","entryPoint","exitPoint","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,SAASC,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,YAAYC,OAAO,WAAW;AAC9B,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,SAAS,QAAQ,0DAA0D;AACpF,SAASC,kBAAkB,QAAQ,2DAA2D;AAC9F,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,OAAO,MAAMC,oBAAoBP,OAAOQ,MAAM,CAAC,aAAaV,QAAQW,GAAG,IAAI;IACvEC,aAAa,CAAC,uEAAuE,EAAEZ,QAAQW,GAAG,GAAG,EAAE,CAAC;IACxGE,WAAWT,EAAEU,QAAQ;AACzB,GAAG;AAEH,OAAO,MAAMC,yBAAyBV;IAmBzBW,SAAS;QACd,MAAMC,sBAAsBV,mBAAmB;YAC3CW,aAAa,IAAI,CAACA,WAAW;YAC7BC,WAAW,IAAI,CAACA,SAAS;QAC7B;QAEA,MAAMC,qBAAqBZ,kBAAkB;YACzCU,aAAa,IAAI,CAACA,WAAW;YAC7BG,UAAU,IAAI,CAACA,QAAQ;QAC3B;QAEA,qBACI,oBAACf;YACGgB,YAAYL;YACZM,WAAWH;;IAGvB;;;aA7BAD,YAAYjB,OAAOQ,MAAM,CAAC,cAAc,gBAAgB;YACpDE,aAAa;YACbC,WAAWT,EAAEU,QAAQ;QACzB;aAEAO,WAAWnB,OAAOQ,MAAM,CAAC,eAAe,mBAAmB;YACvDE,aAAa;YACbC,WAAWT,EAAEU,QAAQ;QACzB;aAEAI,cAAcT;;AAoBlB;AArCaM,iBACOS,QAAQ;IAAC;QAAC;KAAY;CAAC;AAD9BT,iBAGOU,QAAQxB,QAAQyB,KAAK,CAAC;IAClCd,aAAa;AACjB"}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
|
3
|
+
import { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
|
3
4
|
interface Props {
|
4
5
|
entryPoint: ValidatedEntryPoint;
|
6
|
+
exitPoint: ValidatedExitPoint;
|
5
7
|
}
|
6
|
-
export declare const Transpile: ({ entryPoint }: Props) => React.JSX.Element;
|
8
|
+
export declare const Transpile: ({ entryPoint, exitPoint }: Props) => React.JSX.Element;
|
7
9
|
export {};
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
|
3
3
|
import { CheckList } from '../../../components/CheckList/index.js';
|
4
|
-
export const Transpile = ({ entryPoint })=>{
|
4
|
+
export const Transpile = ({ entryPoint, exitPoint })=>{
|
5
5
|
const items = useTranspileTasks({
|
6
|
-
entryPoint
|
6
|
+
entryPoint,
|
7
|
+
exitPoint
|
7
8
|
});
|
8
9
|
return /*#__PURE__*/ React.createElement(CheckList, {
|
9
10
|
items: items,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\ninterface Props {\n entryPoint: ValidatedEntryPoint;\n}\n\nexport const Transpile = ({ entryPoint }: Props) => {\n const items = useTranspileTasks({\n entryPoint,\n });\n\n return <CheckList items={items} onFinish={() => process.exit} />;\n};\n"],"names":["React","useTranspileTasks","CheckList","Transpile","entryPoint","items","onFinish","process","exit"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\n\ninterface Props {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n}\n\nexport const Transpile = ({ entryPoint, exitPoint }: Props) => {\n const items = useTranspileTasks({\n entryPoint,\n exitPoint,\n });\n\n return <CheckList items={items} onFinish={() => process.exit} />;\n};\n"],"names":["React","useTranspileTasks","CheckList","Transpile","entryPoint","exitPoint","items","onFinish","process","exit"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,iBAAiB,QAAQ,6DAA6D;AAE/F,SAASC,SAAS,QAAQ,sCAAsC;AAQhE,OAAO,MAAMC,YAAY,CAAC,EAAEC,UAAU,EAAEC,SAAS,EAAS;IACtD,MAAMC,QAAQL,kBAAkB;QAC5BG;QACAC;IACJ;IAEA,qBAAO,oBAACH;QAAUI,OAAOA;QAAOC,UAAU,IAAMC,QAAQC,IAAI;;AAChE,EAAE"}
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import * as tstl from 'typescript-to-lua';
|
2
2
|
import { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';
|
3
|
-
|
3
|
+
import { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
|
4
|
+
export declare const transpile: ({ entryPoint, exitPoint, buildMode, }: {
|
4
5
|
entryPoint: ValidatedEntryPoint;
|
6
|
+
exitPoint: ValidatedExitPoint;
|
5
7
|
buildMode?: tstl.BuildMode;
|
6
8
|
}) => tstl.EmitResult;
|
@@ -1,13 +1,21 @@
|
|
1
|
-
import {
|
1
|
+
import { existsSync } from 'node:fs';
|
2
|
+
import { mkdirSync } from 'node:fs';
|
3
|
+
import { basename, dirname, join } from 'node:path';
|
2
4
|
import * as tstl from 'typescript-to-lua';
|
3
5
|
import { LuaTarget } from 'typescript-to-lua';
|
4
6
|
import { RootFolder } from '../../../constants.js';
|
5
|
-
export const transpile = ({ entryPoint, buildMode = tstl.BuildMode.Default })=>{
|
7
|
+
export const transpile = ({ entryPoint, exitPoint, buildMode = tstl.BuildMode.Default })=>{
|
8
|
+
const exitDir = dirname(exitPoint.exitPath);
|
9
|
+
if (!existsSync(exitDir)) {
|
10
|
+
mkdirSync(exitDir, {
|
11
|
+
recursive: true
|
12
|
+
});
|
13
|
+
}
|
6
14
|
return tstl.transpileProject(join(entryPoint.projectPath, 'tsconfig.json'), {
|
7
15
|
buildMode,
|
8
16
|
luaTarget: LuaTarget.Lua54,
|
9
|
-
outDir:
|
10
|
-
luaBundle:
|
17
|
+
outDir: dirname(exitPoint.exitPath),
|
18
|
+
luaBundle: basename(exitPoint.exitPath),
|
11
19
|
luaBundleEntry: join(entryPoint.entryFile),
|
12
20
|
luaPlugins: [
|
13
21
|
{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/transpile.ts"],"sourcesContent":["import { join } from 'node:path';\nimport * as tstl from 'typescript-to-lua';\nimport { LuaTarget } from 'typescript-to-lua';\nimport { RootFolder } from '@/cli/constants.js';\nimport { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';\n\nexport const transpile = ({\n entryPoint,\n buildMode = tstl.BuildMode.Default,\n}: {\n entryPoint: ValidatedEntryPoint;\n buildMode?: tstl.BuildMode;\n}) => {\n return tstl.transpileProject(\n join(entryPoint.projectPath, 'tsconfig.json'),\n {\n buildMode,\n luaTarget: LuaTarget.Lua54,\n outDir:
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/transpile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdirSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport * as tstl from 'typescript-to-lua';\nimport { LuaTarget } from 'typescript-to-lua';\nimport { RootFolder } from '@/cli/constants.js';\nimport { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\n\nexport const transpile = ({\n entryPoint,\n exitPoint,\n buildMode = tstl.BuildMode.Default,\n}: {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n buildMode?: tstl.BuildMode;\n}) => {\n const exitDir = dirname(exitPoint.exitPath);\n\n if (!existsSync(exitDir)) {\n mkdirSync(exitDir, { recursive: true });\n }\n\n return tstl.transpileProject(\n join(entryPoint.projectPath, 'tsconfig.json'),\n {\n buildMode,\n luaTarget: LuaTarget.Lua54,\n outDir: dirname(exitPoint.exitPath),\n luaBundle: basename(exitPoint.exitPath),\n luaBundleEntry: join(entryPoint.entryFile),\n luaPlugins: [\n {\n name: join(RootFolder, 'assets', 'index.js'),\n },\n ],\n },\n );\n};\n"],"names":["existsSync","mkdirSync","basename","dirname","join","tstl","LuaTarget","RootFolder","transpile","entryPoint","exitPoint","buildMode","BuildMode","Default","exitDir","exitPath","recursive","transpileProject","projectPath","luaTarget","Lua54","outDir","luaBundle","luaBundleEntry","entryFile","luaPlugins","name"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,QAAQ,UAAU;AACrC,SAASC,SAAS,QAAQ,UAAU;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AACpD,YAAYC,UAAU,oBAAoB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,UAAU,QAAQ,qBAAqB;AAIhD,OAAO,MAAMC,YAAY,CAAC,EACtBC,UAAU,EACVC,SAAS,EACTC,YAAYN,KAAKO,SAAS,CAACC,OAAO,EAKrC;IACG,MAAMC,UAAUX,QAAQO,UAAUK,QAAQ;IAE1C,IAAI,CAACf,WAAWc,UAAU;QACtBb,UAAUa,SAAS;YAAEE,WAAW;QAAK;IACzC;IAEA,OAAOX,KAAKY,gBAAgB,CACxBb,KAAKK,WAAWS,WAAW,EAAE,kBAC7B;QACIP;QACAQ,WAAWb,UAAUc,KAAK;QAC1BC,QAAQlB,QAAQO,UAAUK,QAAQ;QAClCO,WAAWpB,SAASQ,UAAUK,QAAQ;QACtCQ,gBAAgBnB,KAAKK,WAAWe,SAAS;QACzCC,YAAY;YACR;gBACIC,MAAMtB,KAAKG,YAAY,UAAU;YACrC;SACH;IACL;AAER,EAAE"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { existsSync, statSync } from 'node:fs';
|
2
|
+
import { resolve, dirname } from 'node:path';
|
3
|
+
export const validateExitPoint = (input)=>{
|
4
|
+
const resolvedPath = resolve(input.projectPath);
|
5
|
+
const resolvedExit = resolve(input.exitFile);
|
6
|
+
const exitDir = dirname(resolvedExit);
|
7
|
+
if (!existsSync(resolvedPath) || !statSync(resolvedPath).isDirectory()) {
|
8
|
+
throw new Error(`"${resolvedPath}" is not a valid project path`);
|
9
|
+
}
|
10
|
+
if (!existsSync(exitDir)) {
|
11
|
+
// Will be created
|
12
|
+
} else if (!statSync(exitDir).isDirectory()) {
|
13
|
+
throw new Error(`"${exitDir}" exists but is not a directory`);
|
14
|
+
}
|
15
|
+
// Check if the parent directory is inside the project path
|
16
|
+
if (!exitDir.startsWith(resolvedPath)) {
|
17
|
+
throw new Error(`Exit path must be inside project path`);
|
18
|
+
}
|
19
|
+
return {
|
20
|
+
__validated: true,
|
21
|
+
projectPath: resolvedPath,
|
22
|
+
exitPath: resolvedExit
|
23
|
+
};
|
24
|
+
};
|
25
|
+
|
26
|
+
//# sourceMappingURL=validateExitPoint.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/validateExitPoint.ts"],"sourcesContent":["import { existsSync, statSync } from 'node:fs';\nimport { resolve, dirname } from 'node:path';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\n\nexport const validateExitPoint = (input: {\n projectPath: string;\n exitFile: string;\n}): ValidatedExitPoint => {\n const resolvedPath = resolve(input.projectPath);\n const resolvedExit = resolve(input.exitFile);\n const exitDir = dirname(resolvedExit);\n\n if (!existsSync(resolvedPath) || !statSync(resolvedPath).isDirectory()) {\n throw new Error(`\"${resolvedPath}\" is not a valid project path`);\n }\n\n if (!existsSync(exitDir)) {\n // Will be created\n } else if (!statSync(exitDir).isDirectory()) {\n throw new Error(`\"${exitDir}\" exists but is not a directory`);\n }\n\n // Check if the parent directory is inside the project path\n if (!exitDir.startsWith(resolvedPath)) {\n throw new Error(`Exit path must be inside project path`);\n }\n\n return {\n __validated: true,\n projectPath: resolvedPath,\n exitPath: resolvedExit,\n } satisfies ValidatedExitPoint;\n};\n"],"names":["existsSync","statSync","resolve","dirname","validateExitPoint","input","resolvedPath","projectPath","resolvedExit","exitFile","exitDir","isDirectory","Error","startsWith","__validated","exitPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAC/C,SAASC,OAAO,EAAEC,OAAO,QAAQ,YAAY;AAG7C,OAAO,MAAMC,oBAAoB,CAACC;IAI9B,MAAMC,eAAeJ,QAAQG,MAAME,WAAW;IAC9C,MAAMC,eAAeN,QAAQG,MAAMI,QAAQ;IAC3C,MAAMC,UAAUP,QAAQK;IAExB,IAAI,CAACR,WAAWM,iBAAiB,CAACL,SAASK,cAAcK,WAAW,IAAI;QACpE,MAAM,IAAIC,MAAM,CAAC,CAAC,EAAEN,aAAa,6BAA6B,CAAC;IACnE;IAEA,IAAI,CAACN,WAAWU,UAAU;IACtB,kBAAkB;IACtB,OAAO,IAAI,CAACT,SAASS,SAASC,WAAW,IAAI;QACzC,MAAM,IAAIC,MAAM,CAAC,CAAC,EAAEF,QAAQ,+BAA+B,CAAC;IAChE;IAEA,2DAA2D;IAC3D,IAAI,CAACA,QAAQG,UAAU,CAACP,eAAe;QACnC,MAAM,IAAIM,MAAM,CAAC,qCAAqC,CAAC;IAC3D;IAEA,OAAO;QACHE,aAAa;QACbP,aAAaD;QACbS,UAAUP;IACd;AACJ,EAAE"}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
import { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
|
2
|
+
import { ValidatedExitPoint } from '../../../commands/TranspileCommand/model/ValidatedExitPoint.js';
|
2
3
|
import { CheckListItem } from '../../../types.js';
|
3
|
-
export declare const useTranspileTasks: ({ entryPoint, }: {
|
4
|
+
export declare const useTranspileTasks: ({ entryPoint, exitPoint, }: {
|
4
5
|
entryPoint: ValidatedEntryPoint;
|
6
|
+
exitPoint: ValidatedExitPoint;
|
5
7
|
}) => CheckListItem<unknown>[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
2
|
import { getErrorMessage } from '../../../commands/TranspileCommand/fn/getErrorMessage.js';
|
3
3
|
import { transpile } from '../../../commands/TranspileCommand/fn/transpile.js';
|
4
|
-
export const useTranspileTasks = ({ entryPoint })=>{
|
4
|
+
export const useTranspileTasks = ({ entryPoint, exitPoint })=>{
|
5
5
|
return useMemo(()=>[
|
6
6
|
{
|
7
7
|
waitingDescription: 'Waiting to transpile code...',
|
@@ -10,7 +10,8 @@ export const useTranspileTasks = ({ entryPoint })=>{
|
|
10
10
|
finishedDescription: ()=>'Code transpiled',
|
11
11
|
runner: async ()=>{
|
12
12
|
const result = transpile({
|
13
|
-
entryPoint
|
13
|
+
entryPoint,
|
14
|
+
exitPoint
|
14
15
|
});
|
15
16
|
if (result.diagnostics.length > 0) {
|
16
17
|
const errors = getErrorMessage(result.diagnostics);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { getErrorMessage } from '@/cli/commands/TranspileCommand/fn/getErrorMessage.js';\nimport { transpile } from '@/cli/commands/TranspileCommand/fn/transpile.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport const useTranspileTasks = ({\n entryPoint,\n}: {\n entryPoint: ValidatedEntryPoint;\n}) => {\n return useMemo(\n () => [\n {\n waitingDescription: 'Waiting to transpile code...',\n errorDescription: 'Could not transpile code',\n runningDescription: 'Transpiling code...',\n finishedDescription: () => 'Code transpiled',\n runner: async () => {\n const result = transpile({\n entryPoint,\n });\n\n if (result.diagnostics.length > 0) {\n const errors = getErrorMessage(result.diagnostics);\n\n throw new Error(\n `${\n result.diagnostics.length === 1\n ? 'An error'\n : 'Errors'\n } occurred while transpiling the code:\\n${errors}`,\n );\n }\n },\n ready: true,\n quitOnError: false,\n },\n ],\n [],\n ) as CheckListItem<unknown>[];\n};\n"],"names":["useMemo","getErrorMessage","transpile","useTranspileTasks","entryPoint","waitingDescription","errorDescription","runningDescription","finishedDescription","runner","result","diagnostics","length","errors","Error","ready","quitOnError"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { getErrorMessage } from '@/cli/commands/TranspileCommand/fn/getErrorMessage.js';\nimport { transpile } from '@/cli/commands/TranspileCommand/fn/transpile.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { ValidatedExitPoint } from '@/cli/commands/TranspileCommand/model/ValidatedExitPoint.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport const useTranspileTasks = ({\n entryPoint,\n exitPoint,\n}: {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n}) => {\n return useMemo(\n () => [\n {\n waitingDescription: 'Waiting to transpile code...',\n errorDescription: 'Could not transpile code',\n runningDescription: 'Transpiling code...',\n finishedDescription: () => 'Code transpiled',\n runner: async () => {\n const result = transpile({\n entryPoint,\n exitPoint,\n });\n\n if (result.diagnostics.length > 0) {\n const errors = getErrorMessage(result.diagnostics);\n\n throw new Error(\n `${\n result.diagnostics.length === 1\n ? 'An error'\n : 'Errors'\n } occurred while transpiling the code:\\n${errors}`,\n );\n }\n },\n ready: true,\n quitOnError: false,\n },\n ],\n [],\n ) as CheckListItem<unknown>[];\n};\n"],"names":["useMemo","getErrorMessage","transpile","useTranspileTasks","entryPoint","exitPoint","waitingDescription","errorDescription","runningDescription","finishedDescription","runner","result","diagnostics","length","errors","Error","ready","quitOnError"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,eAAe,QAAQ,wDAAwD;AACxF,SAASC,SAAS,QAAQ,kDAAkD;AAK5E,OAAO,MAAMC,oBAAoB,CAAC,EAC9BC,UAAU,EACVC,SAAS,EAIZ;IACG,OAAOL,QACH,IAAM;YACF;gBACIM,oBAAoB;gBACpBC,kBAAkB;gBAClBC,oBAAoB;gBACpBC,qBAAqB,IAAM;gBAC3BC,QAAQ;oBACJ,MAAMC,SAAST,UAAU;wBACrBE;wBACAC;oBACJ;oBAEA,IAAIM,OAAOC,WAAW,CAACC,MAAM,GAAG,GAAG;wBAC/B,MAAMC,SAASb,gBAAgBU,OAAOC,WAAW;wBAEjD,MAAM,IAAIG,MACN,CAAC,EACGJ,OAAOC,WAAW,CAACC,MAAM,KAAK,IACxB,aACA,SACT,uCAAuC,EAAEC,OAAO,CAAC;oBAE1D;gBACJ;gBACAE,OAAO;gBACPC,aAAa;YACjB;SACH,EACD,EAAE;AAEV,EAAE"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedExitPoint.ts"],"sourcesContent":["export type ValidatedExitPoint = {\n __validated: true;\n\n /**\n * The path to a directory containing a tsconfig.json file\n */\n projectPath: string;\n /**\n * The path to the output directory. Must be within the project path.\n */\n exitPath: string;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAWE"}
|
@@ -17,7 +17,7 @@ export const Item = ({ item: { runningDescription, waitingDescription, errorDesc
|
|
17
17
|
const couldStartButNotReady = !failedReason && !hasResult && start && ready === false;
|
18
18
|
useEffect(()=>{
|
19
19
|
if (failedReason && quitOnError) {
|
20
|
-
process.exit();
|
20
|
+
process.exit(1);
|
21
21
|
}
|
22
22
|
}, [
|
23
23
|
failedReason,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/components/CheckList/Item.tsx"],"sourcesContent":["import { StatusMessage, StatusMessageProps } from '@inkjs/ui';\nimport { Text } from 'ink';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Spinner } from '@/cli/components/Spinner.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport interface ItemProps<TResult> {\n item: CheckListItem<TResult>;\n start: boolean;\n}\n\nexport const Item = <TResult,>({\n item: {\n runningDescription,\n waitingDescription,\n errorDescription,\n finishedDescription,\n skipDescription,\n runner,\n onFinish,\n ready,\n quitOnError = true,\n skip,\n },\n start,\n}: ItemProps<TResult>) => {\n const executed = useRef(false);\n const interval = useRef<NodeJS.Timeout | null>(null);\n const [dotCount, setDotCount] = useState(0);\n const [result, setResult] = useState<TResult | null | false>(null);\n const [failedReason, setfailedReason] = useState<string | null>(null);\n const [isSkipped, setIsSkipped] = useState(false);\n\n // Determine if the task should be skipped\n const shouldSkip = typeof skip === 'function' ? skip() : skip === true;\n\n const hasResult = !failedReason && result !== null;\n const isRunning =\n !failedReason && !hasResult && start && ready !== false && !shouldSkip;\n const isWaiting = !failedReason && !hasResult && (!start || !ready);\n const couldStartButNotReady =\n !failedReason && !hasResult && start && ready === false;\n\n useEffect(() => {\n if (failedReason && quitOnError) {\n process.exit();\n }\n }, [failedReason, quitOnError]);\n\n useEffect(() => {\n if (couldStartButNotReady) {\n interval.current = setInterval(() => {\n setDotCount(count => (count + 1) % 4);\n }, 250);\n } else {\n if (interval.current) {\n clearInterval(interval.current);\n }\n }\n\n return () => {\n if (interval.current) {\n clearInterval(interval.current);\n }\n };\n }, [couldStartButNotReady]);\n\n useEffect(() => {\n if (!start || executed.current || ready === false) {\n return;\n }\n\n // If the task should be skipped, mark it as executed with a success result\n if (shouldSkip) {\n executed.current = true;\n setIsSkipped(true);\n setResult(true as TResult);\n onFinish?.(true as TResult);\n return;\n }\n\n runner()\n .then(result => {\n executed.current = true;\n\n if (result === false) {\n setfailedReason(errorDescription);\n\n return;\n }\n\n setResult(result);\n onFinish?.(result);\n })\n .catch(reason => {\n setfailedReason(reason.message);\n setResult(false);\n onFinish?.(false);\n });\n }, [errorDescription, onFinish, runner, start, shouldSkip]);\n\n let message = waitingDescription;\n let variant: StatusMessageProps['variant'] = 'info';\n\n if (failedReason) {\n message = ` ${failedReason}`;\n variant = 'error';\n } else if (isSkipped) {\n message = skipDescription || 'Task skipped';\n variant = 'info';\n } else if (isRunning) {\n message = runningDescription;\n variant = 'warning';\n } else if (hasResult) {\n message = finishedDescription(result);\n variant = 'success';\n }\n\n if (isRunning) {\n return <Spinner label={message} />;\n }\n\n return (\n <StatusMessage variant={variant}>\n <Text\n bold={!isWaiting}\n color={\n isRunning\n ? 'yellow'\n : isWaiting\n ? 'gray'\n : failedReason\n ? 'red'\n : isSkipped\n ? 'gray'\n : 'green'\n }\n >\n {message}{' '}\n {couldStartButNotReady &&\n `— not ready yet${'.'.repeat(dotCount)}`}\n </Text>\n </StatusMessage>\n );\n};\n"],"names":["StatusMessage","Text","React","useEffect","useRef","useState","Spinner","Item","item","runningDescription","waitingDescription","errorDescription","finishedDescription","skipDescription","runner","onFinish","ready","quitOnError","skip","start","executed","interval","dotCount","setDotCount","result","setResult","failedReason","setfailedReason","isSkipped","setIsSkipped","shouldSkip","hasResult","isRunning","isWaiting","couldStartButNotReady","process","exit","current","setInterval","count","clearInterval","then","catch","reason","message","variant","label","bold","color","repeat"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAA4B,YAAY;AAC9D,SAASC,IAAI,QAAQ,MAAM;AAC3B,OAAOC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,8BAA8B;AAQtD,OAAO,MAAMC,OAAO,CAAW,EAC3BC,MAAM,EACFC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,MAAM,EACNC,QAAQ,EACRC,KAAK,EACLC,cAAc,IAAI,EAClBC,IAAI,EACP,EACDC,KAAK,EACY;IACjB,MAAMC,WAAWhB,OAAO;IACxB,MAAMiB,WAAWjB,OAA8B;IAC/C,MAAM,CAACkB,UAAUC,YAAY,GAAGlB,SAAS;IACzC,MAAM,CAACmB,QAAQC,UAAU,GAAGpB,SAAiC;IAC7D,MAAM,CAACqB,cAAcC,gBAAgB,GAAGtB,SAAwB;IAChE,MAAM,CAACuB,WAAWC,aAAa,GAAGxB,SAAS;IAE3C,0CAA0C;IAC1C,MAAMyB,aAAa,OAAOZ,SAAS,aAAaA,SAASA,SAAS;IAElE,MAAMa,YAAY,CAACL,gBAAgBF,WAAW;IAC9C,MAAMQ,YACF,CAACN,gBAAgB,CAACK,aAAaZ,SAASH,UAAU,SAAS,CAACc;IAChE,MAAMG,YAAY,CAACP,gBAAgB,CAACK,aAAc,CAAA,CAACZ,SAAS,CAACH,KAAI;IACjE,MAAMkB,wBACF,CAACR,gBAAgB,CAACK,aAAaZ,SAASH,UAAU;IAEtDb,UAAU;QACN,IAAIuB,gBAAgBT,aAAa;YAC7BkB,QAAQC,IAAI;
|
1
|
+
{"version":3,"sources":["../../../../../../libs/cli/src/components/CheckList/Item.tsx"],"sourcesContent":["import { StatusMessage, StatusMessageProps } from '@inkjs/ui';\nimport { Text } from 'ink';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Spinner } from '@/cli/components/Spinner.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport interface ItemProps<TResult> {\n item: CheckListItem<TResult>;\n start: boolean;\n}\n\nexport const Item = <TResult,>({\n item: {\n runningDescription,\n waitingDescription,\n errorDescription,\n finishedDescription,\n skipDescription,\n runner,\n onFinish,\n ready,\n quitOnError = true,\n skip,\n },\n start,\n}: ItemProps<TResult>) => {\n const executed = useRef(false);\n const interval = useRef<NodeJS.Timeout | null>(null);\n const [dotCount, setDotCount] = useState(0);\n const [result, setResult] = useState<TResult | null | false>(null);\n const [failedReason, setfailedReason] = useState<string | null>(null);\n const [isSkipped, setIsSkipped] = useState(false);\n\n // Determine if the task should be skipped\n const shouldSkip = typeof skip === 'function' ? skip() : skip === true;\n\n const hasResult = !failedReason && result !== null;\n const isRunning =\n !failedReason && !hasResult && start && ready !== false && !shouldSkip;\n const isWaiting = !failedReason && !hasResult && (!start || !ready);\n const couldStartButNotReady =\n !failedReason && !hasResult && start && ready === false;\n\n useEffect(() => {\n if (failedReason && quitOnError) {\n process.exit(1);\n }\n }, [failedReason, quitOnError]);\n\n useEffect(() => {\n if (couldStartButNotReady) {\n interval.current = setInterval(() => {\n setDotCount(count => (count + 1) % 4);\n }, 250);\n } else {\n if (interval.current) {\n clearInterval(interval.current);\n }\n }\n\n return () => {\n if (interval.current) {\n clearInterval(interval.current);\n }\n };\n }, [couldStartButNotReady]);\n\n useEffect(() => {\n if (!start || executed.current || ready === false) {\n return;\n }\n\n // If the task should be skipped, mark it as executed with a success result\n if (shouldSkip) {\n executed.current = true;\n setIsSkipped(true);\n setResult(true as TResult);\n onFinish?.(true as TResult);\n return;\n }\n\n runner()\n .then(result => {\n executed.current = true;\n\n if (result === false) {\n setfailedReason(errorDescription);\n\n return;\n }\n\n setResult(result);\n onFinish?.(result);\n })\n .catch(reason => {\n setfailedReason(reason.message);\n setResult(false);\n onFinish?.(false);\n });\n }, [errorDescription, onFinish, runner, start, shouldSkip]);\n\n let message = waitingDescription;\n let variant: StatusMessageProps['variant'] = 'info';\n\n if (failedReason) {\n message = ` ${failedReason}`;\n variant = 'error';\n } else if (isSkipped) {\n message = skipDescription || 'Task skipped';\n variant = 'info';\n } else if (isRunning) {\n message = runningDescription;\n variant = 'warning';\n } else if (hasResult) {\n message = finishedDescription(result);\n variant = 'success';\n }\n\n if (isRunning) {\n return <Spinner label={message} />;\n }\n\n return (\n <StatusMessage variant={variant}>\n <Text\n bold={!isWaiting}\n color={\n isRunning\n ? 'yellow'\n : isWaiting\n ? 'gray'\n : failedReason\n ? 'red'\n : isSkipped\n ? 'gray'\n : 'green'\n }\n >\n {message}{' '}\n {couldStartButNotReady &&\n `— not ready yet${'.'.repeat(dotCount)}`}\n </Text>\n </StatusMessage>\n );\n};\n"],"names":["StatusMessage","Text","React","useEffect","useRef","useState","Spinner","Item","item","runningDescription","waitingDescription","errorDescription","finishedDescription","skipDescription","runner","onFinish","ready","quitOnError","skip","start","executed","interval","dotCount","setDotCount","result","setResult","failedReason","setfailedReason","isSkipped","setIsSkipped","shouldSkip","hasResult","isRunning","isWaiting","couldStartButNotReady","process","exit","current","setInterval","count","clearInterval","then","catch","reason","message","variant","label","bold","color","repeat"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAA4B,YAAY;AAC9D,SAASC,IAAI,QAAQ,MAAM;AAC3B,OAAOC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,8BAA8B;AAQtD,OAAO,MAAMC,OAAO,CAAW,EAC3BC,MAAM,EACFC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mBAAmB,EACnBC,eAAe,EACfC,MAAM,EACNC,QAAQ,EACRC,KAAK,EACLC,cAAc,IAAI,EAClBC,IAAI,EACP,EACDC,KAAK,EACY;IACjB,MAAMC,WAAWhB,OAAO;IACxB,MAAMiB,WAAWjB,OAA8B;IAC/C,MAAM,CAACkB,UAAUC,YAAY,GAAGlB,SAAS;IACzC,MAAM,CAACmB,QAAQC,UAAU,GAAGpB,SAAiC;IAC7D,MAAM,CAACqB,cAAcC,gBAAgB,GAAGtB,SAAwB;IAChE,MAAM,CAACuB,WAAWC,aAAa,GAAGxB,SAAS;IAE3C,0CAA0C;IAC1C,MAAMyB,aAAa,OAAOZ,SAAS,aAAaA,SAASA,SAAS;IAElE,MAAMa,YAAY,CAACL,gBAAgBF,WAAW;IAC9C,MAAMQ,YACF,CAACN,gBAAgB,CAACK,aAAaZ,SAASH,UAAU,SAAS,CAACc;IAChE,MAAMG,YAAY,CAACP,gBAAgB,CAACK,aAAc,CAAA,CAACZ,SAAS,CAACH,KAAI;IACjE,MAAMkB,wBACF,CAACR,gBAAgB,CAACK,aAAaZ,SAASH,UAAU;IAEtDb,UAAU;QACN,IAAIuB,gBAAgBT,aAAa;YAC7BkB,QAAQC,IAAI,CAAC;QACjB;IACJ,GAAG;QAACV;QAAcT;KAAY;IAE9Bd,UAAU;QACN,IAAI+B,uBAAuB;YACvBb,SAASgB,OAAO,GAAGC,YAAY;gBAC3Bf,YAAYgB,CAAAA,QAAS,AAACA,CAAAA,QAAQ,CAAA,IAAK;YACvC,GAAG;QACP,OAAO;YACH,IAAIlB,SAASgB,OAAO,EAAE;gBAClBG,cAAcnB,SAASgB,OAAO;YAClC;QACJ;QAEA,OAAO;YACH,IAAIhB,SAASgB,OAAO,EAAE;gBAClBG,cAAcnB,SAASgB,OAAO;YAClC;QACJ;IACJ,GAAG;QAACH;KAAsB;IAE1B/B,UAAU;QACN,IAAI,CAACgB,SAASC,SAASiB,OAAO,IAAIrB,UAAU,OAAO;YAC/C;QACJ;QAEA,2EAA2E;QAC3E,IAAIc,YAAY;YACZV,SAASiB,OAAO,GAAG;YACnBR,aAAa;YACbJ,UAAU;YACVV,4BAAAA,SAAW;YACX;QACJ;QAEAD,SACK2B,IAAI,CAACjB,CAAAA;YACFJ,SAASiB,OAAO,GAAG;YAEnB,IAAIb,WAAW,OAAO;gBAClBG,gBAAgBhB;gBAEhB;YACJ;YAEAc,UAAUD;YACVT,4BAAAA,SAAWS;QACf,GACCkB,KAAK,CAACC,CAAAA;YACHhB,gBAAgBgB,OAAOC,OAAO;YAC9BnB,UAAU;YACVV,4BAAAA,SAAW;QACf;IACR,GAAG;QAACJ;QAAkBI;QAAUD;QAAQK;QAAOW;KAAW;IAE1D,IAAIc,UAAUlC;IACd,IAAImC,UAAyC;IAE7C,IAAInB,cAAc;QACdkB,UAAU,CAAC,CAAC,EAAElB,aAAa,CAAC;QAC5BmB,UAAU;IACd,OAAO,IAAIjB,WAAW;QAClBgB,UAAU/B,mBAAmB;QAC7BgC,UAAU;IACd,OAAO,IAAIb,WAAW;QAClBY,UAAUnC;QACVoC,UAAU;IACd,OAAO,IAAId,WAAW;QAClBa,UAAUhC,oBAAoBY;QAC9BqB,UAAU;IACd;IAEA,IAAIb,WAAW;QACX,qBAAO,oBAAC1B;YAAQwC,OAAOF;;IAC3B;IAEA,qBACI,oBAAC5C;QAAc6C,SAASA;qBACpB,oBAAC5C;QACG8C,MAAM,CAACd;QACPe,OACIhB,YACM,WACAC,YACA,SACAP,eACA,QACAE,YACA,SACA;OAGTgB,SAAS,KACTV,yBACG,CAAC,eAAe,EAAE,IAAIe,MAAM,CAAC3B,UAAU,CAAC;AAI5D,EAAE"}
|
package/src/index.js
CHANGED
@@ -6,6 +6,7 @@ import { CompileCommand } from './commands/CompileCommand/index.js';
|
|
6
6
|
import { DoctorCommand } from './commands/DoctorCommand.js';
|
7
7
|
import { GenerateTypesCommand } from './commands/GenerateTypes/index.js';
|
8
8
|
import { NewCommand } from './commands/NewCommand/NewCommand.js';
|
9
|
+
import { NewLibCommand } from './commands/NewLibCommand/index.js';
|
9
10
|
import { SimulatorCommand } from './commands/SimulatorCommand/index.js';
|
10
11
|
import { TranspileCommand } from './commands/TranspileCommand/index.js';
|
11
12
|
import { RootFolder } from './constants.js';
|
@@ -24,6 +25,7 @@ cli.register(Builtins.HelpCommand);
|
|
24
25
|
cli.register(Builtins.VersionCommand);
|
25
26
|
cli.register(DoctorCommand);
|
26
27
|
cli.register(NewCommand);
|
28
|
+
cli.register(NewLibCommand);
|
27
29
|
cli.register(TranspileCommand);
|
28
30
|
cli.register(CompileCommand);
|
29
31
|
cli.register(GenerateTypesCommand);
|
package/src/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../libs/cli/src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFileSync } from 'fs';\nimport { join } from 'node:path';\nimport { Builtins, Cli } from 'clipanion';\nimport { CompileCommand } from '@/cli/commands/CompileCommand/index.js';\nimport { DoctorCommand } from '@/cli/commands/DoctorCommand.js';\nimport { GenerateTypesCommand } from '@/cli/commands/GenerateTypes/index.js';\nimport { NewCommand } from '@/cli/commands/NewCommand/NewCommand.js';\nimport { SimulatorCommand } from '@/cli/commands/SimulatorCommand/index.js';\nimport { TranspileCommand } from '@/cli/commands/TranspileCommand/index.js';\nimport { RootFolder } from '@/cli/constants.js';\n\nconst packageJsonContents = readFileSync(\n join(RootFolder, 'package.json'),\n 'utf-8',\n);\nconst packageJson = JSON.parse(packageJsonContents);\n\nconst args = process.argv.slice(2);\n\nconst cli = new Cli({\n binaryLabel: 'crankscript',\n binaryName: 'crankscript',\n binaryVersion: packageJson.version,\n});\n\nprocess.on('SIGINT', function () {\n process.exit();\n});\n\ncli.register(Builtins.HelpCommand);\ncli.register(Builtins.VersionCommand);\ncli.register(DoctorCommand);\ncli.register(NewCommand);\ncli.register(TranspileCommand);\ncli.register(CompileCommand);\ncli.register(GenerateTypesCommand);\ncli.register(SimulatorCommand);\ncli.runExit(args);\n"],"names":["readFileSync","join","Builtins","Cli","CompileCommand","DoctorCommand","GenerateTypesCommand","NewCommand","SimulatorCommand","TranspileCommand","RootFolder","packageJsonContents","packageJson","JSON","parse","args","process","argv","slice","cli","binaryLabel","binaryName","binaryVersion","version","on","exit","register","HelpCommand","VersionCommand","runExit"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../libs/cli/src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { readFileSync } from 'fs';\nimport { join } from 'node:path';\nimport { Builtins, Cli } from 'clipanion';\nimport { CompileCommand } from '@/cli/commands/CompileCommand/index.js';\nimport { DoctorCommand } from '@/cli/commands/DoctorCommand.js';\nimport { GenerateTypesCommand } from '@/cli/commands/GenerateTypes/index.js';\nimport { NewCommand } from '@/cli/commands/NewCommand/NewCommand.js';\nimport { NewLibCommand } from '@/cli/commands/NewLibCommand/index.js';\nimport { SimulatorCommand } from '@/cli/commands/SimulatorCommand/index.js';\nimport { TranspileCommand } from '@/cli/commands/TranspileCommand/index.js';\nimport { RootFolder } from '@/cli/constants.js';\n\nconst packageJsonContents = readFileSync(\n join(RootFolder, 'package.json'),\n 'utf-8',\n);\nconst packageJson = JSON.parse(packageJsonContents);\n\nconst args = process.argv.slice(2);\n\nconst cli = new Cli({\n binaryLabel: 'crankscript',\n binaryName: 'crankscript',\n binaryVersion: packageJson.version,\n});\n\nprocess.on('SIGINT', function () {\n process.exit();\n});\n\ncli.register(Builtins.HelpCommand);\ncli.register(Builtins.VersionCommand);\ncli.register(DoctorCommand);\ncli.register(NewCommand);\ncli.register(NewLibCommand);\ncli.register(TranspileCommand);\ncli.register(CompileCommand);\ncli.register(GenerateTypesCommand);\ncli.register(SimulatorCommand);\ncli.runExit(args);\n"],"names":["readFileSync","join","Builtins","Cli","CompileCommand","DoctorCommand","GenerateTypesCommand","NewCommand","NewLibCommand","SimulatorCommand","TranspileCommand","RootFolder","packageJsonContents","packageJson","JSON","parse","args","process","argv","slice","cli","binaryLabel","binaryName","binaryVersion","version","on","exit","register","HelpCommand","VersionCommand","runExit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SAASA,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,QAAQ,EAAEC,GAAG,QAAQ,YAAY;AAC1C,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,oBAAoB,QAAQ,wCAAwC;AAC7E,SAASC,UAAU,QAAQ,0CAA0C;AACrE,SAASC,aAAa,QAAQ,wCAAwC;AACtE,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,MAAMC,sBAAsBZ,aACxBC,KAAKU,YAAY,iBACjB;AAEJ,MAAME,cAAcC,KAAKC,KAAK,CAACH;AAE/B,MAAMI,OAAOC,QAAQC,IAAI,CAACC,KAAK,CAAC;AAEhC,MAAMC,MAAM,IAAIjB,IAAI;IAChBkB,aAAa;IACbC,YAAY;IACZC,eAAeV,YAAYW,OAAO;AACtC;AAEAP,QAAQQ,EAAE,CAAC,UAAU;IACjBR,QAAQS,IAAI;AAChB;AAEAN,IAAIO,QAAQ,CAACzB,SAAS0B,WAAW;AACjCR,IAAIO,QAAQ,CAACzB,SAAS2B,cAAc;AACpCT,IAAIO,QAAQ,CAACtB;AACbe,IAAIO,QAAQ,CAACpB;AACba,IAAIO,QAAQ,CAACnB;AACbY,IAAIO,QAAQ,CAACjB;AACbU,IAAIO,QAAQ,CAACvB;AACbgB,IAAIO,QAAQ,CAACrB;AACbc,IAAIO,QAAQ,CAAClB;AACbW,IAAIU,OAAO,CAACd"}
|
package/src/types.d.ts
CHANGED
package/src/types.js
CHANGED
@@ -12,5 +12,9 @@ export var TemplateName;
|
|
12
12
|
(function(TemplateName) {
|
13
13
|
TemplateName["Blank"] = "blank";
|
14
14
|
})(TemplateName || (TemplateName = {}));
|
15
|
+
export var LibraryTemplateName;
|
16
|
+
(function(LibraryTemplateName) {
|
17
|
+
LibraryTemplateName["Blank"] = "blank";
|
18
|
+
})(LibraryTemplateName || (LibraryTemplateName = {}));
|
15
19
|
|
16
20
|
//# sourceMappingURL=types.js.map
|
package/src/types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../libs/cli/src/types.ts"],"sourcesContent":["import {\n ClassDeclarationStructure,\n FunctionDeclarationStructure,\n MethodDeclarationStructure,\n ParameterDeclarationStructure,\n PropertyDeclarationStructure,\n VariableDeclarationStructure,\n} from 'ts-morph';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\nimport { PlaydateSdkPath } from '@/cli/environment/path/dto/PlaydateSdkPath.js';\n\nexport enum PlaydateSdkVersionIdentifier {\n Latest = 'latest',\n}\n\nexport type PlaydateSdkVersion = PlaydateSdkVersionIdentifier.Latest | string;\n\nexport type EnvironmentHealthResult =\n | {\n isHealthy: true;\n environment: Environment;\n health: EnvironmentHealth;\n }\n | {\n isHealthy: false;\n health: EnvironmentHealth;\n };\n\nexport enum HealthCheckStatusType {\n Healthy = 'Healthy',\n Unhealthy = 'Unhealthy',\n Unknown = 'Unknown',\n}\n\nexport type HealthCheckStatus<TArgument> =\n | {\n healthStatus:\n | HealthCheckStatusType.Unknown\n | HealthCheckStatusType.Unhealthy;\n }\n | {\n healthStatus: HealthCheckStatusType.Healthy;\n argument: TArgument;\n };\n\nexport interface EnvironmentHealth {\n sdkPathKnown: HealthCheckStatus<PlaydateSdkPath>;\n}\n\nexport type CheckListItem<TResult> = {\n runningDescription: string;\n waitingDescription: string;\n errorDescription: string;\n finishedDescription: (result: TResult | false) => string;\n skipDescription?: string;\n runner: () => Promise<TResult> | Promise<false>;\n onFinish?: (result: TResult | false) => void;\n ready?: boolean;\n quitOnError?: boolean;\n skip?: boolean | (() => boolean);\n};\n\nexport interface ParameterDescription {\n name: string;\n required: boolean;\n}\n\nexport interface PropertyDescription {\n signature: string;\n name: string;\n namespaces: string[];\n docs: string;\n}\n\nexport interface FunctionDescription {\n signature: string;\n name: string;\n namespaces: string[];\n parameters: ParameterDescription[];\n hasSelf: boolean;\n docs: string;\n}\n\nexport interface ApiObject {\n functions: FunctionDescription[];\n methods: FunctionDescription[];\n properties: PropertyDescription[];\n namespaces: Record<string, ApiObject>;\n}\n\nexport interface ApiDefinitions {\n global: ApiObject;\n}\n\nexport interface PropertyDetails extends Partial<PropertyDeclarationStructure> {\n signature: string;\n}\n\nexport type FunctionDetails = {\n signature: string;\n parameters: ParameterDetails[];\n overrideParameters?: boolean;\n} & (\n | Partial<FunctionDeclarationStructure>\n | Partial<MethodDeclarationStructure>\n);\n\nexport type ParameterDetails = ParameterDeclarationStructure;\n\nexport interface ConstantDefinition\n extends Partial<VariableDeclarationStructure> {\n name: string;\n}\n\nexport type TypeProviderData = {\n globalStatements: string[];\n statements: string[];\n constants: Record<string, (ConstantDefinition | string)[]>;\n classes: Record<string, Partial<ClassDeclarationStructure>>;\n properties: Record<string, PropertyDetails>;\n /**\n * Properties that are described in prose rather than in formal API documentation.\n * While 'properties' contains actual property definitions with their full path as the key,\n * 'dynamicProperties' contains additional properties that belong to a parent namespace.\n *\n * For example, if the docs mention \"You can access rect.x, rect.y\" in prose,\n * the key would be \"playdate.geometry.rect\" and the value would be the properties\n * that should be added to that namespace.\n */\n dynamicProperties: Record<\n string,\n Pick<PropertyDescription, 'name' | 'docs'>[]\n >;\n functions: Record<string, FunctionDetails>;\n};\n\nexport type FunctionTypeOverrideMap = Record<string, { isMethod: boolean }>;\n\nexport enum TemplateName {\n Blank = 'blank',\n}\n"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatusType","TemplateName"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../libs/cli/src/types.ts"],"sourcesContent":["import {\n ClassDeclarationStructure,\n FunctionDeclarationStructure,\n MethodDeclarationStructure,\n ParameterDeclarationStructure,\n PropertyDeclarationStructure,\n VariableDeclarationStructure,\n} from 'ts-morph';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\nimport { PlaydateSdkPath } from '@/cli/environment/path/dto/PlaydateSdkPath.js';\n\nexport enum PlaydateSdkVersionIdentifier {\n Latest = 'latest',\n}\n\nexport type PlaydateSdkVersion = PlaydateSdkVersionIdentifier.Latest | string;\n\nexport type EnvironmentHealthResult =\n | {\n isHealthy: true;\n environment: Environment;\n health: EnvironmentHealth;\n }\n | {\n isHealthy: false;\n health: EnvironmentHealth;\n };\n\nexport enum HealthCheckStatusType {\n Healthy = 'Healthy',\n Unhealthy = 'Unhealthy',\n Unknown = 'Unknown',\n}\n\nexport type HealthCheckStatus<TArgument> =\n | {\n healthStatus:\n | HealthCheckStatusType.Unknown\n | HealthCheckStatusType.Unhealthy;\n }\n | {\n healthStatus: HealthCheckStatusType.Healthy;\n argument: TArgument;\n };\n\nexport interface EnvironmentHealth {\n sdkPathKnown: HealthCheckStatus<PlaydateSdkPath>;\n}\n\nexport type CheckListItem<TResult> = {\n runningDescription: string;\n waitingDescription: string;\n errorDescription: string;\n finishedDescription: (result: TResult | false) => string;\n skipDescription?: string;\n runner: () => Promise<TResult> | Promise<false>;\n onFinish?: (result: TResult | false) => void;\n ready?: boolean;\n quitOnError?: boolean;\n skip?: boolean | (() => boolean);\n};\n\nexport interface ParameterDescription {\n name: string;\n required: boolean;\n}\n\nexport interface PropertyDescription {\n signature: string;\n name: string;\n namespaces: string[];\n docs: string;\n}\n\nexport interface FunctionDescription {\n signature: string;\n name: string;\n namespaces: string[];\n parameters: ParameterDescription[];\n hasSelf: boolean;\n docs: string;\n}\n\nexport interface ApiObject {\n functions: FunctionDescription[];\n methods: FunctionDescription[];\n properties: PropertyDescription[];\n namespaces: Record<string, ApiObject>;\n}\n\nexport interface ApiDefinitions {\n global: ApiObject;\n}\n\nexport interface PropertyDetails extends Partial<PropertyDeclarationStructure> {\n signature: string;\n}\n\nexport type FunctionDetails = {\n signature: string;\n parameters: ParameterDetails[];\n overrideParameters?: boolean;\n} & (\n | Partial<FunctionDeclarationStructure>\n | Partial<MethodDeclarationStructure>\n);\n\nexport type ParameterDetails = ParameterDeclarationStructure;\n\nexport interface ConstantDefinition\n extends Partial<VariableDeclarationStructure> {\n name: string;\n}\n\nexport type TypeProviderData = {\n globalStatements: string[];\n statements: string[];\n constants: Record<string, (ConstantDefinition | string)[]>;\n classes: Record<string, Partial<ClassDeclarationStructure>>;\n properties: Record<string, PropertyDetails>;\n /**\n * Properties that are described in prose rather than in formal API documentation.\n * While 'properties' contains actual property definitions with their full path as the key,\n * 'dynamicProperties' contains additional properties that belong to a parent namespace.\n *\n * For example, if the docs mention \"You can access rect.x, rect.y\" in prose,\n * the key would be \"playdate.geometry.rect\" and the value would be the properties\n * that should be added to that namespace.\n */\n dynamicProperties: Record<\n string,\n Pick<PropertyDescription, 'name' | 'docs'>[]\n >;\n functions: Record<string, FunctionDetails>;\n};\n\nexport type FunctionTypeOverrideMap = Record<string, { isMethod: boolean }>;\n\nexport enum TemplateName {\n Blank = 'blank',\n}\n\nexport enum LibraryTemplateName {\n Blank = 'blank',\n}\n"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatusType","TemplateName","LibraryTemplateName"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":";UAWYA;;GAAAA,iCAAAA;;UAiBAC;;;;GAAAA,0BAAAA;;UA8GAC;;GAAAA,iBAAAA;;UAIAC;;GAAAA,wBAAAA"}
|