Socket
Socket
Sign inDemoInstall

@faststore/cli

Package Overview
Dependencies
Maintainers
0
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@faststore/cli - npm Package Compare versions

Comparing version 3.0.80 to 3.0.82

4

dist/commands/build.d.ts
import { Command } from '@oclif/core';
export default class Build extends Command {
static args: {
name: string;
description: string;
}[];
run(): Promise<void>;
}

@@ -12,4 +12,11 @@ "use strict";

class Build extends core_1.Command {
static args = [
{
name: 'path',
description: 'The path where the FastStore being built is. Defaults to cwd.',
}
];
async run() {
const basePath = process.cwd();
const { args } = await this.parse(Build);
const basePath = args.path ?? process.cwd();
const { tmpDir } = (0, directory_1.withBasePath)(basePath);

@@ -16,0 +23,0 @@ await (0, generate_1.generate)({ setup: true, basePath });

@@ -7,3 +7,7 @@ /// <reference types="node" />

};
static args: {
name: string;
description: string;
}[];
run(): Promise<import("child_process").ChildProcess | undefined>;
}

10

dist/commands/cms-sync.js

@@ -12,5 +12,11 @@ "use strict";

};
static args = [
{
name: 'path',
description: 'The path where the FastStore being synched with the CMS is. Defaults to cwd.',
}
];
async run() {
const { flags } = await this.parse(CmsSync);
const basePath = process.cwd();
const { flags, args } = await this.parse(CmsSync);
const basePath = args.path ?? process.cwd();
const { tmpDir } = (0, directory_1.withBasePath)(basePath);

@@ -17,0 +23,0 @@ await (0, generate_1.generate)({ setup: true, basePath });

import { Command } from '@oclif/core';
export default class Dev extends Command {
static args: {
name: string;
description: string;
}[];
run(): Promise<unknown>;
}

@@ -48,4 +48,11 @@ "use strict";

class Dev extends core_1.Command {
static args = [
{
name: 'path',
description: 'The path where the FastStore being run is. Defaults to cwd.',
}
];
async run() {
const basePath = process.cwd();
const { args } = await this.parse(Dev);
const basePath = args.path ?? process.cwd();
const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);

@@ -52,0 +59,0 @@ const queueChange = ( /* path: string, remove: boolean */) => {

@@ -7,3 +7,7 @@ import { Command } from '@oclif/core';

};
static args: {
name: string;
description: string;
}[];
run(): Promise<void>;
}

@@ -14,5 +14,11 @@ "use strict";

};
static args = [
{
name: 'path',
description: 'The path where the FastStore GraphQL customization is. Defaults to cwd.',
}
];
async run() {
const { flags } = await this.parse(GenerateGraphql);
const basePath = process.cwd();
const { flags, args } = await this.parse(GenerateGraphql);
const basePath = args.path ?? process.cwd();
const { tmpDir, coreDir } = (0, directory_1.withBasePath)(basePath);

@@ -19,0 +25,0 @@ const debug = flags.debug ?? false;

/// <reference types="node" />
import { Command } from '@oclif/core';
export default class Start extends Command {
static args: {
name: string;
description: string;
}[];
run(): Promise<import("child_process").ChildProcess>;
}

@@ -8,4 +8,11 @@ "use strict";

class Start extends core_1.Command {
static args = [
{
name: 'path',
description: 'The path where the FastStore being run is. Defaults to cwd.',
}
];
async run() {
const basePath = process.cwd();
const { args } = await this.parse(Start);
const basePath = args.path ?? process.cwd();
const { tmpDir } = (0, directory_1.withBasePath)(basePath);

@@ -12,0 +19,0 @@ if (!(0, fs_extra_1.existsSync)(tmpDir)) {

import { Command } from '@oclif/core';
export default class Test extends Command {
static args: {
name: string;
description: string;
}[];
run(): Promise<unknown>;
}

@@ -40,4 +40,11 @@ "use strict";

class Test extends core_1.Command {
static args = [
{
name: 'path',
description: 'The path where the FastStore being tested is. Defaults to cwd.',
}
];
async run() {
const basePath = process.cwd();
const { args } = await this.parse(Test);
const basePath = args.path ?? process.cwd();
const { getRoot, tmpDir } = (0, directory_1.withBasePath)(basePath);

@@ -44,0 +51,0 @@ const watcher = chokidar_1.default.watch([...defaultPatterns], {

@@ -6,2 +6,3 @@ "use strict";

const path_1 = tslib_1.__importDefault(require("path"));
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
const withBasePath = (basepath) => {

@@ -20,5 +21,20 @@ const tmpFolderName = '.faststore';

};
const getFastStorePath = () => {
// TODO: a more complex version of this would look into the monorepo parent
return path_1.default.join(basepath, 'node_modules', '@faststore');
/*
* This will loop from the basepath until the process.cwd() looking for node_modules/@faststore/core
*
* If it reaches process.cwd() (or /, as a safeguard), without finding it, it will throw an exception
*/
const getCorePackagePath = () => {
const coreFromNodeModules = path_1.default.join('node_modules', '@faststore', 'core');
const resolvedCwd = path_1.default.resolve(process.cwd());
const parents = [];
let attemptedPath;
do {
attemptedPath = path_1.default.join(basepath, ...parents, coreFromNodeModules);
if (node_fs_1.default.existsSync(attemptedPath)) {
return attemptedPath;
}
parents.push('..');
} while (path_1.default.resolve(attemptedPath) !== resolvedCwd || path_1.default.resolve(attemptedPath) !== '/');
throw `Could not find @node_modules on ${basepath} or any of its parents until ${attemptedPath}`;
};

@@ -41,4 +57,4 @@ const tmpDir = path_1.default.join(getRoot(), tmpFolderName);

tmpStoreConfigFile: path_1.default.join(tmpDir, 'src', 'customizations', 'faststore.config.js'),
coreDir: path_1.default.join(getFastStorePath(), 'core'),
coreCMSDir: path_1.default.join(getFastStorePath(), 'core', 'cms', 'faststore'),
coreDir: getCorePackagePath(),
coreCMSDir: path_1.default.join(getCorePackagePath(), 'cms', 'faststore'),
};

@@ -45,0 +61,0 @@ };

@@ -13,11 +13,2 @@ "use strict";

const basePath = '.';
describe('coreDir', () => {
it('is the faststoreDir + core', () => {
const { coreDir: coreDirWithBase } = (0, directory_1.withBasePath)(basePath);
expect(pathsToMatch(coreDirWithBase, './node_modules/@faststore/core')).toBe(true);
});
describe('when is in a monorepo', () => {
it.todo('can look at its parent until it reaches the monorepo directory');
});
});
describe('tmpDir', () => {

@@ -65,8 +56,2 @@ it('is the basePath + .faststore', () => {

});
describe('coreCMSDir', () => {
it('returns the path of the CMS dir on @faststore/core package', () => {
const { coreCMSDir: coreCMSDirWithBase } = (0, directory_1.withBasePath)(basePath);
expect(pathsToMatch(coreCMSDirWithBase, './node_modules/@faststore/core/cms/faststore')).toBe(true);
});
});
describe('tmpCMSWebhookUrlsFile', () => {

@@ -99,3 +84,6 @@ it('returns the path of the CMS webhooks file on the .faststore dir', () => {

describe('when is in a monorepo', () => {
it.todo('can look at its parent until it reaches the monorepo directory');
it('can look at its parent until it reaches the monorepo directory', () => {
const { coreDir: coreDirWithBase } = (0, directory_1.withBasePath)(path_1.default.join(__dirname, '..', '__mocks__', 'monorepo', 'discovery'));
expect(pathsToMatch(coreDirWithBase, './src/__mocks__/monorepo/node_modules/@faststore/core')).toBe(true);
});
});

@@ -102,0 +90,0 @@ });

interface GenerateOptions {
setup?: boolean;
basePath?: string;
basePath: string;
}
export declare function generate(options?: GenerateOptions): Promise<void>;
export declare function generate(options: GenerateOptions): Promise<void>;
export {};

@@ -89,3 +89,3 @@ "use strict";

}
const userStoreConfig = await (_a = userStoreConfigFile, Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
const userStoreConfig = await (_a = path_1.default.resolve(userStoreConfigFile), Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
// Copy custom Cypress folder and files

@@ -126,3 +126,3 @@ if ((0, fs_extra_1.existsSync)(`${userDir}/cypress`) &&

const { userStoreConfigFile, tmpCMSWebhookUrlsFile } = (0, directory_1.withBasePath)(basePath);
const userStoreConfig = await (_a = userStoreConfigFile, Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
const userStoreConfig = await (_a = path_1.default.resolve(userStoreConfigFile), Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
if (userStoreConfig?.vtexHeadlessCms &&

@@ -146,3 +146,3 @@ userStoreConfig.vtexHeadlessCms?.webhookUrls) {

const { userStoreConfigFile, userThemesFileDir, tmpThemesCustomizationsFile } = (0, directory_1.withBasePath)(basePath);
const storeConfig = await (_a = userStoreConfigFile, Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
const storeConfig = await (_a = path_1.default.resolve(userStoreConfigFile), Promise.resolve().then(() => tslib_1.__importStar(require(_a))));
if (storeConfig.theme) {

@@ -169,3 +169,3 @@ const customTheme = path_1.default.join(userThemesFileDir, `${storeConfig.theme}.scss`);

async function generate(options) {
const { setup = false, basePath = process.cwd() } = options ?? {};
const { basePath, setup = false } = options;
let setupPromise = null;

@@ -172,0 +172,0 @@ if (setup) {

@@ -1,1 +0,1 @@

{"version":"3.0.80","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.82","commands":{"build":{"id":"build","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being built is. Defaults to cwd."}]},"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":[{"name":"path","description":"The path where the FastStore being synched with the CMS is. Defaults to cwd."}]},"dev":{"id":"dev","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"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":[{"name":"path","description":"The path where the FastStore GraphQL customization is. Defaults to cwd."}]},"start":{"id":"start","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being run is. Defaults to cwd."}]},"test":{"id":"test","strict":true,"pluginName":"@faststore/cli","pluginAlias":"@faststore/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"The path where the FastStore being tested is. Defaults to cwd."}]}}}
{
"name": "@faststore/cli",
"version": "3.0.80",
"version": "3.0.82",
"description": "FastStore CLI",

@@ -72,3 +72,3 @@ "author": "Emerson Laurentino @emersonlaurentino",

"types": "dist/index.d.ts",
"gitHead": "a3f57ed88cba732ba13cfab351caca6aeefa93ef"
"gitHead": "1fad72c2407848819a84644178257e250ea8cb5f"
}

@@ -33,3 +33,3 @@ <p align="center">

$ faststore (--version)
@faststore/cli/3.0.80 linux-x64 node-v18.20.3
@faststore/cli/3.0.82 linux-x64 node-v18.20.3
$ faststore --help [COMMAND]

@@ -45,25 +45,31 @@ USAGE

<!-- commands -->
* [`faststore build`](#faststore-build)
* [`faststore cms-sync`](#faststore-cms-sync)
* [`faststore dev`](#faststore-dev)
* [`faststore generate-graphql`](#faststore-generate-graphql)
* [`faststore build [PATH]`](#faststore-build-path)
* [`faststore cms-sync [PATH]`](#faststore-cms-sync-path)
* [`faststore dev [PATH]`](#faststore-dev-path)
* [`faststore generate-graphql [PATH]`](#faststore-generate-graphql-path)
* [`faststore help [COMMAND]`](#faststore-help-command)
* [`faststore start`](#faststore-start)
* [`faststore test`](#faststore-test)
* [`faststore start [PATH]`](#faststore-start-path)
* [`faststore test [PATH]`](#faststore-test-path)
## `faststore build`
## `faststore build [PATH]`
```
USAGE
$ faststore build
$ faststore build [PATH]
ARGUMENTS
PATH The path where the FastStore being built is. Defaults to cwd.
```
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/build.ts)_
_See code: [dist/commands/build.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/build.ts)_
## `faststore cms-sync`
## `faststore cms-sync [PATH]`
```
USAGE
$ faststore cms-sync [-d]
$ faststore cms-sync [PATH] [-d]
ARGUMENTS
PATH The path where the FastStore being synched with the CMS is. Defaults to cwd.
FLAGS

@@ -73,19 +79,25 @@ -d, --dry-run

_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/cms-sync.ts)_
_See code: [dist/commands/cms-sync.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/cms-sync.ts)_
## `faststore dev`
## `faststore dev [PATH]`
```
USAGE
$ faststore dev
$ faststore dev [PATH]
ARGUMENTS
PATH The path where the FastStore being run is. Defaults to cwd.
```
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/dev.ts)_
_See code: [dist/commands/dev.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/dev.ts)_
## `faststore generate-graphql`
## `faststore generate-graphql [PATH]`
```
USAGE
$ faststore generate-graphql [-d]
$ faststore generate-graphql [PATH] [-d]
ARGUMENTS
PATH The path where the FastStore GraphQL customization is. Defaults to cwd.
FLAGS

@@ -95,3 +107,3 @@ -d, --debug

_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/generate-graphql.ts)_
_See code: [dist/commands/generate-graphql.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/generate-graphql.ts)_

@@ -118,19 +130,25 @@ ## `faststore help [COMMAND]`

## `faststore start`
## `faststore start [PATH]`
```
USAGE
$ faststore start
$ faststore start [PATH]
ARGUMENTS
PATH The path where the FastStore being run is. Defaults to cwd.
```
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/start.ts)_
_See code: [dist/commands/start.ts](https://github.com/vtex/faststore/blob/v3.0.82/dist/commands/start.ts)_
## `faststore test`
## `faststore test [PATH]`
```
USAGE
$ faststore test
$ faststore test [PATH]
ARGUMENTS
PATH The path where the FastStore being tested is. Defaults to cwd.
```
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.80/dist/commands/test.ts)_
_See code: [dist/commands/test.ts](https://github.com/vtex/faststore/blob/v3.0.82/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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc