dopstick 0.0.3 → 0.0.7

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.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.github/CODEOWNERS +4 -0
  3. data/.github/FUNDING.yml +1 -1
  4. data/.github/dependabot.yml +15 -0
  5. data/.github/workflows/tests.yml +10 -12
  6. data/.rubocop.yml +12 -7
  7. data/CHANGELOG.md +26 -0
  8. data/CONTRIBUTING.md +1 -1
  9. data/README.md +6 -3
  10. data/dopstick.gemspec +4 -2
  11. data/lib/dopstick/cli.rb +41 -12
  12. data/lib/dopstick/{templates → generator/base/templates}/bug_report.erb +1 -1
  13. data/lib/dopstick/{templates/CHANGELOG.md → generator/base/templates/changelog.erb} +0 -0
  14. data/lib/dopstick/{templates → generator/base/templates}/coc.erb +1 -1
  15. data/lib/dopstick/generator/base/templates/codeowners.erb +4 -0
  16. data/lib/dopstick/{templates → generator/base/templates}/contributing.erb +5 -5
  17. data/lib/dopstick/generator/base/templates/dependabot.erb +15 -0
  18. data/lib/dopstick/{templates → generator/base/templates}/feature_request.erb +0 -0
  19. data/lib/dopstick/generator/base/templates/funding.erb +4 -0
  20. data/lib/dopstick/{templates → generator/base/templates}/gitignore.erb +0 -0
  21. data/lib/dopstick/{templates → generator/base/templates}/issue.erb +0 -0
  22. data/lib/dopstick/{templates → generator/base/templates}/license.erb +1 -1
  23. data/lib/dopstick/{templates → generator/base/templates}/pull_request.erb +0 -0
  24. data/lib/dopstick/{templates → generator/base/templates}/setup.erb +0 -0
  25. data/lib/dopstick/generator/gem/generator.rb +173 -0
  26. data/lib/dopstick/generator/gem/options.rb +34 -0
  27. data/lib/dopstick/{templates → generator/gem/templates}/active_record.erb +25 -0
  28. data/lib/dopstick/generator/gem/templates/bin.erb +5 -0
  29. data/lib/dopstick/{templates → generator/gem/templates}/cli.erb +0 -0
  30. data/lib/dopstick/{templates → generator/gem/templates}/cli_class.erb +0 -0
  31. data/lib/dopstick/{templates → generator/gem/templates}/console.erb +1 -1
  32. data/lib/dopstick/generator/gem/templates/entry_file.erb +3 -0
  33. data/lib/dopstick/generator/gem/templates/gem_entry_file.erb +3 -0
  34. data/lib/dopstick/{templates → generator/gem/templates}/gemfile.erb +0 -0
  35. data/lib/dopstick/{templates → generator/gem/templates}/gemspec.erb +14 -13
  36. data/lib/dopstick/{templates → generator/gem/templates}/generator.erb +0 -0
  37. data/lib/dopstick/{templates → generator/gem/templates}/generator_class.erb +0 -0
  38. data/lib/dopstick/{templates → generator/gem/templates}/rakefile.erb +0 -0
  39. data/lib/dopstick/generator/gem/templates/readme.erb +50 -0
  40. data/lib/dopstick/generator/gem/templates/rubocop.erb +12 -0
  41. data/lib/dopstick/{templates → generator/gem/templates}/test_file.erb +1 -1
  42. data/lib/dopstick/{templates → generator/gem/templates}/test_helper.erb +1 -1
  43. data/lib/dopstick/{templates → generator/gem/templates}/tests_workflow.erb +9 -12
  44. data/lib/dopstick/{templates → generator/gem/templates}/version.erb +0 -0
  45. data/lib/dopstick/generator/npm/generator.rb +106 -0
  46. data/lib/dopstick/generator/npm/options.rb +26 -0
  47. data/lib/dopstick/generator/npm/templates/babel.erb +15 -0
  48. data/lib/dopstick/generator/npm/templates/eslint.erb +4 -0
  49. data/lib/dopstick/generator/npm/templates/index.erb +12 -0
  50. data/lib/dopstick/generator/npm/templates/index_test.erb +7 -0
  51. data/lib/dopstick/generator/npm/templates/jest.erb +12 -0
  52. data/lib/dopstick/generator/npm/templates/package.erb +42 -0
  53. data/lib/dopstick/generator/npm/templates/prettier.erb +1 -0
  54. data/lib/dopstick/generator/npm/templates/readme.erb +52 -0
  55. data/lib/dopstick/generator/npm/templates/tests_workflow.erb +49 -0
  56. data/lib/dopstick/generator/npm/templates/tsconfig.erb +14 -0
  57. data/lib/dopstick/generator/npm/templates/webpack.erb +33 -0
  58. data/lib/dopstick/generator/options.rb +65 -0
  59. data/lib/dopstick/generator.rb +3 -208
  60. data/lib/dopstick/version.rb +1 -1
  61. data/lib/dopstick.rb +7 -1
  62. metadata +60 -39
  63. data/lib/dopstick/templates/bin.erb +0 -5
  64. data/lib/dopstick/templates/entry_file.erb +0 -3
  65. data/lib/dopstick/templates/funding.erb +0 -4
  66. data/lib/dopstick/templates/gem_entry_file.erb +0 -3
  67. data/lib/dopstick/templates/readme.erb +0 -50
  68. data/lib/dopstick/templates/rubocop.erb +0 -12
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require <%= gem_name.inspect %>
5
+ require <%= options.package_name.inspect %>
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ <%= render_tree { %[require "#{options.entry_path}/version"] } %>
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require <%= options.entry_path.inspect %>
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "./lib/<%= entry_path %>/version"
3
+ require_relative "./lib/<%= options.entry_path %>/version"
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "<%= gem_name %>"
7
- spec.version = <%= options[:namespace] %>::VERSION
8
- spec.authors = [<%= user_name.inspect %>]
9
- spec.email = [<%= user_email.inspect %>]
6
+ spec.name = "<%= options.package_name %>"
7
+ spec.version = <%= options.namespace %>::VERSION
8
+ spec.authors = [<%= options.user_name.inspect %>]
9
+ spec.email = [<%= options.user_email.inspect %>]
10
+ spec.metadata = {"rubygems_mfa_required" => "true"}
10
11
 
11
- spec.summary = "Add some description"
12
+ spec.summary = <%= options.description.inspect %>
12
13
  spec.description = spec.summary
13
14
  spec.license = "MIT"
14
- spec.required_ruby_version = Gem::Requirement.new(">= <%= oldest_ruby_version %>")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= <%= options.oldest_ruby_version %>")
15
16
 
16
- github_url = <%= github_url.inspect %>
17
+ github_url = <%= options.github_url.inspect %>
17
18
  github_tree_url = "#{github_url}/tree/v#{spec.version}"
18
19
 
19
20
  spec.homepage = github_url
@@ -34,20 +35,20 @@ Gem::Specification.new do |spec|
34
35
  spec.executables = spec.files.grep(%r{^exe/}) {|f| File.basename(f) }
35
36
  spec.require_paths = ["lib"]
36
37
 
37
- <%- if options[:active_record] -%>
38
+ <%- if options.active_record -%>
38
39
  spec.add_dependency "activerecord"
39
40
  <%- end -%>
40
- <%- unless options[:bin].empty? -%>
41
+ <%- if options.bin? -%>
41
42
  spec.add_dependency "thor"
42
43
  <%- end -%>
43
44
  spec.add_development_dependency "minitest"
44
45
  spec.add_development_dependency "minitest-utils"
46
+ <%- if options.active_record? -%>
47
+ spec.add_development_dependency "pg"
48
+ <%- end -%>
45
49
  spec.add_development_dependency "pry-meta"
46
50
  spec.add_development_dependency "rake"
47
51
  spec.add_development_dependency "rubocop"
48
52
  spec.add_development_dependency "rubocop-fnando"
49
53
  spec.add_development_dependency "simplecov"
50
- <%- if options[:active_record] -%>
51
- spec.add_development_dependency "pg"
52
- <%- end -%>
53
54
  end
@@ -0,0 +1,50 @@
1
+ # <%= options.package_name %>
2
+
3
+ [![Tests](<%= options.github_url %>/workflows/ruby-tests/badge.svg)](https://github.com/fnando/<%= options.package_name %>)
4
+ [![Code Climate](https://codeclimate.com/github/<%= options.github_user %>/<%= options.package_name %>/badges/gpa.svg)](https://codeclimate.com/github/<%= options.github_user %>/<%= options.package_name %>)
5
+ [![Gem](https://img.shields.io/gem/v/<%= options.package_name %>.svg)](https://rubygems.org/gems/<%= options.package_name %>)
6
+ [![Gem](https://img.shields.io/gem/dt/<%= options.package_name %>.svg)](https://rubygems.org/gems/<%= options.package_name %>)
7
+
8
+ <%= options.description %>
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ gem install <%= options.package_name %>
14
+ ```
15
+
16
+ Or add the following line to your project's Gemfile:
17
+
18
+ ```ruby
19
+ gem "<%= options.package_name %>"
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ TODO: Write gem usage
25
+
26
+ ## Maintainer
27
+
28
+ - [<%= options.user_name %>](https://github.com/<%= options.github_user %>)
29
+
30
+ ## Contributors
31
+
32
+ - <%= options.github_url %>/contributors
33
+
34
+ ## Contributing
35
+
36
+ For more details about how to contribute, please read
37
+ <%= options.github_url %>/blob/main/CONTRIBUTING.md.
38
+
39
+
40
+ ## License
41
+
42
+ The gem is available as open source under the terms of the
43
+ [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
44
+ found at <%= options.github_url %>/blob/main/LICENSE.md.
45
+
46
+ ## Code of Conduct
47
+
48
+ Everyone interacting in the <%= options.package_name %> project's codebases, issue trackers,
49
+ chat rooms and mailing lists is expected to follow the
50
+ [code of conduct](<%= options.github_url %>/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,12 @@
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
4
+
5
+ AllCops:
6
+ TargetRubyVersion: <%= options.oldest_ruby_version.split(".").take(2).join(".") %>
7
+ NewCops: enable
8
+ <%- if options.package_name.include?("-") -%>
9
+ Naming/FileName:
10
+ Exclude:
11
+ - lib/<%= options.package_name %>.rb
12
+ <%- end -%>
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "test_helper"
4
4
 
5
- class <%= const_names.last %>Test < Minitest::Test
5
+ class <%= options.namespace_names.last %>Test < Minitest::Test
6
6
  test "passes" do
7
7
  assert true
8
8
  end
@@ -4,7 +4,7 @@ require "simplecov"
4
4
  SimpleCov.start
5
5
 
6
6
  require "bundler/setup"
7
- require <%= gem_name.inspect %>
7
+ require <%= options.package_name.inspect %>
8
8
 
9
9
  require "minitest/utils"
10
10
  require "minitest/autorun"
@@ -1,15 +1,10 @@
1
- name: Tests
1
+ name: ruby-tests
2
2
 
3
3
  on:
4
4
  pull_request:
5
- branches:
6
- - main
7
5
  push:
8
- branches:
9
- - main
10
-
11
- schedule:
12
- - cron: "0 10 * * *"
6
+ workflow_dispatch:
7
+ inputs: {}
13
8
 
14
9
  jobs:
15
10
  build:
@@ -18,11 +13,11 @@ jobs:
18
13
  strategy:
19
14
  fail-fast: false
20
15
  matrix:
21
- ruby: [<%= ruby_versions.map {|v| [*Gem::Version.new(v).canonical_segments, "x"].take(3).join(".") }.join(", ") %>]
16
+ ruby: [<%= ruby_versions_for_workflow %>]
22
17
  gemfile:
23
18
  - Gemfile
24
19
 
25
- <%- if options[:active_record] -%>
20
+ <%- if options.active_record? -%>
26
21
  services:
27
22
  postgres:
28
23
  image: postgres:11.5
@@ -44,11 +39,11 @@ jobs:
44
39
  ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles(matrix.gemfile) }}
45
40
 
46
41
  - name: Set up Ruby
47
- uses: actions/setup-ruby@v1
42
+ uses: ruby/setup-ruby@v1
48
43
  with:
49
44
  ruby-version: ${{ matrix.ruby }}
50
45
 
51
- <%- if options[:active_record] -%>
46
+ <%- if options.active_record? -%>
52
47
  - name: Install PostgreSQL client
53
48
  env:
54
49
  PGHOST: localhost
@@ -68,6 +63,8 @@ jobs:
68
63
 
69
64
  - name: Run Tests
70
65
  env:
66
+ PGHOST: localhost
67
+ PGUSER: postgres
71
68
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
72
69
  run: |
73
70
  bundle exec rake
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dopstick
4
+ module Generator
5
+ module NPM
6
+ Generator.registered["npm"] = self
7
+
8
+ class Generator < Thor::Group
9
+ using Dopstick::Refinements
10
+ include Thor::Actions
11
+
12
+ attr_accessor :options
13
+
14
+ desc "Generate a new npm folder structure"
15
+
16
+ def self.exit_on_failure?
17
+ true
18
+ end
19
+
20
+ def self.source_paths
21
+ [
22
+ source_root,
23
+ File.join(__dir__, "../base/templates")
24
+ ]
25
+ end
26
+
27
+ def self.source_root
28
+ File.join(__dir__, "templates")
29
+ end
30
+
31
+ def copy_npm_templates
32
+ template "package.erb", "package.json"
33
+ template "tests_workflow.erb", ".github/workflows/js-tests.yml"
34
+ template "tsconfig.erb", "tsconfig.json"
35
+ template "prettier.erb", "prettier.config.js"
36
+ template "jest.erb", "jest.config.js"
37
+ template "eslint.erb", ".eslintrc.js"
38
+ template "webpack.erb", "webpack.config.js"
39
+ template "babel.erb", "babel.config.json"
40
+ template "index.erb", "src/index.ts"
41
+ template "index_test.erb", "src/index.test.ts"
42
+ end
43
+
44
+ def copy_generic_templates
45
+ template "license.erb", "LICENSE.md"
46
+ template "coc.erb", "CODE_OF_CONDUCT.md"
47
+ template "readme.erb", "README.md"
48
+ template "changelog.erb", "CHANGELOG.md"
49
+ template "contributing.erb", "CONTRIBUTING.md"
50
+ template "gitignore.erb", ".gitignore"
51
+ end
52
+
53
+ def copy_github_templates
54
+ template "funding.erb", ".github/FUNDING.yml"
55
+ template "bug_report.erb", ".github/ISSUE_TEMPLATE/bug_report.md"
56
+ template "feature_request.erb",
57
+ ".github/ISSUE_TEMPLATE/feature_request.md"
58
+ template "pull_request.erb", ".github/PULL_REQUEST_TEMPLATE.md"
59
+ template "dependabot.erb", ".github/dependabot.yml"
60
+ template "codeowners.erb", ".github/CODEOWNERS"
61
+ end
62
+
63
+ def install_dependencies
64
+ return if options.skip_install?
65
+
66
+ in_root do
67
+ %w[
68
+ @babel/core
69
+ @babel/preset-env
70
+ @fnando/codestyle
71
+ @fnando/eslint-config-codestyle
72
+ @typescript-eslint/eslint-plugin
73
+ @typescript-eslint/parser
74
+ babel-loader
75
+ babel-plugin-module-resolver
76
+ eslint
77
+ jest
78
+ jest-filename-transform
79
+ prettier
80
+ ts-jest
81
+ ts-loader
82
+ typescript
83
+ webpack
84
+ webpack-cli
85
+ ].each do |dep|
86
+ run "yarn add --dev #{dep}", capture: true
87
+ end
88
+ end
89
+ end
90
+
91
+ def initialize_repo
92
+ in_root do
93
+ run "git init --initial-branch=main", capture: true
94
+ run "git add .", capture: true
95
+ end
96
+ end
97
+
98
+ no_commands do
99
+ def dependabot_package_ecosystem
100
+ "npm"
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dopstick
4
+ module Generator
5
+ module NPM
6
+ class Options < Generator::Options
7
+ using Refinements
8
+
9
+ def user_name
10
+ `npm get init.author.name`.chomp.presence ||
11
+ super
12
+ end
13
+
14
+ def user_email
15
+ `npm get init.author.email`.chomp.presence ||
16
+ super
17
+ end
18
+
19
+ def user_url
20
+ `npm get init.author.url`.chomp.presence ||
21
+ "https://github.com/#{github_user}"
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,15 @@
1
+ {
2
+ "presets": ["@babel/preset-env"],
3
+ "plugins": [
4
+ [
5
+ "module-resolver",
6
+ {
7
+ "extensions": [".js", ".ts"],
8
+ "root": ["./src"],
9
+ "alias": {
10
+ "~": "./src"
11
+ }
12
+ }
13
+ ]
14
+ ]
15
+ }
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ["@fnando/codestyle/javascript", "@fnando/codestyle/typescript"]
4
+ };
@@ -0,0 +1,12 @@
1
+ // To import modules, you can use ~/:path, where `:path` must be reflect the
2
+ // structure you define inside `./src`. For instance, if you have a
3
+ // `src/utils.ts` file that exports some functions, you can import it with this:
4
+ //
5
+ // ```ts
6
+ // import { func } from "~/utils";
7
+ // ```
8
+ //
9
+ // To export your final bundle, use `yarn build`. This will ensure that all
10
+ // files point to the right place, considering the `~/` alias.
11
+ //
12
+ export const name = "<%= options.package_name %>";
@@ -0,0 +1,7 @@
1
+ import { name } from "~/index";
2
+
3
+ describe("<%= options.package_name %>", () => {
4
+ test("passes", () => {
5
+ expect(name).toEqual("<%= options.package_name %>");
6
+ });
7
+ });
@@ -0,0 +1,12 @@
1
+ const config = require("@fnando/codestyle/jest");
2
+
3
+ module.exports = {
4
+ ...config,
5
+ testRegex: ".*?\\.test\\.ts",
6
+ roots: ["<rootDir>/src"],
7
+ modulePaths: ["src"],
8
+ moduleNameMapper: {
9
+ "^~/(.*?)$": "<rootDir>/src/$1",
10
+ },
11
+ testPathIgnorePatterns: ["/vendor/bundle/", "node_modules"],
12
+ };
@@ -0,0 +1,42 @@
1
+ <%= JSON.pretty_generate(
2
+ name: options.package_name,
3
+ version: options.version,
4
+ private: true,
5
+ description: options.description,
6
+ author: {
7
+ name: options.user_name,
8
+ email: options.user_email,
9
+ url: options.user_url,
10
+ },
11
+ homepage: options.github_url,
12
+ license: "MIT",
13
+ bugs: "#{options.github_url}/issues",
14
+ repository: "#{options.github_url}.git",
15
+ scripts: {
16
+ test: "jest --watch",
17
+ "test:ci" => "jest && yarn lint",
18
+ lint: "yarn lint:ts && yarn lint:eslint",
19
+ "lint:ts" => "tsc --noEmit",
20
+ "lint:eslint" => "eslint src --max-warnings 0",
21
+ build: "rm -rf dist && webpack"
22
+ },
23
+ devDependencies: {
24
+ "@babel/core" => "*",
25
+ "@babel/preset-env" => "*",
26
+ "@fnando/codestyle" => "*",
27
+ "@fnando/eslint-config-codestyle" => "*",
28
+ "@typescript-eslint/eslint-plugin" => "*",
29
+ "@typescript-eslint/parser" => "*",
30
+ "babel-loader" => "*",
31
+ "babel-plugin-module-resolver" => "*",
32
+ "eslint" => "*",
33
+ "jest" => "*",
34
+ "jest-filename-transform" => "*",
35
+ "prettier" => "*",
36
+ "ts-jest" => "*",
37
+ "ts-loader" => "*",
38
+ "typescript" => "*",
39
+ "webpack" => "*",
40
+ "webpack-cli" => "*"
41
+ }
42
+ ) %>
@@ -0,0 +1 @@
1
+ module.exports = require("@fnando/codestyle/prettier.json");
@@ -0,0 +1,52 @@
1
+ # <%= options.package_name %>
2
+
3
+ [![Tests](<%= options.github_url %>/workflows/node-tests/badge.svg)](https://github.com/fnando/<%= options.package_name %>)
4
+ [![Code Climate](https://codeclimate.com/github/<%= options.github_user %>/<%= options.package_name %>/badges/gpa.svg)](https://codeclimate.com/github/<%= options.github_user %>/<%= options.package_name %>)
5
+ [![NPM](https://img.shields.io/npm/v/<%= options.package_name %>.svg)](https://npmjs.org/packages/<%= options.package_name %>)
6
+ [![NPM](https://img.shields.io/npm/dt/<%= options.package_name %>.svg)](https://npmjs.org/packages/<%= options.package_name %>)
7
+
8
+ <%= options.description %>
9
+
10
+ ## Installation
11
+
12
+ This package is available as a NPM package. To install it, use the following command:
13
+
14
+ ```bash
15
+ npm install <%= options.package_name %> --save
16
+ ```
17
+
18
+ If you're using Yarn (and you should):
19
+
20
+ ```bash
21
+ yarn add <%= options.package_name %>
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ TODO: Write gem usage
27
+
28
+ ## Maintainer
29
+
30
+ - [<%= options.user_name %>](https://github.com/<%= options.github_user %>)
31
+
32
+ ## Contributors
33
+
34
+ - <%= options.github_url %>/contributors
35
+
36
+ ## Contributing
37
+
38
+ For more details about how to contribute, please read
39
+ <%= options.github_url %>/blob/main/CONTRIBUTING.md.
40
+
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the
45
+ [MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
46
+ found at <%= options.github_url %>/blob/main/LICENSE.md.
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the <%= options.package_name %> project's codebases, issue trackers,
51
+ chat rooms and mailing lists is expected to follow the
52
+ [code of conduct](<%= options.github_url %>/blob/main/CODE_OF_CONDUCT.md).
@@ -0,0 +1,49 @@
1
+ name: node-tests
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ push:
8
+ branches:
9
+ - main
10
+
11
+ schedule:
12
+ - cron: "0 10 * * *"
13
+
14
+ workflow_dispatch:
15
+ inputs: {}
16
+
17
+ jobs:
18
+ build:
19
+ name: Tests with Node ${{ matrix.node }}
20
+ runs-on: "ubuntu-latest"
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ node: [<%= options.node_versions.map {|v| Gem::Version.new(v).canonical_segments.first.to_s.inspect }.join(", ") %>]
25
+
26
+ steps:
27
+ - uses: actions/checkout@v1
28
+
29
+ - uses: actions/cache@v2
30
+ with:
31
+ path: vendor/bundle
32
+ key: >
33
+ ${{ runner.os }}-${{ matrix.node }}-npm-${{ hashFiles("package.json") }}
34
+ restore-keys: >
35
+ ${{ runner.os }}-${{ matrix.node }}-npm-${{ hashFiles("package.json") }}
36
+
37
+ - name: Set up Node
38
+ uses: actions/setup-node@v2-beta
39
+ with:
40
+ node-version: ${{ matrix.node }}
41
+
42
+ - name: Install npm dependencies
43
+ run: |
44
+ yarn install
45
+
46
+ - name: Run Tests
47
+ run: |
48
+ yarn test:ci
49
+ yarn lint
@@ -0,0 +1,14 @@
1
+ <%= JSON.pretty_generate(
2
+ extends: "@fnando/codestyle",
3
+ include: %w[src],
4
+ compilerOptions: {
5
+ noEmit: false,
6
+ sourceMap: true,
7
+ declaration: true,
8
+ outDir: "dist",
9
+ baseUrl: ".",
10
+ paths: {
11
+ "~/*": ["src/*"]
12
+ }
13
+ }
14
+ ) %>
@@ -0,0 +1,33 @@
1
+ /* eslint-env node */
2
+
3
+ const path = require("path");
4
+
5
+ module.exports = {
6
+ mode: "production",
7
+ entry: {
8
+ index: "./src/index.ts",
9
+ },
10
+ devtool: "source-map",
11
+ output: {
12
+ filename: "[name].js",
13
+ path: path.resolve(__dirname, "dist"),
14
+ },
15
+ module: {
16
+ rules: [
17
+ {
18
+ test: /\.ts$/,
19
+ use: [{ loader: "babel-loader" }, { loader: "ts-loader" }],
20
+ exclude: /node_modules/,
21
+ },
22
+ {
23
+ test: /\.js$/,
24
+ use: [{ loader: "babel-loader" }],
25
+ exclude: /node_modules/,
26
+ },
27
+ ],
28
+ },
29
+ resolve: {
30
+ alias: { "~/": path.resolve(__dirname, "src/") },
31
+ extensions: [".tsx", ".ts", ".js"],
32
+ },
33
+ };