Skip to content

feat(plugin): Typescript plugin #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nmpignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests
30 changes: 30 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {

loadPlugin: function() {

module.exports = Object.assign(module.exports, {

'migrator:migration:hook:require': function() {

/**
* Always delay requires, otherwise your plugin will cause trouble
* with db-migrates performance and generates issues to your users.
*/
require('typescript').register();

/**
* Return value of this hook can be both, pure value or a promise.
*/
return {
extensions: 'ts'
};
}
});

delete module.exports.loadPlugin;
},
name: 'typescript',
hooks: [
'migrator:migration:hook:require'
]
};
37 changes: 37 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "db-migrate-plugin-typescript",
"version": "1.0.0",
"description": "A db-migrate plugin to enable Typescript style migrations.",
"main": "index.js",
"dependencies": {
"typescript": "^1.8.10"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/db-migrate/plugin-typescript.git"
},
"keywords": [
"dbmigrate",
"db-migrate",
"db",
"migrate",
"migration",
"migrator",
"database",
"sql",
"nosql",
"newsql",
"typescript",
"type-script"
],
"author": "Rémy Jeancolas <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/db-migrate/plugin-typescript/issues"
},
"homepage": "https://github.com/db-migrate/plugin-typescript#readme"
}