crankscript 0.4.1 → 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 +2 -3
- package/src/commands/DoctorCommand.js +1 -1
- package/src/commands/DoctorCommand.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +1 -1
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +3 -3
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +16 -22
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.js.map +1 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +4 -4
- package/src/commands/GenerateTypes/GenerateTypesCommand.js +14 -8
- package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +4 -3
- package/src/commands/GenerateTypes/components/GenerateTypes.js +7 -3
- package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
- package/src/commands/GenerateTypes/fn/generateNamespace.d.ts +3 -0
- package/src/commands/GenerateTypes/fn/generateNamespace.js +33 -0
- package/src/commands/GenerateTypes/fn/generateNamespace.js.map +1 -0
- package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +14 -0
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js +58 -0
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -0
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.d.ts +2 -0
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js +37 -0
- package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js.map +1 -0
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.d.ts +10 -0
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +24 -0
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -0
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +2 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +29 -9
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +2 -2
- package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +25 -0
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +33 -0
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -0
- package/src/commands/GenerateTypes/utils/playdateConstants.d.ts +9 -0
- package/src/commands/GenerateTypes/utils/playdateConstants.js +134 -0
- package/src/commands/GenerateTypes/utils/playdateConstants.js.map +1 -0
- package/src/constants.d.ts +1 -0
- package/src/constants.js +5 -0
- package/src/constants.js.map +1 -1
- package/src/environment/createEnvironment.js +8 -24
- package/src/environment/createEnvironment.js.map +1 -1
- package/src/environment/dto/Environment.d.ts +1 -4
- package/src/environment/dto/Environment.js +1 -2
- package/src/environment/dto/Environment.js.map +1 -1
- package/src/types.d.ts +43 -9
- package/src/types.js +6 -12
- package/src/types.js.map +1 -1
- package/src/environment/configuration/ConfigurationSchema.d.ts +0 -9
- package/src/environment/configuration/ConfigurationSchema.js +0 -9
- package/src/environment/configuration/ConfigurationSchema.js.map +0 -1
- package/src/environment/configuration/dto/Configuration.d.ts +0 -4
- package/src/environment/configuration/dto/Configuration.js +0 -7
- package/src/environment/configuration/dto/Configuration.js.map +0 -1
- package/src/environment/configuration/error/ConfigurationFileNotFoundError.d.ts +0 -4
- package/src/environment/configuration/error/ConfigurationFileNotFoundError.js +0 -8
- package/src/environment/configuration/error/ConfigurationFileNotFoundError.js.map +0 -1
- package/src/environment/configuration/error/ConfigurationFileValidationError.d.ts +0 -5
- package/src/environment/configuration/error/ConfigurationFileValidationError.js +0 -8
- package/src/environment/configuration/error/ConfigurationFileValidationError.js.map +0 -1
- package/src/environment/configuration/getConfiguration.d.ts +0 -4
- package/src/environment/configuration/getConfiguration.js +0 -31
- package/src/environment/configuration/getConfiguration.js.map +0 -1
@@ -1,31 +0,0 @@
|
|
1
|
-
import { readFileSync } from 'fs';
|
2
|
-
import { join } from 'node:path';
|
3
|
-
import * as process from 'node:process';
|
4
|
-
import { ConfigurationSchema } from './ConfigurationSchema.js';
|
5
|
-
import { CrankscriptConfigurationFileName } from '../../constants.js';
|
6
|
-
import { ConfigurationFileNotFoundError } from './error/ConfigurationFileNotFoundError.js';
|
7
|
-
import { ConfigurationFileValidationError } from './error/ConfigurationFileValidationError.js';
|
8
|
-
import { ConfigurationFileValidationErrorType } from '../../types.js';
|
9
|
-
export const getConfiguration = (input)=>{
|
10
|
-
const { workingDirectory = process.cwd() } = input != null ? input : {};
|
11
|
-
const configurationFilePath = join(workingDirectory, CrankscriptConfigurationFileName);
|
12
|
-
let contents = '';
|
13
|
-
let parsedObject;
|
14
|
-
try {
|
15
|
-
contents = readFileSync(configurationFilePath, 'utf8');
|
16
|
-
} catch (error) {
|
17
|
-
throw new ConfigurationFileNotFoundError();
|
18
|
-
}
|
19
|
-
try {
|
20
|
-
parsedObject = JSON.parse(contents);
|
21
|
-
} catch (error) {
|
22
|
-
throw new ConfigurationFileValidationError(ConfigurationFileValidationErrorType.InvalidJson, !!error && typeof error === 'object' && 'message' in error && typeof error.message === 'string' ? error.message : 'Error parsing JSON');
|
23
|
-
}
|
24
|
-
const validation = ConfigurationSchema.safeParse(parsedObject);
|
25
|
-
if (!validation.success) {
|
26
|
-
throw new ConfigurationFileValidationError(ConfigurationFileValidationErrorType.InvalidSchema, validation.error.errors.join(', '));
|
27
|
-
}
|
28
|
-
return validation.data;
|
29
|
-
};
|
30
|
-
|
31
|
-
//# sourceMappingURL=getConfiguration.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/environment/configuration/getConfiguration.ts"],"sourcesContent":["import { readFileSync } from 'fs';\nimport { join } from 'node:path';\nimport * as process from 'node:process';\nimport { ConfigurationSchema } from './ConfigurationSchema.js';\nimport { CrankscriptConfigurationFileName } from '../../constants.js';\nimport { ConfigurationFileNotFoundError } from './error/ConfigurationFileNotFoundError.js';\nimport { ConfigurationFileValidationError } from './error/ConfigurationFileValidationError.js';\nimport { ConfigurationFileValidationErrorType } from '../../types.js';\nimport { Configuration } from './dto/Configuration.js';\n\nexport const getConfiguration = (input?: {\n workingDirectory: string;\n}): Configuration => {\n const { workingDirectory = process.cwd() } = input ?? {};\n const configurationFilePath = join(\n workingDirectory,\n CrankscriptConfigurationFileName\n );\n let contents = '';\n let parsedObject: object;\n\n try {\n contents = readFileSync(configurationFilePath, 'utf8');\n } catch (error) {\n throw new ConfigurationFileNotFoundError();\n }\n\n try {\n parsedObject = JSON.parse(contents);\n } catch (error) {\n throw new ConfigurationFileValidationError(\n ConfigurationFileValidationErrorType.InvalidJson,\n !!error &&\n typeof error === 'object' &&\n 'message' in error &&\n typeof error.message === 'string'\n ? error.message\n : 'Error parsing JSON'\n );\n }\n\n const validation = ConfigurationSchema.safeParse(parsedObject);\n\n if (!validation.success) {\n throw new ConfigurationFileValidationError(\n ConfigurationFileValidationErrorType.InvalidSchema,\n validation.error.errors.join(', ')\n );\n }\n\n return validation.data;\n};\n"],"names":["readFileSync","join","process","ConfigurationSchema","CrankscriptConfigurationFileName","ConfigurationFileNotFoundError","ConfigurationFileValidationError","ConfigurationFileValidationErrorType","getConfiguration","input","workingDirectory","cwd","configurationFilePath","contents","parsedObject","error","JSON","parse","InvalidJson","message","validation","safeParse","success","InvalidSchema","errors","data"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,QAAQ,YAAY;AACjC,YAAYC,aAAa,eAAe;AACxC,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,gCAAgC,QAAQ,qBAAqB;AACtE,SAASC,8BAA8B,QAAQ,4CAA4C;AAC3F,SAASC,gCAAgC,QAAQ,8CAA8C;AAC/F,SAASC,oCAAoC,QAAQ,iBAAiB;AAGtE,OAAO,MAAMC,mBAAmB,CAACC;IAG7B,MAAM,EAAEC,mBAAmBR,QAAQS,GAAG,EAAE,EAAE,GAAGF,gBAAAA,QAAS,CAAC;IACvD,MAAMG,wBAAwBX,KAC1BS,kBACAN;IAEJ,IAAIS,WAAW;IACf,IAAIC;IAEJ,IAAI;QACAD,WAAWb,aAAaY,uBAAuB;IACnD,EAAE,OAAOG,OAAO;QACZ,MAAM,IAAIV;IACd;IAEA,IAAI;QACAS,eAAeE,KAAKC,KAAK,CAACJ;IAC9B,EAAE,OAAOE,OAAO;QACZ,MAAM,IAAIT,iCACNC,qCAAqCW,WAAW,EAChD,CAAC,CAACH,SACF,OAAOA,UAAU,YACjB,aAAaA,SACb,OAAOA,MAAMI,OAAO,KAAK,WACnBJ,MAAMI,OAAO,GACb;IAEd;IAEA,MAAMC,aAAajB,oBAAoBkB,SAAS,CAACP;IAEjD,IAAI,CAACM,WAAWE,OAAO,EAAE;QACrB,MAAM,IAAIhB,iCACNC,qCAAqCgB,aAAa,EAClDH,WAAWL,KAAK,CAACS,MAAM,CAACvB,IAAI,CAAC;IAErC;IAEA,OAAOmB,WAAWK,IAAI;AAC1B,EAAE"}
|