Skip to content

Commit

Permalink
Merge branch 'master' into POC-unicode-identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
fdodino authored Dec 13, 2024
2 parents 4f138f5 + 75e485e commit 669a701
Show file tree
Hide file tree
Showing 31 changed files with 1,765 additions and 372 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:

steps:
- uses: actions/checkout@v3
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
# - uses: webfactory/[email protected]
# with:
# ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.quoteStyle": "single",
"typescript.format.semicolons": "remove",
"editor.tabSize": 2,
"editor.insertSpaces": true
}
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Changelog

## v4.1.9
**Wollok Version: `3.2.7`**
- 👉 Fix report current line on the frame for stack traces
- ⤴️ Fix using `super` inside a closure
- 📁 Fix imports for chained files
- 🔄 Fix #cyclic const instance initialization
- ⛵ Moving function utils for navigation
- ❌ Error handling enhancements
- Better error messages from `lang` (and `native` methods)
- Add return of `void` value
- Sanitize stack trace

## v4.1.8
**Wollok Version: `3.2.6`**
- ❌ Hot fix for validation messages

## v4.1.7
**Wollok Version: `3.2.6`**
- 🌎 Migrate validation messages

## v4.1.6
**Wollok Version: `3.2.5`**
- 👾 Fix REPL constants in sub-folder files for dynamic diagram
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# Wollok-TS [![npm version](https://badge.fury.io/js/wollok-ts.svg)](https://badge.fury.io/js/wollok-ts) [![codecov](https://codecov.io/gh/uqbar-project/wollok-ts/graph/badge.svg?token=4U99G67xRT)](https://codecov.io/gh/uqbar-project/wollok-ts)
# Wollok-TS

[![npm version](https://badge.fury.io/js/wollok-ts.svg)](https://badge.fury.io/js/wollok-ts) [![Node.js CI](https://github.com/uqbar-project/wollok-ts/actions/workflows/node.js.yml/badge.svg)](https://github.com/uqbar-project/wollok-ts/actions/workflows/node.js.yml) [![codecov](https://codecov.io/gh/uqbar-project/wollok-ts/graph/badge.svg?token=4U99G67xRT)](https://codecov.io/gh/uqbar-project/wollok-ts) ![GitHub License](https://img.shields.io/github/license/uqbar-project/wollok-ts)


TypeScript based Wollok language implementation

## Usage
## 📖 Usage

For an in-dept explanation of the API and how to use it please refer to [the documentation page](https://uqbar-project.github.io/wollok-ts/).


## Contributing
## 👩‍💻 Contributing

All contributions are welcome! Feel free to report issues on [the project's issue tracker](https://github.com/uqbar-project/wollok-ts/issues), or fork the project and [create a *Pull Request*](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). If you've never collaborated with an open source project before, you might want to read [this guide](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/).

All contributions are welcome! Feel free to report issues on [the project's issue tracker](https://github.com/uqbar-project/wollok-ts/issues), or fork the project and [create a *Pull Request*](https://help.github.com/articles/creating-a-pull-request-from-a-fork/). If you've never collaborated with an open source project before, you might want to read [this guide](https://akrabat.com/the-beginners-guide-to-contributing-to-a-github-project/).
If you plan to contribute with code, please refer to [this page](https://uqbar-project.github.io/wollok-ts/pages/How-To-Contribute/). There is a list of [good first issues](https://github.com/uqbar-project/wollok-ts/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22), if you have any question please reach out us [in our Discord channel](https://discord.gg/ZstgCPKEaa).

If you plan to contribute with code, please refer to [this page](https://uqbar-project.github.io/wollok-ts/pages/How-To-Contribute/).
**Powered by [Uqbar](https://uqbar.org/)**

1 change: 1 addition & 0 deletions docs/_includes/navbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
- [How To Contribute](/wollok-ts/pages/How-To-Contribute)
- [General Design](/wollok-ts/pages/How-To-Contribute/General-Design-and-Main-Concerns)
- [Developer Environment](/wollok-ts/pages/How-To-Contribute/Developer-environment)
- [Developer Tools](/wollok-ts/pages/How-To-Contribute/Developer-tools)
- [Publish instructions](/wollok-ts/pages/Publish-Instructions)
78 changes: 19 additions & 59 deletions docs/pages/How-To-Contribute/Developer-environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ There are also other plugins that some people on the team find interesting and y
- [TODO Highlight](https://marketplace.visualstudio.com/items?itemName=wayou.vscode-todo-highlight)
- [Test Explorer UI](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-test-explorer)
- [Mocha Test Explorer](https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-mocha-test-adapter)
- [Editor Config for VS Code - Editor Config](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig), only if you use the editor config settings

### Node

#### For Linux and Mac

You need to install [NodeJS](https://nodejs.org/es/), which provides VM environment, and [NVM - Node Version Manager](https://github.com/nvm-sh/nvm).

Make sure you are using the right version of node by running this command:
Expand Down Expand Up @@ -60,6 +63,20 @@ then you need to install it
nvm install lts/hydrogen # or the version you get on the previous input
```

#### For Windows

You need to install the [NVM - for Windows](https://github.com/coreybutler/nvm-windows).

Run the installer `nvm-setup.exe` as Administrator.

Open an elevated Command Prompt or Git Bash in the project folder (with Administrator privileges) and run:

```bash
nvm install <<version number>>
nvm use <<version number>>
# The version number is in the .nvmrc file (do not use codename version e.g. lts/gallium, in Windows you have to use the equivalent version number e.g. 16.15.0)
```
### NPM
You will also need to install [NPM](https://www.npmjs.com/). If you are not familiar with *dependency manager tools*, you can think of this program as the entry point for all the important tasks development-related tasks, like installing dependencies and running tests. After installing the client, go to the project root folder and run:
Expand All @@ -84,63 +101,6 @@ We use [ESLint](https://eslint.org/) to make sure our code complies with our cod
![settingTSversion](https://user-images.githubusercontent.com/4549002/71355632-68957400-255e-11ea-808b-39ec97abff5c.gif)
## Testing

We use [BDD chai unit testing style](https://www.chaijs.com/api/bdd/), in particular

- [should](http://shouldjs.github.io/)
- expect

They are located in `test` folder.

You can run all the project tests from the console by executing:

```bash
npm test
```

We also have specific tests for each component of Wollok-TS:

```bash
npm run test:dynamicDiagram
npm run test:validations
...
```

Please refer to the `package.json` file or just run `npm run` command to see a list of alternatives.

## Debugging

The folder `.vscode` has a `launch.json` file which configures everything for running tests in an embedded VSCode environment. You can set a breakpoint and run the tests:

![ezgif com-video-to-gif](https://user-images.githubusercontent.com/4549002/71355164-00925e00-255d-11ea-9a83-c37f420d4e61.gif)

More on debugging:

- [Debugging in Visual Studio Code](https://code.visualstudio.com/docs/editor/debugging)
- [Debugging Typescript in VS Code](https://code.visualstudio.com/docs/typescript/typescript-debugging)
- [How to debug Typescript in VS Code](https://medium.com/@PhilippKief/how-to-debug-typescript-with-vs-code-9cec93b4ae56)

### Debugging a single test

You can use **Test Explorer with Mocha**, if you follow current instructions and install plugins Test Explorer and Mocha Test Explorer. Then, you can go to the Test Explorer tab and run/debug a single test from the left sidebar:

![debuggingWollokTs2](https://user-images.githubusercontent.com/4549002/71355441-cd040380-255d-11ea-82b6-1cb7c19c1c7a.gif)

Or, if you prefer using the console:

```bash
npm run test:unit -- -f <test>
```

### Building it locally

If you are developing a dependency of Wollok-TS (for instance Wollok-TS CLI or Wollok Web Tools), you might need to run a local build. To do so, just run:

```bash
npm run build
```

### Deploying / Publishing
## Moving on
If you need to deploy or publish a new version, please refer to [this page](../Publish-Instructions.md)
You can check Wollok-TS tools in [the specific tools page](./Developer-tools.md)
70 changes: 70 additions & 0 deletions docs/pages/How-To-Contribute/Developer-tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@

## Base environment

Please take a look at [the developer environment page](./Developer-environment.md) in order to install all required components.

## Testing

We use [BDD chai unit testing style](https://www.chaijs.com/api/bdd/), in particular

- [should](http://shouldjs.github.io/)
- expect

They are located in `test` folder.

You can run all the project tests from the console by executing:

```bash
npm test
```

We also have specific tests for each component of Wollok-TS:

```bash
npm run test:dynamicDiagram
npm run test:validations
...
```

Please refer to the `package.json` file or just run `npm run` command to see a list of alternatives.

## Debugging

The folder `.vscode` has a `launch.json` file which configures everything for running tests in an embedded VSCode environment. You can set a breakpoint and run the tests:

![ezgif com-video-to-gif](https://user-images.githubusercontent.com/4549002/71355164-00925e00-255d-11ea-9a83-c37f420d4e61.gif)

More on debugging:

- [Debugging in Visual Studio Code](https://code.visualstudio.com/docs/editor/debugging)
- [Debugging Typescript in VS Code](https://code.visualstudio.com/docs/typescript/typescript-debugging)
- [How to debug Typescript in VS Code](https://medium.com/@PhilippKief/how-to-debug-typescript-with-vs-code-9cec93b4ae56)

### Debugging a single test

You can use **Test Explorer with Mocha**, if you follow current instructions and install plugins Test Explorer and Mocha Test Explorer. Then, you can go to the Test Explorer tab and run/debug a single test from the left sidebar:

![debuggingWollokTs2](https://user-images.githubusercontent.com/4549002/71355441-cd040380-255d-11ea-82b6-1cb7c19c1c7a.gif)

Or, if you prefer using the console:

```bash
npm run test:unit -- -f <test>
```

### Building it locally

If you are developing a dependency of Wollok-TS (for instance Wollok-TS CLI or Wollok Web Tools), you might need to run a local build. To do so, just run:

```bash
npm run build
```

### We, the People

If you need some human interaction, you're always welcome at [our Discord channel](https://discord.gg/ZstgCPKEaa). We also have [a list of first good issues](https://github.com/uqbar-project/wollok-ts/labels/good%20first%20issue) you can take a look and ask for help to get more information.

### Deploying / Publishing

If you need to deploy or publish a new version, please refer to [this page](../Publish-Instructions.md)

4 changes: 2 additions & 2 deletions package-lock.json

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

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wollok-ts",
"version": "4.1.7",
"version": "4.1.10",
"wollokVersion": ":master",
"description": "TypeScript based Wollok language implementation",
"repository": "https://github.com/uqbar-project/wollok-ts",
Expand All @@ -12,17 +12,20 @@
"scripts": {
"build": "rm -rf dist && tsc && cp -r dist/temp/src/* dist && rm -r dist/temp && cp -r language/src/* dist/wre/",
"buildWRE": "ts-node scripts/buildWRE.ts",
"prepare": "ts-node scripts/fetchLanguage.ts && npm run buildWRE",
"prepare": "ts-node scripts/fetchLanguage.ts && npm run buildWRE && npm run copy:translations",
"copy:translations": "cp ./language/src/resources/validationMessages/*.json ./src/validator",
"diagnostic": "tsc --noEmit --diagnostics --extendedDiagnostics",
"test": "npm run test:lint && npm run test:unit && npm run test:sanity && npm run test:examples && npm run test:validations && npm run test:typeSystem && npm run test:printer",
"test:lint": "eslint .",
"test:coverage": "nyc --reporter=lcov npm run test",
"test:unit": "mocha --parallel -r ts-node/register/transpile-only test/**/*.test.ts",
"test:examples": "npm run test:wtest -- --root language/test/examples",
"test:game": "mocha --parallel -r ts-node/register/transpile-only test/**/game.test.ts",
"test:dynamicDiagram": "mocha --parallel -r ts-node/register/transpile-only test/dynamicDiagram.test.ts",
"test:helpers": "mocha --parallel -r ts-node/register/transpile-only test/helpers.test.ts",
"test:interpreter": "mocha --parallel -r ts-node/register/transpile-only test/interpreter.test.ts",
"test:interpreter": "mocha -r ts-node/register/transpile-only test/interpreter.test.ts",
"test:linker": "mocha --parallel -r ts-node/register/transpile-only test/linker.test.ts",
"test:messageReporter": "mocha --parallel -r ts-node/register/transpile-only test/messageReporter.test.ts",
"test:model": "mocha --parallel -r ts-node/register/transpile-only test/model.test.ts",
"test:sanity": "npm run test:wtest -- --root language/test/sanity",
"test:validations": "mocha --parallel -r ts-node/register/transpile-only test/validator.test.ts",
Expand Down
2 changes: 1 addition & 1 deletion scripts/fetchLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { existsSync, mkdirSync } from 'fs'
import gitClient from 'simple-git'
import { wollokVersion } from '../package.json'

const WOLLOK_LANGUAGE_REPO = 'git@github.com:uqbar-project/wollok-language.git'
const WOLLOK_LANGUAGE_REPO = 'https://github.com/uqbar-project/wollok-language.git'
const WOLLOK_LANGUAGE_TAG = wollokVersion.includes(':') ? wollokVersion.split(':')[1] : `v${wollokVersion}`
const WOLLOK_LANGUAGE_FOLDER = 'language'

Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const DICTIONARY_MODULE = 'wollok.lang.Dictionary'
export const OBJECT_MODULE = 'wollok.lang.Object'
export const EXCEPTION_MODULE = 'wollok.lang.Exception'
export const CLOSURE_MODULE = 'wollok.lang.Closure'
export const VOID_WKO = 'wollok.lang.void'

export const GAME_MODULE = 'wollok.game.game'

Expand Down
2 changes: 2 additions & 0 deletions src/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ export const uniqueBy = <T>(collection: T[], property: keyof T): T[] =>
return uniques
}, [])

export const excludeNullish = <T>(list: (T | undefined)[]): T[] => list.filter((item): item is T => item !== undefined)

export const count = <T>(list: List<T>, condition: (element: T) => boolean): number => list.filter(condition).length

export function raise(error: Error): never { throw error }
Expand Down
Loading

0 comments on commit 669a701

Please sign in to comment.