diff --git a/packages/cli/src/commands/build/runLowdefyBuild.js b/packages/cli/src/commands/build/runLowdefyBuild.js index a5dce816b..1cf87a138 100644 --- a/packages/cli/src/commands/build/runLowdefyBuild.js +++ b/packages/cli/src/commands/build/runLowdefyBuild.js @@ -28,7 +28,7 @@ async function runLowdefyBuild({ context }) { env: { ...process.env, LOWDEFY_DIRECTORY_BUILD: context.directories.build, - LOWDEFY_DIRECTORY_CONFIG: context.directories.base, + LOWDEFY_DIRECTORY_CONFIG: context.directories.config, LOWDEFY_DIRECTORY_SERVER: context.directories.server, }, }, diff --git a/packages/cli/src/commands/dev/runDevServer.js b/packages/cli/src/commands/dev/runDevServer.js index fd19dbe9a..10ba845a4 100644 --- a/packages/cli/src/commands/dev/runDevServer.js +++ b/packages/cli/src/commands/dev/runDevServer.js @@ -26,7 +26,7 @@ async function runDevServer({ context }) { cwd: context.directories.devServer, env: { ...process.env, - LOWDEFY_DIRECTORY_CONFIG: context.directories.base, + LOWDEFY_DIRECTORY_CONFIG: context.directories.config, }, }, silent: false, diff --git a/packages/cli/src/index.js b/packages/cli/src/index.js index fb1e3e505..b7f3bc790 100755 --- a/packages/cli/src/index.js +++ b/packages/cli/src/index.js @@ -37,7 +37,7 @@ program .usage(`[options]`) .option( '--config-directory ', - 'Change base directory. Default is the current working directory.' + 'Change config directory. Default is the current working directory.' ) .option('--disable-telemetry', 'Disable telemetry.') .option( @@ -60,7 +60,7 @@ program .usage(`[options]`) .option( '--config-directory ', - 'Change base directory. Default is the current working directory.' + 'Change config directory. Default is the current working directory.' ) .option('--disable-telemetry', 'Disable telemetry.') .option( @@ -98,7 +98,7 @@ program .usage(`[options]`) .option( '--config-directory ', - 'Change base directory. Default is the current working directory.' + 'Change config directory. Default is the current working directory.' ) .option('--disable-telemetry', 'Disable telemetry.') .option( diff --git a/packages/cli/src/utils/getDirectories.js b/packages/cli/src/utils/getDirectories.js index 67d008d8c..3dc9598fd 100644 --- a/packages/cli/src/utils/getDirectories.js +++ b/packages/cli/src/utils/getDirectories.js @@ -24,7 +24,7 @@ function getDirectories({ configDirectory, options }) { dotLowdefy = path.resolve(configDirectory, '.lowdefy'); } return { - base: configDirectory, + config: configDirectory, build: path.join(dotLowdefy, 'server', 'build'), dotLowdefy, server: path.join(dotLowdefy, 'server'), diff --git a/packages/cli/src/utils/getDirectories.test.js b/packages/cli/src/utils/getDirectories.test.js index 28bed5ff3..5f787c049 100644 --- a/packages/cli/src/utils/getDirectories.test.js +++ b/packages/cli/src/utils/getDirectories.test.js @@ -18,22 +18,22 @@ import getDirectories from './getDirectories.js'; test('default directories', () => { const { cacheDirectory, buildDirectory } = getDirectories({ - configDirectory: '/test/base', + configDirectory: '/test/config', options: {}, }); - expect(cacheDirectory).toEqual('/test/base/.lowdefy/.cache'); - expect(buildDirectory).toEqual('/test/base/.lowdefy/build'); + expect(cacheDirectory).toEqual('/test/config/.lowdefy/.cache'); + expect(buildDirectory).toEqual('/test/config/.lowdefy/build'); }); test('specify outputDirectory in options', () => { const { cacheDirectory, buildDirectory } = getDirectories({ - configDirectory: '/test/base', + configDirectory: '/test/config', options: { outputDirectory: '/test/build', }, }); - expect(cacheDirectory).toEqual('/test/base/.lowdefy/.cache'); + expect(cacheDirectory).toEqual('/test/config/.lowdefy/.cache'); expect(buildDirectory).toEqual('/test/build'); }); diff --git a/packages/cli/src/utils/getLowdefyYaml.js b/packages/cli/src/utils/getLowdefyYaml.js index 8a9b6022b..60edd3a54 100644 --- a/packages/cli/src/utils/getLowdefyYaml.js +++ b/packages/cli/src/utils/getLowdefyYaml.js @@ -27,7 +27,7 @@ async function getLowdefyYaml({ configDirectory, command }) { if (!lowdefyYaml) { if (!['init'].includes(command)) { throw new Error( - `Could not find "lowdefy.yaml" file in specified base directory ${configDirectory}.` + `Could not find "lowdefy.yaml" file in specified config directory ${configDirectory}.` ); } return { cliConfig: {} }; diff --git a/packages/cli/src/utils/getLowdefyYaml.test.js b/packages/cli/src/utils/getLowdefyYaml.test.js index 0bab23a79..a02826b6e 100644 --- a/packages/cli/src/utils/getLowdefyYaml.test.js +++ b/packages/cli/src/utils/getLowdefyYaml.test.js @@ -46,9 +46,9 @@ test('get version from yaml file', async () => { expect(config).toEqual({ lowdefyVersion: '1.0.0', cliConfig: {} }); }); -test('get version from yaml file, base dir specified', async () => { +test('get version from yaml file, config dir specified', async () => { readFile.mockImplementation((filePath) => { - if (filePath === path.resolve(process.cwd(), 'baseDir/lowdefy.yaml')) { + if (filePath === path.resolve(process.cwd(), 'configDir/lowdefy.yaml')) { return ` lowdefy: 1.0.0 `; @@ -56,7 +56,7 @@ test('get version from yaml file, base dir specified', async () => { return null; }); const config = await getLowdefyYaml({ - configDirectory: path.resolve(process.cwd(), './baseDir'), + configDirectory: path.resolve(process.cwd(), './configDir'), }); expect(config).toEqual({ lowdefyVersion: '1.0.0', cliConfig: {} }); }); @@ -74,15 +74,15 @@ test('could not find lowdefy.yaml in cwd', async () => { `; }); await expect(getLowdefyYaml({ configDirectory })).rejects.toThrow( - 'Could not find "lowdefy.yaml" file in specified base directory' + 'Could not find "lowdefy.yaml" file in specified config directory' ); }); -test('could not find lowdefy.yaml in base dir', async () => { +test('could not find lowdefy.yaml in config dir', async () => { readFile.mockImplementation((filePath) => { if ( - filePath === path.resolve(process.cwd(), 'baseDir/lowdefy.yaml') || - filePath === path.resolve(process.cwd(), 'baseDir/lowdefy.yml') + filePath === path.resolve(process.cwd(), 'configDir/lowdefy.yaml') || + filePath === path.resolve(process.cwd(), 'configDir/lowdefy.yml') ) { return null; } @@ -91,8 +91,8 @@ test('could not find lowdefy.yaml in base dir', async () => { `; }); await expect( - getLowdefyYaml({ configDirectory: path.resolve(process.cwd(), './baseDir') }) - ).rejects.toThrow('Could not find "lowdefy.yaml" file in specified base directory'); + getLowdefyYaml({ configDirectory: path.resolve(process.cwd(), './configDir') }) + ).rejects.toThrow('Could not find "lowdefy.yaml" file in specified config directory'); }); test('lowdefy.yaml is invalid yaml', async () => { @@ -175,7 +175,7 @@ test('get cliConfig', async () => { }); }); -test('could not find lowdefy.yaml in base dir, command is "init" or "clean-cache"', async () => { +test('could not find lowdefy.yaml in config dir, command is "init" or "clean-cache"', async () => { readFile.mockImplementation(() => null); let config = await getLowdefyYaml({ command: 'init', configDirectory }); expect(config).toEqual({ diff --git a/packages/docs/concepts/cli.yaml b/packages/docs/concepts/cli.yaml index 4df7e4c3d..8e73b40ef 100644 --- a/packages/docs/concepts/cli.yaml +++ b/packages/docs/concepts/cli.yaml @@ -58,7 +58,7 @@ _ref: The `build` command runs a Lowdefy build. The options are: - - `--config-directory `: Change base directory. The default is the current working directory. + - `--config-directory `: Change config directory. The default is the current working directory. - `--blocks-server-url `: The URL from where Lowdefy blocks will be served. See below for more information. - `--disable-telemetry`: Disable telemetry. - `--output-directory `: Change the directory to which build artifacts are saved. The default is `/.lowdefy/build`. @@ -69,7 +69,7 @@ _ref: We recommend setting the build command to `npx lowdefy@latest build-netlify`. The Netlify publish directory should be set to `.lowdefy/publish`, and the functions directory set to `.lowdefy/functions`. - - `--config-directory `: Change base directory. The default is the current working directory (The base directory should rather be configured in the Netlify build settings). + - `--config-directory `: Change config directory. The default is the current working directory (The confg directory should rather be configured in the Netlify build settings). - `--blocks-server-url `: The URL from where Lowdefy blocks will be served. See below for more information. - `--disable-telemetry`: Disable telemetry. - `--ref-resolver `: Path to a JavaScript file containing a `_ref` resolver function to be used as the app default `_ref` resolver. @@ -78,14 +78,14 @@ _ref: The Lowdefy CLI caches block metadata, and build and server scripts in the `.lowdefy/cache` directory. These cached files can be removed using the `clean-cache` command. - - `--config-directory `: Change base directory. The default is the current working directory. + - `--config-directory `: Change config directory. The default is the current working directory. - `--disable-telemetry`: Disable telemetry. ## dev The `dev` command starts a Lowdefy development server, running locally. It can be accessed in a browser at [http://localhost:3000](http://localhost:3000). The CLI watches the file system, and rebuilds the app and reloads served pages every time a change is made to any of the files in the project directory. - - `--config-directory `: Change base directory. The default is the current working directory. + - `--config-directory `: Change config directory. The default is the current working directory. - `--blocks-server-url `: The URL from where Lowdefy blocks will be served. See below for more information. - `--disable-telemetry`: Disable telemetry. - `--port `: Change the port the server is hosted at. The default is `3000`.