Skip to content

Commit 6fe13c6

Browse files
authored
Flag to generate English-only articles (#558)
1 parent 636b595 commit 6fe13c6

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

scripts/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ npm ci
4040
node generate_learning_path_markdown.js
4141
```
4242

43+
The `-e` param generates only English-language articles, which can speed things up quite a bit if you just need one language to test out some changes.
44+
4345
## How to update innersourcecommons.org with new articles
4446

4547
Anytime there are _any changes_, you need to run the script that generates the updated pages on the [innersourcecommons.org] site.

scripts/generate_learning_path_markdown.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const writeMarkdownFile = require('./write_markdown_file')
1111
const sections = require('./section_data.json')
1212

1313
const urls = YAML.parse(fs.readFileSync(join('..', 'config', 'urls.yaml'), 'utf-8'))
14+
const args = require('args-parser')(process.argv);
1415

1516
const getYouTubeCode = (section, articleNumber) => {
1617
const sectionLinks = urls.filter(entry => entry.section === section.toLowerCase())
@@ -38,9 +39,12 @@ const getArticleImage = (youTubeCode) => {
3839
const baseWritePath = join('.', writeDir, dirName)
3940
mkdirSync(baseWritePath)
4041

41-
const translations = fs.readdirSync(baseReadPath, { withFileTypes: true })
42-
.filter(dirent => dirent.isDirectory())
43-
.map(dirent => dirent.name)
42+
var translations = []
43+
if (!args.e) {
44+
translations = fs.readdirSync(baseReadPath, { withFileTypes: true })
45+
.filter(dirent => dirent.isDirectory())
46+
.map(dirent => dirent.name)
47+
}
4448

4549
translations.concat('' /* The English original */).forEach(async (translation) => {
4650
const isTranslation = translation !== ''

scripts/package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"dependencies": {
77
"@octokit/core": "^4.1.0",
88
"@octokit/plugin-throttling": "^4.3.2",
9+
"args-parser": "^1.3.0",
910
"asciidoctor": "^2.2.1",
1011
"dotenv": "^8.2.0",
1112
"yaml": "^2.2.2",

0 commit comments

Comments
 (0)