crankscript 0.10.5-beta.1 → 0.10.5
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 +30 -30
- package/src/commands/SimulatorCommand/SimulatorCommand.d.ts +1 -1
- package/src/commands/SimulatorCommand/SimulatorCommand.js +3 -3
- package/src/commands/SimulatorCommand/SimulatorCommand.js.map +1 -1
- package/src/commands/SimulatorCommand/components/Simulator.js +5 -7
- package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -1
- package/src/utils/platform.d.ts +1 -0
- package/src/utils/platform.js +1 -0
- package/src/utils/platform.js.map +1 -1
package/package.json
CHANGED
@@ -1,32 +1,32 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
2
|
+
"name": "crankscript",
|
3
|
+
"version": "0.10.5",
|
4
|
+
"scripts": {
|
5
|
+
"dev": "tsx src/index.ts",
|
6
|
+
"post-build": "tsc-alias --project tsconfig.json",
|
7
|
+
"prepare-assets": "npx tsc -p assets/tsconfig.json"
|
8
|
+
},
|
9
|
+
"bin": {
|
10
|
+
"crankscript": "./src/index.js"
|
11
|
+
},
|
12
|
+
"license": "MIT",
|
13
|
+
"dependencies": {
|
14
|
+
"@inkjs/ui": "^2.0.0",
|
15
|
+
"@swc/helpers": "~0.5.11",
|
16
|
+
"cheerio": "^1.0.0",
|
17
|
+
"clipanion": "^4.0.0-rc.4",
|
18
|
+
"ink": "^5.0.1",
|
19
|
+
"open": "^10.1.0",
|
20
|
+
"react": "^18.3.1",
|
21
|
+
"tiged": "^3.0.0-rc.0",
|
22
|
+
"ts-morph": "^23.0.0",
|
23
|
+
"turndown": "^7.2.0",
|
24
|
+
"typanion": "^3.14.0",
|
25
|
+
"typescript-to-lua": "^1.27.0"
|
26
|
+
},
|
27
|
+
"type": "module",
|
28
|
+
"main": "./src/index.js",
|
29
|
+
"typings": "./src/index.d.ts",
|
30
|
+
"module": "./src/index.js",
|
31
|
+
"types": "./src/index.d.ts"
|
32
32
|
}
|
@@ -5,7 +5,7 @@ export declare class SimulatorCommand extends EnvironmentAwareCommand {
|
|
5
5
|
static paths: string[][];
|
6
6
|
static usage: import("clipanion").Usage;
|
7
7
|
watch: boolean;
|
8
|
-
|
8
|
+
recompileOnly: boolean;
|
9
9
|
background: boolean;
|
10
10
|
projectPath: string;
|
11
11
|
renderWithEnvironment(environment: Environment): React.JSX.Element;
|
@@ -9,7 +9,7 @@ export class SimulatorCommand extends EnvironmentAwareCommand {
|
|
9
9
|
environment: environment,
|
10
10
|
path: this.projectPath,
|
11
11
|
watch: this.watch,
|
12
|
-
recompileOnly: this.
|
12
|
+
recompileOnly: this.recompileOnly,
|
13
13
|
background: this.background
|
14
14
|
});
|
15
15
|
}
|
@@ -18,8 +18,8 @@ export class SimulatorCommand extends EnvironmentAwareCommand {
|
|
18
18
|
this.watch = Option.Boolean('-w,--watch', false, {
|
19
19
|
description: 'Watch for changes'
|
20
20
|
});
|
21
|
-
this.
|
22
|
-
description: 'Use with --watch to only recompile without launching the simulator'
|
21
|
+
this.recompileOnly = Option.Boolean('-r,--recompile-only', false, {
|
22
|
+
description: 'Use with --watch to only recompile without launching the simulator when files change'
|
23
23
|
});
|
24
24
|
this.background = Option.Boolean('-b,--background', false, {
|
25
25
|
description: 'Do not bring simulator to foreground'
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/SimulatorCommand/SimulatorCommand.tsx"],"sourcesContent":["import { Command, Option } from 'clipanion';\nimport React from 'react';\nimport { EnvironmentAwareCommand } from '@/cli/commands/EnvironmentAwareCommand/index.js';\nimport { Simulator } from '@/cli/commands/SimulatorCommand/components/Simulator.js';\nimport { projectPathOption } from '@/cli/commands/TranspileCommand/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\n\nexport class SimulatorCommand extends EnvironmentAwareCommand {\n static override paths = [['simulator']];\n\n static override usage = Command.Usage({\n description: 'Transpile, compile, and run the simulator',\n });\n\n watch = Option.Boolean('-w,--watch', false, {\n description: 'Watch for changes',\n });\n\n
|
1
|
+
{"version":3,"sources":["../../../../../../libs/cli/src/commands/SimulatorCommand/SimulatorCommand.tsx"],"sourcesContent":["import { Command, Option } from 'clipanion';\nimport React from 'react';\nimport { EnvironmentAwareCommand } from '@/cli/commands/EnvironmentAwareCommand/index.js';\nimport { Simulator } from '@/cli/commands/SimulatorCommand/components/Simulator.js';\nimport { projectPathOption } from '@/cli/commands/TranspileCommand/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\n\nexport class SimulatorCommand extends EnvironmentAwareCommand {\n static override paths = [['simulator']];\n\n static override usage = Command.Usage({\n description: 'Transpile, compile, and run the simulator',\n });\n\n watch = Option.Boolean('-w,--watch', false, {\n description: 'Watch for changes',\n });\n\n recompileOnly = Option.Boolean('-r,--recompile-only', false, {\n description:\n 'Use with --watch to only recompile without launching the simulator when files change',\n });\n\n background = Option.Boolean('-b,--background', false, {\n description: 'Do not bring simulator to foreground',\n });\n\n projectPath = projectPathOption;\n\n override renderWithEnvironment(environment: Environment) {\n return (\n <Simulator\n environment={environment}\n path={this.projectPath}\n watch={this.watch}\n recompileOnly={this.recompileOnly}\n background={this.background}\n />\n );\n }\n}\n"],"names":["Command","Option","React","EnvironmentAwareCommand","Simulator","projectPathOption","SimulatorCommand","renderWithEnvironment","environment","path","projectPath","watch","recompileOnly","background","Boolean","description","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,SAASC,uBAAuB,QAAQ,kDAAkD;AAC1F,SAASC,SAAS,QAAQ,0DAA0D;AACpF,SAASC,iBAAiB,QAAQ,2CAA2C;AAG7E,OAAO,MAAMC,yBAAyBH;IAsBzBI,sBAAsBC,WAAwB,EAAE;QACrD,qBACI,oBAACJ;YACGI,aAAaA;YACbC,MAAM,IAAI,CAACC,WAAW;YACtBC,OAAO,IAAI,CAACA,KAAK;YACjBC,eAAe,IAAI,CAACA,aAAa;YACjCC,YAAY,IAAI,CAACA,UAAU;;IAGvC;;;aAzBAF,QAAQV,OAAOa,OAAO,CAAC,cAAc,OAAO;YACxCC,aAAa;QACjB;aAEAH,gBAAgBX,OAAOa,OAAO,CAAC,uBAAuB,OAAO;YACzDC,aACI;QACR;aAEAF,aAAaZ,OAAOa,OAAO,CAAC,mBAAmB,OAAO;YAClDC,aAAa;QACjB;aAEAL,cAAcL;;AAalB;AAjCaC,iBACOU,QAAQ;IAAC;QAAC;KAAY;CAAC;AAD9BV,iBAGOW,QAAQjB,QAAQkB,KAAK,CAAC;IAClCH,aAAa;AACjB"}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import { watch as watchDir } from 'node:fs';
|
2
|
-
import { platform } from 'node:os';
|
3
2
|
import { join } from 'node:path';
|
4
3
|
import { StatusMessage } from '@inkjs/ui';
|
5
4
|
import open from 'open';
|
@@ -9,8 +8,7 @@ import { useCompileTasks } from '../../../commands/CompileCommand/hooks/useCompi
|
|
9
8
|
import { getSimulatorPathFromEnvironment } from '../../../commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js';
|
10
9
|
import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
|
11
10
|
import { CheckList } from '../../../components/CheckList/index.js';
|
12
|
-
import { isWindows } from '../../../utils/platform.js';
|
13
|
-
const platformName = platform();
|
11
|
+
import { isMac, isWindows } from '../../../utils/platform.js';
|
14
12
|
export const Simulator = ({ environment, path, watch = false, recompileOnly = false, background = false })=>{
|
15
13
|
const watcher = useRef(null);
|
16
14
|
const [isWatching, setIsWatching] = useState(false);
|
@@ -18,7 +16,7 @@ export const Simulator = ({ environment, path, watch = false, recompileOnly = fa
|
|
18
16
|
const [hasChangedMessage, setHasChangedMessage] = useState(false);
|
19
17
|
const transpileTasks = useTranspileTasks(path);
|
20
18
|
const compileTasks = useCompileTasks(getPdcPathFromEnvironment(environment));
|
21
|
-
const
|
19
|
+
const didRun = useRef(false);
|
22
20
|
useEffect(()=>{
|
23
21
|
if (hasChanged) {
|
24
22
|
setHasChanged(false);
|
@@ -28,13 +26,13 @@ export const Simulator = ({ environment, path, watch = false, recompileOnly = fa
|
|
28
26
|
setHasChanged
|
29
27
|
]);
|
30
28
|
const handleFinish = useCallback(()=>{
|
31
|
-
if (
|
29
|
+
if (didRun.current && recompileOnly) {
|
32
30
|
return;
|
33
31
|
}
|
34
|
-
|
32
|
+
didRun.current = true;
|
35
33
|
open('Game.pdx', {
|
36
34
|
background,
|
37
|
-
app:
|
35
|
+
app: isMac ? undefined : {
|
38
36
|
name: getSimulatorPathFromEnvironment(environment)
|
39
37
|
}
|
40
38
|
}).then(()=>{
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/SimulatorCommand/components/Simulator.tsx"],"sourcesContent":["import { FSWatcher, watch as watchDir } from 'node:fs';\nimport {
|
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 { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { CheckList } 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(path);\n const compileTasks = useCompileTasks(\n getPdcPathFromEnvironment(environment)\n );\n const didRun = useRef(false);\n\n useEffect(() => {\n if (hasChanged) {\n setHasChanged(false);\n }\n }, [hasChanged, setHasChanged]);\n\n const handleFinish = useCallback(() => {\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 }, [watch, setHasChanged, setIsWatching]);\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 <StatusMessage variant=\"info\">\n Watching for changes...\n </StatusMessage>\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","useTranspileTasks","CheckList","isMac","isWindows","Simulator","environment","path","recompileOnly","background","watcher","isWatching","setIsWatching","hasChanged","setHasChanged","hasChangedMessage","setHasChangedMessage","transpileTasks","compileTasks","didRun","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,iBAAiB,QAAQ,6DAA6D;AAC/F,SAASC,SAAS,QAAQ,sCAAsC;AAEhE,SAASC,KAAK,EAAEC,SAAS,QAAQ,0BAA0B;AAU3D,OAAO,MAAMC,YAAY,CAAC,EACtBC,WAAW,EACXC,IAAI,EACJpB,QAAQ,KAAK,EACbqB,gBAAgB,KAAK,EACrBC,aAAa,KAAK,EACd;IACJ,MAAMC,UAAUd,OAAyB;IACzC,MAAM,CAACe,YAAYC,cAAc,GAAGf,SAAS;IAC7C,MAAM,CAACgB,YAAYC,cAAc,GAAGjB,SAAS;IAC7C,MAAM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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../libs/cli/src/utils/platform.ts"],"sourcesContent":["import { platform } from 'node:os';\n\nexport const platformName = platform();\nexport const isWindows = platformName === 'win32';\n"],"names":["platform","platformName","isWindows"],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../../../../../libs/cli/src/utils/platform.ts"],"sourcesContent":["import { platform } from 'node:os';\n\nexport const platformName = platform();\nexport const isWindows = platformName === 'win32';\nexport const isMac = platformName === 'darwin';\n"],"names":["platform","platformName","isWindows","isMac"],"rangeMappings":";;;","mappings":"AAAA,SAASA,QAAQ,QAAQ,UAAU;AAEnC,OAAO,MAAMC,eAAeD,WAAW;AACvC,OAAO,MAAME,YAAYD,iBAAiB,QAAQ;AAClD,OAAO,MAAME,QAAQF,iBAAiB,SAAS"}
|