Skip to content

Commit

Permalink
Merge pull request #17 from CloudCannon/feat/eleventy-3
Browse files Browse the repository at this point in the history
Fix for nested config files on 11ty
  • Loading branch information
Tate-CC authored Apr 26, 2024
2 parents b3134a1 + 2a99633 commit dd5f13b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cloudcannon/command-builder",
"version": "1.1.4",
"version": "1.1.5",
"description": "A script that builds the script that builds your site",
"main": "src/index.js",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions src/lib/eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,16 @@ function getInstallCommands(buildConfig) {
'CONFIG_DIR=`dirname $CONFIG`',
'echo $CONFIG_DIR',

'PWD=`pwd`',
'echo $PWD',

'CONFIG_BASE=`basename $CONFIG`',
'echo $CONFIG_BASE',

'CONFIG_INJECTED="$CONFIG_DIR/inject-cloudcannon.config.cjs"',
'CONFIG_INJECTED="$PWD/$CONFIG_DIR/inject-cloudcannon.config.cjs"',
'echo $CONFIG_INJECTED',

'export CC_ELEVENTY_CONFIG="$CONFIG_DIR/default-$CONFIG_BASE"',
'export CC_ELEVENTY_CONFIG="$PWD/$CONFIG_DIR/default-$CONFIG_BASE"',
'echo $CC_ELEVENTY_CONFIG',

// Move the site config file to injected config require location
Expand Down
24 changes: 16 additions & 8 deletions tests/eleventy.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ test('outputs with empty config', () => {
'CONFIG_DIR=`dirname $CONFIG`',
"echo '$ echo $CONFIG_DIR'",
'echo $CONFIG_DIR',
"echo '$ PWD=`pwd`'",
'PWD=`pwd`',
"echo '$ echo $PWD'",
'echo $PWD',
"echo '$ CONFIG_BASE=`basename $CONFIG`'",
'CONFIG_BASE=`basename $CONFIG`',
"echo '$ echo $CONFIG_BASE'",
'echo $CONFIG_BASE',
"echo '$ CONFIG_INJECTED=\"$CONFIG_DIR/inject-cloudcannon.config.cjs\"'",
'CONFIG_INJECTED="$CONFIG_DIR/inject-cloudcannon.config.cjs"',
"echo '$ CONFIG_INJECTED=\"$PWD/$CONFIG_DIR/inject-cloudcannon.config.cjs\"'",
'CONFIG_INJECTED="$PWD/$CONFIG_DIR/inject-cloudcannon.config.cjs"',
"echo '$ echo $CONFIG_INJECTED'",
'echo $CONFIG_INJECTED',
"echo '$ export CC_ELEVENTY_CONFIG=\"$CONFIG_DIR/default-$CONFIG_BASE\"'",
'export CC_ELEVENTY_CONFIG="$CONFIG_DIR/default-$CONFIG_BASE"',
"echo '$ export CC_ELEVENTY_CONFIG=\"$PWD/$CONFIG_DIR/default-$CONFIG_BASE\"'",
'export CC_ELEVENTY_CONFIG="$PWD/$CONFIG_DIR/default-$CONFIG_BASE"',
"echo '$ echo $CC_ELEVENTY_CONFIG'",
'echo $CC_ELEVENTY_CONFIG',
"echo '$ if [ -f $CONFIG ]; then mv $CONFIG $CC_ELEVENTY_CONFIG; fi'",
Expand Down Expand Up @@ -114,16 +118,20 @@ test('outputs with @next config', () => {
'CONFIG_DIR=`dirname $CONFIG`',
"echo '$ echo $CONFIG_DIR'",
'echo $CONFIG_DIR',
"echo '$ PWD=`pwd`'",
'PWD=`pwd`',
"echo '$ echo $PWD'",
'echo $PWD',
"echo '$ CONFIG_BASE=`basename $CONFIG`'",
'CONFIG_BASE=`basename $CONFIG`',
"echo '$ echo $CONFIG_BASE'",
'echo $CONFIG_BASE',
"echo '$ CONFIG_INJECTED=\"$CONFIG_DIR/inject-cloudcannon.config.cjs\"'",
'CONFIG_INJECTED="$CONFIG_DIR/inject-cloudcannon.config.cjs"',
"echo '$ CONFIG_INJECTED=\"$PWD/$CONFIG_DIR/inject-cloudcannon.config.cjs\"'",
'CONFIG_INJECTED="$PWD/$CONFIG_DIR/inject-cloudcannon.config.cjs"',
"echo '$ echo $CONFIG_INJECTED'",
'echo $CONFIG_INJECTED',
"echo '$ export CC_ELEVENTY_CONFIG=\"$CONFIG_DIR/default-$CONFIG_BASE\"'",
'export CC_ELEVENTY_CONFIG="$CONFIG_DIR/default-$CONFIG_BASE"',
"echo '$ export CC_ELEVENTY_CONFIG=\"$PWD/$CONFIG_DIR/default-$CONFIG_BASE\"'",
'export CC_ELEVENTY_CONFIG="$PWD/$CONFIG_DIR/default-$CONFIG_BASE"',
"echo '$ echo $CC_ELEVENTY_CONFIG'",
'echo $CC_ELEVENTY_CONFIG',
"echo '$ if [ -f $CONFIG ]; then mv $CONFIG $CC_ELEVENTY_CONFIG; fi'",
Expand Down

0 comments on commit dd5f13b

Please sign in to comment.