handoff-app 1.2.2-3 → 1.2.2-5

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/Changelog.md CHANGED
@@ -12,6 +12,11 @@ This patch release clears ESLint failures in the Next.js app pages and aligns
12
12
  several code paths with the compiler target so production builds succeed without
13
13
  enabling `--downlevelIteration`.
14
14
 
15
+ ### Change
16
+
17
+ * Altered the avaliable types to the SlotMetadata so the default can handle
18
+ a wide variaty of types - `default?: string | number | boolean | object | any[] | null;`
19
+
15
20
  ### Lint and code quality
16
21
 
17
22
  * Resolved `no-else-return`, `no-unused-vars`, `camelcase`, `prefer-const`,
@@ -18,9 +18,9 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
18
18
  const path_1 = __importDefault(require("path"));
19
19
  const components_1 = require("../pipeline/components");
20
20
  const patterns_1 = require("../pipeline/patterns");
21
+ const builder_1 = __importDefault(require("../transformers/preview/component/builder"));
21
22
  const css_1 = require("../transformers/preview/component/css");
22
23
  const javascript_1 = require("../transformers/preview/component/javascript");
23
- const builder_1 = __importDefault(require("../transformers/preview/component/builder"));
24
24
  const logger_1 = require("../utils/logger");
25
25
  const client_config_1 = require("./client-config");
26
26
  const paths_1 = require("./paths");
@@ -54,11 +54,15 @@ const initializeProjectApp = (handoff) => __awaiter(void 0, void 0, void 0, func
54
54
  yield (0, paths_1.syncPublicFiles)(handoff);
55
55
  // Copy custom theme CSS if it exists in the user's project
56
56
  const customThemePath = path_1.default.resolve(handoff.workingPath, 'theme.css');
57
+ const destPath = path_1.default.resolve(appPath, 'css', 'theme.css');
57
58
  if (fs_extra_1.default.existsSync(customThemePath)) {
58
- const destPath = path_1.default.resolve(appPath, 'css', 'theme.css');
59
59
  yield fs_extra_1.default.copy(customThemePath, destPath, { overwrite: true });
60
60
  logger_1.Logger.success(`Custom theme.css loaded`);
61
61
  }
62
+ else {
63
+ // create a empty theme.css file
64
+ yield fs_extra_1.default.writeFile(destPath, '');
65
+ }
62
66
  // Prepare project app configuration using stable placeholder replacement.
63
67
  const handoffProjectId = handoff.getProjectId();
64
68
  const handoffAppBasePath = (_a = handoff.config.app.base_path) !== null && _a !== void 0 ? _a : '';
package/dist/cli.js CHANGED
File without changes
@@ -26,7 +26,7 @@ export interface SlotMetadata {
26
26
  name: string;
27
27
  description: string;
28
28
  generic: string;
29
- default?: string;
29
+ default?: string | number | boolean | object | any[] | null;
30
30
  type: SlotType;
31
31
  items?: {
32
32
  type: SlotType;
@@ -16,10 +16,10 @@ exports.getComponentOutputPath = exports.SlotType = void 0;
16
16
  exports.componentTransformer = componentTransformer;
17
17
  const path_1 = __importDefault(require("path"));
18
18
  const api_1 = require("./component/api");
19
- const summary_1 = __importDefault(require("./component/summary"));
20
19
  const builder_1 = __importDefault(require("./component/builder"));
21
20
  const css_1 = require("./component/css");
22
21
  const javascript_1 = require("./component/javascript");
22
+ const summary_1 = __importDefault(require("./component/summary"));
23
23
  var SlotType;
24
24
  (function (SlotType) {
25
25
  SlotType["TEXT"] = "text";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "handoff-app",
3
- "version": "1.2.2-3",
3
+ "version": "1.2.2-5",
4
4
  "description": "Automated documentation toolchain for building client side documentation from figma",
5
5
  "author ": {
6
6
  "name": "Convertiv",
@@ -0,0 +1 @@
1
+ declare module '*.css' {}
@@ -1,5 +1,8 @@
1
1
  import type { AppProps } from 'next/app';
2
2
 
3
+ import '../css/index.css';
4
+ import '../css/theme.css';
5
+
3
6
  function MyApp({ Component, pageProps }: AppProps) {
4
7
  return (
5
8
  <>
@@ -4,13 +4,23 @@ import path from 'path';
4
4
  import Handoff from '..';
5
5
  import { buildComponents } from '../pipeline/components';
6
6
  import { buildPatterns } from '../pipeline/patterns';
7
+ import processComponents from '../transformers/preview/component/builder';
7
8
  import { buildMainCss } from '../transformers/preview/component/css';
8
9
  import { buildMainJS } from '../transformers/preview/component/javascript';
9
- import processComponents from '../transformers/preview/component/builder';
10
10
  import { Logger } from '../utils/logger';
11
11
  import { generateTokensApi, persistClientConfig } from './client-config';
12
12
  import { getAppPath, syncPublicFiles } from './paths';
13
- import { WatcherState, getRuntimeComponentsPathsToWatch, watchAppSource, watchComponentDirectories, watchGlobalEntries, watchPages, watchPublicDirectory, watchRuntimeComponents, watchRuntimeConfiguration } from './watchers';
13
+ import {
14
+ WatcherState,
15
+ getRuntimeComponentsPathsToWatch,
16
+ watchAppSource,
17
+ watchComponentDirectories,
18
+ watchGlobalEntries,
19
+ watchPages,
20
+ watchPublicDirectory,
21
+ watchRuntimeComponents,
22
+ watchRuntimeConfiguration,
23
+ } from './watchers';
14
24
  import { createWebSocketServer } from './websocket';
15
25
 
16
26
  const escapeForSingleQuotedJsString = (value: string): string => value.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
@@ -46,10 +56,13 @@ const initializeProjectApp = async (handoff: Handoff): Promise<string> => {
46
56
 
47
57
  // Copy custom theme CSS if it exists in the user's project
48
58
  const customThemePath = path.resolve(handoff.workingPath, 'theme.css');
59
+ const destPath = path.resolve(appPath, 'css', 'theme.css');
49
60
  if (fs.existsSync(customThemePath)) {
50
- const destPath = path.resolve(appPath, 'css', 'theme.css');
51
61
  await fs.copy(customThemePath, destPath, { overwrite: true });
52
62
  Logger.success(`Custom theme.css loaded`);
63
+ } else {
64
+ // create a empty theme.css file
65
+ await fs.writeFile(destPath, '');
53
66
  }
54
67
 
55
68
  // Prepare project app configuration using stable placeholder replacement.
@@ -2,10 +2,10 @@ import type { DocAnnotation, TypeNode } from 'handoff-docgen';
2
2
  import path from 'path';
3
3
  import Handoff from '../../index';
4
4
  import { getAPIPath } from './component/api';
5
- import writeComponentSummaryAPI from './component/summary';
6
5
  import processComponents from './component/builder';
7
6
  import { buildMainCss } from './component/css';
8
7
  import { buildMainJS } from './component/javascript';
8
+ import writeComponentSummaryAPI from './component/summary';
9
9
 
10
10
  export interface ComponentMetadata {
11
11
  title: string;
@@ -33,7 +33,7 @@ export interface SlotMetadata {
33
33
  name: string;
34
34
  description: string;
35
35
  generic: string;
36
- default?: string;
36
+ default?: string | number | boolean | object | any[] | null;
37
37
  type: SlotType;
38
38
  // used if type is array
39
39
  items?: {