crankscript 0.5.0 → 0.5.1
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 +25 -25
- package/src/commands/DoctorCommand.js +1 -1
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.d.ts +2 -2
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +3 -3
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +1 -1
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +1 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +1 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.js +2 -2
- package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +1 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.js +6 -6
- package/src/commands/GenerateTypes/fn/generateNamespace.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/generateNamespace.js +1 -1
- package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js +1 -1
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js +2 -2
- package/src/commands/GenerateTypes/hooks/useFetchHtml.js +1 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +1 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.js +2 -2
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +3 -3
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +2 -2
- package/src/components/CheckList/CheckList.d.ts +1 -1
- package/src/components/CheckList/Item.d.ts +1 -1
- package/src/index.js +3 -3
- package/src/types.d.ts +2 -2
package/package.json
CHANGED
@@ -1,27 +1,27 @@
|
|
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
|
-
|
2
|
+
"name": "crankscript",
|
3
|
+
"version": "0.5.1",
|
4
|
+
"scripts": {
|
5
|
+
"dev": "tsx src/index.ts",
|
6
|
+
"post-build": "tsc-alias --project tsconfig.json"
|
7
|
+
},
|
8
|
+
"bin": {
|
9
|
+
"crankscript": "./src/index.js"
|
10
|
+
},
|
11
|
+
"license": "MIT",
|
12
|
+
"dependencies": {
|
13
|
+
"@inkjs/ui": "^2.0.0",
|
14
|
+
"@swc/helpers": "~0.5.11",
|
15
|
+
"cheerio": "^1.0.0",
|
16
|
+
"clipanion": "^4.0.0-rc.4",
|
17
|
+
"ink": "^5.0.1",
|
18
|
+
"react": "^18.3.1",
|
19
|
+
"ts-morph": "^23.0.0",
|
20
|
+
"typanion": "^3.14.0"
|
21
|
+
},
|
22
|
+
"type": "module",
|
23
|
+
"main": "./src/index.js",
|
24
|
+
"typings": "./src/index.d.ts",
|
25
|
+
"module": "./src/index.js",
|
26
|
+
"types": "./src/index.d.ts"
|
27
27
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Command } from 'clipanion';
|
2
2
|
import { Text } from 'ink';
|
3
3
|
import React from 'react';
|
4
|
-
import { createEnvironment } from '
|
4
|
+
import { createEnvironment } from '../environment/createEnvironment.js';
|
5
5
|
import { HealthReport } from './EnvironmentAwareCommand/components/HealthReport.js';
|
6
6
|
import { RenderableCommand } from './RenderableCommand.js';
|
7
7
|
export class DoctorCommand extends RenderableCommand {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { JSX } from 'react';
|
2
|
-
import { RenderableCommand } from '
|
3
|
-
import { Environment } from '
|
2
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
3
|
+
import { Environment } from '../../environment/dto/Environment.js';
|
4
4
|
export declare abstract class EnvironmentAwareCommand extends RenderableCommand {
|
5
5
|
private environment;
|
6
6
|
protected abstract renderWithEnvironment(environment: Environment): JSX.Element;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { HealthReport } from '
|
3
|
-
import { RenderableCommand } from '
|
4
|
-
import { createEnvironment } from '
|
2
|
+
import { HealthReport } from '../../commands/EnvironmentAwareCommand/components/HealthReport.js';
|
3
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
4
|
+
import { createEnvironment } from '../../environment/createEnvironment.js';
|
5
5
|
export class EnvironmentAwareCommand extends RenderableCommand {
|
6
6
|
render() {
|
7
7
|
if (!this.environment) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { StatusMessage } from '@inkjs/ui';
|
2
2
|
import { Text } from 'ink';
|
3
3
|
import React from 'react';
|
4
|
-
import { HealthCheckStatusType } from '
|
4
|
+
import { HealthCheckStatusType } from '../../../types.js';
|
5
5
|
const SuccessMessages = {
|
6
6
|
sdkPathKnown: {
|
7
7
|
[HealthCheckStatusType.Unknown]: 'SDK path status unknown',
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { RenderableCommand } from '
|
2
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
3
3
|
export declare class GenerateTypesCommand extends RenderableCommand {
|
4
4
|
static paths: string[][];
|
5
5
|
static usage: import("clipanion").Usage;
|
@@ -3,8 +3,8 @@ import * as process from 'node:process';
|
|
3
3
|
import { Command, Option } from 'clipanion';
|
4
4
|
import React from 'react';
|
5
5
|
import * as t from 'typanion';
|
6
|
-
import { RenderableCommand } from '
|
7
|
-
import { PlaydateSdkVersionIdentifier } from '
|
6
|
+
import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
7
|
+
import { PlaydateSdkVersionIdentifier } from '../../types.js';
|
8
8
|
import { GenerateTypes } from './components/GenerateTypes.js';
|
9
9
|
export class GenerateTypesCommand extends RenderableCommand {
|
10
10
|
render() {
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import React, { useMemo } from 'react';
|
2
|
-
import { useFetchHtml } from '
|
3
|
-
import { useGenerateTypeFile } from '
|
4
|
-
import { useGetVersion } from '
|
5
|
-
import { useParseDocumentation } from '
|
6
|
-
import { CheckList } from '
|
7
|
-
import { useQuitOnCtrlC } from '
|
2
|
+
import { useFetchHtml } from '../../../commands/GenerateTypes/hooks/useFetchHtml.js';
|
3
|
+
import { useGenerateTypeFile } from '../../../commands/GenerateTypes/hooks/useGenerateTypeFile.js';
|
4
|
+
import { useGetVersion } from '../../../commands/GenerateTypes/hooks/useGetVersion.js';
|
5
|
+
import { useParseDocumentation } from '../../../commands/GenerateTypes/hooks/useParseDocumentation.js';
|
6
|
+
import { CheckList } from '../../../components/CheckList/index.js';
|
7
|
+
import { useQuitOnCtrlC } from '../../../hooks/useQuitOnCtrlC.js';
|
8
8
|
export const GenerateTypes = ({ output, version })=>{
|
9
9
|
useQuitOnCtrlC();
|
10
10
|
const { fetchedVersion, getVersion } = useGetVersion(version);
|
@@ -1,3 +1,3 @@
|
|
1
1
|
import { ModuleDeclaration, SourceFile } from 'ts-morph';
|
2
|
-
import { PlaydateNamespace } from '
|
2
|
+
import { PlaydateNamespace } from '../../../types.js';
|
3
3
|
export declare const generateNamespace: (subject: SourceFile | ModuleDeclaration, namespace: string, namespaceDescription: PlaydateNamespace, nextNamespaces: string[]) => void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { TypescriptReservedNamed } from '
|
1
|
+
import { TypescriptReservedNamed } from '../../../constants.js';
|
2
2
|
export const generateNamespace = (subject, namespace, namespaceDescription, nextNamespaces)=>{
|
3
3
|
const module = subject.addModule({
|
4
4
|
name: namespace.trim()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { FunctionDescription, PlaydateNamespace, PlaydateType } from '
|
1
|
+
import { FunctionDescription, PlaydateNamespace, PlaydateType } from '../../../types.js';
|
2
2
|
export declare const getApiDefinitions: (functions: FunctionDescription[]) => {
|
3
3
|
namespaces: Record<string, PlaydateNamespace>;
|
4
4
|
types: Record<string, PlaydateType>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { playdateConstants } from '
|
1
|
+
import { playdateConstants } from '../../../commands/GenerateTypes/utils/playdateConstants.js';
|
2
2
|
export const getApiDefinitions = (functions)=>{
|
3
3
|
const namespaces = {};
|
4
4
|
const types = {};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { FunctionDescription } from '
|
1
|
+
import { FunctionDescription } from '../../../types.js';
|
2
2
|
export declare const getFunctionDescriptionsFromHtml: (html: string, version: string) => FunctionDescription[];
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { _ as _extends } from "@swc/helpers/_/_extends";
|
2
2
|
import { load } from 'cheerio';
|
3
|
-
import { PlaydateSdkUrl } from '
|
4
|
-
import { parseFunctionSignature } from '
|
3
|
+
import { PlaydateSdkUrl } from '../../../commands/GenerateTypes/constants.js';
|
4
|
+
import { parseFunctionSignature } from '../../../commands/GenerateTypes/fn/parseFunctionSignature.js';
|
5
5
|
export const getFunctionDescriptionsFromHtml = (html, version)=>{
|
6
6
|
const $ = load(html);
|
7
7
|
const allSignatures = $('[id^="m-"], [id^="f-"], [id^="c-"]').toArray();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useMemo, useState } from 'react';
|
2
|
-
import { getHtmlForVersion } from '
|
2
|
+
import { getHtmlForVersion } from '../../../commands/GenerateTypes/fn/getHtmlForVersion.js';
|
3
3
|
export const useFetchHtml = (version)=>{
|
4
4
|
const [html, setHtml] = useState(null);
|
5
5
|
const fetchHtml = useMemo(()=>{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useMemo } from 'react';
|
2
2
|
import { Project } from 'ts-morph';
|
3
|
-
import { generateNamespace } from '
|
3
|
+
import { generateNamespace } from '../../../commands/GenerateTypes/fn/generateNamespace.js';
|
4
4
|
export const useGenerateTypeFile = (path, definitions)=>{
|
5
5
|
const generateTypeFile = useMemo(()=>{
|
6
6
|
return {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useCallback, useMemo, useState } from 'react';
|
2
|
-
import { PlaydateSdkUrl } from '
|
3
|
-
import { PlaydateSdkVersionIdentifier } from '
|
2
|
+
import { PlaydateSdkUrl } from '../../../commands/GenerateTypes/constants.js';
|
3
|
+
import { PlaydateSdkVersionIdentifier } from '../../../types.js';
|
4
4
|
export const useGetVersion = (version)=>{
|
5
5
|
const [result, setResult] = useState(null);
|
6
6
|
const fetchLastVersion = useCallback(async ()=>{
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApiDefinitions } from '
|
1
|
+
import { ApiDefinitions } from '../../../types.js';
|
2
2
|
export declare const useParseDocumentation: (html: string | null, version: string) => {
|
3
3
|
definitions: ApiDefinitions | null;
|
4
4
|
parseDocumentation: {
|
@@ -7,8 +7,8 @@ export declare const useParseDocumentation: (html: string | null, version: strin
|
|
7
7
|
finishedDescription: () => string;
|
8
8
|
runningDescription: string;
|
9
9
|
runner: () => Promise<{
|
10
|
-
namespaces: Record<string, import("
|
11
|
-
types: Record<string, import("
|
10
|
+
namespaces: Record<string, import("../../../types.js").PlaydateNamespace>;
|
11
|
+
types: Record<string, import("../../../types.js").PlaydateType>;
|
12
12
|
constants: {
|
13
13
|
name: string;
|
14
14
|
values: {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useMemo, useState } from 'react';
|
2
|
-
import { getApiDefinitions } from '
|
3
|
-
import { getFunctionDescriptionsFromHtml } from '
|
2
|
+
import { getApiDefinitions } from '../../../commands/GenerateTypes/fn/getApiDefinitions.js';
|
3
|
+
import { getFunctionDescriptionsFromHtml } from '../../../commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js';
|
4
4
|
export const useParseDocumentation = (html, version)=>{
|
5
5
|
const [result, setResult] = useState(null);
|
6
6
|
const parseDocumentation = useMemo(()=>{
|
package/src/index.js
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
import { readFileSync } from 'fs';
|
3
3
|
import { join } from 'node:path';
|
4
4
|
import { Cli } from 'clipanion';
|
5
|
-
import { DoctorCommand } from '
|
6
|
-
import { GenerateTypesCommand } from '
|
7
|
-
import { RootFolder } from '
|
5
|
+
import { DoctorCommand } from './commands/DoctorCommand.js';
|
6
|
+
import { GenerateTypesCommand } from './commands/GenerateTypes/GenerateTypesCommand.js';
|
7
|
+
import { RootFolder } from './utils/dirname.js';
|
8
8
|
const packageJsonContents = readFileSync(join(RootFolder, 'package.json'), 'utf-8');
|
9
9
|
const packageJson = JSON.parse(packageJsonContents);
|
10
10
|
const args = process.argv.slice(2);
|
package/src/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Environment } from '
|
2
|
-
import { PlaydateSdkPath } from '
|
1
|
+
import { Environment } from './environment/dto/Environment.js';
|
2
|
+
import { PlaydateSdkPath } from './environment/path/dto/PlaydateSdkPath.js';
|
3
3
|
export declare enum PlaydateSdkVersionIdentifier {
|
4
4
|
Latest = "latest"
|
5
5
|
}
|