mirror of
https://github.com/symfony/recipes.git
synced 2026-09-11 23:26:27 +03:00
Update Flex endpoint
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"post-install-output": [
|
||||
" * Your admin is almost ready:",
|
||||
" 1. Install the JavaScript dependencies by running <comment>yarn add @api-platform/admin @babel/preset-react</comment>",
|
||||
" 1. Install the JavaScript dependencies by running <comment>npm add @api-platform/admin @babel/preset-react</comment>",
|
||||
" 2. Edit <comment>webpack.config.js</comment> and <info>uncomment</info> the following lines:",
|
||||
"",
|
||||
" Encore",
|
||||
@@ -64,7 +64,7 @@
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "0e8b564f51ee72ba5ba1f9741b05b23b2f2af5de"
|
||||
"ref": "b5a9213db0daaa3c3f2908de5f069ca812b08c4c"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"manifests": {
|
||||
"api-platform/admin-pack": {
|
||||
"manifest": {
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/",
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"templates/": "templates/"
|
||||
},
|
||||
"post-install-output": [
|
||||
" * Your admin is almost ready:",
|
||||
" 1. Install the JavaScript dependencies by running <comment>npm add @api-platform/admin @babel/preset-react</comment>",
|
||||
" 2. Edit <comment>webpack.config.js</comment> and <info>uncomment</info> the following lines:",
|
||||
"",
|
||||
" Encore",
|
||||
" // ...",
|
||||
" .enableReactPreset()",
|
||||
" .addEntry('admin', './assets/js/admin.js')",
|
||||
"",
|
||||
" * Mark entities you want in the admin with the <comment>@ApiResource</comment> annotation, it appears in the admin!",
|
||||
"",
|
||||
" * Using MakerBundle? Try <info>php bin/console make:entity --api-resource</info>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/js/admin.js": {
|
||||
"contents": [
|
||||
"import React from 'react';",
|
||||
"import ReactDOM from 'react-dom';",
|
||||
"import { HydraAdmin } from '@api-platform/admin';",
|
||||
"",
|
||||
"const entrypoint = document.getElementById('api-entrypoint').innerText;",
|
||||
"",
|
||||
"ReactDOM.render(<HydraAdmin entrypoint={entrypoint}/>, document.getElementById('api-platform-admin'));",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/routes/api_platform_admin.yaml": {
|
||||
"contents": [
|
||||
"admin:",
|
||||
" path: /admin",
|
||||
" controller: Symfony\\Bundle\\FrameworkBundle\\Controller\\TemplateController",
|
||||
" defaults:",
|
||||
" template: admin.html.twig",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"templates/admin.html.twig": {
|
||||
"contents": [
|
||||
"{% extends 'base.html.twig' %}",
|
||||
"",
|
||||
"{% block title %}API Platform Admin{% endblock %}",
|
||||
"",
|
||||
"{% block body %}<div id=\"api-platform-admin\"></div>{% endblock %}",
|
||||
"",
|
||||
"{% block javascripts %}",
|
||||
" <script type=\"text/plain\" id=\"api-entrypoint\">{{ path('api_entrypoint') }}</script>",
|
||||
" {{ encore_entry_script_tags('admin') }}",
|
||||
"{% endblock %}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "b5a9213db0daaa3c3f2908de5f069ca812b08c4c"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,235 @@
|
||||
{
|
||||
"manifests": {
|
||||
"symfony/webpack-encore-bundle": {
|
||||
"manifest": {
|
||||
"bundles": {
|
||||
"Symfony\\WebpackEncoreBundle\\WebpackEncoreBundle": [
|
||||
"all"
|
||||
]
|
||||
},
|
||||
"copy-from-recipe": {
|
||||
"assets/": "assets/",
|
||||
"config/": "%CONFIG_DIR%/",
|
||||
"package.json": "package.json",
|
||||
"webpack.config.js": "webpack.config.js"
|
||||
},
|
||||
"gitignore": [
|
||||
"/node_modules/",
|
||||
"/%PUBLIC_DIR%/build/",
|
||||
"npm-debug.log",
|
||||
"yarn-error.log"
|
||||
],
|
||||
"conflict": {
|
||||
"symfony/framework-bundle": "<5.4",
|
||||
"symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0"
|
||||
},
|
||||
"add-lines": [
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_script_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block javascripts %}",
|
||||
"warn_if_missing": true
|
||||
},
|
||||
{
|
||||
"file": "templates/base.html.twig",
|
||||
"content": " {{ encore_entry_link_tags('app') }}",
|
||||
"position": "after_target",
|
||||
"target": "{% block stylesheets %}",
|
||||
"warn_if_missing": true
|
||||
}
|
||||
],
|
||||
"post-install-output": [
|
||||
" * Install NPM and run <fg=green>npm install</>",
|
||||
"",
|
||||
" * Compile your assets: <fg=green>npm run dev</>",
|
||||
"",
|
||||
" * Or start the development server: <fg=green>npm run watch</>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"assets/app.js": {
|
||||
"contents": [
|
||||
"/*",
|
||||
" * Welcome to your app's main JavaScript file!",
|
||||
" *",
|
||||
" * We recommend including the built version of this JavaScript file",
|
||||
" * (and its CSS file) in your base layout (base.html.twig).",
|
||||
" */",
|
||||
"",
|
||||
"// any CSS you import will output into a single css file (app.css in this case)",
|
||||
"import './styles/app.css';",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"assets/styles/app.css": {
|
||||
"contents": [
|
||||
"body {",
|
||||
" background-color: lightgray;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"config/packages/webpack_encore.yaml": {
|
||||
"contents": [
|
||||
"webpack_encore:",
|
||||
" # The path where Encore is building the assets - i.e. Encore.setOutputPath()",
|
||||
" output_path: '%kernel.project_dir%/public/build'",
|
||||
" # If multiple builds are defined (as shown below), you can disable the default build:",
|
||||
" # output_path: false",
|
||||
"",
|
||||
" # Set attributes that will be rendered on all script and link tags",
|
||||
" script_attributes:",
|
||||
" defer: true",
|
||||
" # Uncomment (also under link_attributes) if using Turbo Drive",
|
||||
" # https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change",
|
||||
" # 'data-turbo-track': reload",
|
||||
" # link_attributes:",
|
||||
" # Uncomment if using Turbo Drive",
|
||||
" # 'data-turbo-track': reload",
|
||||
"",
|
||||
" # If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')",
|
||||
" # crossorigin: 'anonymous'",
|
||||
"",
|
||||
" # Preload all rendered script and link tags automatically via the HTTP/2 Link header",
|
||||
" # preload: true",
|
||||
"",
|
||||
" # Throw an exception if the entrypoints.json file is missing or an entry is missing from the data",
|
||||
" # strict_mode: false",
|
||||
"",
|
||||
" # If you have multiple builds:",
|
||||
" # builds:",
|
||||
" # frontend: '%kernel.project_dir%/public/frontend/build'",
|
||||
"",
|
||||
" # pass the build name as the 3rd argument to the Twig functions",
|
||||
" # {{ encore_entry_script_tags('entry1', null, 'frontend') }}",
|
||||
"",
|
||||
"framework:",
|
||||
" assets:",
|
||||
" json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'",
|
||||
"",
|
||||
"#when@prod:",
|
||||
"# webpack_encore:",
|
||||
"# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)",
|
||||
"# # Available in version 1.2",
|
||||
"# cache: true",
|
||||
"",
|
||||
"#when@test:",
|
||||
"# webpack_encore:",
|
||||
"# strict_mode: false",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"package.json": {
|
||||
"contents": [
|
||||
"{",
|
||||
" \"devDependencies\": {",
|
||||
" \"@babel/core\": \"^7.17.0\",",
|
||||
" \"@babel/preset-env\": \"^7.16.0\",",
|
||||
" \"@symfony/webpack-encore\": \"^4.0.0\",",
|
||||
" \"core-js\": \"^3.23.0\",",
|
||||
" \"regenerator-runtime\": \"^0.13.9\",",
|
||||
" \"webpack\": \"^5.74.0\",",
|
||||
" \"webpack-cli\": \"^4.10.0\",",
|
||||
" \"webpack-notifier\": \"^1.15.0\"",
|
||||
" },",
|
||||
" \"license\": \"UNLICENSED\",",
|
||||
" \"private\": true,",
|
||||
" \"scripts\": {",
|
||||
" \"dev-server\": \"encore dev-server\",",
|
||||
" \"dev\": \"encore dev\",",
|
||||
" \"watch\": \"encore dev --watch\",",
|
||||
" \"build\": \"encore production --progress\"",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
},
|
||||
"webpack.config.js": {
|
||||
"contents": [
|
||||
"const Encore = require('@symfony/webpack-encore');",
|
||||
"",
|
||||
"// Manually configure the runtime environment if not already configured yet by the \"encore\" command.",
|
||||
"// It's useful when you use tools that rely on webpack.config.js file.",
|
||||
"if (!Encore.isRuntimeEnvironmentConfigured()) {",
|
||||
" Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');",
|
||||
"}",
|
||||
"",
|
||||
"Encore",
|
||||
" // directory where compiled assets will be stored",
|
||||
" .setOutputPath('public/build/')",
|
||||
" // public path used by the web server to access the output path",
|
||||
" .setPublicPath('/build')",
|
||||
" // only needed for CDN's or subdirectory deploy",
|
||||
" //.setManifestKeyPrefix('build/')",
|
||||
"",
|
||||
" /*",
|
||||
" * ENTRY CONFIG",
|
||||
" *",
|
||||
" * Each entry will result in one JavaScript file (e.g. app.js)",
|
||||
" * and one CSS file (e.g. app.css) if your JavaScript imports CSS.",
|
||||
" */",
|
||||
" .addEntry('app', './assets/app.js')",
|
||||
"",
|
||||
" // When enabled, Webpack \"splits\" your files into smaller pieces for greater optimization.",
|
||||
" .splitEntryChunks()",
|
||||
"",
|
||||
" // will require an extra script tag for runtime.js",
|
||||
" // but, you probably want this, unless you're building a single-page app",
|
||||
" .enableSingleRuntimeChunk()",
|
||||
"",
|
||||
" /*",
|
||||
" * FEATURE CONFIG",
|
||||
" *",
|
||||
" * Enable & configure other features below. For a full",
|
||||
" * list of features, see:",
|
||||
" * https://symfony.com/doc/current/frontend.html#adding-more-features",
|
||||
" */",
|
||||
" .cleanupOutputBeforeBuild()",
|
||||
" .enableBuildNotifications()",
|
||||
" .enableSourceMaps(!Encore.isProduction())",
|
||||
" // enables hashed filenames (e.g. app.abc123.css)",
|
||||
" .enableVersioning(Encore.isProduction())",
|
||||
"",
|
||||
" // configure Babel",
|
||||
" // .configureBabel((config) => {",
|
||||
" // config.plugins.push('@babel/a-babel-plugin');",
|
||||
" // })",
|
||||
"",
|
||||
" // enables and configure @babel/preset-env polyfills",
|
||||
" .configureBabelPresetEnv((config) => {",
|
||||
" config.useBuiltIns = 'usage';",
|
||||
" config.corejs = '3.23';",
|
||||
" })",
|
||||
"",
|
||||
" // enables Sass/SCSS support",
|
||||
" //.enableSassLoader()",
|
||||
"",
|
||||
" // uncomment if you use TypeScript",
|
||||
" //.enableTypeScriptLoader()",
|
||||
"",
|
||||
" // uncomment if you use React",
|
||||
" //.enableReactPreset()",
|
||||
"",
|
||||
" // uncomment to get integrity=\"...\" attributes on your script & link tags",
|
||||
" // requires WebpackEncoreBundle 1.4 or higher",
|
||||
" //.enableIntegrityHashes(Encore.isProduction())",
|
||||
"",
|
||||
" // uncomment if you're having problems with a jQuery plugin",
|
||||
" //.autoProvidejQuery()",
|
||||
";",
|
||||
"",
|
||||
"module.exports = Encore.getWebpackConfig();",
|
||||
""
|
||||
],
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "082d754b3bd54b3fc669f278f1eea955cfd23cf5"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,9 +40,11 @@
|
||||
}
|
||||
],
|
||||
"post-install-output": [
|
||||
" * Install Yarn and run <fg=green>yarn install</>",
|
||||
" * Install NPM and run <fg=green>npm install</>",
|
||||
"",
|
||||
" * Start the development server: <fg=green>yarn encore dev-server</>"
|
||||
" * Compile your assets: <fg=green>npm run dev</>",
|
||||
"",
|
||||
" * Or start the development server: <fg=green>npm run watch</>"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
@@ -227,7 +229,7 @@
|
||||
"executable": false
|
||||
}
|
||||
},
|
||||
"ref": "13ebe04e25085e2ff0bcb0f9218b561d8b5089f3"
|
||||
"ref": "082d754b3bd54b3fc669f278f1eea955cfd23cf5"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user