feat(plugin-generate-js): first version

This commit is contained in:
Joakim Carlstein 2023-11-09 22:00:43 +01:00
parent cdafd05c20
commit ce4693d957
4 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
'@emigrate/plugin-generate-js': minor
---
First version. A simple JavaScript migration file generator.

View file

@ -0,0 +1,36 @@
{
"name": "@emigrate/plugin-generate-js",
"version": "0.0.0",
"publishConfig": {
"access": "public"
},
"description": "An Emigrate plugin for generating new migration files in JavaScript.",
"main": "dist/index.js",
"types": "dist/index.d.js",
"type": "module",
"exports": {
".": {
"import": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"build": "tsc --pretty",
"build:watch": "tsc --pretty --watch"
},
"keywords": [
"emigrate",
"emigrate-plugin",
"plugin",
"migrations",
"generate"
],
"author": "Aboviq AB <dev@aboviq.com> (https://www.aboviq.com)",
"license": "MIT",
"dependencies": {
"@emigrate/plugin-tools": "workspace:*"
},
"devDependencies": {
"@emigrate/tsconfig": "workspace:*"
}
}

View file

@ -0,0 +1,12 @@
import { createGeneratorPlugin, getTimestampPrefix, sanitizeMigrationName } from '@emigrate/plugin-tools';
export default createGeneratorPlugin(async (name) => {
return {
filename: `${getTimestampPrefix()}_${sanitizeMigrationName(name)}.js`,
content: `// ${name}
export default async () => {
};
`,
};
});

View file

@ -0,0 +1,8 @@
{
"extends": "@emigrate/tsconfig/build.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}