Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ jobs:
ci:
runs-on: ${{ matrix.os }}
env:
#hardcode the coveralls token...it's not overly important to protect, and github actions won't allow forks to work with coveralls otherwise
COVERALLS_REPO_TOKEN: "fSZnZ2ciuSy219J8ohCWIj5rvJOZVb8JO"
NODE_OPTIONS: "--max-old-space-size=4096"
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: "14.19.0"
node-version: "22"
architecture: 'x64' # fix for macos-latest
- run: npm ci
- run: npm run preversion
- run: npm run publish-coverage
105 changes: 105 additions & 0 deletions .github/workflows/xelp_shadow_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Xelp Shadow Release

on:
workflow_dispatch:

jobs:
shadow-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout xelp/main
uses: actions/checkout@v4
with:
ref: xelp/main
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Calculate XelpShadow Version
id: version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
PACKAGE_NAME=$(node -p "require('./package.json').name")
echo "Current version: $CURRENT_VERSION"
echo "Package name: $PACKAGE_NAME"
echo "package_name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
# Remove pre-release and build metadata
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/[-+].*//')
# Split version into parts
IFS='.' read -r -a PARTS <<< "$BASE_VERSION"
if [ ${#PARTS[@]} -ne 3 ]; then
echo "Error: Version must be in MAJOR.MINOR.PATCH format"
exit 1
fi
MAJOR="${PARTS[0]}"
MINOR="${PARTS[1]}"
PATCH="${PARTS[2]}"
# Get build metadata
DATE=$(date +'%Y%m%d')
SHORT_HASH=$(git rev-parse --short HEAD)
# Construct base version: MAJOR.MINOR.DATE<PATCH>
CLEAN_VERSION="$MAJOR.$MINOR.$DATE$PATCH"
# Full version with metadata for the tag message/release notes
METADATA_VERSION="$CLEAN_VERSION+xelp-$SHORT_HASH"
# Use clean version for package.json and git tag (no + or -)
PACKAGE_VERSION="$CLEAN_VERSION"
TAG_VERSION="$CLEAN_VERSION"
echo "Clean version: $CLEAN_VERSION"
echo "Metadata version: $METADATA_VERSION"
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_OUTPUT
echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT
echo "metadata_version=$METADATA_VERSION" >> $GITHUB_OUTPUT
- name: Install dependencies
run: npm ci

- name: Update package.json version
run: |
npm version ${{ steps.version.outputs.package_version }} --no-git-tag-version
- name: Build
run: npm run build

- name: Commit and Push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
git checkout -b xelp/dist
git add -f dist/ package.json package-lock.json
git commit -m "Release shadow version ${{ steps.version.outputs.package_version }}"
git tag -a "${{ steps.version.outputs.tag_version }}" -m "Shadow release ${{ steps.version.outputs.metadata_version }}"
git push origin xelp/dist --force
git push origin "${{ steps.version.outputs.tag_version }}" --force
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
gh release create "${{ steps.version.outputs.tag_version }}" \
--repo ${{ github.repository }} \
--title "Shadow Release ${{ steps.version.outputs.tag_version }}" \
--notes "Shadow release build ${{ steps.version.outputs.metadata_version }}
## package.json
\`\`\`json
\"${{ steps.version.outputs.package_name }}\": \"https://github.com/${{ github.repository }}.git#${{ steps.version.outputs.tag_version }}\"
\`\`\`" \
--prerelease
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ All boolean, string, and integer [`bsfmt.json`](#bsfmtjson-options) options are
|compositeKeywords| `"split", "combine", "original"`| `"split"` | Forces all composite keywords (i.e. `elseif`, `endwhile`, etc...) to be consistent. If `"split"`, they are split into their alternatives (`else if`, `end while`). If `"combine"`', they are combined (`elseif`, `endwhile`). If `"original"` or falsey, they are not modified. |
|removeTrailingWhiteSpace|`boolean`|`true`| Remove (or don't remove) trailing whitespace at the end of each line |
|[keywordCaseOverride](#keywordCaseOverride)| `object`| `undefined`| Provides a way to override keyword case at the individual TokenType level|
|[typeCaseOverride](#typeCaseOverride)|`object`|`undefined`| Provides a way to override type keyword case at the individual TokenType level.Types are defined as keywords that are preceeded by an `as` token.|
|formatInteriorWhitespace|`boolean`|`true`| All whitespace between items is reduced to exactly 1 space character and certain keywords and operators are padded with whitespace. This is a catchall property that will also disable the following rules: `insertSpaceBeforeFunctionParenthesis`, `insertSpaceBetweenEmptyCurlyBraces` `insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces`|
|[typeCaseOverride](#typeCaseOverride)|`object`|`undefined`| Provides a way to override type keyword case at the individual TokenType level.Types are defined as keywords that are preceded by an `as` token.|
|formatInteriorWhitespace|`boolean`|`true`| All whitespace between items is reduced to exactly 1 space character and certain keywords and operators are padded with whitespace. This is a catchall property that will also disable the following rules: `insertSpaceBeforeFunctionParenthesis`, `insertSpaceBetweenEmptyCurlyBraces`, `insertSpaceAroundParameterAssignment`, `insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces`|
|insertSpaceBeforeFunctionParenthesis|`boolean`|`false`| If true, a space is inserted to the left of an opening function declaration parenthesis. (i.e. `function main ()` or `function ()`). If false, all spacing is removed (i.e. `function main()` or `function()`).|
|insertSpaceBetweenEmptyCurlyBraces|`boolean`|`false`| If true, empty curly braces will contain exactly 1 whitespace char (i.e. `{ }`). If false, there will be zero whitespace chars between empty curly braces (i.e. `{}`) |
|insertSpaceAroundParameterAssignment|`boolean`|`true`| If true, insert spaces around assignment operators in function parameters. (i.e. `function main(a = true, b = false)` or `function(a = true, b = false)`). If false, assignments will be collapsed (i.e. `function main(a=true, b=false)` or `function(a=true, b=false)`).|
|insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces|`boolean`|`true`| If true, ensure exactly 1 space after leading and before trailing curly braces. If false, REMOVE all whitespace after leading and before trailing curly braces (excluding beginning-of-line indentation spacing)|
|insertSpaceBetweenAssociativeArrayLiteralKeyAndColon|`boolean`|`false`| If true, ensure exactly 1 space between an associative array literal key and its colon. If false, all space between the key and its colon will be removed |
|formatSingleLineCommentType|`"singlequote", "rem", "original"`| `"original"` | Forces all single-line comments to use the same style. If 'singlequote' or falsey, all comments are preceeded by a single quote. This is the default. If `"rem"`, all comments are preceeded by `rem`. If `"original"`, the comment type is unchanged|
|formatSingleLineCommentType|`"singlequote", "rem", "original"`| `"original"` | Forces all single-line comments to use the same style. If 'singlequote' or falsey, all comments are preceded by a single quote. This is the default. If `"rem"`, all comments are preceded by `rem`. If `"original"`, the comment type is unchanged|
|formatMultiLineObjectsAndArrays|`boolean`| `true`|For multi-line objects and arrays, move everything after the `{` or `[` and everything before the `}` or `]` onto a new line.`|
|sortImports|`boolean`| `false`|Sort imports alphabetically.`|

Expand Down
7 changes: 6 additions & 1 deletion bsfmt.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
},
"typeCaseOverride": {
"type": "object",
"description": " Provides a way to override type keyword case at the individual TokenType level. Types are defined as keywords that are preceeded by an `as` token.",
"description": " Provides a way to override type keyword case at the individual TokenType level. Types are defined as keywords that are preceded by an `as` token.",
"properties": {
"boolean": {
"type": "string",
Expand Down Expand Up @@ -661,6 +661,11 @@
"default": false,
"description": "If true, empty curly braces will contain exactly 1 whitespace char (i.e. `{ }`). If false, there will be zero whitespace chars between empty curly braces (i.e. `{}`)"
},
"insertSpaceAroundParameterAssignment": {
"type": "boolean",
"default": true,
"description": "If true, insert spaces around assignment operators in function parameters (i.e. `function main(a = true, b = false)` or `function(a = true, b = false)`). If false, assignments will be collapsed (i.e. `function main(a=true, b=false)` or `function(a=true, b=false)`)."
},
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": {
"type": "boolean",
"default": true,
Expand Down
Loading