Use default build

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-12-20 14:56:06 +01:00
parent 3fae2a3fca
commit 584347e4bb
12 changed files with 6188 additions and 21 deletions

View File

@ -13,9 +13,6 @@
},
"dependencies": {
"@strapi/admin": "4.0.0",
"@strapi/plugin-documentation": "4.0.0",
"@strapi/plugin-graphql": "4.0.0",
"@strapi/plugin-i18n": "4.0.0",
"@strapi/provider-email-mailgun": "4.0.0",
"@strapi/provider-upload-aws-s3": "4.0.0",
"@strapi/provider-upload-cloudinary": "4.0.0",

View File

@ -0,0 +1,595 @@
{
"paths": {
"/email": {
"post": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}
}
},
"meta": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},
"tags": [
"Email"
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"/email/test": {
"post": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}
}
},
"meta": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},
"tags": [
"Email"
],
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}
}
}
}
}
}
}
},
"/email/settings": {
"get": {
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"data": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"attributes": {
"type": "object",
"properties": {
"foo": {
"type": "string"
}
}
}
}
},
"meta": {
"type": "object"
}
}
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"403": {
"description": "Forbidden",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
},
"500": {
"description": "Internal Server Error",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"properties": {
"status": {
"type": "integer"
},
"name": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
}
}
}
},
"tags": [
"Email"
],
"parameters": [],
"requestBody": {}
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -43,9 +43,10 @@ function getCustomWebpackConfig(dir, config) {
return webpackConfig;
}
async function build({ plugins, dir, env, options, optimize }) {
async function build({ plugins, dir, env, options, optimize, useDefaultBuild }) {
const buildAdmin = await shouldBuildAdmin({ dir, plugins });
if (!buildAdmin) {
if (!buildAdmin && useDefaultBuild) {
return;
}
@ -319,15 +320,14 @@ async function watchFiles(dir) {
}
const hasCustomAdminCode = async dir => {
const customAdminPath = path.join(dir, 'src/admin');
const customAdminPath = path.join(dir, 'src', 'admin');
const customAdminConfigFile = path.join(customAdminPath, 'app.js');
const customAdminWebpackFile = path.join(customAdminPath, 'webpack.config.js');
if (!(await fs.pathExists(customAdminPath))) {
return false;
}
const hasCustomConfigFile = await fs.pathExists(customAdminConfigFile);
const hasCustomWebpackFile = await fs.pathExists(customAdminWebpackFile);
const files = await fs.readdir(customAdminPath);
return files.length > 0;
return hasCustomConfigFile || hasCustomWebpackFile;
};
const hasNonDefaultPlugins = plugins => {

View File

@ -133,6 +133,7 @@ program
program
.command('build')
.option('--use-default-build', 'Use the default build of the admin panel', false)
.option('--clean', 'Remove the build and .cache folders', false)
.option('--no-optimization', 'Build the Administration without assets optimization')
.description('Builds the strapi admin app')

View File

@ -12,7 +12,7 @@ const getEnabledPlugins = require('../core/loaders/plugins/get-enabled-plugins')
/**
* `$ strapi build`
*/
module.exports = async ({ clean, optimization }) => {
module.exports = async ({ clean, optimization, useDefaultBuild }) => {
const dir = process.cwd();
const strapiInstance = strapi({
@ -36,6 +36,7 @@ module.exports = async ({ clean, optimization }) => {
return strapiAdmin
.build({
useDefaultBuild,
dir,
plugins,
// front end build env is always production for now
@ -47,6 +48,8 @@ module.exports = async ({ clean, optimization }) => {
},
})
.then(() => {
console.log('Admin UI build successfully');
process.exit();
})
.catch(err => {

View File

@ -15,7 +15,7 @@ const strapi = require('../index');
* `$ strapi develop`
*
*/
module.exports = async function ({ build, watchAdmin, polling, browser }) {
module.exports = async function({ build, watchAdmin, polling, browser }) {
const dir = process.cwd();
const config = loadConfiguration(dir);
const logger = createLogger(config.logger, {});
@ -28,7 +28,7 @@ module.exports = async function ({ build, watchAdmin, polling, browser }) {
// Don't run the build process if the admin is in watch mode
if (build && !watchAdmin && serveAdminPanel && !buildExists) {
try {
execa.sync('npm run -s build -- --no-optimization', {
execa.sync('npm run -s build -- --no-optimization --use-default-build', {
stdio: 'inherit',
shell: true,
});
@ -81,7 +81,7 @@ module.exports = async function ({ build, watchAdmin, polling, browser }) {
polling,
});
process.on('message', async (message) => {
process.on('message', async message => {
switch (message) {
case 'kill':
await strapiInstance.destroy();
@ -140,15 +140,15 @@ function watchFileChanges({ dir, strapiInstance, watchIgnoreFiles, polling }) {
});
watcher
.on('add', (path) => {
.on('add', path => {
strapiInstance.log.info(`File created: ${path}`);
restart();
})
.on('change', (path) => {
.on('change', path => {
strapiInstance.log.info(`File changed: ${path}`);
restart();
})
.on('unlink', (path) => {
.on('unlink', path => {
strapiInstance.log.info(`File deleted: ${path}`);
restart();
});

View File

@ -2,7 +2,7 @@ export default {
config: {
locales: [
// 'ar',
'fr',
// 'fr',
// 'cs',
// 'de',
// 'dk',
@ -29,5 +29,7 @@ export default {
// 'zh',
],
},
bootstrap() {},
bootstrap(app) {
console.log(app);
},
};