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.
Files changed (27) hide show
  1. package/package.json +25 -25
  2. package/src/commands/DoctorCommand.js +1 -1
  3. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.d.ts +2 -2
  4. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +3 -3
  5. package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +1 -1
  6. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +1 -1
  7. package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +1 -1
  8. package/src/commands/GenerateTypes/GenerateTypesCommand.js +2 -2
  9. package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +1 -1
  10. package/src/commands/GenerateTypes/components/GenerateTypes.js +6 -6
  11. package/src/commands/GenerateTypes/fn/generateNamespace.d.ts +1 -1
  12. package/src/commands/GenerateTypes/fn/generateNamespace.js +1 -1
  13. package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +1 -1
  14. package/src/commands/GenerateTypes/fn/getApiDefinitions.js +1 -1
  15. package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.d.ts +1 -1
  16. package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js +2 -2
  17. package/src/commands/GenerateTypes/hooks/useFetchHtml.js +1 -1
  18. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +1 -1
  19. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +1 -1
  20. package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +1 -1
  21. package/src/commands/GenerateTypes/hooks/useGetVersion.js +2 -2
  22. package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +3 -3
  23. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +2 -2
  24. package/src/components/CheckList/CheckList.d.ts +1 -1
  25. package/src/components/CheckList/Item.d.ts +1 -1
  26. package/src/index.js +3 -3
  27. package/src/types.d.ts +2 -2
package/package.json CHANGED
@@ -1,27 +1,27 @@
1
1
  {
2
- "name": "crankscript",
3
- "version": "0.5.0",
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"
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 '@/cli/environment/createEnvironment.js';
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 '@/cli/commands/RenderableCommand.js';
3
- import { Environment } from '@/cli/environment/dto/Environment.js';
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 '@/cli/commands/EnvironmentAwareCommand/components/HealthReport.js';
3
- import { RenderableCommand } from '@/cli/commands/RenderableCommand.js';
4
- import { createEnvironment } from '@/cli/environment/createEnvironment.js';
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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { EnvironmentHealthResult } from '@/cli/types.js';
2
+ import { EnvironmentHealthResult } from '../../../types.js';
3
3
  interface Props {
4
4
  environment: EnvironmentHealthResult;
5
5
  }
@@ -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 '@/cli/types.js';
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 '@/cli/commands/RenderableCommand.js';
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 '@/cli/commands/RenderableCommand.js';
7
- import { PlaydateSdkVersionIdentifier } from '@/cli/types.js';
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,5 +1,5 @@
1
1
  import React from 'react';
2
- import { PlaydateSdkVersion } from '@/cli/types.js';
2
+ import { PlaydateSdkVersion } from '../../../types.js';
3
3
  interface Props {
4
4
  output: string;
5
5
  version: PlaydateSdkVersion;
@@ -1,10 +1,10 @@
1
1
  import React, { useMemo } from 'react';
2
- import { useFetchHtml } from '@/cli/commands/GenerateTypes/hooks/useFetchHtml.js';
3
- import { useGenerateTypeFile } from '@/cli/commands/GenerateTypes/hooks/useGenerateTypeFile.js';
4
- import { useGetVersion } from '@/cli/commands/GenerateTypes/hooks/useGetVersion.js';
5
- import { useParseDocumentation } from '@/cli/commands/GenerateTypes/hooks/useParseDocumentation.js';
6
- import { CheckList } from '@/cli/components/CheckList/index.js';
7
- import { useQuitOnCtrlC } from '@/cli/hooks/useQuitOnCtrlC.js';
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 '@/cli/types.js';
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 '@/cli/constants.js';
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 '@/cli/types.js';
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 '@/cli/commands/GenerateTypes/utils/playdateConstants.js';
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 '@/cli/types.js';
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 '@/cli/commands/GenerateTypes/constants.js';
4
- import { parseFunctionSignature } from '@/cli/commands/GenerateTypes/fn/parseFunctionSignature.js';
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 '@/cli/commands/GenerateTypes/fn/getHtmlForVersion.js';
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,4 +1,4 @@
1
- import { ApiDefinitions } from '@/cli/types.js';
1
+ import { ApiDefinitions } from '../../../types.js';
2
2
  export declare const useGenerateTypeFile: (path: string, definitions: ApiDefinitions | null) => {
3
3
  generateTypeFile: {
4
4
  waitingDescription: string;
@@ -1,6 +1,6 @@
1
1
  import { useMemo } from 'react';
2
2
  import { Project } from 'ts-morph';
3
- import { generateNamespace } from '@/cli/commands/GenerateTypes/fn/generateNamespace.js';
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,4 +1,4 @@
1
- import { PlaydateSdkVersion } from '@/cli/types.js';
1
+ import { PlaydateSdkVersion } from '../../../types.js';
2
2
  export declare const useGetVersion: (version: PlaydateSdkVersion) => {
3
3
  fetchedVersion: string | null;
4
4
  getVersion: {
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useMemo, useState } from 'react';
2
- import { PlaydateSdkUrl } from '@/cli/commands/GenerateTypes/constants.js';
3
- import { PlaydateSdkVersionIdentifier } from '@/cli/types.js';
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 '@/cli/types.js';
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("@/cli/types.js").PlaydateNamespace>;
11
- types: Record<string, import("@/cli/types.js").PlaydateType>;
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 '@/cli/commands/GenerateTypes/fn/getApiDefinitions.js';
3
- import { getFunctionDescriptionsFromHtml } from '@/cli/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js';
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(()=>{
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CheckListItem } from '@/cli/types.js';
2
+ import { CheckListItem } from '../../types.js';
3
3
  interface Props {
4
4
  items: CheckListItem<unknown>[];
5
5
  onFinish?: () => void;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { CheckListItem } from '@/cli/types.js';
2
+ import { CheckListItem } from '../../types.js';
3
3
  export interface ItemProps<TResult> {
4
4
  item: CheckListItem<TResult>;
5
5
  start: boolean;
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 '@/cli/commands/DoctorCommand.js';
6
- import { GenerateTypesCommand } from '@/cli/commands/GenerateTypes/GenerateTypesCommand.js';
7
- import { RootFolder } from '@/cli/utils/dirname.js';
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 '@/cli/environment/dto/Environment.js';
2
- import { PlaydateSdkPath } from '@/cli/environment/path/dto/PlaydateSdkPath.js';
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
  }