Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
leventebalogh committed Jan 27, 2025
1 parent 6b36d7f commit 6b6203b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/create-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"generate-datasource-backend": "tsc && npm run clean-generated && CREATE_PLUGIN_DEV=true node ./dist/bin/run.js --pluginName='Sample datasource' --orgName='sample-org' --pluginType='datasource' --hasBackend",
"lint": "eslint --cache ./src",
"lint:fix": "npm run lint -- --fix",
"test": "vitest",
"test": "vitest --passWithNoTests",
"typecheck": "tsc --noEmit"
},
"dependencies": {
Expand Down Expand Up @@ -88,4 +88,4 @@
"engines": {
"node": ">=20"
}
}
}
11 changes: 6 additions & 5 deletions packages/create-plugin/src/migrations/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ type Migrations = {

export default {
migrations: {
'add-webpack-profile': {
version: '5.13.0',
description: 'Update build command to use webpack profile flag.',
migrationScript: './scripts/add-webpack-profile.js',
},
// Example migration entry (DO NOT UNCOMMENT!)
// 'example-migration': {
// version: '5.13.0',
// description: 'Update build command to use webpack profile flag.',
// migrationScript: './scripts/example-migration.js',
// },
},
} as Migrations;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ONLY FOR DRAFT - DELETE BEFORE MERGE
// -------------------------------------

import migrate from './add-webpack-profile.js';
import migrate from './example-migration.js';
import { createDefaultContext } from '../test-utils.js';

describe('Migration - append profile to webpack', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// ONLY FOR DRAFT - DELETE BEFORE MERGE
// -------------------------------------

import type { Context } from '../context.js';

export default function migrate(context: Context): Context {
// UPDATING ----
const rawPkgJson = context.getFile('./package.json') ?? '{}';
const packageJson = JSON.parse(rawPkgJson);

Expand All @@ -20,22 +16,18 @@ export default function migrate(context: Context): Context {
context.updateFile('./package.json', JSON.stringify(packageJson, null, 2));
}

// DELETING ----
if (context.doesFileExist('./src/README.md')) {
context.deleteFile('./src/README.md');
}

// ADDING ----
if (!context.doesFileExist('./src/foo.json')) {
context.addFile('./src/foo.json', JSON.stringify({ foo: 'bar' }));
}

// RENAME ---
if (context.doesFileExist('.eslintrc')) {
context.renameFile('.eslintrc', '.eslint.config.json');
}

// READ DIR ---
context.readDir('./src');

return context;
Expand Down

0 comments on commit 6b6203b

Please sign in to comment.