Skip to content
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

Rewrite in TypeScript #81

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
'prettier/@typescript-eslint',
'plugin:prettier/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add line break to the end

10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
/node_modules
/lib
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add line break to the end

42 changes: 23 additions & 19 deletions erb_transformer.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
delimiter = ARGV[0]
engine = ARGV[1]
handler = case engine
when 'erubi'
require 'erubi'
Erubi::Engine
when 'erubis'
require 'erubis'
Erubis::Eruby
when 'erb'
require 'erb'
ERB
else raise "Unknown templating engine `#{engine}`"
end
begin
delimiter = ARGV[0]
engine = ARGV[1]
handler = case engine
when 'erubi'
require 'erubi'
Erubi::Engine
when 'erubis'
require 'erubis'
Erubis::Eruby
when 'erb'
require 'erb'
ERB
else raise "Unknown templating engine `#{engine}`"
end

if engine == 'erubi'
puts "#{delimiter}#{eval(handler.new(STDIN.read).src)}#{delimiter}"
else
puts "#{delimiter}#{handler.new(STDIN.read).result}#{delimiter}"
end
if engine == 'erubi'
puts "#{delimiter}#{eval(handler.new(STDIN.read).src)}#{delimiter}"
else
puts "#{delimiter}#{handler.new(STDIN.read).result}#{delimiter}"
end
rescue => error
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this required in "rewrite to TS"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, I can't remember now. I probably just fixed this in testing as an attempt to capture error output.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah, I think this was to fix #63.

STDERR.puts error
end
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add line break to the end

231 changes: 0 additions & 231 deletions index.js

This file was deleted.

Loading