-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for specifying options via a configuration file instead of command line arguments. Uses `lilconfig` and `js-yaml` under the hood. | | Before | After | Diff | | :------: | -----: | :-----: | :--: | | packed | 4.4 kB | 5.5 kB | +25% | | unpacked | 9.5 kB | 12.6 kB | +33% | The increase in download size brings the package back to pre-bundling size. Note: This includes increased README documentation size. dist/main.js: 3.2kb Improves pipeline tests with bash unofficial strict mode, which fixes potential for false positives. Removes `-latest` from OS variable in test matrix. +semver:minor
- Loading branch information
Showing
13 changed files
with
247 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pattern: "*.css" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ "pattern": "*.css" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pattern: "*.css" | ||
outdir: generated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default { pattern: `*.css` }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,40 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail # Removed `-u` which failed on macos for `options` | ||
IFS=$' ' # We want space splitting for this script | ||
|
||
# $1 is the input name, relative to `fixtures`. Required. | ||
input=$1 | ||
|
||
# $2 is the standard (before) options. Defaults to "". | ||
IFS=" " read -r -a beforeOpts <<< "${2:-}" | ||
# $2 is the config file name, relative to `fixtures/config`. Defaults to $1.yaml. | ||
config=${2:-$1.yaml} | ||
|
||
# $3 is the output name, relative to `fixtures`. Defaults to $1. | ||
output=${3:-$1} | ||
# $3 is the options. Defaults to "". | ||
read -r -a options <<< "${3:-}" | ||
|
||
# $4 is the after options. Use an array. Defaults to "". | ||
IFS=" " read -r -a afterOpts <<< "${4:-}" | ||
# $4 is the output name, relative to `fixtures`. Defaults to $1. | ||
output=${4:-$1} | ||
|
||
# $5 is the path prefix for output. Defaults to "". | ||
prefix=${5:-} | ||
|
||
# Run from $RUNNER_TEMP for auto-cleanup. | ||
cp fixtures/${input}.css $RUNNER_TEMP/test.css | ||
cp fixtures/${output}.d.css.ts $RUNNER_TEMP/expected.d.css.ts | ||
|
||
rm -rf "${RUNNER_TEMP:?}/.config" | ||
if [ -f fixtures/config/${config} ]; then | ||
mkdir -p $RUNNER_TEMP/.config | ||
cp fixtures/config/${config} $RUNNER_TEMP/.config/${config} | ||
fi | ||
|
||
pushd $RUNNER_TEMP > /dev/null || exit | ||
|
||
# `./dist/main.js` is executing local `css-typed` as if installed (same as `bin`). | ||
# But it is `$GITHUB_WORKSPACE/dist/main.js` b/c we `cd $RUNNER_TEMP`. | ||
echo "css-typed ${beforeOpts[*]} \"*.css\" ${afterOpts[*]}" | ||
echo "css-typed " "${options[@]}" | ||
# shellcheck disable=SC2068 | ||
$GITHUB_WORKSPACE/dist/main.js ${beforeOpts[@]} "*.css" ${afterOpts[@]} | ||
$GITHUB_WORKSPACE/dist/main.js ${options[@]} | ||
|
||
# Use `diff` to compare the files. | ||
# Use `-I '//.*'` to ignore the first line (comment) which has generated path and timestamp. | ||
diff --color=auto --strip-trailing-cr -uI "//.*" expected.d.css.ts ${prefix}test.d.css.ts | ||
diff --color=always --strip-trailing-cr -uI "//.*" expected.d.css.ts ${prefix}test.d.css.ts |
Oops, something went wrong.