@faststore/cli
Advanced tools
Comparing version 3.0.31 to 3.0.33
@@ -23,2 +23,3 @@ export interface ContentTypeOrSectionDefinition { | ||
export declare function dedupeAndMergeDefinitions(coreDefinitions: ContentTypeOrSectionDefinition[], duplicates: ContentTypeOrSectionDefinition[], primaryIdentifier: 'id' | 'name'): ContentTypeOrSectionDefinition[]; | ||
export declare function mergeCMSFile(fileName: string): Promise<void>; | ||
export declare function mergeCMSFiles(): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mergeCMSFiles = exports.dedupeAndMergeDefinitions = exports.splitCustomDefinitions = void 0; | ||
exports.mergeCMSFiles = exports.mergeCMSFile = exports.dedupeAndMergeDefinitions = exports.splitCustomDefinitions = void 0; | ||
const tslib_1 = require("tslib"); | ||
@@ -60,3 +60,3 @@ const path_1 = tslib_1.__importDefault(require("path")); | ||
const primaryIdentifierForDefinitions = fileName === 'content-types.json' ? 'id' : 'name'; | ||
let output = []; | ||
let output = coreDefinitions; | ||
// TODO: create a validation when the CMS files exist but don't have a component for them | ||
@@ -96,2 +96,3 @@ if ((0, fs_extra_1.existsSync)(customFilePath)) { | ||
} | ||
exports.mergeCMSFile = mergeCMSFile; | ||
async function mergeCMSFiles() { | ||
@@ -98,0 +99,0 @@ try { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
const path_1 = tslib_1.__importDefault(require("path")); | ||
const hcms_1 = require("../__mocks__/hcms"); | ||
const hcms_2 = require("./hcms"); | ||
const directory_1 = require("./directory"); | ||
jest.mock('fs-extra', () => ({ | ||
readFileSync: jest.fn(), | ||
existsSync: jest.fn(), | ||
writeFileSync: jest.fn(), | ||
})); | ||
describe('mergeCMSFile', () => { | ||
it("should create a resulting file that contains all core definitions if a custom definitions file doesn't exist", async () => { | ||
const { readFileSync, existsSync, writeFileSync } = require('fs-extra'); | ||
existsSync.mockReturnValueOnce(false); | ||
readFileSync.mockReturnValueOnce(JSON.stringify(hcms_1.coreContentTypes)); | ||
await (0, hcms_2.mergeCMSFile)('content-types.json'); | ||
expect(writeFileSync).toHaveBeenCalledWith(path_1.default.join(directory_1.tmpCMSDir, 'content-types.json'), JSON.stringify(hcms_1.coreContentTypes)); | ||
existsSync.mockReturnValueOnce(false); | ||
readFileSync.mockReturnValueOnce(JSON.stringify(hcms_1.coreSections)); | ||
await (0, hcms_2.mergeCMSFile)('sections.json'); | ||
expect(writeFileSync).toHaveBeenCalledWith(path_1.default.join(directory_1.tmpCMSDir, 'sections.json'), JSON.stringify(hcms_1.coreSections)); | ||
}); | ||
}); | ||
describe('splitCustomDefinitions', () => { | ||
@@ -6,0 +27,0 @@ it('should return empty arrays if there are no custom definitions', () => { |
@@ -1,1 +0,1 @@ | ||
{"version":"3.0.31","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"cms-sync":{"id":"cms-sync","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","allowNo":false}},"args":[]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"generate-graphql":{"id":"generate-graphql","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"debug":{"name":"debug","type":"boolean","char":"d","allowNo":false},"core":{"name":"core","type":"boolean","char":"c","hidden":true,"allowNo":false}},"args":[]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]}}} | ||
{"version":"3.0.33","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"cms-sync":{"id":"cms-sync","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"dry-run":{"name":"dry-run","type":"boolean","char":"d","allowNo":false}},"args":[]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"generate-graphql":{"id":"generate-graphql","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{"debug":{"name":"debug","type":"boolean","char":"d","allowNo":false},"core":{"name":"core","type":"boolean","char":"c","hidden":true,"allowNo":false}},"args":[]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[]}}} |
{ | ||
"name": "@faststore/cli", | ||
"version": "3.0.31", | ||
"version": "3.0.33", | ||
"description": "FastStore CLI", | ||
@@ -72,3 +72,3 @@ "author": "Emerson Laurentino @emersonlaurentino", | ||
"types": "dist/index.d.ts", | ||
"gitHead": "71edd96f9f974dc6b1a586e0c3bb326f20ba810f" | ||
"gitHead": "9d2ee7df473ff392d5b3887e1d9ac784ebcd778f" | ||
} |
@@ -33,3 +33,3 @@ <p align="center"> | ||
$ faststore (--version) | ||
@faststore/cli/3.0.31 linux-x64 node-v18.19.1 | ||
@faststore/cli/3.0.33 linux-x64 node-v18.19.1 | ||
$ faststore --help [COMMAND] | ||
@@ -60,3 +60,3 @@ USAGE | ||
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/build.ts)_ | ||
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/build.ts)_ | ||
@@ -73,3 +73,3 @@ ## `faststore cms-sync` | ||
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/cms-sync.ts)_ | ||
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/cms-sync.ts)_ | ||
@@ -83,3 +83,3 @@ ## `faststore dev` | ||
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/dev.ts)_ | ||
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/dev.ts)_ | ||
@@ -96,3 +96,3 @@ ## `faststore generate-graphql` | ||
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/generate-graphql.ts)_ | ||
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/generate-graphql.ts)_ | ||
@@ -126,3 +126,3 @@ ## `faststore help [COMMAND]` | ||
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/start.ts)_ | ||
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/start.ts)_ | ||
@@ -136,3 +136,3 @@ ## `faststore test` | ||
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.31/dist/commands/test.ts)_ | ||
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.33/dist/commands/test.ts)_ | ||
<!-- commandsstop --> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
84863
1235
15