Skip to content

Commit

Permalink
build: Package config setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrina-p committed May 17, 2023
1 parent bb60f6e commit 45fc628
Show file tree
Hide file tree
Showing 16 changed files with 15,226 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"root": true,
"extends": ["eslint:recommended", "prettier"],
"plugins": ["import", "jest", "sort-keys", "unused-imports"],
"parser": "babel-eslint",
"env": {
"es6": true,
"browser": true,
"node": true,
"jest": true
},
"rules": {
"jest/no-focused-tests": "error",
"arrow-body-style": 0,
"default-case": 0,
"import/order": [
"warn",
{
"groups": ["builtin", "external", "parent"],
"newlines-between": "always",
"alphabetize": {
"order": "asc" /* sort in ascending order. Options: ['ignore', 'asc', 'desc'] */,
"caseInsensitive": true /* ignore case. Options: [true, false] */
}
}
],
"no-unused-vars": ["error", { "ignoreRestSiblings": true }]
}
}
Binary file added .github/media/jsf_logo_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build
on:
pull_request:
jobs:
dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Cache NPM dependencies
# From: https://dev.to/drakulavich/aggressive-dependency-caching-in-github-actions-3c64
uses: actions/cache@v3
id: cache-primes
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-primes.outputs.cache-hit != 'true'
run: npm ci

test:
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Get cached NPM dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} # (1)

- name: Tests
run: npm run test

lint:
runs-on: ubuntu-latest
needs: [dependencies]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Get cached NPM dependencies
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} # (1)

- name: Lint
run: npm run lint
- run: npm run prettier:check
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependency directories
node_modules

# Optional npm cache directory
.npm
.npmrc

# Optional REPL history
.DS_Store

# Tests
coverage

# env files
.env

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/cspell.json
!.vscode/*.code-snippets

# Build Files
dist
3 changes: 3 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.14.0
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"printWidth": 100
}
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 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]

<!-- Type of changes:
- Added
- Changed
- Deprecated
- Removed
- Fixed
- Security
-->

<!-- eg:
### Added
- Short description about it. ([#pr-id](https://github.com/remoteoss/jsf/pull/<pr-id>))
### Deprecated
- Deprecated `xxx` in favor of `yyy`. ([#pr-id](https://github.com/remoteoss/jsf/pull/<pr-id>))
-->

## [1.0.0-beta.1] - 2023-XX-XX

### Added

- Initial public release. ([#1](https://github.com/remoteoss/jsf/pull/1))

---
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Contributing

## Questions / Bugs / Feedback

If you have questions about the library, found a bug or want to suggest a feature, please create an issue.

## Development

- Install dependencies:

```bash
npm ci
```

- Run tests:

```
npm test
```

### Documentation

You can visit the [docs website](https://json-schema-form.vercel.app/), however its source is not in the repo yet, only the build (`/docs_build`). Our docs are still coupled to Remote's internal Design System and integration tests. The effort to decouple it at the moment is too high.

So our strategy is to at each new PR, to update the docs internally and manually copy its build to this repo.

## Pull requests (PR)

Maintainers merge PRs by squashing the commits and editing the merge commit message using [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).

## Releases

For each new PR merged, a GitHub action is triggered to create a new release.
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) 2023 Remote
Copyright (c) 2023 Remote Technology, Inc.

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
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
# json-schema-form
<p align="center">
<img src=".github/media/jsf_logo_dark.png" width="600" alt="json-schema-form">
</p>

<p align="center">
<code>json-schema-form</code> is a headless UI form library powered by <a href="https://json-schema.org/">JSON Schemas</a>.
<br/>
It transforms JSON schemas into Javascript to be consumed by your UI libraries.
</p>

---

### Why JSON Schemas for forms?

JSON Schemas are the SSoT (Single Source of Truth) that allows you to share form's _structure_ and _validations_ between frontend and backend, regardless of the language used.

## Documentation

Check the 📚 **[JSF website](https://json-schema-form.vercel.app/)** for documentation and demos.

## Contributing

Read [CONTRIBUTING](CONTRIBUTING.md) to get started.

_Backed by [Remote.com](https://remote.com/)_
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [['@babel/preset-env', { targets: { node: 'current' } }]],
};
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = async () => {
return {
verbose: true,
testEnvironment: 'jsdom',
};
};
Loading

0 comments on commit 45fc628

Please sign in to comment.