@ms-cloudpack/storybook-builder 0.2.14 → 0.2.15

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/index.js CHANGED
@@ -141,6 +141,7 @@ export const start = async ({ options, startTime, router, server: devServer, })
141
141
  const { startApiServer } = await import('@ms-cloudpack/api-server');
142
142
  // Start api server for tracking status and handling remote requests.
143
143
  apiServer = await startApiServer(apiContext);
144
+ session.urls.apiServer = apiServer.url;
144
145
  // Kick off bundling app package as soon as api server is ready.
145
146
  void ensurePackageBundled({
146
147
  input: { name: definition.name, version: definition.version },
@@ -150,16 +151,14 @@ export const start = async ({ options, startTime, router, server: devServer, })
150
151
  bundleServer = await startBundleServer({
151
152
  context: {
152
153
  ...apiContext,
153
- apiServer,
154
154
  disableCache: false, // TODO: Get options and enable this.
155
155
  },
156
156
  });
157
+ session.urls.bundleServer = bundleServer.url;
157
158
  // Finally start the app server.
158
159
  appServer = await startAppServer({
159
160
  session,
160
161
  definition,
161
- bundleServer,
162
- apiServer,
163
162
  config,
164
163
  reporter,
165
164
  packages,
@@ -168,6 +167,7 @@ export const start = async ({ options, startTime, router, server: devServer, })
168
167
  middlewareMode: true,
169
168
  server: devServer,
170
169
  });
170
+ session.urls.appServer = appServer.url;
171
171
  router.use(appServer.app);
172
172
  // TODO: Figure out if it is possible to know when browser will open.
173
173
  // performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAkB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAqB,MAAM,6BAA6B,CAAC;AACnF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AG,CAAC,IAAuD,EAAQ,EAAE;IACrF,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACjE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC","sourcesContent":["import { getLocalCachePath, type ApiServer } from '@ms-cloudpack/api-server';\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport { startAppServer, type AppServer } from '@ms-cloudpack/app-server';\nimport { startBundleServer, type BundleServer } from '@ms-cloudpack/bundle-server';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { express, type Router } from '@ms-cloudpack/create-express-app';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n getDisplayVersion,\n getExportsMap,\n getVersion,\n resolve,\n} from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n verboseLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { createTelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Options } from '@storybook/types';\nimport fsExtra from 'fs-extra';\nimport fsPromises from 'fs/promises';\nimport { type Server } from 'http';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { generateIframeHtml } from './generateIFrameHtml.js';\nimport { getNodeModuleDir } from './getNodeModuleDir.js';\nimport { listStories } from './listStories.js';\n\nexport type ClosableServer = {\n close: () => Promise<void>;\n url: string;\n};\n\nlet appServer: AppServer;\nlet apiServer: ApiServer;\nlet bundleServer: BundleServer;\n\nexport async function bail(error?: Error): Promise<void> {\n if (error) {\n console.error('Error:', error);\n }\n\n const servers = [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ];\n\n await Promise.all(\n servers.map(async ([name, server]) => {\n if (!server || !server.url) {\n console.info(`No ${name} to close.`);\n return;\n }\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server?.close();\n console.info(`Closed ${name}: ${server.url}`);\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }),\n );\n}\n\nexport const start = async ({\n options,\n startTime,\n router,\n server: devServer,\n}: {\n options: Options;\n startTime: [number, number];\n router: Router;\n server: Server;\n}) => {\n const previewResolvedDir = getNodeModuleDir('@storybook/preview');\n const previewDirOrigin = path.join(previewResolvedDir, 'dist');\n\n router.use('/sb-preview', express.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));\n\n // TODO: This might be useful later on.\n // const env = await options.presets.apply<Record<string, string>>('env');\n\n // eslint-disable-next-line no-restricted-properties -- this is the one place we need cwd (for a default)\n const appPath = process.cwd();\n\n const config = await readConfig(appPath);\n\n // TODO: Move to won package.\n // runPrerequisites(config, appPath);\n\n // Make sure the package has a valid definition.\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // This part should be almost identical to the cli start command.\n const reporter = new TaskReporter({\n productName: `Cloudpack`,\n version: getDisplayVersion(import.meta.url),\n description: () => `Running \"${bold('storybook')}\"`,\n helpMessage: config.helpMessage,\n // TODO: Get options and enable this.\n plainTextMode: options.ci,\n ...(options.loglevel === 'debug'\n ? debugLoggingConfig\n : options.loglevel === 'verbose'\n ? verboseLoggingConfig\n : options.quiet || options.loglevel === 'quiet'\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const connectionString = options.disableTelemetry\n ? undefined\n : config.telemetry?.connectionString || process.env.CLOUDPACK_TELEMETRY_CONNECTION_STRING;\n\n const logLevel = options.loglevel === 'verbose' ? 'VERBOSE' : options.loglevel === 'debug' ? 'DEBUG' : undefined;\n if (options.loglevel !== 'debug') {\n reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n connectionString,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n rootSpanName: 'CLI',\n });\n\n // Register performance observers to track performance metrics as events of CLI span.\n // registerPerformanceObservers(telemetryClient);\n\n const apiContext = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'watcher', 'taskRunner', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n overlayPath: await resolve('@ms-cloudpack/overlay', path.dirname(fileURLToPath(import.meta.url))),\n });\n\n const { packages, session, packageImportPaths } = apiContext;\n\n // TODO: Get options and enable this.\n // Increment the session version if caching is disabled.\n // if (options.cache === false) {\n // session.incrementSessionVersion();\n // }\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n // TODO: Get options and enable this.\n // if (options.logResolveMap) {\n // // Write the resolve map to disk.\n // await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n // }\n\n // Storybook set up is mostly done here.\n const generated = await generateIframeHtml(options, { packages, session });\n await fsExtra.ensureDir(getLocalCachePath(appPath));\n\n // TODO: Currently saving it to disk as the config only accepts a path.\n const iFramePath = path.join(getLocalCachePath(appPath), 'iFrame.html');\n await fsPromises.writeFile(iFramePath, generated, { encoding: 'utf-8' });\n\n // iFrame script is required for storybook to work.\n config.devServer ??= {};\n config.devServer.routes ??= [];\n config.devServer.routes.push({\n match: '/iframe.html',\n renderScript: iFramePath,\n });\n\n const storyEntries = Object.fromEntries(\n (await listStories(options)).map((story) => {\n const storyPath = normalizeRelativePath(path.relative(appPath, story));\n return [storyPath, storyPath];\n }),\n );\n\n const packagePath = findResolveMapEntry({ packageName: definition.name, resolveMap: session.resolveMap })?.path;\n if (!packagePath) {\n throw new Error(`Could not find package ${definition.name} in the resolve map.`);\n }\n\n const exports = await getExportsMap({ packagePath }, { packages, config: session.config });\n for (const [importPath, filePath] of Object.entries(storyEntries)) {\n await addExportsMapEntry({ exports, packagePath, importPath, filePath }, { packages, config: session.config });\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n apiServer = await startApiServer(apiContext);\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled({\n input: { name: definition.name, version: definition.version },\n ctx: apiContext,\n });\n\n // Start bundle and app servers for hosting the app.\n bundleServer = await startBundleServer({\n context: {\n ...apiContext,\n apiServer,\n disableCache: false, // TODO: Get options and enable this.\n },\n });\n\n // Finally start the app server.\n appServer = await startAppServer({\n session,\n definition,\n bundleServer,\n apiServer,\n config,\n reporter,\n packages,\n packageImportPaths,\n packageHashes: apiContext.packageHashes,\n middlewareMode: true,\n server: devServer,\n });\n\n router.use(appServer.app);\n\n // TODO: Figure out if it is possible to know when browser will open.\n // performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n\n return {\n bail,\n stats: { toJson: () => null },\n totalTime: process.hrtime(startTime),\n };\n};\n\nexport const build = (_arg: { options: Options; startTime: [number, number] }): void => {\n console.log('Cloudpack Storybook build is not implemented yet.');\n process.exit(1);\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAkB,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAkB,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAqB,MAAM,6BAA6B,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAe,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,OAAO,GACR,MAAM,iCAAiC,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AO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC","sourcesContent":["import { getLocalCachePath, type ApiServer } from '@ms-cloudpack/api-server';\nimport { createPartialApiContext, ensurePackageBundled } from '@ms-cloudpack/api-server';\nimport { startAppServer, type AppServer } from '@ms-cloudpack/app-server';\nimport { startBundleServer, type BundleServer } from '@ms-cloudpack/bundle-server';\nimport { readConfig } from '@ms-cloudpack/config';\nimport type { PackageJson } from '@ms-cloudpack/common-types';\nimport { express, type Router } from '@ms-cloudpack/create-express-app';\nimport { readJson } from '@ms-cloudpack/json-utilities';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n getDisplayVersion,\n getExportsMap,\n getVersion,\n resolve,\n} from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport {\n TaskReporter,\n bold,\n debugLoggingConfig,\n defaultLoggingConfig,\n noLoggingConfig,\n verboseLoggingConfig,\n} from '@ms-cloudpack/task-reporter';\nimport { createTelemetryClient } from '@ms-cloudpack/telemetry';\nimport type { Options } from '@storybook/types';\nimport fsExtra from 'fs-extra';\nimport fsPromises from 'fs/promises';\nimport { type Server } from 'http';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\nimport { generateIframeHtml } from './generateIFrameHtml.js';\nimport { getNodeModuleDir } from './getNodeModuleDir.js';\nimport { listStories } from './listStories.js';\n\nexport type ClosableServer = {\n close: () => Promise<void>;\n url: string;\n};\n\nlet appServer: AppServer;\nlet apiServer: ApiServer;\nlet bundleServer: BundleServer;\n\nexport async function bail(error?: Error): Promise<void> {\n if (error) {\n console.error('Error:', error);\n }\n\n const servers = [\n ['appServer', appServer] as const,\n ['apiServer', apiServer] as const,\n ['bundleServer', bundleServer] as const,\n ];\n\n await Promise.all(\n servers.map(async ([name, server]) => {\n if (!server || !server.url) {\n console.info(`No ${name} to close.`);\n return;\n }\n console.info(`Closing ${name}: ${server.url}`);\n try {\n await server?.close();\n console.info(`Closed ${name}: ${server.url}`);\n } catch (err) {\n console.warn('Error closing server:', err);\n }\n }),\n );\n}\n\nexport const start = async ({\n options,\n startTime,\n router,\n server: devServer,\n}: {\n options: Options;\n startTime: [number, number];\n router: Router;\n server: Server;\n}) => {\n const previewResolvedDir = getNodeModuleDir('@storybook/preview');\n const previewDirOrigin = path.join(previewResolvedDir, 'dist');\n\n router.use('/sb-preview', express.static(previewDirOrigin, { immutable: true, maxAge: '5m' }));\n\n // TODO: This might be useful later on.\n // const env = await options.presets.apply<Record<string, string>>('env');\n\n // eslint-disable-next-line no-restricted-properties -- this is the one place we need cwd (for a default)\n const appPath = process.cwd();\n\n const config = await readConfig(appPath);\n\n // TODO: Move to won package.\n // runPrerequisites(config, appPath);\n\n // Make sure the package has a valid definition.\n const definition = (await readJson(path.join(appPath, 'package.json'))) as PackageJson;\n\n if (!definition.name || !definition.version) {\n throw new Error(`The package.json at \"${appPath}\" did not have a name and/or version.`);\n }\n\n // This part should be almost identical to the cli start command.\n const reporter = new TaskReporter({\n productName: `Cloudpack`,\n version: getDisplayVersion(import.meta.url),\n description: () => `Running \"${bold('storybook')}\"`,\n helpMessage: config.helpMessage,\n // TODO: Get options and enable this.\n plainTextMode: options.ci,\n ...(options.loglevel === 'debug'\n ? debugLoggingConfig\n : options.loglevel === 'verbose'\n ? verboseLoggingConfig\n : options.quiet || options.loglevel === 'quiet'\n ? noLoggingConfig\n : defaultLoggingConfig),\n });\n\n const connectionString = options.disableTelemetry\n ? undefined\n : config.telemetry?.connectionString || process.env.CLOUDPACK_TELEMETRY_CONNECTION_STRING;\n\n const logLevel = options.loglevel === 'verbose' ? 'VERBOSE' : options.loglevel === 'debug' ? 'DEBUG' : undefined;\n if (options.loglevel !== 'debug') {\n reporter.ignoreLogMessage('ApplicationInsights:');\n }\n\n const telemetryClient = await createTelemetryClient({\n productVersion: getVersion(import.meta.url),\n connectionString,\n logLevel,\n serviceNamespace: 'cloudpack',\n serviceName: 'cli',\n rootSpanName: 'CLI',\n });\n\n // Register performance observers to track performance metrics as events of CLI span.\n // registerPerformanceObservers(telemetryClient);\n\n const apiContext = await createPartialApiContext({\n appPath,\n config,\n reporter,\n telemetryClient,\n items: ['bus', 'watcher', 'taskRunner', 'packages', 'session', 'packageImportPaths', 'packageHashes'],\n overlayPath: await resolve('@ms-cloudpack/overlay', path.dirname(fileURLToPath(import.meta.url))),\n });\n\n const { packages, session, packageImportPaths } = apiContext;\n\n // TODO: Get options and enable this.\n // Increment the session version if caching is disabled.\n // if (options.cache === false) {\n // session.incrementSessionVersion();\n // }\n\n // Set shared telemetry attributes which will be sent with all telemetry events.\n telemetryClient.setSharedSpanAttribute('sessionId', session.id);\n\n // TODO: Get options and enable this.\n // if (options.logResolveMap) {\n // // Write the resolve map to disk.\n // await writeJson(path.join(appPath, 'resolve-map.json'), session.resolveMap);\n // }\n\n // Storybook set up is mostly done here.\n const generated = await generateIframeHtml(options, { packages, session });\n await fsExtra.ensureDir(getLocalCachePath(appPath));\n\n // TODO: Currently saving it to disk as the config only accepts a path.\n const iFramePath = path.join(getLocalCachePath(appPath), 'iFrame.html');\n await fsPromises.writeFile(iFramePath, generated, { encoding: 'utf-8' });\n\n // iFrame script is required for storybook to work.\n config.devServer ??= {};\n config.devServer.routes ??= [];\n config.devServer.routes.push({\n match: '/iframe.html',\n renderScript: iFramePath,\n });\n\n const storyEntries = Object.fromEntries(\n (await listStories(options)).map((story) => {\n const storyPath = normalizeRelativePath(path.relative(appPath, story));\n return [storyPath, storyPath];\n }),\n );\n\n const packagePath = findResolveMapEntry({ packageName: definition.name, resolveMap: session.resolveMap })?.path;\n if (!packagePath) {\n throw new Error(`Could not find package ${definition.name} in the resolve map.`);\n }\n\n const exports = await getExportsMap({ packagePath }, { packages, config: session.config });\n for (const [importPath, filePath] of Object.entries(storyEntries)) {\n await addExportsMapEntry({ exports, packagePath, importPath, filePath }, { packages, config: session.config });\n }\n\n const { startApiServer } = await import('@ms-cloudpack/api-server');\n\n // Start api server for tracking status and handling remote requests.\n apiServer = await startApiServer(apiContext);\n session.urls.apiServer = apiServer.url;\n\n // Kick off bundling app package as soon as api server is ready.\n void ensurePackageBundled({\n input: { name: definition.name, version: definition.version },\n ctx: apiContext,\n });\n\n // Start bundle and app servers for hosting the app.\n bundleServer = await startBundleServer({\n context: {\n ...apiContext,\n disableCache: false, // TODO: Get options and enable this.\n },\n });\n session.urls.bundleServer = bundleServer.url;\n\n // Finally start the app server.\n appServer = await startAppServer({\n session,\n definition,\n config,\n reporter,\n packages,\n packageImportPaths,\n packageHashes: apiContext.packageHashes,\n middlewareMode: true,\n server: devServer,\n });\n session.urls.appServer = appServer.url;\n\n router.use(appServer.app);\n\n // TODO: Figure out if it is possible to know when browser will open.\n // performance.measure(PerfMeasurementOpenBrowser, PerfMarkerCliEntry);\n\n return {\n bail,\n stats: { toJson: () => null },\n totalTime: process.hrtime(startTime),\n };\n};\n\nexport const build = (_arg: { options: Options; startTime: [number, number] }): void => {\n console.log('Cloudpack Storybook build is not implemented yet.');\n process.exit(1);\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/storybook-builder",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "A tool for building storybook bundles for the cloudpack ecosystem.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,16 +22,16 @@
22
22
  "lint": "cloudpack-scripts lint"
23
23
  },
24
24
  "dependencies": {
25
- "@ms-cloudpack/api-server": "^0.41.0",
26
- "@ms-cloudpack/app-server": "^0.4.4",
27
- "@ms-cloudpack/bundle-server": "^0.2.61",
28
- "@ms-cloudpack/common-types": "^0.4.0",
29
- "@ms-cloudpack/config": "^0.20.1",
30
- "@ms-cloudpack/create-express-app": "^1.6.8",
25
+ "@ms-cloudpack/api-server": "^0.42.0",
26
+ "@ms-cloudpack/app-server": "^0.5.0",
27
+ "@ms-cloudpack/bundle-server": "^0.3.0",
28
+ "@ms-cloudpack/common-types": "^0.5.0",
29
+ "@ms-cloudpack/config": "^0.20.2",
30
+ "@ms-cloudpack/create-express-app": "^1.6.9",
31
31
  "@ms-cloudpack/json-utilities": "^0.1.4",
32
- "@ms-cloudpack/package-utilities": "^7.4.0",
32
+ "@ms-cloudpack/package-utilities": "^7.4.1",
33
33
  "@ms-cloudpack/path-string-parsing": "^1.2.1",
34
- "@ms-cloudpack/path-utilities": "^2.7.5",
34
+ "@ms-cloudpack/path-utilities": "^2.7.6",
35
35
  "@ms-cloudpack/task-reporter": "^0.14.0",
36
36
  "@ms-cloudpack/telemetry": "^0.5.1",
37
37
  "@storybook/core-common": "^7.0.0",
@@ -42,7 +42,7 @@
42
42
  "fs-extra": "^11.2.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@ms-cloudpack/common-types": "^0.4.0",
45
+ "@ms-cloudpack/common-types": "^0.5.0",
46
46
  "@ms-cloudpack/eslint-plugin-internal": "^0.0.1",
47
47
  "@ms-cloudpack/scripts": "^0.0.1",
48
48
  "@storybook/types": "^7.0.0"