feat(plugin-generate-js): first version
This commit is contained in:
parent
cdafd05c20
commit
ce4693d957
4 changed files with 61 additions and 0 deletions
5
.changeset/few-dryers-remain.md
Normal file
5
.changeset/few-dryers-remain.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@emigrate/plugin-generate-js': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
First version. A simple JavaScript migration file generator.
|
||||||
36
packages/plugin-generate-js/package.json
Normal file
36
packages/plugin-generate-js/package.json
Normal 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:*"
|
||||||
|
}
|
||||||
|
}
|
||||||
12
packages/plugin-generate-js/src/index.ts
Normal file
12
packages/plugin-generate-js/src/index.ts
Normal 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 () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
});
|
||||||
8
packages/plugin-generate-js/tsconfig.json
Normal file
8
packages/plugin-generate-js/tsconfig.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"extends": "@emigrate/tsconfig/build.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "dist"
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["node_modules", "dist"]
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue