typesmith 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/typesmith/generator.rb +13 -2
- data/lib/typesmith/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7f4e800264a5c0dd9fe51e09f4969c154dba5f1f693ce1f699d6dc542fb800b
|
4
|
+
data.tar.gz: aa95236c68def51f5e1d866b4d340a5f6832d43e8fe88e6c869b9ccb061baee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e735a1bb14b254d8b71eddb4621e6804b7b1ff32424478e919bc2bbc5daf643462cb97a6ae4dffd774f8d3cda5651525bca1940550d7ab153736e71c26f1acc
|
7
|
+
data.tar.gz: 38af486d897e05a7c27a8faf943035a77550253e82c97db3185256e114edf25b8dfe69ee2a0cd2009e5c39b57b551ed20c817df5fa7b5edeed87f3b51872605b
|
data/lib/typesmith/generator.rb
CHANGED
@@ -10,6 +10,14 @@ module Typesmith
|
|
10
10
|
new.generate_all(base_path: base_path)
|
11
11
|
end
|
12
12
|
|
13
|
+
HEADER = <<-HEADER
|
14
|
+
/**
|
15
|
+
* This file was auto-generated by Typesmith. DO NOT EDIT.
|
16
|
+
* https://github.com/johnpanos/typesmith
|
17
|
+
*/
|
18
|
+
|
19
|
+
HEADER
|
20
|
+
|
13
21
|
def generate_all(base_path:)
|
14
22
|
@base_path = base_path
|
15
23
|
|
@@ -30,7 +38,9 @@ module Typesmith
|
|
30
38
|
FileUtils.mkdir_p(directory)
|
31
39
|
|
32
40
|
file_name = "#{File.basename(module_path)}.ts"
|
33
|
-
|
41
|
+
|
42
|
+
content = HEADER
|
43
|
+
content += generate_imports(klass)
|
34
44
|
content += klass.to_typescript
|
35
45
|
|
36
46
|
full_path = File.join(directory, file_name)
|
@@ -112,7 +122,8 @@ module Typesmith
|
|
112
122
|
directories.each do |directory|
|
113
123
|
files_in_directory = generated_files.select { |file| File.dirname(file[:path]) == directory }
|
114
124
|
|
115
|
-
index_content =
|
125
|
+
index_content = HEADER
|
126
|
+
index_content += files_in_directory.map do |file|
|
116
127
|
file_name = File.basename(file[:path], ".ts")
|
117
128
|
"export { #{file[:type_name]} } from './#{file_name}';"
|
118
129
|
end.join("\n")
|
data/lib/typesmith/version.rb
CHANGED