Skip to content

Commit

Permalink
chore/remove-copy-files (#913)
Browse files Browse the repository at this point in the history
* chore(core): remove copy config/styles files

It removes copy eventcatalog config/styles to astro. These files are
copied by the hydration phase with the use o `mapCatalogToAstro`.

* chore: remove unused script

* Create pink-snakes-tap.md

---------

Co-authored-by: David Boyne <[email protected]>
  • Loading branch information
carlosallexandre and boyney123 authored Oct 27, 2024
1 parent cb82839 commit b29d4f9
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 55 deletions.
5 changes: 5 additions & 0 deletions .changeset/pink-snakes-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eventcatalog/core": patch
---

chore(core): removed code that copies over files twice to users catalog.
26 changes: 0 additions & 26 deletions bin/eventcatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ const eventCatalogDir = join(currentDir, '../../');

program.name('eventcatalog').description('Documentation tool for event-driven architectures');

const copyFile = (from: string, to: string) => {
if (fs.existsSync(from)) {
// fs.copyFileSync(from, to);
fs.cpSync(from, to);
}
};

const copyFolder = (from: string, to: string) => {
if (fs.existsSync(from)) {
fs.cpSync(from, to, { recursive: true });
Expand Down Expand Up @@ -78,11 +71,6 @@ program
if (options.forceRecreate) clearCore();
copyCore();

// // Copy the config and styles
copyFolder(join(dir, 'public'), join(core, 'public'));
copyFile(join(dir, 'eventcatalog.config.js'), join(core, 'eventcatalog.config.js'));
copyFile(join(dir, 'eventcatalog.styles.css'), join(core, 'eventcatalog.styles.css'));

console.log('EventCatalog is starting at http://localhost:3000/docs');

execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run dev`, {
Expand All @@ -100,11 +88,6 @@ program

copyCore();

// Copy the config and styles
copyFolder(join(dir, 'public'), join(core, 'public'));
copyFile(join(dir, 'eventcatalog.config.js'), join(core, 'eventcatalog.config.js'));
copyFile(join(dir, 'eventcatalog.styles.css'), join(core, 'eventcatalog.styles.css'));

execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run build`, {
cwd: core,
stdio: 'inherit',
Expand All @@ -117,11 +100,6 @@ program
const previewCatalog = () => {
copyCore();

// Copy the config and styles
copyFolder(join(dir, 'public'), join(core, 'public'));
copyFile(join(dir, 'eventcatalog.config.js'), join(core, 'eventcatalog.config.js'));
copyFile(join(dir, 'eventcatalog.styles.css'), join(core, 'eventcatalog.styles.css'));

execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
cwd: core,
stdio: 'inherit',
Expand Down Expand Up @@ -153,10 +131,6 @@ program
.action(() => {
copyCore();

copyFolder(join(dir, 'public'), join(core, 'public'));
copyFile(join(dir, 'eventcatalog.config.js'), join(core, 'eventcatalog.config.js'));
copyFile(join(dir, 'eventcatalog.styles.css'), join(core, 'eventcatalog.styles.css'));

execSync(`cross-env PROJECT_DIR='${dir}' npm run generate`, {
cwd: core,
stdio: 'inherit',
Expand Down
5 changes: 0 additions & 5 deletions scripts/build-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

// This is used for CI on vercel. Must copy files before building.
import { join } from 'node:path';
import fs from 'fs';
import { execSync } from 'node:child_process';
const __dirname = import.meta.dirname;

Expand All @@ -12,10 +11,6 @@ const catalog = args[0] || 'default';
const catalogDir = join(__dirname, '../');
const projectDIR = join(__dirname, `../examples/${catalog}`);

fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'eventcatalog.config.js'));

fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));

execSync(
`cross-env NODE_ENV=CI PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run build && astro check --minimumSeverity error`,
{
Expand Down
4 changes: 0 additions & 4 deletions scripts/start-catalog-locally.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env node
import { join } from 'node:path';
import fs from 'fs';
import { execSync } from 'node:child_process';
const __dirname = import.meta.dirname;

Expand All @@ -10,9 +9,6 @@ const catalog = args[0] || 'default';
const catalogDir = join(__dirname, '../');
const projectDIR = join(__dirname, `../examples/${catalog}`);

fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'eventcatalog.config.js'));
fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));

execSync(
`cross-env NODE_ENV=development PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run scripts:hydrate-content && cross-env PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run dev:local`,
{
Expand Down
20 changes: 0 additions & 20 deletions scripts/verify-build.js

This file was deleted.

0 comments on commit b29d4f9

Please sign in to comment.