mirror of
https://github.com/flarum/core.git
synced 2025-07-16 14:26:25 +02:00
Merge remote-tracking branch 'js_packages_tsconfig/REWRITE'
This commit is contained in:
16
js-packages/tsconfig/.gitattributes
vendored
Normal file
16
js-packages/tsconfig/.gitattributes
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.gitmodules export-ignore
|
||||
.github export-ignore
|
||||
.travis export-ignore
|
||||
.travis.yml export-ignore
|
||||
.editorconfig export-ignore
|
||||
.styleci.yml export-ignore
|
||||
|
||||
phpunit.xml export-ignore
|
||||
tests export-ignore
|
||||
|
||||
js/dist/* -diff
|
||||
js/dist/* linguist-generated
|
||||
|
||||
* text=auto eol=lf
|
6
js-packages/tsconfig/.gitignore
vendored
Normal file
6
js-packages/tsconfig/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.idea/*
|
||||
.vscode
|
||||
*.log
|
||||
node_modules/
|
21
js-packages/tsconfig/LICENSE
Normal file
21
js-packages/tsconfig/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2021 Stichting Flarum (Flarum Foundation)
|
||||
|
||||
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.
|
37
js-packages/tsconfig/README.md
Normal file
37
js-packages/tsconfig/README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Flarum Typescript Config
|
||||
|
||||
A standardised `tsconfig.json` for use in Flarum extensions.
|
||||
|
||||
## Usage
|
||||
|
||||
You'll need to configure a `tsconfig.json` file to ensure your IDE sets up Typescript support correctly.
|
||||
|
||||
You need to install this package as a dev dependency to your extension JS:
|
||||
|
||||
```properties
|
||||
npm install --save-dev flarum-tsconfig
|
||||
yarn add --dev flarum-tsconfig
|
||||
```
|
||||
|
||||
A baseline `tsconfig.json` is provided below that you can modify as needed. This file needs to be copied into your extension's `js` folder for your IDE to apply the correct settings.
|
||||
|
||||
```jsonc
|
||||
{
|
||||
// Use Flarum's tsconfig as a starting point
|
||||
"extends": "flarum-tsconfig",
|
||||
// This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder
|
||||
// and also tells your Typescript server to read core's global typings for
|
||||
// access to `dayjs` and `$` in the global namespace.
|
||||
"include": ["src/**/*", "../vendor/flarum/core/js/dist-typings/@types/**/*"],
|
||||
"compilerOptions": {
|
||||
// This will output typings to `dist-typings`
|
||||
"declarationDir": "./dist-typings",
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"flarum/*": ["../vendor/flarum/core/js/dist-typings/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
You'll also need to ensure that you run `composer update` in your extension's root directory to ensure that a copy of Flarum core is downloaded to your `vendor` folder. Remember that `vendor` should **not** be committed to Git repositories.
|
15
js-packages/tsconfig/package.json
Normal file
15
js-packages/tsconfig/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "flarum-tsconfig",
|
||||
"version": "1.0.2",
|
||||
"description": "Flarum's official Typescript config file",
|
||||
"main": "tsconfig.json",
|
||||
"repository": "https://github.com/flarum/flarum-tsconfig",
|
||||
"author": "Flarum Team",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/jquery": "^3.5.5",
|
||||
"@types/mithril": "^2.0.7",
|
||||
"@types/throttle-debounce": "^2.1.0",
|
||||
"dayjs": "^1.10.4"
|
||||
}
|
||||
}
|
22
js-packages/tsconfig/tsconfig.json
Normal file
22
js-packages/tsconfig/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowUmdGlobalAccess": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitReturns": true,
|
||||
"noImplicitThis": true,
|
||||
"declaration": true,
|
||||
"emitDeclarationOnly": true,
|
||||
"module": "es2015",
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "Node",
|
||||
"target": "es6",
|
||||
"jsx": "preserve",
|
||||
"allowJs": true,
|
||||
"lib": ["dom", "es5", "es2015", "es2016", "es2017", "es2018", "es2019.array"],
|
||||
"allowSyntheticDefaultImports": true
|
||||
}
|
||||
}
|
30
js-packages/tsconfig/yarn.lock
Normal file
30
js-packages/tsconfig/yarn.lock
Normal file
@@ -0,0 +1,30 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@types/jquery@^3.5.5":
|
||||
version "3.5.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-3.5.5.tgz#2c63f47c9c8d96693d272f5453602afd8338c903"
|
||||
integrity sha512-6RXU9Xzpc6vxNrS6FPPapN1SxSHgQ336WC6Jj/N8q30OiaBZ00l1GBgeP7usjVZPivSkGUfL1z/WW6TX989M+w==
|
||||
dependencies:
|
||||
"@types/sizzle" "*"
|
||||
|
||||
"@types/mithril@^2.0.7":
|
||||
version "2.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@types/mithril/-/mithril-2.0.7.tgz#e4016c79ce206621d7aee23de189faf7b007e0d5"
|
||||
integrity sha512-ByD422x0GnYh5MOEAWNyqfkw2QlKkK3Yf7y5e1CobDVPG9m+/ThblfrIHENihF7VnygT6sQRObPvY1J/fUZICg==
|
||||
|
||||
"@types/sizzle@*":
|
||||
version "2.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/sizzle/-/sizzle-2.3.3.tgz#ff5e2f1902969d305225a047c8a0fd5c915cebef"
|
||||
integrity sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==
|
||||
|
||||
"@types/throttle-debounce@^2.1.0":
|
||||
version "2.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/throttle-debounce/-/throttle-debounce-2.1.0.tgz#1c3df624bfc4b62f992d3012b84c56d41eab3776"
|
||||
integrity sha512-5eQEtSCoESnh2FsiLTxE121IiE60hnMqcb435fShf4bpLRjEu1Eoekht23y6zXS9Ts3l+Szu3TARnTsA0GkOkQ==
|
||||
|
||||
dayjs@^1.10.4:
|
||||
version "1.10.4"
|
||||
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
|
||||
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
|
Reference in New Issue
Block a user