rubyjs-vite 1.0.0b
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/arguments.rb +49 -0
- data/app/main.rb +48 -0
- data/app/signals.rb +4 -0
- data/bin/rjsv +5 -0
- data/lib/json_parser.rb +96 -0
- data/lib/option_parser.rb +91 -0
- data/lib/ruby_js/constants.rb +6 -0
- data/lib/ruby_js/helper.rb +46 -0
- data/lib/ruby_js/scaffold.rb +39 -0
- data/lib/ruby_js/version.rb +3 -0
- data/lib/ruby_js.rb +46 -0
- data/share/template/bin/server +4 -0
- data/share/template/index.html +13 -0
- data/share/template/package.json +11 -0
- data/share/template/public/vite.svg +1 -0
- data/share/template/src/css/style.css +0 -0
- data/share/template/src/rjs/main.rjs +3 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aea8b3a56de6a56a42441b2ff4b1dd674bd9c2d0fb575362ea41577f0451f94a
|
4
|
+
data.tar.gz: e53b300f84563d99df1a379de6c1b2893dfe96587366415a3a50d5686317c42c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: facec2d7bd59c7d634d63d9cc29536495105d9e75eac52208fd4dde3bd96fd165853200cf266645c0c623801e9cc8fc5435793f8c2fa7caecab4eb3eca6bec97
|
7
|
+
data.tar.gz: a524d66c09b1d04d6a6f28403d62abb851c529cc3174e6c10ab1a58f8964e104ebd15849b64c3ba5ef6655a1c675f4062fdd3b9d93b4fd565c4c2d32484b1bcb
|
data/app/arguments.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "option_parser"
|
2
|
+
|
3
|
+
@options = {
|
4
|
+
compile: false,
|
5
|
+
watch: false,
|
6
|
+
output: Dir.pwd,
|
7
|
+
source: Dir.pwd,
|
8
|
+
eslevel: "2021".to_i
|
9
|
+
}
|
10
|
+
|
11
|
+
OptionParser.parse do |parser|
|
12
|
+
parser.banner(
|
13
|
+
"Converts the syntax of ruby into javascript.\n" +
|
14
|
+
"Usage: #{RubyJS::Constants::APP_NAME} [options]\n" +
|
15
|
+
"\nOptions:"
|
16
|
+
)
|
17
|
+
parser.on( "-h", "--help", "Show help" ) do
|
18
|
+
puts parser
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
parser.on( "-v", "--version", "Show version" ) do
|
22
|
+
puts "Version is #{RubyJS::VERSION}"
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
parser.on( "-c", "--compile", "Compile to JavaScript and save as .js files." ) do
|
26
|
+
@options[:compile] = true
|
27
|
+
end
|
28
|
+
parser.on( "-w", "--watch", "Watch scripts for changes and rerun commands." ) do
|
29
|
+
@options[:watch] = true
|
30
|
+
end
|
31
|
+
parser.on("-o DIR", "--output DIR", "Set the output path or path/filename\n" +
|
32
|
+
"for compiled JavaScript." ) do |dir|
|
33
|
+
@options[:output] = dir
|
34
|
+
end
|
35
|
+
parser.on("-s DIR", "--source DIR", "Set the source path or path/filename\n" +
|
36
|
+
"for RubyJS." ) do |dir|
|
37
|
+
@options[:source] = dir
|
38
|
+
end
|
39
|
+
parser.on("-es LEVEL", "--eslevel LEVEL", "ECMAScript versions for compilation.\n" +
|
40
|
+
"The default: #{@options[:eslevel]}\n" +
|
41
|
+
"(Accepted level ranges 2015...2022.)") do |level|
|
42
|
+
|
43
|
+
@options[:eslevel] = level.to_i
|
44
|
+
end
|
45
|
+
parser.on("--create PROJECT", nil, "Creates a new project using scaffolding." ) do |project|
|
46
|
+
RubyJS::Scaffold.create project
|
47
|
+
exit
|
48
|
+
end
|
49
|
+
end
|
data/app/main.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "ruby_js"
|
2
|
+
require_relative "arguments"
|
3
|
+
require_relative "signals"
|
4
|
+
|
5
|
+
def compile_fun path_f
|
6
|
+
RubyJS.compile path_f, {
|
7
|
+
eslevel: @options[:eslevel],
|
8
|
+
path_s: @options[:source],
|
9
|
+
path_o: @options[:output]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
def compile path_f
|
14
|
+
if @options[:compile]
|
15
|
+
compile_fun(path_f)
|
16
|
+
else
|
17
|
+
puts "This '#{path_f}' file was edited, but it wasn't made into a js file."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if @options[:compile]
|
22
|
+
RubyJS.get_files(@options[:source]).each do |path_f|
|
23
|
+
compile_fun(path_f)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if @options[:watch]
|
28
|
+
puts "There is now a watch for edited files."
|
29
|
+
path_s = @options[:source]
|
30
|
+
|
31
|
+
RubyJS::Helper.create_dir(path_s)
|
32
|
+
RubyJS.watch path_s do |modified, added, removed|
|
33
|
+
unless added.empty?
|
34
|
+
compile(added.last)
|
35
|
+
end
|
36
|
+
|
37
|
+
unless modified.empty?
|
38
|
+
compile(modified.last)
|
39
|
+
end
|
40
|
+
|
41
|
+
unless removed.empty?
|
42
|
+
RubyJS.free removed.last, {
|
43
|
+
path_s: @options[:source],
|
44
|
+
path_o: @options[:output]
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/app/signals.rb
ADDED
data/bin/rjsv
ADDED
data/lib/json_parser.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
require "json"
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
class JsonParser
|
5
|
+
attr_reader :db
|
6
|
+
|
7
|
+
def initialize path, auto_write = true
|
8
|
+
@path = path
|
9
|
+
@db = open @path
|
10
|
+
@auto_write = auto_write
|
11
|
+
end
|
12
|
+
|
13
|
+
def on symbol, value
|
14
|
+
if exist?
|
15
|
+
parse symbol, value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse symbols, value = nil, delete = nil
|
20
|
+
symbols_join = ""
|
21
|
+
if symbols.class.name == "Array"
|
22
|
+
symbols_join = symbols.join("\"][\"")
|
23
|
+
else
|
24
|
+
symbols_join = symbols.to_s
|
25
|
+
end
|
26
|
+
symbols_join = "[\"#{symbols_join}\"]"
|
27
|
+
|
28
|
+
unless delete
|
29
|
+
unless value
|
30
|
+
eval "@db#{ symbols_join }"
|
31
|
+
else
|
32
|
+
eval "@db#{ symbols_join } = value"
|
33
|
+
|
34
|
+
if @auto_write
|
35
|
+
write @path, @db
|
36
|
+
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
if symbols
|
40
|
+
eval "@db#{ symbols_join }.delete('#{delete}')"
|
41
|
+
else
|
42
|
+
eval "@db.delete('#{delete}')"
|
43
|
+
end
|
44
|
+
|
45
|
+
if @auto_write
|
46
|
+
write @path, @db
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def exist?
|
52
|
+
@db.empty?
|
53
|
+
end
|
54
|
+
|
55
|
+
def delete key, symbols = nil
|
56
|
+
parse(symbols, nil, key)
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def open path
|
61
|
+
begin
|
62
|
+
result = String.new
|
63
|
+
File.open path do |f|
|
64
|
+
result = JSON.parse f.read
|
65
|
+
end
|
66
|
+
|
67
|
+
return result
|
68
|
+
rescue
|
69
|
+
return Hash.new
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def write path, db
|
74
|
+
begin
|
75
|
+
create_dir path do
|
76
|
+
|
77
|
+
f = File.new path, "w"
|
78
|
+
f.write JSON.pretty_generate db
|
79
|
+
f.close
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def create_dir path, &callback
|
85
|
+
begin
|
86
|
+
dir_path = File.dirname path
|
87
|
+
unless Dir.exist? dir_path
|
88
|
+
FileUtils.mkpath dir_path
|
89
|
+
end
|
90
|
+
|
91
|
+
callback.call
|
92
|
+
rescue
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
class OptionParser
|
2
|
+
|
3
|
+
LEFT = 2
|
4
|
+
MIDDLE = 28
|
5
|
+
|
6
|
+
attr_reader :args
|
7
|
+
|
8
|
+
def self.parse(args = ARGV)
|
9
|
+
parser = OptionParser.new
|
10
|
+
yield parser
|
11
|
+
parser.process args
|
12
|
+
parser
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.last_arg(args = ARGV)
|
16
|
+
args.length >= 1 ? args[args.length - 1] : nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(args = ARGV)
|
20
|
+
@args = args
|
21
|
+
@banner = nil
|
22
|
+
@flags = Array.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def banner(banner)
|
26
|
+
@banner = banner
|
27
|
+
end
|
28
|
+
|
29
|
+
def on(short_flag, long_flag, description, &block)
|
30
|
+
@flags << { short_flag: short_flag || '', long_flag: long_flag || '',
|
31
|
+
description: description || '', block: block }
|
32
|
+
end
|
33
|
+
|
34
|
+
def process( args = ARGV )
|
35
|
+
unless args.length == 0
|
36
|
+
args.each_with_index do |arg, i|
|
37
|
+
@flags.each do |flag|
|
38
|
+
name = -> (type_flag) do
|
39
|
+
flag[type_flag].gsub( /[a-z -]/, '' )
|
40
|
+
end
|
41
|
+
|
42
|
+
flag_strip = -> (type_flag) do
|
43
|
+
flag[type_flag].sub( name.(type_flag), '' ).strip()
|
44
|
+
end
|
45
|
+
has_flag = -> (type_flag) { arg == flag_strip.(type_flag) }
|
46
|
+
|
47
|
+
if has_flag.(:short_flag) or
|
48
|
+
has_flag.(:long_flag)
|
49
|
+
|
50
|
+
has_name = -> (type_flag) do
|
51
|
+
name.(type_flag) != ""
|
52
|
+
end
|
53
|
+
value = nil
|
54
|
+
|
55
|
+
if has_name.(:short_flag) or
|
56
|
+
has_name.(:long_flag)
|
57
|
+
value = args[i + 1]
|
58
|
+
end
|
59
|
+
|
60
|
+
flag[:block].call( value )
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
else
|
65
|
+
flag = @flags[0]
|
66
|
+
flag[:block].call
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.get_empty_spaces
|
71
|
+
" " * (MIDDLE + LEFT)
|
72
|
+
end
|
73
|
+
|
74
|
+
def to_s()
|
75
|
+
io = Array.new
|
76
|
+
if banner = @banner
|
77
|
+
io << banner
|
78
|
+
io << "\n"
|
79
|
+
end
|
80
|
+
|
81
|
+
@flags.each do |flag|
|
82
|
+
l_flag = !flag[:long_flag].empty? ? ", #{flag[:long_flag]}" : ""
|
83
|
+
flags = "#{flag[:short_flag]}#{l_flag}".ljust(MIDDLE)
|
84
|
+
desc = flag[:description].gsub("\n", "\n#{OptionParser.get_empty_spaces}")
|
85
|
+
io << "".ljust(LEFT) + flags + desc
|
86
|
+
io << "\n"
|
87
|
+
end
|
88
|
+
|
89
|
+
io.join
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RubyJS
|
2
|
+
module Helper
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
def self.open path
|
6
|
+
result = ""
|
7
|
+
|
8
|
+
if File.exist? path
|
9
|
+
File.open path do |f|
|
10
|
+
result = f.read
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.write path_o, content
|
18
|
+
path_od = File.dirname(path_o)
|
19
|
+
create_dir(path_od)
|
20
|
+
|
21
|
+
file = File.new(path_o, "w+")
|
22
|
+
file.write content
|
23
|
+
file.close
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.free path_o
|
27
|
+
File.delete(path_o) if File.exists? path_o
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.event_p event, path_f
|
31
|
+
"#{Time.now.strftime("%l:%M:%S %p").lstrip} [#{Constants::APP_NAME}] #{event} #{path_f}"
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.absolute_path path_f, path_options, prefix = "js"
|
35
|
+
path_ffr = path_f.sub("#{Dir.pwd}/", '').sub(path_options[:path_s], '').sub(Constants::FILE_TYPE, prefix)
|
36
|
+
path_ffa = File.join(path_options[:path_o], path_ffr)
|
37
|
+
path_ffa
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.create_dir path
|
41
|
+
unless Dir.exist? path
|
42
|
+
FileUtils.mkdir_p path
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RubyJS
|
2
|
+
module Scaffold
|
3
|
+
require "json_parser"
|
4
|
+
|
5
|
+
def self.create project
|
6
|
+
path_as = File.expand_path("./share/template", ROOT)
|
7
|
+
path_ao = File.join(Dir.pwd, project)
|
8
|
+
|
9
|
+
puts "Scaffolding project in #{path_ao}..."
|
10
|
+
FileUtils.copy_entry path_as, path_ao
|
11
|
+
|
12
|
+
json_oc = JsonParser.new File.join(path_ao, "package.json")
|
13
|
+
json_oc.parse :name, project.downcase
|
14
|
+
|
15
|
+
change_server_f(path_ao)
|
16
|
+
install_vite(project, path_ao)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.change_server_f path_ao
|
20
|
+
path_bin_ao = "#{path_ao}/bin/server"
|
21
|
+
content = Helper.open(path_bin_ao)
|
22
|
+
content_ch = content.sub("APP_NAME", Constants::APP_NAME)
|
23
|
+
Helper.write(path_bin_ao, content_ch)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.install_vite project, path_ao
|
27
|
+
is_done = system("cd #{path_ao} && npm install -D vite")
|
28
|
+
if is_done
|
29
|
+
puts "\nDone. Now run:\n\n cd #{project}\n bin/server\n\n"
|
30
|
+
else
|
31
|
+
puts "\nThe Vite library installation encountered an issue.\n" +
|
32
|
+
"NPM is probably not installed on your machine.\n\n" +
|
33
|
+
"Please rerun the Vite installation after installing NodeJS.\n" +
|
34
|
+
"In your project, use the following command:\n\n" +
|
35
|
+
"#{' '*2}npm install -D vite"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/ruby_js.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'ruby2js'
|
2
|
+
require "ruby2js/filter/esm"
|
3
|
+
require "listen"
|
4
|
+
require "option_parser"
|
5
|
+
|
6
|
+
module RubyJS
|
7
|
+
require "ruby_js/version"
|
8
|
+
require "ruby_js/helper"
|
9
|
+
require "ruby_js/constants"
|
10
|
+
require "ruby_js/scaffold"
|
11
|
+
|
12
|
+
def self.watch path
|
13
|
+
listener = Listen.to(path, only: /\.#{Constants::FILE_TYPE}$/) do |modified, added, removed|
|
14
|
+
yield modified, added, removed
|
15
|
+
end
|
16
|
+
listener.start
|
17
|
+
sleep
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.compile path_f, options
|
21
|
+
path_o = Helper.absolute_path path_f, { path_s: options[:path_s], path_o: options[:path_o] }
|
22
|
+
|
23
|
+
begin
|
24
|
+
content_rb = Helper.open(path_f)
|
25
|
+
content_js = Ruby2JS.convert(content_rb, eslevel: options[:eslevel]) unless content_rb.empty?
|
26
|
+
|
27
|
+
path_write = Helper.write(path_o, content_js)
|
28
|
+
puts Helper.event_p("compiled", path_o)
|
29
|
+
rescue => exception
|
30
|
+
# p exception.inspect
|
31
|
+
puts Helper.event_p("error", "#{path_o} #{exception}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.free path_f, options
|
36
|
+
path_o = Helper.absolute_path path_f, options
|
37
|
+
Helper.free path_o
|
38
|
+
|
39
|
+
puts Helper.event_p("deleted", path_o)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get_files(path_s)
|
43
|
+
path = "#{path_s}/**/*.#{Constants::FILE_TYPE}"
|
44
|
+
Dir.glob(path)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8" />
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
+
<title>Vite App</title>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
<div id="app"></div>
|
11
|
+
<script type="module" src="/src/.js/main.js"></script>
|
12
|
+
</body>
|
13
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubyjs-vite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0b
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Filip Vrba
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-04 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: "# RubyJS Vite\nWeb applications may be made with the help of RubyJS
|
14
|
+
Vite. The programmer can avoid using JS syntax, which is helpful. Everything is
|
15
|
+
done automatically; all you have to do is start the server and build a project using
|
16
|
+
scaffolding.\n\nWrite your code using the JS api and Ruby syntax, and the server
|
17
|
+
will automatically translate it. It then stores it in a file with the extension
|
18
|
+
\".js\". You will then be able to publish the project to [Vercel](https://vercel.com/)
|
19
|
+
or directly to the [NPM package](https://www.npmjs.com/), and you will have a website
|
20
|
+
that is written in the native JS language.\n\n### Content\n- [1 Installation](#1-installation)\n-
|
21
|
+
[2 Usage](#2-usage)\n - [2.1 Scaffold](#21-scaffold)\n - [2.2 More parameters](#22-more-parameters)\n-
|
22
|
+
[3 Development](#3-development)\n- [4 Unexpected errors](#4-unexpected-errors)\n
|
23
|
+
\ - [4.1 Third-party libraries](#41-third-party-libraries)\n - [4.2 NPM](#42-npm)\n-
|
24
|
+
[5 Examples](#5-examples)\n- [6 Contributors](#6-contributors)\n\n## 1 Installation\nThe
|
25
|
+
executable application and libraries are installed using the ruby gem during installation.\n\n```bash\ngem
|
26
|
+
install rubyjs-vite\n```\n\n## 2 Usage\nRubyJS Vite has a unique command that can
|
27
|
+
be used at the terminal called **rjsv**.\n\n### 2.1 Scaffold\nThe **—create** parameter
|
28
|
+
should be followed by the project name if you want to create your own project.\n\n*Use
|
29
|
+
this command as an example, then follow the instructions the terminal gives you:*\n```bash\nrjsv
|
30
|
+
--create hello\n```\n\n![rjsv-scaffold](./public/rjsv_scaffold.gif)\n\n### 2.2 More
|
31
|
+
parameters\nIf you only need to convert files to *.js* format rather than build
|
32
|
+
scaffolding.\nTherefore, there is an argument for this function called **-c** or
|
33
|
+
**—compile**.\n\nYou must include an additional parameter called **-w** or **—watch**
|
34
|
+
so that the compilation always happens after saving the *.rjs* file.\n\nOther choices
|
35
|
+
include which directory will be searched for updated files and which directory will
|
36
|
+
house all transformed code. The code can also be converted into the chosen EC level,
|
37
|
+
with 2021 as the default level. Enter **rjsv -h** in the terminal for more details.\n\n*Example
|
38
|
+
for compiling and tracking files:*\n```bash\nrjsv -c -w -s src/rjs -o src/js\n```\n\n![rjsv-compile-watch](./public/rjsv_cw.gif)\n\n##
|
39
|
+
3 Development\nLook in the *'lib'* folder if you want to edit this RubyJS Vite project.
|
40
|
+
Everything you require for file transformation and change tracking is available.
|
41
|
+
The console portion is under the *'app'* subdirectory. Everything that needs to
|
42
|
+
be executed with various arguments is available here. \n\n*The following third-party
|
43
|
+
libraries are employed:*\n- [ruby2js](https://rubygems.org/gems/ruby2js)\n- [listen](https://rubygems.org/gems/listen)\n\n##
|
44
|
+
4 Unexpected errors\nWhen using this utility, some problems could happen.\n\n###
|
45
|
+
4.1 Third-party libraries\nCertain library dependencies must be installed for the
|
46
|
+
program to function as a whole. (The section on [development](#3-development) has
|
47
|
+
more details regarding libraries.)\n\n*Use this command if the software indicates
|
48
|
+
that the library was not found:*\n```bash\ngem install ruby2js &&\ngem install listen\n```\n\n###
|
49
|
+
4.2 NPM\nThe process of constructing a project could go wrong. This is because Vite
|
50
|
+
is attempting to be installed using the NPM tool during the scaffolding phase. This
|
51
|
+
indicates that your machine does not have NodeJS installed. [Installing it is necessary!](https://nodejs.org)
|
52
|
+
Run a command in your project to install the Vite library after you've finished
|
53
|
+
the installation.\n\n*Vite installation command:*\n```bash\nnpm install -D vite\n```\n\nYou
|
54
|
+
can launch the server and begin developing your project after the installation has
|
55
|
+
been successfully completed.\n\n*An order to launch the server:*\n```bash\nbin/server\n```\n\n##
|
56
|
+
5 Examples\nHere, I'll outline a few projects where RubyJS Vite was applied to alter
|
57
|
+
code.\n\n- [adb2-weapon-rjs](https://github.com/filipvrba/adb2-weapon-rjs) - Here,
|
58
|
+
a web application was built with scaffolding and uploaded to Vercel.\n- [suitescript-generator](https://github.com/filipvrba/suitescript-generator)
|
59
|
+
- It is a console program that utilizes npm. Here, the file tracking and compilation
|
60
|
+
command is employed. \n\n## 6 Contributors\n- [Filip Vrba](https://github.com/filipvrba)
|
61
|
+
- creator and maintainer\n"
|
62
|
+
email: filipvrbaxi@gmail.com
|
63
|
+
executables:
|
64
|
+
- rjsv
|
65
|
+
extensions: []
|
66
|
+
extra_rdoc_files: []
|
67
|
+
files:
|
68
|
+
- app/arguments.rb
|
69
|
+
- app/main.rb
|
70
|
+
- app/signals.rb
|
71
|
+
- bin/rjsv
|
72
|
+
- lib/json_parser.rb
|
73
|
+
- lib/option_parser.rb
|
74
|
+
- lib/ruby_js.rb
|
75
|
+
- lib/ruby_js/constants.rb
|
76
|
+
- lib/ruby_js/helper.rb
|
77
|
+
- lib/ruby_js/scaffold.rb
|
78
|
+
- lib/ruby_js/version.rb
|
79
|
+
- share/template/bin/server
|
80
|
+
- share/template/index.html
|
81
|
+
- share/template/package.json
|
82
|
+
- share/template/public/vite.svg
|
83
|
+
- share/template/src/css/style.css
|
84
|
+
- share/template/src/rjs/main.rjs
|
85
|
+
homepage: https://rubygems.org/gems/rubyjs-vite
|
86
|
+
licenses:
|
87
|
+
- MIT
|
88
|
+
metadata:
|
89
|
+
source_code_uri: https://github.com/filipvrba/ruby-js
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.3.1
|
104
|
+
requirements: []
|
105
|
+
rubygems_version: 3.4.0.dev
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Converts the syntax of ruby into javascript.
|
109
|
+
test_files: []
|