mirror of
https://github.com/strapi/strapi.git
synced 2025-09-01 04:42:58 +00:00
Add a typescript kitchensink example
This commit is contained in:
parent
bb584a5c58
commit
c28ca35990
16
examples/kitchensink-ts/.editorconfig
Normal file
16
examples/kitchensink-ts/.editorconfig
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[{package.json,*.yml}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
2
examples/kitchensink-ts/.env.example
Normal file
2
examples/kitchensink-ts/.env.example
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
HOST=0.0.0.0
|
||||||
|
PORT=1337
|
114
examples/kitchensink-ts/.gitignore
vendored
Normal file
114
examples/kitchensink-ts/.gitignore
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
############################
|
||||||
|
# OS X
|
||||||
|
############################
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
Icon
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
._*
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Linux
|
||||||
|
############################
|
||||||
|
|
||||||
|
*~
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Windows
|
||||||
|
############################
|
||||||
|
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Packages
|
||||||
|
############################
|
||||||
|
|
||||||
|
*.7z
|
||||||
|
*.csv
|
||||||
|
*.dat
|
||||||
|
*.dmg
|
||||||
|
*.gz
|
||||||
|
*.iso
|
||||||
|
*.jar
|
||||||
|
*.rar
|
||||||
|
*.tar
|
||||||
|
*.zip
|
||||||
|
*.com
|
||||||
|
*.class
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*.o
|
||||||
|
*.seed
|
||||||
|
*.so
|
||||||
|
*.swo
|
||||||
|
*.swp
|
||||||
|
*.swn
|
||||||
|
*.swm
|
||||||
|
*.out
|
||||||
|
*.pid
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Logs and databases
|
||||||
|
############################
|
||||||
|
|
||||||
|
.tmp
|
||||||
|
*.log
|
||||||
|
*.sql
|
||||||
|
*.sqlite
|
||||||
|
*.sqlite3
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Misc.
|
||||||
|
############################
|
||||||
|
|
||||||
|
*#
|
||||||
|
ssl
|
||||||
|
.idea
|
||||||
|
nbproject
|
||||||
|
public/uploads/*
|
||||||
|
!public/uploads/.gitkeep
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Node.js
|
||||||
|
############################
|
||||||
|
|
||||||
|
lib-cov
|
||||||
|
lcov.info
|
||||||
|
pids
|
||||||
|
logs
|
||||||
|
results
|
||||||
|
node_modules
|
||||||
|
.node_history
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Tests
|
||||||
|
############################
|
||||||
|
|
||||||
|
testApp
|
||||||
|
coverage
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Strapi
|
||||||
|
############################
|
||||||
|
|
||||||
|
.env
|
||||||
|
license.txt
|
||||||
|
exports
|
||||||
|
*.cache
|
||||||
|
build
|
||||||
|
.strapi-updater.json
|
3
examples/kitchensink-ts/README.md
Normal file
3
examples/kitchensink-ts/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Strapi application
|
||||||
|
|
||||||
|
A quick description of your strapi application
|
5
examples/kitchensink-ts/config/admin.ts
Normal file
5
examples/kitchensink-ts/config/admin.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default ({ env }) => ({
|
||||||
|
auth: {
|
||||||
|
secret: env('ADMIN_JWT_SECRET', 'example-token'),
|
||||||
|
},
|
||||||
|
});
|
7
examples/kitchensink-ts/config/api.ts
Normal file
7
examples/kitchensink-ts/config/api.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export default {
|
||||||
|
rest: {
|
||||||
|
defaultLimit: 25,
|
||||||
|
maxLimit: 100,
|
||||||
|
withCount: true,
|
||||||
|
},
|
||||||
|
};
|
11
examples/kitchensink-ts/config/database.ts
Normal file
11
examples/kitchensink-ts/config/database.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
export default ({ env }) => ({
|
||||||
|
connection: {
|
||||||
|
client: 'sqlite',
|
||||||
|
connection: {
|
||||||
|
filename: path.join(__dirname, '..', env('DATABASE_FILENAME', '.tmp/data.db')),
|
||||||
|
},
|
||||||
|
useNullAsDefault: true,
|
||||||
|
},
|
||||||
|
});
|
11
examples/kitchensink-ts/config/functions/bootstrap.ts
Normal file
11
examples/kitchensink-ts/config/functions/bootstrap.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
/**
|
||||||
|
* 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 () => {};
|
19
examples/kitchensink-ts/config/functions/cron.ts
Normal file
19
examples/kitchensink-ts/config/functions/cron.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* 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': () => {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
};
|
@ -0,0 +1,3 @@
|
|||||||
|
export default async (/* ctx */) => {
|
||||||
|
// return ctx.notFound('My custom message 404');
|
||||||
|
};
|
12
examples/kitchensink-ts/config/server.ts
Normal file
12
examples/kitchensink-ts/config/server.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export default ({ env }) => ({
|
||||||
|
host: env('HOST', '0.0.0.0'),
|
||||||
|
port: env.int('PORT', 6567),
|
||||||
|
admin: {
|
||||||
|
auth: {
|
||||||
|
secret: env('ADMIN_JWT_SECRET', '6f75e424d1a0307077c294fcc3c7d78d'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
app: {
|
||||||
|
keys: env.array('APP_KEYS', ['toBeModified1', 'toBeModified2']),
|
||||||
|
},
|
||||||
|
});
|
BIN
examples/kitchensink-ts/favicon.ico
Normal file
BIN
examples/kitchensink-ts/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.6 KiB |
41
examples/kitchensink-ts/package.json
Normal file
41
examples/kitchensink-ts/package.json
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
"name": "kitchensink-ts",
|
||||||
|
"private": true,
|
||||||
|
"version": "4.1.1",
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@strapi/admin": "4.1.1",
|
||||||
|
"@strapi/provider-email-mailgun": "4.1.1",
|
||||||
|
"@strapi/provider-upload-aws-s3": "4.1.1",
|
||||||
|
"@strapi/provider-upload-cloudinary": "4.1.1",
|
||||||
|
"@strapi/strapi": "4.1.1",
|
||||||
|
"@strapi/utils": "4.1.1",
|
||||||
|
"lodash": "4.17.21",
|
||||||
|
"mysql": "2.18.1",
|
||||||
|
"passport-google-oauth2": "0.2.0",
|
||||||
|
"pg": "8.6.0",
|
||||||
|
"sqlite3": "5.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@swc/cli": "0.1.55",
|
||||||
|
"@swc/core": "1.2.146",
|
||||||
|
"tsc": "2.0.4",
|
||||||
|
"typescript": "4.6.2"
|
||||||
|
},
|
||||||
|
"strapi": {
|
||||||
|
"uuid": "getstarted"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.22.0 <=16.x.x",
|
||||||
|
"npm": ">=6.0.0"
|
||||||
|
},
|
||||||
|
"license": "SEE LICENSE IN LICENSE"
|
||||||
|
}
|
3
examples/kitchensink-ts/public/robots.txt
Normal file
3
examples/kitchensink-ts/public/robots.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
|
||||||
|
# User-Agent: *
|
||||||
|
# Disallow: /
|
0
examples/kitchensink-ts/public/uploads/.gitkeep
Normal file
0
examples/kitchensink-ts/public/uploads/.gitkeep
Normal file
33
examples/kitchensink-ts/src/admin/app.example.js
Normal file
33
examples/kitchensink-ts/src/admin/app.example.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import theme from './extensions/theme';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
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', 'de'],
|
||||||
|
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 },
|
||||||
|
},
|
||||||
|
bootstrap() {},
|
||||||
|
};
|
47
examples/kitchensink-ts/src/admin/extensions/theme.js
Normal file
47
examples/kitchensink-ts/src/admin/extensions/theme.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const theme = {
|
||||||
|
colors: {
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default theme;
|
0
examples/kitchensink-ts/src/admin/foo.ts
Normal file
0
examples/kitchensink-ts/src/admin/foo.ts
Normal file
10
examples/kitchensink-ts/src/admin/webpack.config.example.js
Normal file
10
examples/kitchensink-ts/src/admin/webpack.config.example.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
/* eslint-disable no-unused-vars */
|
||||||
|
module.exports = (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;
|
||||||
|
};
|
0
examples/kitchensink-ts/src/api/.gitkeep
Normal file
0
examples/kitchensink-ts/src/api/.gitkeep
Normal file
0
examples/kitchensink-ts/src/extensions/.gitkeep
Normal file
0
examples/kitchensink-ts/src/extensions/.gitkeep
Normal file
25
examples/kitchensink-ts/tsconfig.json
Normal file
25
examples/kitchensink-ts/tsconfig.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"],
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es2019",
|
||||||
|
"strict": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"allowJs": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"noEmitOnError": true
|
||||||
|
},
|
||||||
|
|
||||||
|
"exclude": [
|
||||||
|
// Misc
|
||||||
|
"node_modules/",
|
||||||
|
"dist/",
|
||||||
|
// Admin Directories
|
||||||
|
"src/admin",
|
||||||
|
"src/plugins/**/admin",
|
||||||
|
"src/extensions/**/admin" // to verify
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user