Skip to content

Commit

Permalink
Add @codinasion/language-data (codinasion-archive#4464)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshraj8843 authored May 31, 2023
1 parent d5eb11c commit 0f2c6cb
Show file tree
Hide file tree
Showing 79 changed files with 1,334 additions and 15 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.next
dist
program
Binary file added assets/language/C#.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/C++.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/C.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Dart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/F#.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Go.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Haskell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Java.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/JavaScript.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Julia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Kotlin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Perl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Php.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/R.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Ruby.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Rust.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Scala.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/Swift.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/language/TypeScript.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion github-bots/assign-me/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
"engines": {
"node": ">= 10.13.0"
}
}
}
6 changes: 2 additions & 4 deletions github-bots/assign-me/vercel.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"regions": [
"bom1"
],
"regions": ["bom1"],
"functions": {
"api/**": {
"memory": 1024,
"maxDuration": 10
}
}
}
}
1 change: 0 additions & 1 deletion github-bots/codinasion-bot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"node-fetch": "2.6.6",
"probot": "^12.2.4"
},

"engines": {
"node": ">= 10.13.0"
}
Expand Down
6 changes: 2 additions & 4 deletions github-bots/codinasion-bot/vercel.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"regions": [
"bom1"
],
"regions": ["bom1"],
"functions": {
"api/**": {
"memory": 1024,
"maxDuration": 10
}
}
}
}
2 changes: 1 addition & 1 deletion github-bots/pr-loc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"engines": {
"node": ">= 10.13.0"
}
}
}
6 changes: 2 additions & 4 deletions github-bots/pr-loc/vercel.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"regions": [
"bom1"
],
"regions": ["bom1"],
"functions": {
"api/**": {
"memory": 1024,
"maxDuration": 10
}
}
}
}
7 changes: 7 additions & 0 deletions packages/npm/language-data/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @codinasion/language-data

## 1.0.0

### Major Changes

- Initial Package
101 changes: 101 additions & 0 deletions packages/npm/language-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# @codinasion/language-data

Get programming language data.

<div align="center">
<img src="https://raw.githubusercontent.com/codinasion/codinasion/master/assets/rainbow-hr.png" alt="rainbow hr" width="100%" height="70%">
</div>

## Installation

```bash
npm install @codinasion/language-data
# or
yarn add @codinasion/language-data
# or
pnpm add @codinasion/language-data
```

<div align="center">
<img src="https://raw.githubusercontent.com/codinasion/codinasion/master/assets/rainbow-hr.png" alt="rainbow hr" width="100%" height="70%">
</div>

## Usage

### `getLanguageData`

```js
// Import the `getLanguageData` function from the `@codinasion/language-data` package.
import { getLanguageData } from "@codinasion/language-data";

// Call the `getLanguageData` function with the language name, or, file extension.
const languageData = getLanguageData({ name: "Python" })[0];

// Use the `languageData` object to get the language data.
console.log(languageData.name); // Python
console.log(languageData.fileExtension[0]); // py
console.log(languageData.namingConvention); // snake_case
console.log(languageData.prismTag); // python
console.log(languageData.logo); // https://github.com/codinasion/codinasion/assets/54644599/84788b04-f9ca-4201-b8fa-b097610ab2cf
```

```js
// Import the `getLanguageData` function from the `@codinasion/language-data` package.
import { getLanguageData } from "@codinasion/language-data";

// Call the `getLanguageData` function with the language name, or, file extension.
const languageData = getLanguageData({
prismTag: "csharp",
})[0];

// // Use the `languageData` object to get the language data.
console.log(languageData.name); // C#
console.log(languageData.fileExtension[0]); // cs
console.log(languageData.namingConvention); // PascalCase
console.log(languageData.prismTag); // csharp
console.log(languageData.logo); // https://github.com/codinasion/codinasion/assets/54644599/7c1c6b28-37ba-4871-afe0-3c8faee97b45
```

### `renameFile`

```js
// Import the `renameFile` function from the `@codinasion/language-data` package.
import { renameFile } from "@codinasion/language-data";

// Call the `renameFile` function with the file name and the language name, or, file extension.
const sampleFileName = "sample-file-name.py";

console.log(renameFile({ fileName: sampleFileName })); // sample_file_name.py
```

> **Note:** Use `language name` with `file name` to rename file. Because multiple languages can have the same file extension.
```js
import { renameFile } from "@codinasion/language-data";

const sampleFileName = "sample-file-name.py";

console.log(renameFile({ fileName: sampleFileName, name: "python" })); // sample_file_name.py
```

<div align="center">
<img src="https://raw.githubusercontent.com/codinasion/codinasion/master/assets/rainbow-hr.png" alt="rainbow hr" width="100%" height="70%">
</div>

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.

<div align="center">
<img src="https://raw.githubusercontent.com/codinasion/codinasion/master/assets/rainbow-hr.png" alt="rainbow hr" width="100%" height="70%">
</div>

<br/>

<p align="center">
Made with 💖 by Codinasion
</p>

<div align="center">
<img src="https://raw.githubusercontent.com/codinasion/codinasion/master/assets/rainbow-hr.png" alt="rainbow hr" width="100%" height="70%">
</div>
8 changes: 8 additions & 0 deletions packages/npm/language-data/jestconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"transform": {
"^.+\\.(t|j)sx?$": "ts-jest"
},
"testRegex": "(/__test__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
"testPathIgnorePatterns": ["dist"]
}
54 changes: 54 additions & 0 deletions packages/npm/language-data/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@codinasion/language-data",
"version": "1.0.0",
"access": "public",
"description": "Get programming language data",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"license": "MIT",
"repository": "https://github.com/codinasion/codinasion",
"homepage": "https://github.com/codinasion/codinasion/tree/master/packages/npm/language-data",
"bugs": {
"url": "https://github.com/codinasion/codinasion/issues",
"email": "[email protected]"
},
"author": {
"name": "Harsh Raj",
"email": "[email protected]",
"url": "https://github.com/harshraj8843"
},
"keywords": [
"codinasion",
"language",
"programming language",
"typescript",
"language data",
"programming language data",
"file extension",
"naming convention",
"programming language logo"
],
"scripts": {
"lint": "eslint \"**/*.ts*\"",
"build": "tsup",
"dev": "tsup --watch",
"check-types": "tsc --noEmit",
"test": "jest --config jestconfig.json --maxWorkers=50%"
},
"dependencies": {
"@codinasion/tools": "workspace:*"
},
"devDependencies": {
"@types/jest": "^29.5.1",
"eslint": "^7.32.0",
"eslint-config-custom": "workspace:*",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"tsconfig": "workspace:*",
"tsup": "^6.1.3",
"typescript": "^4.9.4"
}
}
Loading

0 comments on commit 0f2c6cb

Please sign in to comment.