Skip to content

Commit

Permalink
fix: add shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
magic-akari committed Sep 21, 2024
1 parent e12e366 commit b457670
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
BasedOnStyle: Chromium
IndentWidth: 4
---
Language: JavaScript
AccessModifierOffset: 2
AlignAfterOpenBracket: true
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakStringLiterals: false
ColumnLimit: 120
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentWidth: 4
TabWidth: 4
UseTab: Never
...
7 changes: 6 additions & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ SMALLEST_WASM=$(ls -Sr build/*.wasm | head -1)
cp $SMALLEST_WASM pkg/clang-format.wasm
npm exec terser -- src/template.js build/clang-format-esm.js --config-file .terser.json --output pkg/clang-format.js

# format cli script itself
echo '{"type": "commonjs"}' > build/package.json
node ./build/clang-format-cli.js -i ./build/clang-format-cli.js

# add shebang
echo '#!/usr/bin/env node' | cat - ./build/clang-format-cli.js > ./pkg/clang-format-cli.cjs
cp ./build/clang-format-cli.wasm ./pkg/
cp ./build/clang-format-cli.js ./pkg/clang-format-cli.cjs

cp ./src/clang-format.d.ts src/clang-format-*.js ./pkg/
cp ./package.json LICENSE README.md .npmignore ./pkg/
Expand Down

0 comments on commit b457670

Please sign in to comment.