Skip to content

Commit

Permalink
Merge branch 'dev-next' of https://github.com/Kipper-Lang/Kipper into…
Browse files Browse the repository at this point in the history
… dev-next
  • Loading branch information
Luna-Klatzer committed Jun 26, 2024
2 parents 026bade + 615c88a commit 42f91ff
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 19 deletions.
1 change: 1 addition & 0 deletions add-next-tag.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions add-next-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 14 additions & 9 deletions kipper/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ and the [Kipper website](https://kipper-lang.org)._
[![DOI](https://zenodo.org/badge/411260595.svg)](https://zenodo.org/badge/latestdoi/411260595)

<!-- toc -->
* [Kipper CLI - `@kipper/cli` 🦊✨](#kipper-cli---kippercli-)
* [Usage](#usage)
* [Commands](#commands)

- [Kipper CLI - `@kipper/cli` 🦊✨](#kipper-cli---kippercli-)
- [Usage](#usage)
- [Commands](#commands)
<!-- tocstop -->

## General Information
Expand All @@ -39,6 +40,7 @@ and the [Kipper website](https://kipper-lang.org)._
# Usage

<!-- usage -->

```sh-session
$ npm install -g @kipper/cli
$ kipper COMMAND
Expand All @@ -50,17 +52,19 @@ USAGE
$ kipper COMMAND
...
```

<!-- usagestop -->

# Commands

<!-- 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]`

Expand Down Expand Up @@ -208,6 +212,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)_

<!-- commandsstop -->

## Contributing to Kipper
Expand Down
3 changes: 2 additions & 1 deletion kipper/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
11 changes: 11 additions & 0 deletions kipper/cli/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions kipper/cli/src/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> = [];
Expand All @@ -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.",
},
];

Expand Down Expand Up @@ -111,7 +111,7 @@ export default class New extends Command {
@prettifiedErrors<New>()
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
Expand Down
10 changes: 6 additions & 4 deletions kipper/target-js/src/code-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" ?' +
Expand All @@ -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"; }})',
";",
],
];
Expand Down
2 changes: 1 addition & 1 deletion kipper/target-ts/src/code-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 42f91ff

Please sign in to comment.