@ms-cloudpack/config 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.d.ts CHANGED
@@ -1,31 +1,31 @@
1
1
  import type { CloudpackConfig } from './types.js';
2
2
  export declare const configFileName = "cloudpack.config.json";
3
3
  /**
4
- * @param cwd base path of the config file
4
+ * @param cwd - base path of the config file
5
5
  * @returns the path of the config file
6
6
  */
7
7
  export declare function getConfigPath(cwd?: string): string;
8
8
  /**
9
9
  * Reads the config file synchronously
10
- * @param cwd base path of the config file
10
+ * @param cwd - base path of the config file
11
11
  * @returns cloudpack config object or empty object if no config file exists.
12
12
  */
13
13
  export declare function readConfigSync(cwd?: string): CloudpackConfig;
14
14
  /**
15
15
  * Reads the config file asynchronously
16
- * @param cwd base path of the config file
16
+ * @param cwd - base path of the config file
17
17
  * @returns cloudpack config object or empty object if no config file exists.
18
18
  */
19
19
  export declare function readConfig(cwd?: string): Promise<CloudpackConfig>;
20
20
  /**
21
21
  * Writes the config file asynchronously
22
- * @param config updated config object to be written
23
- * @param cwd base path of the config file
22
+ * @param config - updated config object to be written
23
+ * @param cwd - base path of the config file
24
24
  */
25
25
  export declare function writeConfig(config: CloudpackConfig, cwd?: string): Promise<void>;
26
26
  /**
27
27
  * Writes the config file synchronously
28
- * @param config updated config object to be written
29
- * @param cwd base path of the config file
28
+ * @param config - updated config object to be written
29
+ * @param cwd - base path of the config file
30
30
  */
31
31
  export declare function writeConfigSync(config: CloudpackConfig, cwd?: string): void;
package/lib/config.js CHANGED
@@ -2,7 +2,7 @@ import path from 'path';
2
2
  import { readJson, readJsonSync, writeJson, writeJsonSync } from '@ms-cloudpack/json-utilities';
3
3
  export const configFileName = 'cloudpack.config.json';
4
4
  /**
5
- * @param cwd base path of the config file
5
+ * @param cwd - base path of the config file
6
6
  * @returns the path of the config file
7
7
  */
8
8
  export function getConfigPath(cwd) {
@@ -11,7 +11,7 @@ export function getConfigPath(cwd) {
11
11
  }
12
12
  /**
13
13
  * Reads the config file synchronously
14
- * @param cwd base path of the config file
14
+ * @param cwd - base path of the config file
15
15
  * @returns cloudpack config object or empty object if no config file exists.
16
16
  */
17
17
  export function readConfigSync(cwd) {
@@ -21,7 +21,7 @@ export function readConfigSync(cwd) {
21
21
  }
22
22
  /**
23
23
  * Reads the config file asynchronously
24
- * @param cwd base path of the config file
24
+ * @param cwd - base path of the config file
25
25
  * @returns cloudpack config object or empty object if no config file exists.
26
26
  */
27
27
  export async function readConfig(cwd) {
@@ -31,8 +31,8 @@ export async function readConfig(cwd) {
31
31
  }
32
32
  /**
33
33
  * Writes the config file asynchronously
34
- * @param config updated config object to be written
35
- * @param cwd base path of the config file
34
+ * @param config - updated config object to be written
35
+ * @param cwd - base path of the config file
36
36
  */
37
37
  export async function writeConfig(config, cwd) {
38
38
  const filePath = getConfigPath(cwd);
@@ -42,8 +42,8 @@ export async function writeConfig(config, cwd) {
42
42
  }
43
43
  /**
44
44
  * Writes the config file synchronously
45
- * @param config updated config object to be written
46
- * @param cwd base path of the config file
45
+ * @param config - updated config object to be written
46
+ * @param cwd - base path of the config file
47
47
  */
48
48
  export function writeConfigSync(config, cwd) {
49
49
  const filePath = getConfigPath(cwd);
package/lib/config.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEhG,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,MAAM,QAAQ,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAY;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAEjE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAuB,EAAE,GAAY;IACrE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC,QAAQ,EAAE;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,GAAY;IACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,aAAa,CAAC,QAAQ,EAAE;QAC7B,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\nimport type { CloudpackConfig } from './types.js';\nimport { readJson, readJsonSync, writeJson, writeJsonSync } from '@ms-cloudpack/json-utilities';\n\nexport const configFileName = 'cloudpack.config.json';\n\n/**\n * @param cwd base path of the config file\n * @returns the path of the config file\n */\nexport function getConfigPath(cwd?: string) {\n const basePath = cwd || process.cwd();\n return path.join(basePath, configFileName);\n}\n\n/**\n * Reads the config file synchronously\n * @param cwd base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport function readConfigSync(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = readJsonSync(filePath) || {};\n\n return config;\n}\n\n/**\n * Reads the config file asynchronously\n * @param cwd base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport async function readConfig(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = (await readJson(filePath)) || {};\n\n return config;\n}\n\n/**\n * Writes the config file asynchronously\n * @param config updated config object to be written\n * @param cwd base path of the config file\n */\nexport async function writeConfig(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJson(filePath, {\n ...config,\n });\n}\n\n/**\n * Writes the config file synchronously\n * @param config updated config object to be written\n * @param cwd base path of the config file\n */\nexport function writeConfigSync(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJsonSync(filePath, {\n ...config,\n });\n}\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEhG,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,GAAY;IACxC,MAAM,QAAQ,GAAG,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IACtC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAY;IACzC,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAE7D,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAY;IAC3C,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,MAAM,MAAM,GAAoB,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;IAEjE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAuB,EAAE,GAAY;IACrE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,SAAS,CAAC,QAAQ,EAAE;QACzB,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAuB,EAAE,GAAY;IACnE,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAEpC,OAAO,aAAa,CAAC,QAAQ,EAAE;QAC7B,GAAG,MAAM;KACV,CAAC,CAAC;AACL,CAAC","sourcesContent":["import path from 'path';\nimport type { CloudpackConfig } from './types.js';\nimport { readJson, readJsonSync, writeJson, writeJsonSync } from '@ms-cloudpack/json-utilities';\n\nexport const configFileName = 'cloudpack.config.json';\n\n/**\n * @param cwd - base path of the config file\n * @returns the path of the config file\n */\nexport function getConfigPath(cwd?: string) {\n const basePath = cwd || process.cwd();\n return path.join(basePath, configFileName);\n}\n\n/**\n * Reads the config file synchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport function readConfigSync(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = readJsonSync(filePath) || {};\n\n return config;\n}\n\n/**\n * Reads the config file asynchronously\n * @param cwd - base path of the config file\n * @returns cloudpack config object or empty object if no config file exists.\n */\nexport async function readConfig(cwd?: string) {\n const filePath = getConfigPath(cwd);\n const config: CloudpackConfig = (await readJson(filePath)) || {};\n\n return config;\n}\n\n/**\n * Writes the config file asynchronously\n * @param config - updated config object to be written\n * @param cwd - base path of the config file\n */\nexport async function writeConfig(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJson(filePath, {\n ...config,\n });\n}\n\n/**\n * Writes the config file synchronously\n * @param config - updated config object to be written\n * @param cwd - base path of the config file\n */\nexport function writeConfigSync(config: CloudpackConfig, cwd?: string) {\n const filePath = getConfigPath(cwd);\n\n return writeJsonSync(filePath, {\n ...config,\n });\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { configTemplate } from './configTemplate.js';
2
2
  export { configFileName, getConfigPath, readConfig, readConfigSync, writeConfig, writeConfigSync } from './config.js';
3
- export type { CloudpackConfig, TelemetryConfig } from './types.js';
3
+ export type { CloudpackConfig, DevServer, PackageOverride, Route, TelemetryConfig } from './types.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { configTemplate } from './configTemplate.js';\nexport { configFileName, getConfigPath, readConfig, readConfigSync, writeConfig, writeConfigSync } from './config.js';\nexport type { CloudpackConfig, TelemetryConfig } from './types.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { configTemplate } from './configTemplate.js';\nexport { configFileName, getConfigPath, readConfig, readConfigSync, writeConfig, writeConfigSync } from './config.js';\nexport type { CloudpackConfig, DevServer, PackageOverride, Route, TelemetryConfig } from './types.js';\n"]}
package/lib/types.d.ts CHANGED
@@ -81,4 +81,15 @@ export interface CloudpackConfig {
81
81
  * A set of options for configuring telemetry
82
82
  */
83
83
  telemetry?: TelemetryConfig;
84
+ /**
85
+ * A set of options for configuring the experience. Features can be set to true to change the default
86
+ * behavior.
87
+ */
88
+ features?: {
89
+ /**
90
+ * If true, no source maps will be generated for any bundles produced. This might be useful if sourcemap
91
+ * generation causes performance issues.
92
+ */
93
+ disableSourceMaps?: boolean;
94
+ };
84
95
  }
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { HttpsConfig } from '@ms-cloudpack/create-express-app';\n\nexport interface PackageOverride {\n name: string;\n versionRequirement: string;\n isInternal?: boolean;\n overrides: PackageJson;\n}\n\nexport interface Route {\n /**\n * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also\n * use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n */\n match: string;\n\n /**\n * The path relative to the app root to static assets. If this is provided, renderScript/exportEntry\n * will be ignored.\n */\n staticPath?: string;\n\n /**\n * Path to a .js or .html file used for rendering the route. If a script is provided, it must\n * export a default function implementing `CreateHtmlFunction` defined in `@ms-cloudpack/cli`.\n */\n renderScript?: string;\n\n /**\n * The key in the exports map which represents the entry point app script for this route.\n * Default is '.', meaning the main package export key.\n */\n exportEntry?: string;\n}\n\nexport interface DevServer {\n /**\n * The domain name of the server.\n */\n domain?: string;\n\n /**\n * The ports to be used by the server.\n * It can be a number or an array of numbers.\n * If ports are provided, an error will be thrown if none are available.\n * If no ports are provided, the server will attempt to find an available port.\n */\n port?: number | number[];\n\n /**\n * The config settings for the https server.\n * Paths to files are accepted for 'ca', 'cert', 'key', and 'pfx' settings.\n * Everything else is passed directly to the https.createServer() method.\n * If not provided, the server will use http.\n */\n https?: HttpsConfig;\n\n /**\n * If provided, will override where the publicDir is located, relative to the app package folder.\n * Defaults to `./public`. The same thing can be achieved with `routes`, using route: '*' and\n * staticPath: './public', so the `publicPath` setting may be removed in the future.\n */\n publicPath?: string;\n\n /**\n * If provided, will register routes with the dev server to host various pages.\n */\n routes?: Route[];\n}\n\nexport interface TelemetryConfig {\n /**\n * Application Insights instrumentation key.\n */\n instrumentationKey: string;\n}\n\n/**\n * Per-application configuration for Cloudpack.\n */\nexport interface CloudpackConfig {\n /**\n * An array of PackageOverride objects, used to provide overrides for packages without modifying their\n * definitions directly. This is primarily used for providing exports maps for packages that don't have them.\n */\n packageOverrides?: PackageOverride[];\n\n /**\n * A set of options for configuring how the dev server works.\n */\n devServer?: DevServer;\n\n /**\n * A set of options for configuring telemetry\n */\n telemetry?: TelemetryConfig;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { PackageJson } from '@ms-cloudpack/bundler-types';\nimport type { HttpsConfig } from '@ms-cloudpack/create-express-app';\n\nexport interface PackageOverride {\n name: string;\n versionRequirement: string;\n isInternal?: boolean;\n overrides: PackageJson;\n}\n\nexport interface Route {\n /**\n * The url path part to match. Start paths with a leading slash, e.g. `'/my-route'`. You can also\n * use wildcards (`*`), e.g. `'/my-route/*'` to match all paths starting with `'/my-route'`.\n */\n match: string;\n\n /**\n * The path relative to the app root to static assets. If this is provided, renderScript/exportEntry\n * will be ignored.\n */\n staticPath?: string;\n\n /**\n * Path to a .js or .html file used for rendering the route. If a script is provided, it must\n * export a default function implementing `CreateHtmlFunction` defined in `@ms-cloudpack/cli`.\n */\n renderScript?: string;\n\n /**\n * The key in the exports map which represents the entry point app script for this route.\n * Default is '.', meaning the main package export key.\n */\n exportEntry?: string;\n}\n\nexport interface DevServer {\n /**\n * The domain name of the server.\n */\n domain?: string;\n\n /**\n * The ports to be used by the server.\n * It can be a number or an array of numbers.\n * If ports are provided, an error will be thrown if none are available.\n * If no ports are provided, the server will attempt to find an available port.\n */\n port?: number | number[];\n\n /**\n * The config settings for the https server.\n * Paths to files are accepted for 'ca', 'cert', 'key', and 'pfx' settings.\n * Everything else is passed directly to the https.createServer() method.\n * If not provided, the server will use http.\n */\n https?: HttpsConfig;\n\n /**\n * If provided, will override where the publicDir is located, relative to the app package folder.\n * Defaults to `./public`. The same thing can be achieved with `routes`, using route: '*' and\n * staticPath: './public', so the `publicPath` setting may be removed in the future.\n */\n publicPath?: string;\n\n /**\n * If provided, will register routes with the dev server to host various pages.\n */\n routes?: Route[];\n}\n\nexport interface TelemetryConfig {\n /**\n * Application Insights instrumentation key.\n */\n instrumentationKey: string;\n}\n\n/**\n * Per-application configuration for Cloudpack.\n */\nexport interface CloudpackConfig {\n /**\n * An array of PackageOverride objects, used to provide overrides for packages without modifying their\n * definitions directly. This is primarily used for providing exports maps for packages that don't have them.\n */\n packageOverrides?: PackageOverride[];\n\n /**\n * A set of options for configuring how the dev server works.\n */\n devServer?: DevServer;\n\n /**\n * A set of options for configuring telemetry\n */\n telemetry?: TelemetryConfig;\n\n /**\n * A set of options for configuring the experience. Features can be set to true to change the default\n * behavior.\n */\n features?: {\n /**\n * If true, no source maps will be generated for any bundles produced. This might be useful if sourcemap\n * generation causes performance issues.\n */\n disableSourceMaps?: boolean;\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/config",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Configuration handling for cloudpack.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "@ms-cloudpack/bundler-types": "^0.11.0",
16
+ "@ms-cloudpack/bundler-types": "^0.12.0",
17
17
  "@ms-cloudpack/create-express-app": "^1.3.0",
18
18
  "@ms-cloudpack/json-utilities": "^0.0.5"
19
19
  },