@faststore/cli
Advanced tools
Comparing version 1.12.25 to 1.12.26
@@ -6,2 +6,11 @@ # Change Log | ||
## [1.12.26](https://github.com/vtex/faststore/compare/v1.12.25...v1.12.26) (2022-11-09) | ||
### Features | ||
* adds develop command when running faststore dev ([#1500](https://github.com/vtex/faststore/issues/1500)) ([ff6bad5](https://github.com/vtex/faststore/commit/ff6bad5abfd674eec62aee5ad1f467dbcbaa51b0)) | ||
## [1.12.25](https://github.com/vtex/faststore/compare/v1.12.24...v1.12.25) (2022-11-09) | ||
@@ -8,0 +17,0 @@ |
import { Command } from '@oclif/core'; | ||
export default class Dev extends Command { | ||
run(): Promise<void>; | ||
run(): Promise<unknown>; | ||
} |
@@ -6,2 +6,3 @@ "use strict"; | ||
const chokidar_1 = tslib_1.__importDefault(require("chokidar")); | ||
const child_process_1 = require("child_process"); | ||
const generate_1 = require("../utils/generate"); | ||
@@ -27,2 +28,14 @@ const directory_1 = require("../utils/directory"); | ||
]; | ||
const devAbortController = new AbortController(); | ||
async function storeDev() { | ||
const devProcess = (0, child_process_1.spawn)('yarn develop', { | ||
shell: true, | ||
cwd: directory_1.tmpDir, | ||
signal: devAbortController.signal, | ||
stdio: 'inherit', | ||
}); | ||
devProcess.on('close', () => { | ||
devAbortController.abort(); | ||
}); | ||
} | ||
class Dev extends core_1.Command { | ||
@@ -45,4 +58,8 @@ async run() { | ||
}); | ||
devAbortController.signal.addEventListener('abort', () => { | ||
watcher.close(); | ||
}); | ||
await (0, generate_1.generate)({ setup: true }); | ||
await new Promise((resolve, reject) => { | ||
storeDev(); | ||
return await new Promise((resolve, reject) => { | ||
watcher | ||
@@ -52,3 +69,6 @@ .on('add', ( /*file*/) => queueChange( /*file, false*/)) | ||
.on('unlink', ( /*file*/) => queueChange( /*file, true*/)) | ||
.on('error', reject) | ||
.on('error', () => { | ||
devAbortController.abort(); | ||
reject(); | ||
}) | ||
.on('ready', resolve); | ||
@@ -55,0 +75,0 @@ }); |
@@ -22,1 +22,3 @@ export declare const getRoot: () => string; | ||
export declare const tmpStoreConfigFileDir: string; | ||
export declare const userNodeModulesDir: string; | ||
export declare const tmpNodeModulesDir: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tmpStoreConfigFileDir = exports.coreStoreConfigFileDir = exports.userStoreConfigFileDir = exports.storeConfigFileName = exports.userCMSDir = exports.coreCMSDir = exports.tmpCMSDir = exports.cmsFolderName = exports.tmpThemesCustomizationsFileDir = exports.userThemesFileDir = exports.tmpCustomizationsDir = exports.customizationsFolderName = exports.userSrcDir = exports.srcFolderName = exports.coreDir = exports.coreFolderName = exports.tmpDir = exports.tmpFolderName = exports.faststoreDir = exports.userDir = exports.getRoot = void 0; | ||
exports.tmpNodeModulesDir = exports.userNodeModulesDir = exports.tmpStoreConfigFileDir = exports.coreStoreConfigFileDir = exports.userStoreConfigFileDir = exports.storeConfigFileName = exports.userCMSDir = exports.coreCMSDir = exports.tmpCMSDir = exports.cmsFolderName = exports.tmpThemesCustomizationsFileDir = exports.userThemesFileDir = exports.tmpCustomizationsDir = exports.customizationsFolderName = exports.userSrcDir = exports.srcFolderName = exports.coreDir = exports.coreFolderName = exports.tmpDir = exports.tmpFolderName = exports.faststoreDir = exports.userDir = exports.getRoot = void 0; | ||
const getRoot = () => { | ||
@@ -31,2 +31,4 @@ if (process.env.OCLIF_COMPILATION) { | ||
exports.tmpStoreConfigFileDir = `${exports.tmpDir}/${exports.storeConfigFileName}`; | ||
exports.userNodeModulesDir = `${exports.userDir}/node_modules`; | ||
exports.tmpNodeModulesDir = `${exports.tmpDir}/node_modules`; | ||
//# sourceMappingURL=directory.js.map |
@@ -11,2 +11,5 @@ "use strict"; | ||
try { | ||
if ((0, fs_extra_1.existsSync)(directory_1.tmpDir)) { | ||
(0, fs_extra_1.removeSync)(directory_1.tmpDir); | ||
} | ||
(0, fs_extra_1.mkdirsSync)(directory_1.tmpDir); | ||
@@ -109,2 +112,11 @@ } | ||
} | ||
function createNodeModulesSymbolicLink() { | ||
try { | ||
(0, fs_extra_1.symlinkSync)(directory_1.userNodeModulesDir, directory_1.tmpNodeModulesDir); | ||
} | ||
catch (err) { | ||
console.error(err); | ||
} | ||
console.log(`node_modules symbolic link created from ${directory_1.userNodeModulesDir} to ${directory_1.tmpNodeModulesDir}`); | ||
} | ||
async function generate(options) { | ||
@@ -114,3 +126,7 @@ const { setup = false } = options ?? {}; | ||
if (setup) { | ||
setupPromise = Promise.all([createTmpFolder(), copyCoreFiles()]); | ||
setupPromise = Promise.all([ | ||
createTmpFolder(), | ||
copyCoreFiles(), | ||
createNodeModulesSymbolicLink(), | ||
]); | ||
} | ||
@@ -117,0 +133,0 @@ await Promise.all([ |
{ | ||
"name": "@faststore/cli", | ||
"version": "1.12.25", | ||
"version": "1.12.26", | ||
"description": "FastStore CLI", | ||
@@ -66,3 +66,3 @@ "author": "Emerson Laurentino @emersonlaurentino", | ||
"types": "dist/index.d.ts", | ||
"gitHead": "4c42036e9c87bd6c1266bdfe54325b6096811b4b" | ||
"gitHead": "32cff5b4951e5139209736e012a2dadadf1349cd" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27131
336