Skip to content

Commit

Permalink
Merge pull request #165 from Convertiv/release/0.14.1
Browse files Browse the repository at this point in the history
Release/0.14.1
  • Loading branch information
DomagojGojak authored Oct 28, 2024
2 parents 84942ec + ea63b28 commit 69eaf9c
Show file tree
Hide file tree
Showing 103 changed files with 2,508 additions and 565 deletions.
18 changes: 18 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.14.1] - 2024-10-28

This release introduces greater flexibility for custom integrations and general improvements to CLI handling.

### Changes

- Added support for custom integration paths with the `-i <path-to-integration>` CLI argument.
- Can be used with commands like `fetch`, `start`, `build:app`, etc.
- Defaults to the `integration` directory if the argument isn't specified, ensuring backward compatibility.

### Improvements

- Enhanced CLI command management:
- Switched to `yargs` for improved CLI parsing.
- Each command now has a dedicated handler file for better modularity.
- Improved the docs app build process:
- Introduced a cleanup procedure that ensures only files present in the working directory are included in the final build.

## [0.14.0] - 2024-09-26

This release enables creation of complex documentation pages, with storybook
Expand Down
63 changes: 43 additions & 20 deletions dist/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,47 +159,64 @@ var transformMdx = function (src, dest, id) {
mdx = "\n\n\n".concat(mdx, "\n\n\nimport {staticBuildMenu, getCurrentSection} from \"handoff-app/src/app/components/util\";\nimport { getClientConfig } from '@handoff/config';\nimport { getPreview } from \"handoff-app/src/app/components/util\";\n\nexport const getStaticProps = async () => {\n // get previews for components on this page\n const previews = getPreview();\n const menu = staticBuildMenu();\n const config = getClientConfig();\n return {\n props: {\n previews,\n menu,\n config,\n current: getCurrentSection(menu, \"/").concat(id, "\") ?? [],\n title: \"").concat(title, "\",\n description: \"").concat(description, "\",\n image: \"").concat(image, "\",\n },\n };\n};\n\nexport const preview = (name) => {\n return previews.components[name];\n};\n\nimport MarkdownLayout from \"handoff-app/src/app/components/MarkdownLayout\";\nexport default function Layout(props) {\n return (\n <MarkdownLayout\n menu={props.menu}\n metadata={{\n metaDescription: \"").concat(metaDescription, "\",\n metaTitle: \"").concat(metaTitle, "\",\n title: \"").concat(title, "\",\n weight: ").concat(weight, ",\n image: \"").concat(image, "\",\n menuTitle: \"").concat(menuTitle, "\",\n enabled: ").concat(enabled, ",\n }}\n wide={").concat(wide, "}\n allPreviews={props.previews}\n config={props.config}\n current={props.current}\n >\n {props.children}\n </MarkdownLayout>\n );\n\n}");
fs_extra_1.default.writeFileSync(dest, mdx, 'utf-8');
};
var performCleanup = function (handoff) { return __awaiter(void 0, void 0, void 0, function () {
var appPath;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
appPath = getAppPath(handoff);
if (!fs_extra_1.default.existsSync(appPath)) return [3 /*break*/, 2];
return [4 /*yield*/, fs_extra_1.default.rm(appPath, { recursive: true })];
case 1:
_a.sent();
_a.label = 2;
case 2: return [2 /*return*/];
}
});
}); };
var prepareProjectApp = function (handoff) { return __awaiter(void 0, void 0, void 0, function () {
var srcPath, appPath, handoffProjectId, handoffAppBasePath, handoffWorkingPath, handoffModulePath, handoffExportPath, nextConfigPath, nextConfigContent;
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
var srcPath, appPath, handoffProjectId, handoffAppBasePath, handoffWorkingPath, handoffIntegrationPath, handoffModulePath, handoffExportPath, nextConfigPath, nextConfigContent;
var _a, _b, _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
srcPath = path_1.default.resolve(handoff.modulePath, 'src', 'app');
appPath = getAppPath(handoff);
// Prepare project app dir
return [4 /*yield*/, fs_extra_1.default.promises.mkdir(appPath, { recursive: true })];
case 1:
// Prepare project app dir
_c.sent();
_d.sent();
return [4 /*yield*/, fs_extra_1.default.copy(srcPath, appPath, { overwrite: true })];
case 2:
_c.sent();
_d.sent();
return [4 /*yield*/, mergePublicDir(handoff)];
case 3:
_c.sent();
_d.sent();
return [4 /*yield*/, mergeMDX(handoff)];
case 4:
_c.sent();
_d.sent();
handoffProjectId = (_a = handoff.config.figma_project_id) !== null && _a !== void 0 ? _a : '';
handoffAppBasePath = (_b = handoff.config.app.base_path) !== null && _b !== void 0 ? _b : '';
handoffWorkingPath = path_1.default.resolve(handoff.workingPath);
handoffIntegrationPath = path_1.default.resolve(handoff.workingPath, (_c = handoff.config.integrationPath) !== null && _c !== void 0 ? _c : 'integration');
handoffModulePath = path_1.default.resolve(handoff.modulePath);
handoffExportPath = path_1.default.resolve(handoff.workingPath, handoff.exportsDirectory, handoff.config.figma_project_id);
nextConfigPath = path_1.default.resolve(appPath, 'next.config.mjs');
return [4 /*yield*/, fs_extra_1.default.readFile(nextConfigPath, 'utf-8')];
case 5:
nextConfigContent = (_c.sent())
nextConfigContent = (_d.sent())
.replace(/basePath:\s+\'\'/g, "basePath: '".concat(handoffAppBasePath, "'"))
.replace(/HANDOFF_PROJECT_ID:\s+\'\'/g, "HANDOFF_PROJECT_ID: '".concat(handoffProjectId, "'"))
.replace(/HANDOFF_APP_BASE_PATH:\s+\'\'/g, "HANDOFF_APP_BASE_PATH: '".concat(handoffAppBasePath, "'"))
.replace(/HANDOFF_WORKING_PATH:\s+\'\'/g, "HANDOFF_WORKING_PATH: '".concat(handoffWorkingPath, "'"))
.replace(/HANDOFF_INTEGRATION_PATH:\s+\'\'/g, "HANDOFF_INTEGRATION_PATH: '".concat(handoffIntegrationPath, "'"))
.replace(/HANDOFF_MODULE_PATH:\s+\'\'/g, "HANDOFF_MODULE_PATH: '".concat(handoffModulePath, "'"))
.replace(/HANDOFF_EXPORT_PATH:\s+\'\'/g, "HANDOFF_EXPORT_PATH: '".concat(handoffExportPath, "'"))
.replace(/%HANDOFF_MODULE_PATH%/g, handoffModulePath);
return [4 /*yield*/, fs_extra_1.default.writeFile(nextConfigPath, nextConfigContent)];
case 6:
_c.sent();
_d.sent();
return [2 /*return*/, appPath];
}
});
Expand All @@ -217,9 +234,14 @@ var buildApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
if (!fs_extra_1.default.existsSync(path_1.default.resolve(handoff.workingPath, handoff.exportsDirectory, handoff.config.figma_project_id, 'tokens.json'))) {
throw new Error('Tokens not exported. Run `handoff-app fetch` first.');
}
// Perform cleanup
return [4 /*yield*/, performCleanup(handoff)];
case 1:
// Perform cleanup
_a.sent();
// If we are building the app, ensure the integration is built first
return [4 /*yield*/, (0, pipeline_1.buildIntegrationOnly)(handoff)];
case 1:
case 2:
// If we are building the app, ensure the integration is built first
_a.sent();
// Build client preview styles
Expand All @@ -228,11 +250,11 @@ var buildApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
.catch(function (error) {
throw new Error(error);
})];
case 2:
case 3:
// Build client preview styles
_a.sent();
return [4 /*yield*/, prepareProjectApp(handoff)];
case 3:
case 4:
appPath = _a.sent();
// Build app
return [4 /*yield*/, (0, next_build_1.nextBuild)({
Expand All @@ -243,7 +265,7 @@ var buildApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
experimentalTurbo: false,
experimentalBuildMode: 'default',
}, appPath)];
case 4:
case 5:
// Build app
_a.sent();
outputRoot = path_1.default.resolve(handoff.workingPath, handoff.sitesDirectory);
Expand All @@ -266,8 +288,9 @@ var buildApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
*/
var watchApp = function (handoff) { return __awaiter(void 0, void 0, void 0, function () {
var appPath, dev, hostname, port, app, handle, moduleOutput, chokidarConfig, debounce;
return __generator(this, function (_a) {
switch (_a.label) {
var _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
if (!fs_extra_1.default.existsSync(path_1.default.resolve(handoff.workingPath, handoff.exportsDirectory, handoff.config.figma_project_id, 'tokens.json'))) {
throw new Error('Tokens not exported. Run `handoff-app fetch` first.');
Expand All @@ -280,10 +303,10 @@ var watchApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
})];
case 1:
// Build client preview styles
_a.sent();
_c.sent();
return [4 /*yield*/, prepareProjectApp(handoff)];
case 2:
appPath = _a.sent();
appPath = _c.sent();
// Include any changes made within the app source during watch
chokidar_1.default
.watch(path_1.default.resolve(handoff.modulePath, 'src', 'app'), {
Expand Down Expand Up @@ -410,8 +433,8 @@ var watchApp = function (handoff) { return __awaiter(void 0, void 0, void 0, fun
});
}); });
}
if (fs_extra_1.default.existsSync(path_1.default.resolve(handoff.workingPath, 'integration'))) {
chokidar_1.default.watch(path_1.default.resolve(handoff.workingPath, 'integration'), chokidarConfig).on('all', function (event, file) { return __awaiter(void 0, void 0, void 0, function () {
if (fs_extra_1.default.existsSync(path_1.default.resolve(handoff.workingPath, (_a = handoff.config.integrationPath) !== null && _a !== void 0 ? _a : 'integration'))) {
chokidar_1.default.watch(path_1.default.resolve(handoff.workingPath, (_b = handoff.config.integrationPath) !== null && _b !== void 0 ? _b : 'integration'), chokidarConfig).on('all', function (event, file) { return __awaiter(void 0, void 0, void 0, function () {
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
Expand Down
Loading

0 comments on commit 69eaf9c

Please sign in to comment.