Skip to content

Commit

Permalink
Updating config and move package to organization
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumebriday committed Mar 23, 2024
1 parent 59f77a9 commit dc769c9
Show file tree
Hide file tree
Showing 21 changed files with 4,468 additions and 3,603 deletions.
10 changes: 2 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"presets": [
"@babel/env",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-typescript",
"@babel/plugin-proposal-class-properties"
]
"presets": ["@babel/env", "@babel/preset-typescript"],
"plugins": ["@babel/plugin-transform-typescript"]
}
12 changes: 7 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// https://eslint.org/docs/user-guide/configuring

module.exports = {
root: true,
parser: "@typescript-eslint/parser",
env: {
browser: true,
node: true,
es6: true
es6: true,
jest: true,
},

globals: {
page: 'readonly'
}
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
extends: ["standard", "prettier"],
plugins: ["@typescript-eslint"],
}
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: '.node-version'
cache: 'yarn'
node-version-file: ".node-version"
cache: "yarn"
- run: |
yarn install --silent --non-interactive
yarn lint
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Test

on: [push]
Expand All @@ -10,8 +9,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: '.node-version'
cache: 'yarn'
node-version-file: ".node-version"
cache: "yarn"
- name: test
run: |
yarn install --silent --non-interactive
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
3 changes: 1 addition & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ index.html
netlify.toml
.node-version
.eslintrc.js
src
spec
tsconfig.json
vite.config.js
vite.config.mjs
.prettierignore
postcss.config.js
tailwind.config.js
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"printWidth": 120
"printWidth": 120,
"semi": false
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [5.0.0] - 2024-03-23

### Added

- Dispatch `rails-nested-form:add` and `rails-nested-form:remove` events.

### Chore

- Renaming the component from `stimulus-rails-nested-form` to `@stimulus-components/rails-nested-form`
- Upgrading dependencies
- Exporting Typescript Types
- Updating demo UI
- Add [Stimulus LSP](https://github.com/marcoroth/stimulus-lsp) compatibility

## [4.1.0] - 2022-12-23

### Added
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Guillaume Briday
Copyright (c) Guillaume Briday

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
107 changes: 47 additions & 60 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand All @@ -11,62 +11,45 @@
<title>Stimulus Rails Nested Form</title>

<script type="module" defer>
import './src/app.css'
import { Application } from '@hotwired/stimulus'
import NestedForm from './src/index'
import "./src/app.css"
import { Application } from "@hotwired/stimulus"
import RailsNestedForm from "./src/index"

const application = Application.start()
application.register('nested-form', NestedForm)
application.register("nested-form", RailsNestedForm)
</script>
</head>

<body>
<!-- This example requires Tailwind CSS v2.0+ -->
<div class="relative bg-gray-50 overflow-hidden">
<div class="hidden sm:block sm:absolute sm:inset-y-0 sm:h-full sm:w-full" aria-hidden="true">
<div class="relative h-full max-w-7xl mx-auto">
<svg
class="absolute right-full transform translate-y-1/4 translate-x-1/4 lg:translate-x-1/2"
width="404"
height="784"
fill="none"
viewBox="0 0 404 784"
>
<defs>
<pattern
id="f210dbf6-a58d-4871-961e-36d5016a0f49"
x="0"
y="0"
width="20"
height="20"
patternUnits="userSpaceOnUse"
>
<rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
</pattern>
</defs>
<rect width="404" height="784" fill="url(#f210dbf6-a58d-4871-961e-36d5016a0f49)" />
</svg>
<svg
class="absolute left-full transform -translate-y-3/4 -translate-x-1/4 md:-translate-y-1/2 lg:-translate-x-1/2"
width="404"
height="784"
fill="none"
viewBox="0 0 404 784"
>
<defs>
<pattern
id="5d0dd344-b041-4d26-bec4-8d33ea57ec9b"
x="0"
y="0"
width="20"
height="20"
patternUnits="userSpaceOnUse"
>
<rect x="0" y="0" width="4" height="4" class="text-gray-200" fill="currentColor" />
</pattern>
</defs>
<rect width="404" height="784" fill="url(#5d0dd344-b041-4d26-bec4-8d33ea57ec9b)" />
</svg>
<div class="relative bg-white overflow-hidden">
<div class="relative isolate pt-14">
<div
class="absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]"
aria-hidden="true"
>
<div
class="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-yellow-500 to-orange-500 opacity-30 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
style="
clip-path: polygon(
74.1% 44.1%,
100% 61.6%,
97.5% 26.9%,
85.5% 0.1%,
80.7% 2%,
72.5% 32.5%,
60.2% 62.4%,
52.4% 68.1%,
47.5% 58.3%,
45.2% 34.5%,
27.5% 76.7%,
0.1% 64.9%,
17.9% 100%,
27.6% 76.8%,
76.1% 97.7%,
74.1% 44.1%
);
"
></div>
</div>
</div>

Expand All @@ -85,8 +68,11 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
</p>

<p class="text-center mt-3">
<img class="inline-block" src="https://img.shields.io/npm/dt/stimulus-rails-nested-form.svg" />
<img class="inline-block" src="https://img.shields.io/npm/v/stimulus-rails-nested-form.svg" />
<img
class="inline-block"
src="https://img.shields.io/npm/dt/@stimulus-components/rails-nested-form.svg"
/>
<img class="inline-block" src="https://img.shields.io/npm/v/@stimulus-components/rails-nested-form.svg" />

<img
class="inline-block"
Expand All @@ -107,7 +93,7 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
<div class="mt-5 max-w-md mx-auto sm:flex sm:justify-center md:mt-8">
<div class="rounded-md shadow">
<a
href="https://www.stimulus-components.com/docs/stimulus-rails-nested-form"
href="https://www.stimulus-components.com/docs/stimulus-rails-nested-form/"
class="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base font-medium rounded-md text-white bg-gradient-to-r from-yellow-500 to-orange-500 md:py-4 md:text-lg md:px-10"
>
Documentation &rarr;
Expand All @@ -118,7 +104,7 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
href="https://github.com/stimulus-components/stimulus-rails-nested-form"
class="w-full flex items-center justify-center gap-1 px-8 py-3 border border-transparent text-base font-medium rounded-md bg-white hover:bg-gray-50 md:py-4 md:text-lg md:px-10"
>
<svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true" class="h-6 w-6">
<svg fill="currentColor" viewBox="0 0 24 24" aria-hidden="true" class="size-6">
<path
fill-rule="evenodd"
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
Expand Down Expand Up @@ -198,15 +184,14 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t

<button
type="submit"
class="mt-4 bg-indigo-600 hover:bg-indigo-400 text-white font-semibold py-2 px-4 border rounded shadow"
class="mt-4 bg-blue-600 hover:bg-blue-500 text-white font-semibold py-2 px-4 border rounded shadow"
>
Save todos
</button>
</form>
</section>
</div>

<!-- This example requires Tailwind CSS v2.0+ -->
<footer class="bg-white">
<div class="max-w-7xl mx-auto py-12 px-4 overflow-hidden sm:px-6 lg:px-8">
<div class="-mx-5 -my-2 flex flex-wrap justify-center" aria-label="Footer">
Expand All @@ -229,9 +214,11 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
class="text-gray-400 hover:text-gray-500"
>
<span class="sr-only">Twitter</span>
<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<svg class="size-6" fill="currentColor" viewBox="0 0 512 512">
<path
d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84"
fill-rule="evenodd"
d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z"
clip-rule="evenodd"
/>
</svg>
</a>
Expand All @@ -243,7 +230,7 @@ <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:t
class="text-gray-400 hover:text-gray-500"
>
<span class="sr-only">GitHub</span>
<svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<svg class="size-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
<path
fill-rule="evenodd"
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
Expand Down
2 changes: 0 additions & 2 deletions jest/jest-setup.js

This file was deleted.

2 changes: 2 additions & 0 deletions jest/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "@babel/polyfill"
import "mutationobserver-shim"
74 changes: 48 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,51 +1,73 @@
{
"name": "stimulus-rails-nested-form",
"name": "@stimulus-components/rails-nested-form",
"version": "4.1.0",
"description": "A Stimulus controller to create new fields on the fly to populate your Rails relationship.",
"keywords": [
"stimulus",
"stimulusjs",
"stimulus controller",
"rails",
"nested form"
],
"repository": "git@github.com:stimulus-components/stimulus-rails-nested-form.git",
"bugs": {
"url": "https://github.com/stimulus-components/stimulus-rails-nested-form/issues"
},
"author": "Guillaume Briday <guillaumebriday@gmail.com>",
"license": "MIT",
"homepage": "https://github.com/stimulus-components/stimulus-rails-nested-form",
"private": false,
"publishConfig": {
"access": "public"
},
"main": "dist/stimulus-rails-nested-form.umd.js",
"module": "dist/stimulus-rails-nested-form.mjs",
"types": "dist/types/index.d.ts",
"scripts": {
"format": "prettier-standard '**/*.{ts,css,html}' --format",
"lint": "prettier-standard '**/*.{ts,css,html}' --lint",
"lint": "tsc --noEmit && eslint --ext .js,.mjs,.ts . && prettier . --check",
"lintfix": "eslint --ext .js,.mjs,.ts . --fix && prettier . --write",
"types": "tsc --noEmit false --declaration true --emitDeclarationOnly true --outDir dist/types",
"dev": "vite",
"prod": "vite build --mode netlify",
"build": "tsc --noEmit && vite build",
"build": "vite build && yarn types",
"version": "yarn build",
"test": "BABEL_ENV=test jest",
"np": "np --no-2fa"
},
"devDependencies": {
"@babel/core": "7.20.7",
"@babel/plugin-syntax-class-properties": "7.12.13",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.20.2",
"@babel/preset-typescript": "^7.18.6",
"@hotwired/stimulus": "^3.2.1",
"@testing-library/dom": "^8.19.1",
"@types/jest": "^29.2.4",
"autoprefixer": "^10.4.13",
"babel-jest": "^29.3.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"@babel/core": "7.24.3",
"@babel/polyfill": "7.12.1",
"@babel/preset-env": "7.24.3",
"@babel/preset-typescript": "7.24.1",
"@hotwired/stimulus": "^3",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"autoprefixer": "10.4.19",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-n": "16.6.2",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-standard": "5.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mutationobserver-shim": "^0.3.7",
"np": "^7.6.2",
"postcss": "^8.4.20",
"prettier-standard": "16.4.1",
"tailwindcss": "^3.2.4",
"typescript": "^4.9.4",
"vite": "^4.0.3"
"np": "9.2.0",
"postcss": "8.4.38",
"prettier": "3.2.5",
"tailwindcss": "3.4.1",
"typescript": "^5.4.3",
"vite": "5.2.4"
},
"peerDependencies": {
"@hotwired/stimulus": "^3.0.0"
},
"jest": {
"setupFiles": [
"<rootDir>/jest/jest-setup.js"
"<rootDir>/jest/jest-setup.ts"
]
},
"peerDependencies": {
"@hotwired/stimulus": "^3.2.1"
}
}
Loading

0 comments on commit dc769c9

Please sign in to comment.