From 59a1093d612c713d362f2dec71a2b4b4faf8f50d Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Tue, 5 Nov 2019 14:14:32 -0800 Subject: [PATCH] feat(cli): generate datasource json with '.config.json` extension Workaround for https://github.com/microsoft/TypeScript/issues/34761 --- docs/site/DataSource-generator.md | 2 +- docs/site/DataSources.md | 4 ++-- docs/site/Inside-Loopback-Application.md | 4 ++-- docs/site/Repositories.md | 6 +++--- docs/site/Testing-your-application.md | 2 +- docs/site/deployment/Deploying-to-IBM-Cloud.md | 4 ++-- .../soap-calculator-tutorial-add-datasource.md | 6 +++--- docs/site/tutorials/todo/todo-tutorial-datasource.md | 2 +- .../todo/todo-tutorial-geocoding-service.md | 4 ++-- .../{ds.datasource.json => ds.config.json} | 0 .../src/datasources/ds.datasource.ts | 6 +++--- ...ulator.datasource.json => calculator.config.json} | 0 .../src/datasources/calculator.datasource.ts | 6 +++--- .../{db.datasource.json => db.config.json} | 0 examples/todo-list/src/datasources/db.datasource.ts | 6 +++--- examples/todo/src/__tests__/helpers.ts | 12 ++++++------ .../{db.datasource.json => db.config.json} | 0 examples/todo/src/datasources/db.datasource.ts | 6 +++--- ...geocoder.datasource.json => geocoder.config.json} | 0 examples/todo/src/datasources/geocoder.datasource.ts | 6 +++--- packages/cli/generators/datasource/index.js | 2 +- packages/cli/lib/utils.js | 2 +- .../generators/datasource.integration.snapshots.js | 10 +++++----- packages/cli/test/fixtures/relation/index.js | 10 +++++----- packages/cli/test/fixtures/repository/index.js | 10 +++++----- packages/cli/test/fixtures/service/index.js | 8 ++++---- .../integration/generators/datasource.integration.js | 2 +- .../integration/generators/repository.integration.js | 1 + packages/cli/test/unit/utils.unit.js | 2 +- 29 files changed, 62 insertions(+), 61 deletions(-) rename examples/express-composition/src/datasources/{ds.datasource.json => ds.config.json} (100%) rename examples/soap-calculator/src/datasources/{calculator.datasource.json => calculator.config.json} (100%) rename examples/todo-list/src/datasources/{db.datasource.json => db.config.json} (100%) rename examples/todo/src/datasources/{db.datasource.json => db.config.json} (100%) rename examples/todo/src/datasources/{geocoder.datasource.json => geocoder.config.json} (100%) diff --git a/docs/site/DataSource-generator.md b/docs/site/DataSource-generator.md index 8f06ec99e3bd..140c2c50fd98 100644 --- a/docs/site/DataSource-generator.md +++ b/docs/site/DataSource-generator.md @@ -51,7 +51,7 @@ Once all the prompts have been answered, the CLI will do the following: - Install `@loopback/repository` and the connector package (if it's not a custom connector). - Create a file with the connector configuration as follows: - `/src/datasources/${dataSource.dataSourceName}.datasource.json` + `/src/datasources/${dataSource.dataSourceName}.config.json` - Create a DataSource class which recieves the connector config using [Dependency Injection](Dependency-injection.md) as follows: `/src/datasources/${dataSource.dataSourceName}.datasource.ts` diff --git a/docs/site/DataSources.md b/docs/site/DataSources.md index a57875509c78..f517501c4223 100644 --- a/docs/site/DataSources.md +++ b/docs/site/DataSources.md @@ -20,7 +20,7 @@ It is recommended to use the [`lb4 datasource` command](DataSource-generator.md) provided by the CLI to generate a DataSource. The CLI will prompt for all necessary connector information and create the following files: -- `${dataSource.dataSourceName}.datasource.json` containing the connector +- `${dataSource.dataSourceName}.config.json` containing the connector configuration - `${dataSource.dataSourceName}.datasource.ts` containing a class extending `juggler.DataSource`. This class can be used to override the default @@ -37,7 +37,7 @@ Example DataSource Class: ```ts import {inject} from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './db.datasource.json'; +import * as config from './db.config.json'; export class DbDataSource extends juggler.DataSource { static dataSourceName = 'db'; diff --git a/docs/site/Inside-Loopback-Application.md b/docs/site/Inside-Loopback-Application.md index 3007cd6ad7c4..7b64f4c58b57 100644 --- a/docs/site/Inside-Loopback-Application.md +++ b/docs/site/Inside-Loopback-Application.md @@ -258,9 +258,9 @@ We need appropriate drivers to connect with the backend datasources. > to provide easy to use CRUD operations and connection configurations. In the example, -[Redis datasource definition](https://github.com/strongloop/loopback4-example-shopping/blob/master/packages/shopping/src/datasources/redis.datasource.json) +[Redis datasource definition](https://github.com/strongloop/loopback4-example-shopping/blob/master/packages/shopping/src/datasources/redis.config.json) uses the LoopBack `kv-redis` connector and -[MongoDB datasource definition](https://github.com/strongloop/loopback4-example-shopping/blob/master/packages/shopping/src/datasources/mongo.datasource.json) +[MongoDB datasource definition](https://github.com/strongloop/loopback4-example-shopping/blob/master/packages/shopping/src/datasources/mongo.config.json) uses the LoopBack `mongodb` connector. ## Application startup diff --git a/docs/site/Repositories.md b/docs/site/Repositories.md index f296cab91411..8c82e6f9c89b 100644 --- a/docs/site/Repositories.md +++ b/docs/site/Repositories.md @@ -312,7 +312,7 @@ better flexibility, we split the datasource definition into two files. The json file captures the configuration properties and it can be possibly overridden by dependency injection. -1. redis.datasource.json +1. redis.config.json ```json { @@ -328,14 +328,14 @@ dependency injection. 2. redis.datasource.ts The class uses a configuration object to set up a datasource for the Redis -instance. By default, the configuration is loaded from `redis.datasource.json`. +instance. By default, the configuration is loaded from `redis.config.json`. We can override it by binding a new object to `datasources.config.redis` for a context. ```ts import {inject} from '@loopback/core'; import {juggler, AnyObject} from '@loopback/repository'; -import * as config from './redis.datasource.json'; +import * as config from './redis.config.json'; export class RedisDataSource extends juggler.DataSource { static dataSourceName = 'redis'; diff --git a/docs/site/Testing-your-application.md b/docs/site/Testing-your-application.md index 3c7f087798d9..428b5d1d0860 100644 --- a/docs/site/Testing-your-application.md +++ b/docs/site/Testing-your-application.md @@ -740,7 +740,7 @@ instance: ```ts import {merge} from 'lodash'; -import * as GEO_CODER_CONFIG from '../datasources/geo.datasource.json'; +import * as GEO_CODER_CONFIG from '../datasources/geo.config.json'; function givenGeoService() { const config = merge({}, GEO_CODER_CONFIG, { diff --git a/docs/site/deployment/Deploying-to-IBM-Cloud.md b/docs/site/deployment/Deploying-to-IBM-Cloud.md index d6be47f03eb7..3e99294487e2 100644 --- a/docs/site/deployment/Deploying-to-IBM-Cloud.md +++ b/docs/site/deployment/Deploying-to-IBM-Cloud.md @@ -69,7 +69,7 @@ Cloudant connector, so data is persisted. ### Step 3: Updating your DataSource -Update `db.datasource.json` to use the Cloudant connector. The value for the +Update `db.config.json` to use the Cloudant connector. The value for the `url` property is just a placeholder and does not need to have the correct credential because we will be binding the app with the Cloudant service once it's pushed to IBM Cloud. @@ -106,7 +106,7 @@ $ npm i loopback-connector-cloudant import {TodoListApplication} from './application'; import {ApplicationConfig} from '@loopback/core'; // --------- ADD THIS SNIPPET --------- - const datasourceDb = require('./datasources/db.datasource.json'); + const datasourceDb = require('./datasources/db.config.json'); const cfenv = require('cfenv'); const appEnv = cfenv.getAppEnv(); // --------- ADD THIS SNIPPET --------- diff --git a/docs/site/tutorials/soap-calculator/soap-calculator-tutorial-add-datasource.md b/docs/site/tutorials/soap-calculator/soap-calculator-tutorial-add-datasource.md index 3a4e72d95325..fb3b99289843 100644 --- a/docs/site/tutorials/soap-calculator/soap-calculator-tutorial-add-datasource.md +++ b/docs/site/tutorials/soap-calculator/soap-calculator-tutorial-add-datasource.md @@ -67,7 +67,7 @@ JSON configuration file and a .ts file with the Datasource name and added an entry inside the index.ts file. ```sh - create src/datasources/calculator.datasource.json + create src/datasources/calculator.config.json create src/datasources/calculator.datasource.ts update src/datasources/index.ts @@ -103,10 +103,10 @@ bind the Node.js method _Multiply_. } ``` -Edit the file `src/datasources/calculator.datasource.json` and add the following +Edit the file `src/datasources/calculator.config.json` and add the following configuration after the `remoteEnabled: true,` property as follows: -{% include code-caption.html content="src/datasources/calculator.datasource.json" %} +{% include code-caption.html content="src/datasources/calculator.config.json" %} ```ts "operations": { diff --git a/docs/site/tutorials/todo/todo-tutorial-datasource.md b/docs/site/tutorials/todo/todo-tutorial-datasource.md index 872a6f261880..f83de75316be 100644 --- a/docs/site/tutorials/todo/todo-tutorial-datasource.md +++ b/docs/site/tutorials/todo/todo-tutorial-datasource.md @@ -39,7 +39,7 @@ lb4 datasource ? window.localStorage key to use for persistence (browser only): ? Full path to file for persistence (server only): ./data/db.json - create src/datasources/db.datasource.json + create src/datasources/db.config.json create src/datasources/db.datasource.ts update src/datasources/index.ts diff --git a/docs/site/tutorials/todo/todo-tutorial-geocoding-service.md b/docs/site/tutorials/todo/todo-tutorial-geocoding-service.md index 665c45090905..a4fa7627e8ed 100644 --- a/docs/site/tutorials/todo/todo-tutorial-geocoding-service.md +++ b/docs/site/tutorials/todo/todo-tutorial-geocoding-service.md @@ -47,7 +47,7 @@ $ lb4 datasource ? Default options for the request: ? An array of operation templates: ? Use default CRUD mapping: No - create src/datasources/geocoder.datasource.json + create src/datasources/geocoder.config.json create src/datasources/geocoder.datasource.ts # npm will install dependencies now update src/datasources/index.ts @@ -59,7 +59,7 @@ Edit the newly created datasource configuration to configure Geocoder API endpoints. Configuration options provided by REST Connector are described in our docs here: [REST connector](/doc/en/lb3/REST-connector.html). -{% include code-caption.html content="/src/datasources/geocoder.datasource.json" %} +{% include code-caption.html content="/src/datasources/geocoder.config.json" %} ```json { diff --git a/examples/express-composition/src/datasources/ds.datasource.json b/examples/express-composition/src/datasources/ds.config.json similarity index 100% rename from examples/express-composition/src/datasources/ds.datasource.json rename to examples/express-composition/src/datasources/ds.config.json diff --git a/examples/express-composition/src/datasources/ds.datasource.ts b/examples/express-composition/src/datasources/ds.datasource.ts index 66534a4a928f..060c6b876be7 100644 --- a/examples/express-composition/src/datasources/ds.datasource.ts +++ b/examples/express-composition/src/datasources/ds.datasource.ts @@ -3,9 +3,9 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {inject} from '@loopback/core'; -import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import { inject } from '@loopback/core'; +import { juggler } from '@loopback/repository'; +import * as config from './ds.config.json'; export class DsDataSource extends juggler.DataSource { static dataSourceName = 'ds'; diff --git a/examples/soap-calculator/src/datasources/calculator.datasource.json b/examples/soap-calculator/src/datasources/calculator.config.json similarity index 100% rename from examples/soap-calculator/src/datasources/calculator.datasource.json rename to examples/soap-calculator/src/datasources/calculator.config.json diff --git a/examples/soap-calculator/src/datasources/calculator.datasource.ts b/examples/soap-calculator/src/datasources/calculator.datasource.ts index 84d4b16b4f12..68ddcbde5e9d 100644 --- a/examples/soap-calculator/src/datasources/calculator.datasource.ts +++ b/examples/soap-calculator/src/datasources/calculator.datasource.ts @@ -3,9 +3,9 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {inject} from '@loopback/core'; -import {juggler} from '@loopback/repository'; -import * as config from './calculator.datasource.json'; +import { inject } from '@loopback/core'; +import { juggler } from '@loopback/repository'; +import * as config from './calculator.config.json'; export class CalculatorDataSource extends juggler.DataSource { static dataSourceName = 'calculator'; diff --git a/examples/todo-list/src/datasources/db.datasource.json b/examples/todo-list/src/datasources/db.config.json similarity index 100% rename from examples/todo-list/src/datasources/db.datasource.json rename to examples/todo-list/src/datasources/db.config.json diff --git a/examples/todo-list/src/datasources/db.datasource.ts b/examples/todo-list/src/datasources/db.datasource.ts index f97cc8ad360b..f471ee0af721 100644 --- a/examples/todo-list/src/datasources/db.datasource.ts +++ b/examples/todo-list/src/datasources/db.datasource.ts @@ -3,9 +3,9 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {inject} from '@loopback/core'; -import {juggler} from '@loopback/repository'; -import * as config from './db.datasource.json'; +import { inject } from '@loopback/core'; +import { juggler } from '@loopback/repository'; +import * as config from './db.config.json'; export class DbDataSource extends juggler.DataSource { static dataSourceName = 'db'; diff --git a/examples/todo/src/__tests__/helpers.ts b/examples/todo/src/__tests__/helpers.ts index 0928f9c695e3..fb5407c09bb3 100644 --- a/examples/todo/src/__tests__/helpers.ts +++ b/examples/todo/src/__tests__/helpers.ts @@ -3,12 +3,12 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {HttpCachingProxy} from '@loopback/http-caching-proxy'; -import {merge} from 'lodash'; +import { HttpCachingProxy } from '@loopback/http-caching-proxy'; +import { merge } from 'lodash'; import * as path from 'path'; -import * as GEO_CODER_CONFIG from '../datasources/geocoder.datasource.json'; -import {Todo} from '../models/index'; -import {GeocoderService, GeoPoint} from '../services/geocoder.service'; +import * as GEO_CODER_CONFIG from '../datasources/geocoder.config.json'; +import { Todo } from '../models/index'; +import { GeocoderService, GeoPoint } from '../services/geocoder.service'; /* ============================================================================== @@ -63,7 +63,7 @@ export function getProxiedGeoCoderConfig(proxy: HttpCachingProxy) { }); } -export {HttpCachingProxy}; +export { HttpCachingProxy }; export async function givenCachingProxy() { const proxy = new HttpCachingProxy({ cachePath: path.resolve(__dirname, '.http-cache'), diff --git a/examples/todo/src/datasources/db.datasource.json b/examples/todo/src/datasources/db.config.json similarity index 100% rename from examples/todo/src/datasources/db.datasource.json rename to examples/todo/src/datasources/db.config.json diff --git a/examples/todo/src/datasources/db.datasource.ts b/examples/todo/src/datasources/db.datasource.ts index 155368826c50..03e000eec5e1 100644 --- a/examples/todo/src/datasources/db.datasource.ts +++ b/examples/todo/src/datasources/db.datasource.ts @@ -3,9 +3,9 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {inject} from '@loopback/core'; -import {juggler} from '@loopback/repository'; -import * as config from './db.datasource.json'; +import { inject } from '@loopback/core'; +import { juggler } from '@loopback/repository'; +import * as config from './db.config.json'; export class DbDataSource extends juggler.DataSource { static dataSourceName = 'db'; diff --git a/examples/todo/src/datasources/geocoder.datasource.json b/examples/todo/src/datasources/geocoder.config.json similarity index 100% rename from examples/todo/src/datasources/geocoder.datasource.json rename to examples/todo/src/datasources/geocoder.config.json diff --git a/examples/todo/src/datasources/geocoder.datasource.ts b/examples/todo/src/datasources/geocoder.datasource.ts index b391a9005d78..e2db743d64d9 100644 --- a/examples/todo/src/datasources/geocoder.datasource.ts +++ b/examples/todo/src/datasources/geocoder.datasource.ts @@ -3,9 +3,9 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -import {inject} from '@loopback/core'; -import {juggler, AnyObject} from '@loopback/repository'; -import * as config from './geocoder.datasource.json'; +import { inject } from '@loopback/core'; +import { AnyObject, juggler } from '@loopback/repository'; +import * as config from './geocoder.config.json'; export class GeocoderDataSource extends juggler.DataSource { static dataSourceName = 'geocoder'; diff --git a/packages/cli/generators/datasource/index.js b/packages/cli/generators/datasource/index.js index 01ca9d981794..1a9f1da8c80a 100644 --- a/packages/cli/generators/datasource/index.js +++ b/packages/cli/generators/datasource/index.js @@ -240,7 +240,7 @@ module.exports = class DataSourceGenerator extends ArtifactGenerator { this.artifactInfo.className = utils.toClassName(this.artifactInfo.name); this.artifactInfo.fileName = utils.toFileName(this.artifactInfo.name); // prettier-ignore - this.artifactInfo.jsonFileName = `${this.artifactInfo.fileName}.datasource.json`; + this.artifactInfo.jsonFileName = `${this.artifactInfo.fileName}.config.json`; // prettier-ignore this.artifactInfo.outFile = `${this.artifactInfo.fileName}.datasource.ts`; diff --git a/packages/cli/lib/utils.js b/packages/cli/lib/utils.js index 998f3de6dc28..8b411813565a 100644 --- a/packages/cli/lib/utils.js +++ b/packages/cli/lib/utils.js @@ -559,7 +559,7 @@ exports.getDataSourceName = function(datasourcesDir, dataSourceClass) { exports.dataSourceToJSONFileName = function(dataSourceClass) { return path.join( - toFileName(dataSourceClass.replace('Datasource', '')) + '.datasource.json', + toFileName(dataSourceClass.replace('Datasource', '')) + '.config.json', ); }; diff --git a/packages/cli/snapshots/integration/generators/datasource.integration.snapshots.js b/packages/cli/snapshots/integration/generators/datasource.integration.snapshots.js index 1d6aad76aff4..1f15e802d076 100644 --- a/packages/cli/snapshots/integration/generators/datasource.integration.snapshots.js +++ b/packages/cli/snapshots/integration/generators/datasource.integration.snapshots.js @@ -15,7 +15,7 @@ import { ValueOrPromise, } from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import * as config from './ds.config.json'; @lifeCycleObserver('datasource') export class DsDataSource extends juggler.DataSource @@ -56,7 +56,7 @@ import { ValueOrPromise, } from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import * as config from './ds.config.json'; @lifeCycleObserver('datasource') export class DsDataSource extends juggler.DataSource @@ -97,7 +97,7 @@ import { ValueOrPromise, } from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import * as config from './ds.config.json'; @lifeCycleObserver('datasource') export class DsDataSource extends juggler.DataSource @@ -138,7 +138,7 @@ import { ValueOrPromise, } from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import * as config from './ds.config.json'; @lifeCycleObserver('datasource') export class DsDataSource extends juggler.DataSource @@ -179,7 +179,7 @@ import { ValueOrPromise, } from '@loopback/core'; import {juggler} from '@loopback/repository'; -import * as config from './ds.datasource.json'; +import * as config from './ds.config.json'; @lifeCycleObserver('datasource') export class DsDataSource extends juggler.DataSource diff --git a/packages/cli/test/fixtures/relation/index.js b/packages/cli/test/fixtures/relation/index.js index 5c1f42baf1ed..a6c48d9df701 100644 --- a/packages/cli/test/fixtures/relation/index.js +++ b/packages/cli/test/fixtures/relation/index.js @@ -108,7 +108,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'dbkv.datasource.json', + file: 'dbkv.config.json', content: JSON.stringify({ name: 'dbkv', connector: 'kv-redis', @@ -121,7 +121,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'dbmem.datasource.json', + file: 'dbmem.config.json', content: JSON.stringify({ name: 'dbmem', connector: 'memory', @@ -129,7 +129,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'my-ds.datasource.json', + file: 'my-ds.config.json', content: JSON.stringify({ name: 'MyDS', connector: 'memory', @@ -142,7 +142,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'restdb.datasource.json', + file: 'restdb.config.json', content: JSON.stringify({ name: 'restdb', connector: 'rest', @@ -150,7 +150,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'sqlite3.datasource.json', + file: 'sqlite3.config.json', content: JSON.stringify({ name: 'sqlite3', connector: 'loopback-connector-sqlite3', diff --git a/packages/cli/test/fixtures/repository/index.js b/packages/cli/test/fixtures/repository/index.js index 835f97dab984..e75fe2419021 100644 --- a/packages/cli/test/fixtures/repository/index.js +++ b/packages/cli/test/fixtures/repository/index.js @@ -21,7 +21,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'dbkv.datasource.json', + file: 'dbkv.config.json', content: JSON.stringify({ name: 'dbkv', connector: 'kv-redis', @@ -34,7 +34,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'dbmem.datasource.json', + file: 'dbmem.config.json', content: JSON.stringify({ name: 'dbmem', connector: 'memory', @@ -42,7 +42,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'my-ds.datasource.json', + file: 'my-ds.config.json', content: JSON.stringify({ name: 'MyDS', connector: 'memory', @@ -55,7 +55,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'restdb.datasource.json', + file: 'restdb.config.json', content: JSON.stringify({ name: 'restdb', connector: 'rest', @@ -63,7 +63,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'sqlite3.datasource.json', + file: 'sqlite3.config.json', content: JSON.stringify({ name: 'sqlite3', connector: 'loopback-connector-sqlite3', diff --git a/packages/cli/test/fixtures/service/index.js b/packages/cli/test/fixtures/service/index.js index c53ecf131b2f..4c264a5ce0a5 100644 --- a/packages/cli/test/fixtures/service/index.js +++ b/packages/cli/test/fixtures/service/index.js @@ -26,7 +26,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'myds.datasource.json', + file: 'myds.config.json', content: JSON.stringify({ name: 'myds', connector: 'soap', @@ -34,7 +34,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'map-ds.datasource.json', + file: 'map-ds.config.json', content: JSON.stringify({ name: 'MapDS', connector: 'soap', @@ -47,7 +47,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'dbmem.datasource.json', + file: 'dbmem.config.json', content: JSON.stringify({ name: 'dbmem', connector: 'memory', @@ -60,7 +60,7 @@ exports.SANDBOX_FILES = [ }, { path: DATASOURCE_APP_PATH, - file: 'restdb.datasource.json', + file: 'restdb.config.json', content: JSON.stringify({ name: 'restdb', connector: 'rest', diff --git a/packages/cli/test/integration/generators/datasource.integration.js b/packages/cli/test/integration/generators/datasource.integration.js index 9e2e858fd0f9..e3aeda7c7222 100644 --- a/packages/cli/test/integration/generators/datasource.integration.js +++ b/packages/cli/test/integration/generators/datasource.integration.js @@ -64,7 +64,7 @@ const expectedTSFile = path.join( const expectedJSONFile = path.join( SANDBOX_PATH, - 'src/datasources/ds.datasource.json', + 'src/datasources/ds.config.json', ); const expectedIndexFile = path.join(SANDBOX_PATH, 'src/datasources/index.ts'); diff --git a/packages/cli/test/integration/generators/repository.integration.js b/packages/cli/test/integration/generators/repository.integration.js index 8b50e44172e9..11fdb3c8a1ea 100644 --- a/packages/cli/test/integration/generators/repository.integration.js +++ b/packages/cli/test/integration/generators/repository.integration.js @@ -328,6 +328,7 @@ describe('lb4 repository', function() { const files = SANDBOX_FILES.filter( e => e.path !== 'src/datasources' || + e.file.includes('sqlite3.config.') || e.file.includes('sqlite3.datasource.'), ); const basicPrompt = { diff --git a/packages/cli/test/unit/utils.unit.js b/packages/cli/test/unit/utils.unit.js index c7bbbccd516e..e02b083e9e65 100644 --- a/packages/cli/test/unit/utils.unit.js +++ b/packages/cli/test/unit/utils.unit.js @@ -495,7 +495,7 @@ describe('Utils', () => { describe('dataSourceToJSONFileName', () => { it('returns the datasource json file name', () => { expect(utils.dataSourceToJSONFileName('MapDS')).to.equal( - 'map-ds.datasource.json', + 'map-ds.config.json', ); }); });