Skip to content

Commit

Permalink
Group astro files under astro/ (#975)
Browse files Browse the repository at this point in the history
* refactor(core): group astro files under astro dir

* refactor: replace .npmignore with `files`field in package.json

Removed .npmignore in favor o fmanaging publishable files using the
`files`field in package.json.

* refactor: rename from `astro/` to `eventcatalog/`

* Create two-lizards-share.md

---------

Co-authored-by: David Boyne <[email protected]>
  • Loading branch information
carlosallexandre and boyney123 authored Dec 2, 2024
1 parent 82b9e49 commit e260995
Show file tree
Hide file tree
Showing 186 changed files with 87 additions and 82 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-lizards-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eventcatalog/core": minor
---

chore(core): refactor project files and folders
2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: npx . build
env:
PROJECT_DIR: ./examples/default/
CATALOG_DIR: ./
CATALOG_DIR: ./eventcatalog/
NODE_ENV: CI # Skip analytics
- name: Run tests
run: npm run test:e2e
19 changes: 1 addition & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# build output
dist/

# generated types
.astro/

# dependencies
node_modules/

Expand All @@ -24,23 +21,9 @@ pnpm-debug.log*
.idea/

# EventCatalog files
/src/content/*
!/src/content/config.ts
/public/generated/*
/src/catalog-files/*
/src/custom-defined-components/*
/.eventcatalog-core/*
**/.eventcatalog-core/
/examples/large-catalog/*

eventcatalog.config.js
eventcatalog.styles.css

!/scripts/__tests__/example-catalog/eventcatalog.config.js
!/examples/default/eventcatalog.config.js
!/examples/default/eventcatalog.styles.css



.vscode/*

git-push.sh
Expand Down
27 changes: 0 additions & 27 deletions .npmignore

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dist
node_modules
astro
.astro/
dist
eventcatalog.config.js
examples/
Expand Down
8 changes: 4 additions & 4 deletions bin/eventcatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const dir = path.resolve(process.env.PROJECT_DIR || process.cwd());
const core = path.resolve(process.env.CATALOG_DIR || join(dir, '.eventcatalog-core'));

// The project itself
const eventCatalogDir = path.resolve(join(currentDir, '../../'));
const eventCatalogDir = path.resolve(join(currentDir, '../../eventcatalog/'));

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

Expand Down Expand Up @@ -94,7 +94,7 @@ program
const { result } = concurrently([
{
name: 'astro',
command: 'npm run dev',
command: 'npx astro dev',
cwd: core,
env: {
PROJECT_DIR: dir,
Expand Down Expand Up @@ -123,7 +123,7 @@ program

await catalogToAstro(dir, core);

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

execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
cwd: core,
stdio: 'inherit',
});
Expand Down
18 changes: 18 additions & 0 deletions eventcatalog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# build output
dist/

# generated types
.astro/

# dependencies
node_modules/

# EventCatalog files
src/content/*
!src/content/config.ts
public/generated/*
src/catalog-files/*
src/custom-defined-components/*

eventcatalog.config.js
eventcatalog.styles.css
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions eventcatalog/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"strict": true,
"baseUrl": ".",
"paths": {
"@config": ["./eventcatalog.config.js"],
"@eventcatalog": ["src/utils/eventcatalog-config/catalog.ts"],
"@icons/*": ["src/icons/*"],
"@components/*": ["src/components/*"],
"@catalog/components/*": ["src/custom-defined-components/*"],
"@types": ["src/types/index.ts"],
"@utils/*": ["src/utils/*"],
"@layouts/*": ["src/layouts/*"]
},
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": ["vitest/globals"]
}
}
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@
"bin": {
"eventcatalog": "bin/dist/eventcatalog.cjs"
},
"files": [
"eventcatalog/",
"!eventcatalog/**/__tests__/",
"bin/dist/",
"default-files-for-collections/"
],
"scripts": {
"dev": "astro dev",
"build:bin": "tsup",
"prepublishOnly": "npm run build:bin",
"test": "vitest --config vitest.config.ts",
"test": "vitest",
"test:ci": "node scripts/ci/test.js",
"test:e2e": "playwright test",
"start": "astro dev",
Expand Down
3 changes: 1 addition & 2 deletions scripts/build-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ const __dirname = import.meta.dirname;
const args = process.argv.slice(2);
const catalog = args[0] || 'default';

const catalogDir = join(__dirname, '../');
const catalogDir = join(__dirname, '../eventcatalog/');
const projectDIR = join(__dirname, `../examples/${catalog}`);

// Build cli
execSync('npm run build:bin', { stdio: 'inherit' });

// Build catalog
execSync(`cross-env NODE_ENV=CI PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npx . build`, {
cwd: catalogDir,
stdio: 'inherit',
});

Expand Down
5 changes: 2 additions & 3 deletions scripts/ci/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import { execSync } from 'node:child_process';
const args = process.argv.slice(2);
const catalog = args[0] || 'default';

const catalogDir = join(process.cwd());
const catalogDir = join(process.cwd(), 'eventcatalog/');
const projectDIR = join(process.cwd(), `/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=test PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run test`, {
cwd: catalogDir,
execSync(`cross-env NODE_ENV=test PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run test run`, {
stdio: 'inherit',
});
2 changes: 1 addition & 1 deletion scripts/start-catalog-locally.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ async function main() {
const args = process.argv.slice(2);
const catalog = args[0] || 'default';

const catalogDir = join(__dirname, '../');
const catalogDir = join(__dirname, '../eventcatalog/');
const projectDIR = join(__dirname, `../examples/${catalog}`);

execSync('npm run build:bin', { stdio: 'inherit' });
Expand Down
12 changes: 0 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,6 @@
"compilerOptions": {
"strict": true,
"baseUrl": ".",
"paths": {
"@config": ["./eventcatalog.config.js"],
"@eventcatalog": ["src/utils/eventcatalog-config/catalog.ts"],
"@icons/*": ["src/icons/*"],
"@components/*": ["src/components/*"],
"@catalog/components/*": ["src/custom-defined-components/*"],
"@types": ["src/types/index.ts"],
"@utils/*": ["src/utils/*"],
"@layouts/*": ["src/layouts/*"]
},
"jsx": "react-jsx",
"jsxImportSource": "react",
"types": ["vitest/globals"]
}
}
12 changes: 0 additions & 12 deletions vitest.config.ts

This file was deleted.

26 changes: 26 additions & 0 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { defaultExclude, defineWorkspace } from 'vitest/config';
import { getViteConfig } from 'astro/config';
import tsConfigPaths from 'vite-tsconfig-paths';

export default defineWorkspace([
{
plugins: [tsConfigPaths()],
test: {
name: '@eventcatalog/core',
globals: true,
exclude: [...defaultExclude, 'e2e/**', 'eventcatalog/**'],
},
},
getViteConfig({
plugins: [tsConfigPaths()],
test: {
name: '@eventcatalog/astro',
globals: true,
root: 'eventcatalog/',
env: {
PROJECT_DIR: 'examples/default/',
CATALOG_DIR: 'eventcatalog/',
},
},
}),
]);

0 comments on commit e260995

Please sign in to comment.