Skip to content

Commit

Permalink
feat: first release
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneskuettner committed May 4, 2023
0 parents commit 68abc21
Show file tree
Hide file tree
Showing 26 changed files with 5,807 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root=true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = tab
trim_trailing_whitespace = true

[{package.json,*.yml,*.yaml}]
indent_style = space
indent_size = 2

[Dockerfile]
indent_style = tab

[Makefile]
indent_style = tab
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
dist/
63 changes: 63 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
const defaultRules = {
// No console statements in production
'no-console': process.env.NODE_ENV !== 'development' ? 'error' : 'off',
// No debugger statements in production
'no-debugger': process.env.NODE_ENV !== 'development' ? 'error' : 'off',
// Enforce prettier formatting
'prettier/prettier': 'error',
};

module.exports = {
// Stop looking for ESLint configurations in parent folders
root: true,
// Global variables: Browser and Node.js
env: {
browser: true,
node: true,
},
// Basic configuration for js files
plugins: ['@typescript-eslint', 'prettier'],
extends: ['eslint:recommended', 'prettier'],
rules: defaultRules,
parserOptions: {
ecmaVersion: 2020,
},
overrides: [
// Parse rollup configration as module
{
files: ['rollup.config.js', 'vite.config.js'],
parserOptions: {
sourceType: 'module',
},
},
// Configuration for ts/vue files
{
files: ['*.ts', '*.vue'],
parser: 'vue-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser',
},
extends: [
'plugin:vue/vue3-recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
],
rules: {
...defaultRules,
// It's recommended to turn off this rule on TypeScript projects
'no-undef': 'off',
// Allow ts-directive comments (used to suppress TypeScript compiler errors)
'@typescript-eslint/ban-ts-comment': 'off',
// Allow usage of the any type (consider to enable this rule later on)
'@typescript-eslint/no-explicit-any': 'off',
// Allow usage of require statements (consider to enable this rule later on)
'@typescript-eslint/no-var-requires': 'off',
// Allow non-null assertions for now (consider to enable this rule later on)
'@typescript-eslint/no-non-null-assertion': 'off',
// Allow unused arguments and variables when they begin with an underscore
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
},
},
],
};
32 changes: 32 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release
on: [push, workflow_dispatch]
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm build

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: pnpm release
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
node_modules
dist
.idea

extension.config.cjs
22 changes: 22 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module.exports = {
htmlWhitespaceSensitivity: 'ignore',
printWidth: 120,
singleQuote: true,
useTabs: true,
proseWrap: 'always',
overrides: [
{
files: ['*.yaml', '*.yml', 'package.json'],
options: {
useTabs: false,
tabWidth: 2,
},
},
{
files: ['Dockerfile', 'Makefile'],
options: {
useTabs: true,
},
},
],
};
24 changes: 24 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
"next",
"next-major",
{
"name": "beta",
"prerelease": true
},
{
"name": "alpha",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/git",
"@semantic-release/github"
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Hannes Küttner

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Directus Inline Form Interface

An inline form interface for Directus that allows editing of a related M2O collection
item within its parent's form.

For more details as to why you would need this see these discussions in the Directus repository
[directus/directus#3474](https://github.com/directus/directus/discussions/3474) and
[directus/directus#18041](https://github.com/directus/directus/discussions/18041).

<picture>
<source media="(prefers-color-scheme: dark)" srcset="./docs/screenshot-dark.png">
<img alt="Screenshot of the tab group interface" src="./docs/screenshot-light.png">
</picture>

## Installation

Add `directus-extension-inline-form-interface` to your project:


```shell
# Using pnpm
pnpm add directus-extension-inline-form-interface
# Using yarn
yarn add directus-extension-inline-form-interface
# Using npm
npm install directus-extension-inline-form-interface
```

## Usage

When creating a new M2O field you can select `Inline Form` in the `Relational` section.

Alternatively you can change the interface of an existing M2O field in the
`Interface` section.

## Options

#### `Create Related Item`

Decide when an item should be created in the related collection.

You can choose between:

- `Only with Content`, which will only create a new item if *some* content is filled in the inline form, and
- `Always`, which will always create a new item, even if no content is filled in the inline form
Binary file added docs/screenshot-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/screenshot-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions extension.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import alias from '@rollup/plugin-alias';
import resolve from '@rollup/plugin-node-resolve';
import yaml from "@rollup/plugin-yaml";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname);
const customResolver = resolve({
extensions: ['.ts', '.js']
});

export default{
plugins: [
alias({
customResolver,
entries: [
{find: /^@\/(.*)/, replacement: path.resolve(rootDir, 'src/$1')}
]
}),
yaml()
]
}
66 changes: 66 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"name": "directus-extension-inline-form-interface",
"description": "An inline form interface for Directus",
"icon": "extension",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "https://github.com/hanneskuettner/directus-extension-inline-form-interface.git"
},
"bugs": {
"url": "https://github.com/hanneskuettner/directus-extension-inline-form-interface/issues"
},
"homepage": "https://github.com/hanneskuettner/directus-extension-inline-form-interface",
"keywords": [
"directus",
"directus-extension",
"directus-custom-interface"
],
"directus:extension": {
"type": "interface",
"path": "dist/index.js",
"source": "src/index.ts",
"host": "^9.26.0"
},
"scripts": {
"build": "directus-extension build",
"dev": "directus-extension build -w --no-minify",
"link": "directus-extension link",
"lint": "eslint .",
"release": "semantic-release"
},
"devDependencies": {
"@directus/composables": "^9.26.0",
"@directus/exceptions": "^9.26.0",
"@directus/types": "^9.26.0",
"@directus/utils": "^9.26.0",
"@rollup/plugin-alias": "^5.0.0",
"@rollup/plugin-node-resolve": "^15.0.2",
"@rollup/plugin-yaml": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/github": "^8.0.7",
"@types/lodash-es": "^4.17.7",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"eslint": "^8.39.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.10.0",
"knex-schema-inspector": "^3.0.1",
"lodash-es": "^4.17.21",
"prettier": "^2.8.7",
"rollup-plugin-copy": "^3.4.0",
"sass": "^1.60.0",
"semantic-release": "^21.0.2",
"typescript": "^5.0.3"
},
"peerDependencies": {
"@directus/extensions-sdk": "^9.26.0",
"vue": "^3.2.47",
"vue-i18n": "^9.2.2"
},
"publishConfig": {
"access": "public"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 68abc21

Please sign in to comment.