From 79c565d457b7dad243d6600453bcf9b73b456c4f Mon Sep 17 00:00:00 2001 From: Luna-Klatzer Date: Tue, 25 Jun 2024 20:53:45 +0200 Subject: [PATCH 1/5] other: Added `@kipper/config` to add-next-tag scripts --- add-next-tag.ps1 | 1 + add-next-tag.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/add-next-tag.ps1 b/add-next-tag.ps1 index 0b95a9c68..69782a2c0 100644 --- a/add-next-tag.ps1 +++ b/add-next-tag.ps1 @@ -9,6 +9,7 @@ $(npm dist-tag add @kipper/cli@$version next) $(npm dist-tag add @kipper/core@$version next) $(npm dist-tag add @kipper/target-js@$version next) $(npm dist-tag add @kipper/target-ts@$version next) +$(npm dist-tag add @kipper/config@$version next) $(npm dist-tag add @kipper/web@$version next) ExitOnFailure diff --git a/add-next-tag.sh b/add-next-tag.sh index 7d765182e..e15454da7 100644 --- a/add-next-tag.sh +++ b/add-next-tag.sh @@ -14,4 +14,5 @@ npm dist-tag add @kipper/cli@$version next npm dist-tag add @kipper/core@$version next npm dist-tag add @kipper/target-js@$version next npm dist-tag add @kipper/target-ts@$version next +npm dist-tag add @kipper/config@$version next npm dist-tag add @kipper/web@$version next From 129c4a22e951a0b59aebbf11506b1d2a819a5606 Mon Sep 17 00:00:00 2001 From: Luna-Klatzer Date: Tue, 25 Jun 2024 21:00:49 +0200 Subject: [PATCH 2/5] other: Added rimraf to CLI dev dependencies --- kipper/cli/package.json | 3 ++- kipper/cli/pnpm-lock.yaml | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/kipper/cli/package.json b/kipper/cli/package.json index 05711cc01..9e0b1e2ce 100644 --- a/kipper/cli/package.json +++ b/kipper/cli/package.json @@ -29,7 +29,8 @@ "@types/inquirer": "7.3.3", "typescript": "5.1.3", "prettier": "2.8.8", - "oclif": "2.7.0" + "oclif": "2.7.0", + "rimraf": "5.0.7" }, "engines": { "node": "16.x || 18.x || 20.x || 22.x", diff --git a/kipper/cli/pnpm-lock.yaml b/kipper/cli/pnpm-lock.yaml index 004e8a70e..3657194a0 100644 --- a/kipper/cli/pnpm-lock.yaml +++ b/kipper/cli/pnpm-lock.yaml @@ -67,6 +67,9 @@ devDependencies: prettier: specifier: 2.8.8 version: 2.8.8 + rimraf: + specifier: 5.0.7 + version: 5.0.7 typescript: specifier: 5.1.3 version: 5.1.3 @@ -3738,6 +3741,14 @@ packages: glob: 7.2.3 dev: true + /rimraf@5.0.7: + resolution: {integrity: sha512-nV6YcJo5wbLW77m+8KjH8aB/7/rxQy9SZ0HY5shnwULfS+9nmTtVXAJET5NdZmCzA4fPI/Hm1wo/Po/4mopOdg==} + engines: {node: '>=14.18'} + hasBin: true + dependencies: + glob: 10.4.2 + dev: true + /run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} From 11f4cbaff5c9225f493c58edc4974127608c85c6 Mon Sep 17 00:00:00 2001 From: Luna-Klatzer Date: Tue, 25 Jun 2024 21:28:58 +0200 Subject: [PATCH 3/5] fix: Fixed cwd showing in `--help` of `kipper new` --- kipper/cli/README.md | 22 +++++++++++++--------- kipper/cli/src/commands/new.ts | 8 ++++---- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/kipper/cli/README.md b/kipper/cli/README.md index 71be0fe45..84571d514 100644 --- a/kipper/cli/README.md +++ b/kipper/cli/README.md @@ -22,9 +22,9 @@ and the [Kipper website](https://kipper-lang.org)._ [![DOI](https://zenodo.org/badge/411260595.svg)](https://zenodo.org/badge/latestdoi/411260595) -* [Kipper CLI - `@kipper/cli` 🦊✨](#kipper-cli---kippercli-) -* [Usage](#usage) -* [Commands](#commands) +- [Kipper CLI - `@kipper/cli` 🦊✨](#kipper-cli---kippercli-) +- [Usage](#usage) +- [Commands](#commands) ## General Information @@ -39,6 +39,7 @@ and the [Kipper website](https://kipper-lang.org)._ # Usage + ```sh-session $ npm install -g @kipper/cli $ kipper COMMAND @@ -50,17 +51,19 @@ USAGE $ kipper COMMAND ... ``` + # Commands -* [`kipper analyse [FILE]`](#kipper-analyse-file) -* [`kipper compile [FILE]`](#kipper-compile-file) -* [`kipper help [COMMAND]`](#kipper-help-command) -* [`kipper new [LOCATION]`](#kipper-new-location) -* [`kipper run [FILE]`](#kipper-run-file) -* [`kipper version`](#kipper-version) + +- [`kipper analyse [FILE]`](#kipper-analyse-file) +- [`kipper compile [FILE]`](#kipper-compile-file) +- [`kipper help [COMMAND]`](#kipper-help-command) +- [`kipper new [LOCATION]`](#kipper-new-location) +- [`kipper run [FILE]`](#kipper-run-file) +- [`kipper version`](#kipper-version) ## `kipper analyse [FILE]` @@ -208,6 +211,7 @@ USAGE ``` _See code: [src/commands/version.ts](https://github.com/Kipper-Lang/Kipper/blob/v0.11.0-alpha.2/kipper/cli/src/commands/version.ts)_ + ## Contributing to Kipper diff --git a/kipper/cli/src/commands/new.ts b/kipper/cli/src/commands/new.ts index ff47d6f95..cbfbfd626 100644 --- a/kipper/cli/src/commands/new.ts +++ b/kipper/cli/src/commands/new.ts @@ -19,7 +19,7 @@ const templates = { }; export default class New extends Command { - static override description: string = "Generate a new Kipper using a setup wizard. (Node-only for now)"; + static override description: string = "Generate a new Kipper using a setup wizard."; // TODO! Add examples when the command moves out of development static override examples: Array = []; @@ -28,8 +28,8 @@ export default class New extends Command { { name: "location", required: false, - default: process.cwd(), - description: "The directory where the new project should be created. Defaults to the current directory.", + default: ".", + description: "The directory where the new project should be created.", }, ]; @@ -111,7 +111,7 @@ export default class New extends Command { @prettifiedErrors() public async run() { const { args, flags } = await this.getRunConfig(); - const rootDir = args.location; + const rootDir = path.resolve(args.location); const promptModule = await PromptModule.create(); // For the setup wizard we will ask the following questions From d596c042a825eea3e281503e676f036538066bd7 Mon Sep 17 00:00:00 2001 From: Luna-Klatzer Date: Tue, 25 Jun 2024 21:29:33 +0200 Subject: [PATCH 4/5] fix: Fixed TS error when running Kipper files --- kipper/target-js/src/code-generator.ts | 10 ++++++---- kipper/target-ts/src/code-generator.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/kipper/target-js/src/code-generator.ts b/kipper/target-js/src/code-generator.ts index 2f82c2945..c73e58f3a 100644 --- a/kipper/target-js/src/code-generator.ts +++ b/kipper/target-js/src/code-generator.ts @@ -84,7 +84,7 @@ export class JavaScriptTargetCodeGenerator extends KipperTargetCodeGenerator { // Determine the global scope in the JS execution environment ["// @ts-ignore"], [ - 'var __kipperGlobalScope = typeof __kipperGlobalScope !== "undefined" ? __kipperGlobalScope : typeof' + + 'var __globalScope = typeof __globalScope !== "undefined" ? __globalScope : typeof' + ' globalThis !== "undefined" ?' + " globalThis : typeof" + ' window !== "undefined" ?' + @@ -93,15 +93,17 @@ export class JavaScriptTargetCodeGenerator extends KipperTargetCodeGenerator { ], // Create global kipper object - Always prefer the global '__kipper' instance ["// @ts-ignore"], - ["var __kipper = __kipperGlobalScope.__kipper = __kipperGlobalScope.__kipper || __kipper || {}", ";"], + ["var __kipper = __globalScope.__kipper = __globalScope.__kipper || __kipper || {}", ";"], // The following error classes are simply used for errors thrown in internal Kipper functions and should be used // when the user code uses a Kipper-specific feature, syntax or function incorrectly. + ["// @ts-ignore"], [ - '__kipper.TypeError = __kipper.TypeError || (class KipperTypeError extends TypeError { constructor(msg) { super(msg); this.name="TypeError"; }})', + '__kipper.TypeError = __kipper.TypeError || (class KipperTypeError extends TypeError { constructor(msg) { super(msg); this.name="TypeError"; }})', ";", ], + ["// @ts-ignore"], [ - '__kipper.IndexError = __kipper.IndexError || (class KipperIndexError extends Error { constructor(msg) { super(msg); this.name="IndexError"; }})', + '__kipper.IndexError = __kipper.IndexError || (class KipperIndexError extends Error { constructor(msg) { super(msg); this.name="IndexError"; }})', ";", ], ]; diff --git a/kipper/target-ts/src/code-generator.ts b/kipper/target-ts/src/code-generator.ts index 442c12ae5..4e6f8db98 100644 --- a/kipper/target-ts/src/code-generator.ts +++ b/kipper/target-ts/src/code-generator.ts @@ -2,7 +2,7 @@ * The TypeScript target-specific code generator for translating Kipper code into TypeScript. * @since 0.8.0 */ -import type { TranslatedCodeLine, VariableDeclaration } from "@kipper/core"; +import { TranslatedCodeLine, VariableDeclaration } from "@kipper/core"; import { FunctionDeclaration } from "@kipper/core"; import { createTSFunctionSignature, getTSFunctionSignature } from "./tools"; import { JavaScriptTargetCodeGenerator } from "@kipper/target-js"; From 615c88af6b01b5b2cc55179bba715c8a2e8b864e Mon Sep 17 00:00:00 2001 From: Luna-Klatzer Date: Tue, 25 Jun 2024 21:32:14 +0200 Subject: [PATCH 5/5] other: Prettified README.md --- kipper/cli/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/kipper/cli/README.md b/kipper/cli/README.md index 84571d514..688aec330 100644 --- a/kipper/cli/README.md +++ b/kipper/cli/README.md @@ -22,6 +22,7 @@ and the [Kipper website](https://kipper-lang.org)._ [![DOI](https://zenodo.org/badge/411260595.svg)](https://zenodo.org/badge/latestdoi/411260595) + - [Kipper CLI - `@kipper/cli` 🦊✨](#kipper-cli---kippercli-) - [Usage](#usage) - [Commands](#commands)