Skip to content

Commit ce472ae

Browse files
committed
Clean up scripts and array concat.
1 parent d3bc8db commit ce472ae

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"license": "MIT",
99
"repository": "https://github.com/FormidableLabs/prism-react-renderer",
1010
"scripts": {
11-
"postinstall": "pnpm run --filter generate-prism-languages start",
11+
"postinstall": "pnpm run --filter generate-prism-languages generate",
1212
"build": "pnpm run --filter prism-react-renderer build",
1313
"build:watch": "pnpm run --filter prism-react-renderer build:watch"
1414
},

packages/generate-prism-languages/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ const readLanguageFile = async (language: string): Promise<string> => {
3737

3838
const strArrayFromUnknown = (input: unknown) => (array: string[]) => {
3939
if (typeof input === "string") array.push(input)
40-
else if (Array.isArray(input)) {
41-
array = [...array, ...input.filter(i => typeof i === "string")]
42-
}
40+
else if (Array.isArray(input)) array = array.concat(input)
4341
return array
4442
}
4543

@@ -52,11 +50,11 @@ const main = async () => {
5250
"../prism-react-renderer/src/prism-langs.ts"
5351
)
5452

55-
const addLanguageToOutput = async (language: string) => {
53+
const addLanguageToOutput = async (language?: string) => {
5654
if (bundledLanguages.has(language)) {
5755
return
5856
}
59-
if (prismLanguages[language] == null) {
57+
if (language == null || prismLanguages[language] == null) {
6058
return
6159
}
6260
bundledLanguages.add(language)

packages/generate-prism-languages/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "generate-prism-languages",
33
"private": true,
44
"scripts": {
5-
"start": "ts-node ./index.ts"
5+
"generate": "ts-node ./index.ts"
66
},
77
"peerDependencies": {
88
"react": ">=16.0.0"
@@ -17,9 +17,7 @@
1717
"ts-node": "^10.9.1",
1818
"tslib": "^2.5.0",
1919
"typescript": "*",
20-
"uglify-js": "^3.17.4"
21-
},
22-
"dependencies": {
20+
"uglify-js": "^3.17.4",
2321
"lodash.flowright": "^3.5.0"
2422
}
2523
}

0 commit comments

Comments
 (0)