Comments (11)
The Python code run in our GitHub Action directory_formatter.yml should be replaced by TypeScript code so that contributors to this repo are better able to maintain it.
I disagree. It is not necessary to duplicate this script in TypeScript as long as the Python script is working well. CI is "meta" for this repo and does not have to be in TS. We're not converting the embedded bash either.
from typescript.
I closed by mistake. I will let you all decide how you want to proceed.
from typescript.
from typescript.
The scripts should be rather taken from the scripts repository, IMO.
There are still a few pending changes on that, so, you might want to wait a bit.
from typescript.
The action currently downloads the script from the script repository using wget
.
from typescript.
Oh, I meant using the newly actions we've created (still WIP, though).
from typescript.
A bit more on why creating a TypeScript implementation is a good idea… TheAlgorithms/Rust#473
from typescript.
So, we're not going to use this or? 🤔
from typescript.
Feel free to choose, @raklaptudirm and @appgurueu.
I'm fine with any of the options. 🙂
from typescript.
If someone submits a decent TS implementation, I'd be fine with switching, but this is definitely not a priority.
from typescript.
ChatGPT ported the JavaScript repo’s implementation to TypeScript…
import path from 'path'
import fs from 'fs'
import { globby } from 'globby'
function pathPrefix(i: number): string {
const res = ' '.repeat(i)
return res + '*'
}
function printPath(oldPath: string, newPath: string, output: string[]): string {
const oldParts = oldPath.split(path.sep)
const newParts = newPath.split(path.sep)
for (let i = 0; i < newParts.length; ++i) {
const newPart = newParts[i]
if (i + 1 > oldParts.length || oldParts[i] !== newPart) {
if (newPart) {
output.push(`${pathPrefix(i)} **${newPart.replace('_', ' ')}**`)
}
}
}
return newPath
}
function pathsToMarkdown(filePaths: string[]): string {
const output: string[] = []
let oldPath = ''
filePaths.sort(function (a, b) {
if (a.toLowerCase() < b.toLowerCase()) return -1
if (a.toLowerCase() > b.toLowerCase()) return 1
return 0
})
for (let filepath of filePaths) {
let filename = path.basename(filepath)
filepath = path.dirname(filepath)
if (filepath !== oldPath) {
oldPath = printPath(oldPath, filepath, output)
}
let indent = filepath.split(path.sep).length
// prepare the markdown-esque prefix to the file's line
const prefix = pathPrefix(indent)
// remove extension from filename
const name = path.basename(filename, ".js")
const url = path.join(filepath, filename)
output.push(`${prefix} [${name}](${url})`)
}
return output.join('\n')
}
// get paths of all .js files - excluding node_modules, the .github folder, tests and config stuff
globby([
'**/*.js',
'!(node_modules|.github)/**/*',
"!**/test/**/*",
'!**/*.test.js',
'!**/*.manual-test.js',
'!babel.config.js'
])
// create markdown content
.then(pathsToMarkdown)
// write markdown to file
.then(markdown => fs.writeFileSync('DIRECTORY.md', markdown + '\n', { encoding: 'utf8' }))
from typescript.
Related Issues (20)
- Add some maths' functions HOT 12
- Add Absolute Number Function in Maths HOT 2
- [BUG]: QuickSelect test case is failing HOT 4
- Add Binary Convert in Maths
- [BUG]: some test cases are failing..... HOT 1
- Setup tooling
- [FEATURE]: Adding a new category for Sequences HOT 3
- [FEATURE]: Add Gitpod Setup HOT 1
- Clarify project HOT 1
- Add Insertion Sort algorithm HOT 1
- Add a contributing guidelines file
- [OTHER] Update all Discord links
- [QUESTION] Should we run the CI for all other branches? HOT 3
- [FEATURE] Setup the Gitpod ready-to-code system
- Add Quick Select Algorithm HOT 3
- Add bug issue template
- Add a GitHub Actions workflow to generate `DIRECTORY.md` HOT 1
- Add CONTRIBUTING.md
- [FEATURE]: Selection Sort
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typescript.