Socket
Socket
Sign inDemoInstall

@ms-cloudpack/config

Package Overview
Dependencies
Maintainers
0
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/config - npm Package Compare versions

Comparing version 0.26.0 to 0.26.1

5

lib/sortGeneratedConfig.js

@@ -8,3 +8,6 @@ import { sortObjectKeys } from './sortObjectKeys.js';

export function sortGeneratedConfig(generated) {
const { packageSettings = [] } = generated;
const { packageSettings } = generated;
if (!packageSettings) {
return;
}
// Ensure package overrides are sorted based on package name and version requirement.

@@ -11,0 +14,0 @@ packageSettings.sort(compareSettings);

17

lib/writeGeneratedConfig.d.ts
import type { GeneratedConfig } from '@ms-cloudpack/common-types';
/**
* Writes generated config. This is used for `init` to provide package overrides needed.
* Comment added to the top of the generated file (exported for testing only).
* @internal
*/
export declare function writeGeneratedConfig(config: GeneratedConfig, appPath: string): Promise<void>;
export declare const fileHeaderComment = "/**\n * THIS FILE IS AUTO-GENERATED.\n * DO NOT MANUALLY EDIT THIS FILE.\n */\n";
/**
* Clean up the generated config (sort it and remove empty settings) and write it to
* cloudpack.generated.json. This is used at the end of `init`.
*
* If the config file exists but is no longer needed, it will be deleted.
*
* @returns
* - `'written'` if the config was written
* - `'deleted'` if the config previously existed but is now empty and was deleted
* - `'no-op'` if the config didn't previously exist and is still empty
*/
export declare function writeGeneratedConfig(config: GeneratedConfig, appPath: string): Promise<'written' | 'deleted' | 'no-op'>;
//# sourceMappingURL=writeGeneratedConfig.d.ts.map
import { writeJson } from '@ms-cloudpack/json-utilities';
import fs from 'fs';
import { cleanGeneratedConfig } from './cleanGeneratedConfig.js';
import { getConfigPath } from './getConfigPath.js';
import { generatedAppConfigSchemaUrl } from './schemaUrls.js';
import { sortGeneratedConfig } from './sortGeneratedConfig.js';
import { cleanGeneratedConfig } from './cleanGeneratedConfig.js';
/**
* Writes generated config. This is used for `init` to provide package overrides needed.
* Comment added to the top of the generated file (exported for testing only).
* @internal
*/
export const fileHeaderComment = `/**\n * THIS FILE IS AUTO-GENERATED.\n * DO NOT MANUALLY EDIT THIS FILE.\n */\n`;
/**
* Clean up the generated config (sort it and remove empty settings) and write it to
* cloudpack.generated.json. This is used at the end of `init`.
*
* If the config file exists but is no longer needed, it will be deleted.
*
* @returns
* - `'written'` if the config was written
* - `'deleted'` if the config previously existed but is now empty and was deleted
* - `'no-op'` if the config didn't previously exist and is still empty
*/
export async function writeGeneratedConfig(config, appPath) {
const { generatedConfigPath } = getConfigPath(appPath);
const fileHeaderComment = `/**\n * THIS FILE IS AUTO-GENERATED.\n * DO NOT MANUALLY EDIT THIS FILE.\n */\n`;
sortGeneratedConfig(config);
cleanGeneratedConfig(config);
return writeJson(generatedConfigPath, {
if (!config.packageSettings?.length) {
if (fs.existsSync(generatedConfigPath)) {
fs.unlinkSync(generatedConfigPath);
return 'deleted';
}
return 'no-op';
}
await writeJson(generatedConfigPath, {
$schema: generatedAppConfigSchemaUrl,
...config,
}, { fileHeaderComment });
return 'written';
}
//# sourceMappingURL=writeGeneratedConfig.js.map
{
"name": "@ms-cloudpack/config",
"version": "0.26.0",
"version": "0.26.1",
"description": "Configuration handling for cloudpack.",

@@ -5,0 +5,0 @@ "license": "MIT",

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