New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

create-devcycle-app

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-devcycle-app - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

19

bin/utils/startDevServer.js

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

const startDevServer = async (outputPath) => {
var _a;
(0, _1.logStatus)('Starting development server');

@@ -19,18 +20,14 @@ process_1.default.on('SIGINT', () => {

});
const command = await (0, _1.parseDevCommand)(outputPath);
if (!command) {
const devCommand = await (0, _1.parseDevCommand)(outputPath);
if (!devCommand) {
(0, _1.logWarning)('Unable to parse development command');
return (0, _1.logDevInstructions)(outputPath);
}
await new Promise((resolve, reject) => {
var _a;
const childProcess = (0, child_process_1.exec)(command, { cwd: outputPath }, (err) => {
if (err && err.signal !== 'SIGINT' && err.signal !== 'SIGTERM') {
return reject(err);
}
resolve();
});
(_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process_1.default.stdout);
const [command, ...args] = devCommand.split(' ');
const childProcess = (0, child_process_1.spawn)(command, args, {
cwd: outputPath,
env: { ...process_1.default.env, FORCE_COLOR: 'true' }
});
(_a = childProcess.stdout) === null || _a === void 0 ? void 0 : _a.pipe(process_1.default.stdout);
};
exports.startDevServer = startDevServer;
{
"name": "create-devcycle-app",
"version": "1.1.1",
"version": "1.1.2",
"description": "A command line tool for generating DevCycle example apps",

@@ -5,0 +5,0 @@ "engines": {

@@ -11,3 +11,3 @@ import { startDevServer } from './startDevServer'

describe('startDevServer', () => {
let mockExec: jest.SpyInstance
let mockSpawn: jest.SpyInstance
let mockProcessOn: jest.SpyInstance

@@ -21,3 +21,3 @@

beforeEach(() => {
mockExec = jest.spyOn(cp, 'exec')
mockSpawn = jest.spyOn(cp, 'spawn')
mockProcessOn = jest.spyOn(process, 'on')

@@ -36,5 +36,3 @@

it('should start the development server', async () => {
mockExec.mockImplementation((command, options, callback) => {
callback(null)
})
mockSpawn.mockReturnValue({ stdout: { pipe: jest.fn() } })

@@ -51,3 +49,6 @@ const outputPath = '/path/to/output'

expect(mockParseDevCommand).toHaveBeenCalledWith(outputPath)
expect(mockExec).toHaveBeenCalledWith(command, { cwd: outputPath }, expect.any(Function))
expect(mockSpawn).toHaveBeenCalledWith(
'npm', ['run', 'dev'],
{ cwd: outputPath, env: expect.objectContaining({ FORCE_COLOR: 'true' })
})
})

@@ -65,18 +66,2 @@

})
it('should handle error when starting the development server', async () => {
const error = new Error('Failed to start server')
mockExec.mockImplementation((command, options, callback) => {
callback(error)
})
const outputPath = '/path/to/output'
const command = 'npm run dev'
mockParseDevCommand.mockResolvedValue(command)
await expect(startDevServer(outputPath)).rejects.toThrow(error)
expect(mockExec).toHaveBeenCalledWith(command, { cwd: outputPath }, expect.any(Function))
})
})

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

import { exec } from 'child_process'
import { spawn } from 'child_process'
import process from 'process'

@@ -15,5 +15,5 @@ import { logDevInstructions, logStatus, logWarning, parseDevCommand } from '.'

const command = await parseDevCommand(outputPath)
const devCommand = await parseDevCommand(outputPath)
if (!command) {
if (!devCommand) {
logWarning('Unable to parse development command')

@@ -23,12 +23,12 @@ return logDevInstructions(outputPath)

await new Promise<void>((resolve, reject) => {
const childProcess = exec(command, { cwd: outputPath }, (err) => {
if (err && err.signal !== 'SIGINT' && err.signal !== 'SIGTERM') {
return reject(err)
}
resolve()
})
const [command, ...args] = devCommand.split(' ')
const childProcess = spawn(
command, args,
{
cwd: outputPath,
env: { ...process.env, FORCE_COLOR: 'true' }
}
)
childProcess.stdout?.pipe(process.stdout)
})
childProcess.stdout?.pipe(process.stdout)
}
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