mirror of
https://github.com/strapi/strapi.git
synced 2025-08-10 09:47:46 +00:00
Merge branch 'features/typescript' of github.com:strapi/strapi into typescript/types/schema
This commit is contained in:
commit
f11c12ad57
@ -1,2 +1,3 @@
|
||||
HOST=0.0.0.0
|
||||
PORT=1337
|
||||
APP_KEYS=
|
||||
|
1
examples/kitchensink-ts/.gitignore
vendored
1
examples/kitchensink-ts/.gitignore
vendored
@ -112,4 +112,3 @@ exports
|
||||
*.cache
|
||||
build
|
||||
.strapi-updater.json
|
||||
documentation
|
@ -1,3 +1,57 @@
|
||||
# Strapi application generated in TypeScript
|
||||
# 🚀 Getting started with Strapi
|
||||
|
||||
A quick description of your strapi application
|
||||
Strapi comes with a full featured [Command Line Interface](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html) (CLI) which lets you scaffold and manage your project in seconds.
|
||||
|
||||
### `develop`
|
||||
|
||||
Start your Strapi application with autoReload enabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-develop)
|
||||
|
||||
```
|
||||
npm run develop
|
||||
# or
|
||||
yarn develop
|
||||
```
|
||||
|
||||
### `start`
|
||||
|
||||
Start your Strapi application with autoReload disabled. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-start)
|
||||
|
||||
```
|
||||
npm run start
|
||||
# or
|
||||
yarn start
|
||||
```
|
||||
|
||||
### `build`
|
||||
|
||||
Build your admin panel. [Learn more](https://docs.strapi.io/developer-docs/latest/developer-resources/cli/CLI.html#strapi-build)
|
||||
|
||||
```
|
||||
npm run build
|
||||
# or
|
||||
yarn build
|
||||
```
|
||||
|
||||
## ⚙️ Deployment
|
||||
|
||||
Strapi gives you many possible deployment options for your project. Find the one that suits you on the [deployment section of the documentation](https://docs.strapi.io/developer-docs/latest/setup-deployment-guides/deployment.html).
|
||||
|
||||
## 📚 Learn more
|
||||
|
||||
- [Resource center](https://strapi.io/resource-center) - Strapi resource center.
|
||||
- [Strapi documentation](https://docs.strapi.io) - Official Strapi documentation.
|
||||
- [Strapi tutorials](https://strapi.io/tutorials) - List of tutorials made by the core team and the community.
|
||||
- [Strapi blog](https://docs.strapi.io) - Official Strapi blog containing articles made by the Strapi team and the community.
|
||||
- [Changelog](https://strapi.io/changelog) - Find out about the Strapi product updates, new features and general improvements.
|
||||
|
||||
Feel free to check out the [Strapi GitHub repository](https://github.com/strapi/strapi). Your feedback and contributions are welcome!
|
||||
|
||||
## ✨ Community
|
||||
|
||||
- [Discord](https://discord.strapi.io) - Come chat with the Strapi community including the core team.
|
||||
- [Forum](https://forum.strapi.io/) - Place to discuss, ask questions and find answers, show your Strapi project and get feedback or just talk with other Community members.
|
||||
- [Awesome Strapi](https://github.com/strapi/awesome-strapi) - A curated list of awesome things related to Strapi.
|
||||
|
||||
---
|
||||
|
||||
<sub>🤫 Psst! [Strapi is hiring](https://strapi.io/careers).</sub>
|
||||
|
@ -4,12 +4,7 @@ export default ({ env }) => ({
|
||||
connection: {
|
||||
client: 'sqlite',
|
||||
connection: {
|
||||
filename: path.join(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
env('DATABASE_FILENAME', path.join('.tmp', 'data.db'))
|
||||
),
|
||||
filename: path.join(__dirname, '..', '..', env('DATABASE_FILENAME', '.tmp/data.db')),
|
||||
},
|
||||
useNullAsDefault: true,
|
||||
},
|
||||
|
@ -1,11 +0,0 @@
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#bootstrap
|
||||
*/
|
||||
|
||||
export default () => {};
|
@ -1,19 +0,0 @@
|
||||
/**
|
||||
* Cron config that gives you an opportunity
|
||||
* to run scheduled jobs.
|
||||
*
|
||||
* The cron format consists of:
|
||||
* [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK]
|
||||
*
|
||||
* See more details here: https://strapi.io/documentation/developer-docs/latest/setup-deployment-guides/configurations.html#cron-tasks
|
||||
*/
|
||||
|
||||
export default {
|
||||
/**
|
||||
* Simple example.
|
||||
* Every monday at 1am.
|
||||
*/
|
||||
// '0 1 * * 1': () => {
|
||||
//
|
||||
// }
|
||||
};
|
@ -1,3 +0,0 @@
|
||||
export default async (/* ctx */) => {
|
||||
// return ctx.notFound('My custom message 404');
|
||||
};
|
12
examples/kitchensink-ts/config/middlewares.ts
Normal file
12
examples/kitchensink-ts/config/middlewares.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export default [
|
||||
'strapi::errors',
|
||||
'strapi::security',
|
||||
'strapi::cors',
|
||||
'strapi::poweredBy',
|
||||
'strapi::logger',
|
||||
'strapi::query',
|
||||
'strapi::body',
|
||||
'strapi::session',
|
||||
'strapi::favicon',
|
||||
'strapi::public',
|
||||
];
|
@ -1 +0,0 @@
|
||||
module.exports = {};
|
@ -1,12 +1,7 @@
|
||||
export default ({ env }) => ({
|
||||
host: env('HOST', '0.0.0.0'),
|
||||
port: env.int('PORT', 1337),
|
||||
admin: {
|
||||
auth: {
|
||||
secret: env('ADMIN_JWT_SECRET', '6f75e424d1a0307077c294fcc3c7d78d'),
|
||||
},
|
||||
},
|
||||
app: {
|
||||
keys: env.array('APP_KEYS', ['toBeModified1', 'toBeModified2']),
|
||||
keys: env.array('APP_KEYS'),
|
||||
},
|
||||
});
|
||||
|
7
examples/kitchensink-ts/index.d.ts
vendored
7
examples/kitchensink-ts/index.d.ts
vendored
@ -1,7 +0,0 @@
|
||||
import '@strapi/strapi';
|
||||
|
||||
declare module '@strapi/strapi' {
|
||||
interface StrapiInterface {
|
||||
customAddMethod(n1: number, n2: number): number;
|
||||
}
|
||||
}
|
@ -1,42 +1,30 @@
|
||||
{
|
||||
"name": "kitchensink-ts",
|
||||
"private": true,
|
||||
"version": "4.1.8",
|
||||
"description": "A Strapi application.",
|
||||
"version": "4.1.12",
|
||||
"description": "A Strapi application",
|
||||
"scripts": {
|
||||
"develop": "strapi develop",
|
||||
"develop:ce": "STRAPI_DISABLE_EE=true strapi develop",
|
||||
"start": "strapi start",
|
||||
"build": "strapi build",
|
||||
"build:ce": "STRAPI_DISABLE_EE=true strapi build",
|
||||
"strapi": "strapi"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"dependencies": {
|
||||
"@strapi/admin": "4.1.8",
|
||||
"@strapi/provider-email-mailgun": "4.1.8",
|
||||
"@strapi/plugin-documentation": "4.1.8",
|
||||
"@strapi/provider-upload-aws-s3": "4.1.8",
|
||||
"@strapi/provider-upload-cloudinary": "4.1.8",
|
||||
"@strapi/strapi": "4.1.8",
|
||||
"@strapi/utils": "4.1.8",
|
||||
"lodash": "4.17.21",
|
||||
"mysql": "2.18.1",
|
||||
"passport-google-oauth2": "0.2.0",
|
||||
"pg": "8.6.0",
|
||||
"sqlite3": "5.0.2"
|
||||
"@strapi/strapi": "4.1.12",
|
||||
"@strapi/plugin-users-permissions": "4.1.12",
|
||||
"@strapi/plugin-i18n": "4.1.12",
|
||||
"better-sqlite3": "7.4.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@swc/cli": "0.1.55",
|
||||
"@swc/core": "1.2.146",
|
||||
"tsc": "2.0.4",
|
||||
"typescript": "4.6.2"
|
||||
"author": {
|
||||
"name": "A Strapi developer"
|
||||
},
|
||||
"strapi": {
|
||||
"uuid": "getstarted"
|
||||
"uuid": "6e21118c-e938-4f36-b0cf-bb8503d409c0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.22.0 <=16.x.x",
|
||||
"node": ">=12.x.x <=16.x.x",
|
||||
"npm": ">=6.0.0"
|
||||
},
|
||||
"license": "SEE LICENSE IN LICENSE"
|
||||
"license": "MIT"
|
||||
}
|
||||
|
35
examples/kitchensink-ts/src/admin/app.example.tsx
Normal file
35
examples/kitchensink-ts/src/admin/app.example.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
export default {
|
||||
config: {
|
||||
locales: [
|
||||
// 'ar',
|
||||
// 'fr',
|
||||
// 'cs',
|
||||
// 'de',
|
||||
// 'dk',
|
||||
// 'es',
|
||||
// 'he',
|
||||
// 'id',
|
||||
// 'it',
|
||||
// 'ja',
|
||||
// 'ko',
|
||||
// 'ms',
|
||||
// 'nl',
|
||||
// 'no',
|
||||
// 'pl',
|
||||
// 'pt-BR',
|
||||
// 'pt',
|
||||
// 'ru',
|
||||
// 'sk',
|
||||
// 'sv',
|
||||
// 'th',
|
||||
// 'tr',
|
||||
// 'uk',
|
||||
// 'vi',
|
||||
// 'zh-Hans',
|
||||
// 'zh',
|
||||
],
|
||||
},
|
||||
bootstrap(app) {
|
||||
console.log(app);
|
||||
},
|
||||
};
|
@ -1,54 +0,0 @@
|
||||
import theme from './extensions/theme';
|
||||
|
||||
type Config = {
|
||||
auth: Auth;
|
||||
head: {};
|
||||
locales: string[];
|
||||
menu: {};
|
||||
theme: {};
|
||||
translations: {};
|
||||
tutorials: boolean;
|
||||
notifications: {};
|
||||
};
|
||||
|
||||
type Auth = {
|
||||
logo: string;
|
||||
};
|
||||
|
||||
const config: Config = {
|
||||
auth: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
head: {
|
||||
favicon:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
title: 'Strapi test',
|
||||
},
|
||||
locales: ['fr'],
|
||||
menu: {
|
||||
logo:
|
||||
'https://images.unsplash.com/photo-1593642634367-d91a135587b5?ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=750&q=80',
|
||||
},
|
||||
theme,
|
||||
translations: {
|
||||
fr: {
|
||||
'Auth.form.email.label': 'test',
|
||||
Users: 'Utilisateurs',
|
||||
City: 'CITY FRENCH',
|
||||
// Customize the label of the CM table..
|
||||
Id: 'ID french',
|
||||
},
|
||||
},
|
||||
tutorials: false,
|
||||
notifications: { release: false },
|
||||
};
|
||||
|
||||
const bootstrap = (app: any) => {
|
||||
console.log(app);
|
||||
};
|
||||
|
||||
export default {
|
||||
config,
|
||||
bootstrap,
|
||||
};
|
@ -1,48 +0,0 @@
|
||||
const colors: object = {
|
||||
alternative100: '#f6ecfc',
|
||||
alternative200: '#e0c1f4',
|
||||
alternative500: '#ac73e6',
|
||||
alternative600: '#9736e8',
|
||||
alternative700: '#8312d1',
|
||||
danger100: '#fcecea',
|
||||
danger200: '#f5c0b8',
|
||||
danger500: '#ee5e52',
|
||||
danger600: '#d02b20',
|
||||
danger700: '#b72b1a',
|
||||
neutral0: 'black',
|
||||
neutral100: '#f6f6f9',
|
||||
neutral150: '#eaeaef',
|
||||
neutral200: '#dcdce4',
|
||||
neutral300: '#c0c0cf',
|
||||
neutral400: '#a5a5ba',
|
||||
neutral500: '#8e8ea9',
|
||||
neutral600: '#666687',
|
||||
neutral700: '#4a4a6a',
|
||||
neutral800: '#32324d',
|
||||
neutral900: '#212134',
|
||||
primary100: '#f0f0ff',
|
||||
primary200: '#d9d8ff',
|
||||
primary500: '#7b79ff',
|
||||
primary600: '#4945ff',
|
||||
primary700: '#271fe0',
|
||||
secondary100: '#eaf5ff',
|
||||
secondary200: '#b8e1ff',
|
||||
secondary500: '#66b7f1',
|
||||
secondary600: '#0c75af',
|
||||
secondary700: '#006096',
|
||||
success100: '#eafbe7',
|
||||
success200: '#c6f0c2',
|
||||
success500: '#5cb176',
|
||||
success600: '#328048',
|
||||
success700: '#2f6846',
|
||||
warning100: '#fdf4dc',
|
||||
warning200: '#fae7b9',
|
||||
warning500: '#f29d41',
|
||||
warning600: '#d9822f',
|
||||
warning700: '#be5d01',
|
||||
};
|
||||
const theme = {
|
||||
colors,
|
||||
};
|
||||
|
||||
export default theme;
|
@ -1,6 +1,13 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/lib/configs/admin",
|
||||
|
||||
"include": ["../plugins/**/admin/src/**/*", "./"],
|
||||
"exclude": ["node_modules/", "build/", "dist/", "**/*.test.ts"]
|
||||
"include": [
|
||||
"../plugins/**/admin/src/**/*",
|
||||
"./"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/",
|
||||
"build/",
|
||||
"dist/",
|
||||
"**/*.test.ts"
|
||||
]
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
module.exports = (config, webpack) => {
|
||||
export default (config, webpack) => {
|
||||
// Note: we provide webpack above so you should not `require` it
|
||||
// Perform customizations to webpack config
|
||||
// Important: return the modified config
|
||||
console.log('custom');
|
||||
return config;
|
||||
};
|
@ -1,15 +1,20 @@
|
||||
import type { Strapi } from '@strapi/strapi';
|
||||
import '@strapi/strapi';
|
||||
|
||||
export default {
|
||||
register({ strapi }: { strapi: Strapi }) {
|
||||
// No error when trying the access & set the
|
||||
strapi.customAddMethod = (n1, n2) => {
|
||||
return n1 + n2;
|
||||
};
|
||||
},
|
||||
/**
|
||||
* An asynchronous register function that runs before
|
||||
* your application is initialized.
|
||||
*
|
||||
* This gives you an opportunity to extend code.
|
||||
*/
|
||||
register(/*{ strapi }*/) {},
|
||||
|
||||
bootstrap({ strapi }: { strapi: Strapi }) {
|
||||
// This should return 42
|
||||
strapi.customAddMethod(11, 31);
|
||||
},
|
||||
/**
|
||||
* An asynchronous bootstrap function that runs before
|
||||
* your application gets started.
|
||||
*
|
||||
* This gives you an opportunity to set up your data model,
|
||||
* run jobs, or perform some special logic.
|
||||
*/
|
||||
bootstrap(/*{ strapi }*/) {},
|
||||
};
|
||||
|
@ -1,18 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string", "DOM"],
|
||||
"noImplicitAny": false,
|
||||
"module": "es2020",
|
||||
"target": "es5",
|
||||
"jsx": "react",
|
||||
"allowJs": true,
|
||||
"moduleResolution": "node",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"resolveJsonModule": true,
|
||||
"noEmit": false,
|
||||
"incremental": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.js", "*.js"]
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string", "DOM"],
|
||||
"module": "commonjs",
|
||||
"target": "es2019",
|
||||
"strict": false,
|
||||
"jsx": "react",
|
||||
"noImplicitAny": false,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowJs": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": ".",
|
||||
"noEmitOnError": true,
|
||||
"resolveJsonModule": true
|
||||
},
|
||||
|
||||
"include": ["src/**/*.json", "./"],
|
||||
"exclude": ["node_modules/", "build/", "dist/", "src/admin", ".cache/", ".tmp/"]
|
||||
}
|
21
examples/kitchensink-ts/tsconfig.json
Normal file
21
examples/kitchensink-ts/tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"extends": "@strapi/typescript-utils/lib/configs/server",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [
|
||||
"./",
|
||||
"src/**/*.json"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules/",
|
||||
"build/",
|
||||
"dist/",
|
||||
".cache/",
|
||||
".tmp/",
|
||||
"src/admin/",
|
||||
"**/*.test.ts",
|
||||
"src/plugins/**"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user