Skip to content

Commit

Permalink
Fix relative install path
Browse files Browse the repository at this point in the history
  • Loading branch information
u12206050 committed Dec 7, 2023
1 parent d704de9 commit f119272
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 1.6.0
# Version 1.6.1

- Fixed error thrown when installing config folder without --force
- Fixed installing of config folder

## Version 1.5.0 ⚠️

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "directus-extension-schema-sync",
"description": "Sync schema and data betwreen Directus instances",
"icon": "sync_alt",
"version": "1.6.0",
"version": "1.6.1",
"repository": {
"type": "git",
"url": "https://github.com/bcc-code/directus-schema-sync.git"
Expand Down
8 changes: 4 additions & 4 deletions src/copyConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import fs from 'fs/promises';
import path from 'path';
import { fileURLToPath } from 'url';

export async function copyConfig(force: boolean) {
export async function copyConfig(force: boolean, { logger }: { logger: any }) {
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const srcDir = path.resolve(__dirname, 'install');
const srcDir = path.resolve(__dirname, '../install');
const targetDir = process.cwd();

// Test if it doesn't already exist then if it does exit
if (!force) {
await fs.access(path.resolve(targetDir, 'schema-sync')).then(() => {
console.log('Config folder already exists, use --force to override');
logger.info('Config folder already exists, use --force to override');
process.exit(0);
}).catch(() => {
console.log('Creating config folder...');
logger.info('Creating config folder...');
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const registerHook: HookConfig = async ({ action, init }, { env, services, datab
.action(async ({ force }: { force: boolean }) => {
logger.info('Installing Schema sync...');
await updateManager.ensureInstalled();
await copyConfig(force);
await copyConfig(force, { logger });

logger.info('Done!');
process.exit(0);
Expand Down

0 comments on commit f119272

Please sign in to comment.