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 +5 -0
- package/dist/app-builder/build.js +6 -2
- package/dist/cli.js +0 -0
- package/dist/transformers/preview/component.d.ts +1 -1
- package/dist/transformers/preview/component.js +1 -1
- package/package.json +1 -1
- package/src/app/css.d.ts +1 -0
- package/src/app/pages/_app.tsx +3 -0
- package/src/app-builder/build.ts +16 -3
- package/src/transformers/preview/component.ts +2 -2
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
|
|
@@ -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
package/src/app/css.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '*.css' {}
|
package/src/app/pages/_app.tsx
CHANGED
package/src/app-builder/build.ts
CHANGED
|
@@ -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 {
|
|
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?: {
|