Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for nested config files on 11ty #17

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading