File create-node-modules.rb of Package element

#!/usr/bin/env ruby

require "fileutils"

class Generate

    def initialize
        @npm_packages_cache_path = "./npm-packages-offline-cache"
    end

    def perform
        FileUtils.rm_rf "#{__dir__}/temp_repo"

        `git clone https://github.com/vector-im/element-web.git temp_repo`
        Dir.chdir "temp_repo" do
            `git checkout master`

            # NOTE: --production-true can’t be used as some modules seems to be missing with it.
            `yarn install`
            #`npm install`

            `tar cfJp node_modules.tar.xz node_modules/`
            FileUtils.mv "node_modules.tar.xz", ".."
        end
    end
end

generate = Generate.new
generate.perform