Skip to content

Commit

Permalink
Merge branch 'main' of github.com:strapi/strapi into feature/content-…
Browse files Browse the repository at this point in the history
…releases
  • Loading branch information
Feranchz committed Nov 14, 2023
2 parents 7424dfe + 175b72a commit 7c580f7
Show file tree
Hide file tree
Showing 236 changed files with 3,830 additions and 2,690 deletions.
2 changes: 1 addition & 1 deletion .github/actions/check-pr-status/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "check-pr-status",
"version": "4.15.1",
"version": "4.15.4",
"private": true,
"license": "MIT",
"main": "dist/index.js",
Expand Down
10 changes: 7 additions & 3 deletions docs/docs/docs/01-core/admin/06-commands/01-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ interface BuildContext {
* this path so all asset paths will be rewritten accordingly
*/
basePath: string;
/**
* The customisations defined by the user in their app.js file
*/
customisations?: AppFile;
/**
* The current working directory
*/
Expand All @@ -64,9 +68,9 @@ interface BuildContext {
* The environment variables to be included in the JS bundle
*/
env: Record<string, string>;
logger: Logger;
logger: CLIContext['logger'];
/**
* The build or develop options
* The build options
*/
options: Pick<BuildOptions, 'minify' | 'sourcemaps' | 'stats'> & Pick<DevelopOptions, 'open'>;
/**
Expand All @@ -90,7 +94,7 @@ interface BuildContext {
* The browserslist target either loaded from the user's workspace or falling back to the default
*/
target: string[];
tsconfig?: TSConfig;
tsconfig?: CLIContext['tsconfig'];
}
```

Expand Down
6 changes: 5 additions & 1 deletion docs/docs/docs/01-core/admin/06-commands/02-develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Start your Strapi application in development mode
Options:
--polling Watch for file changes (default: false) – Whether to use fs.watchFile (backed by polling), or fs.watch, this is passed directly to chokidar
--no-build [deprecated]: there is middleware for the server, it is no longer a separate process
--watch-admin [deprecated]: there is now middleware for watching, it is no longer a separate process
--watch-admin Watch the admin for changes (default: false)
--browser <name> [deprecated]: use open instead
--open Open the admin in your browser (default: true)
-h, --help Display help for command
Expand Down Expand Up @@ -66,6 +66,10 @@ interface DevelopOptions extends CLIContext {
* The tsconfig to use for the build. If undefined, this is not a TS project.
*/
tsconfig?: TsConfig;
/**
* Watch the admin for changes
*/
watchAdmin?: boolean;
}

interface Logger {
Expand Down
22 changes: 11 additions & 11 deletions examples/getstarted/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "getstarted",
"version": "4.15.1",
"version": "4.15.4",
"private": true,
"description": "A Strapi application.",
"license": "SEE LICENSE IN LICENSE",
Expand All @@ -14,16 +14,16 @@
},
"dependencies": {
"@strapi/icons": "1.11.0",
"@strapi/plugin-color-picker": "4.15.1",
"@strapi/plugin-documentation": "4.15.1",
"@strapi/plugin-graphql": "4.15.1",
"@strapi/plugin-i18n": "4.15.1",
"@strapi/plugin-sentry": "4.15.1",
"@strapi/plugin-users-permissions": "4.15.1",
"@strapi/provider-email-mailgun": "4.15.1",
"@strapi/provider-upload-aws-s3": "4.15.1",
"@strapi/provider-upload-cloudinary": "4.15.1",
"@strapi/strapi": "4.15.1",
"@strapi/plugin-color-picker": "4.15.4",
"@strapi/plugin-documentation": "4.15.4",
"@strapi/plugin-graphql": "4.15.4",
"@strapi/plugin-i18n": "4.15.4",
"@strapi/plugin-sentry": "4.15.4",
"@strapi/plugin-users-permissions": "4.15.4",
"@strapi/provider-email-mailgun": "4.15.4",
"@strapi/provider-upload-aws-s3": "4.15.4",
"@strapi/provider-upload-cloudinary": "4.15.4",
"@strapi/strapi": "4.15.4",
"better-sqlite3": "8.6.0",
"lodash": "4.17.21",
"mysql": "2.18.1",
Expand Down
9 changes: 0 additions & 9 deletions examples/getstarted/src/admin/app.example.js

This file was deleted.

11 changes: 11 additions & 0 deletions examples/getstarted/src/admin/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const config = {
locales: ['it', 'es', 'en'],
};
const bootstrap = () => {
console.log('I AM BOOTSTRAPPED');
};

export default {
config,
bootstrap,
};
8 changes: 4 additions & 4 deletions examples/kitchensink-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kitchensink-ts",
"version": "4.15.1",
"version": "4.15.4",
"private": true,
"description": "A Strapi application",
"license": "MIT",
Expand All @@ -14,9 +14,9 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/plugin-i18n": "4.15.1",
"@strapi/plugin-users-permissions": "4.15.1",
"@strapi/strapi": "4.15.1",
"@strapi/plugin-i18n": "4.15.4",
"@strapi/plugin-users-permissions": "4.15.4",
"@strapi/strapi": "4.15.4",
"better-sqlite3": "8.6.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 5 additions & 5 deletions examples/kitchensink/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kitchensink",
"version": "4.15.1",
"version": "4.15.4",
"private": true,
"description": "A Strapi application.",
"license": "SEE LICENSE IN LICENSE",
Expand All @@ -13,10 +13,10 @@
"strapi": "strapi"
},
"dependencies": {
"@strapi/provider-email-mailgun": "4.15.1",
"@strapi/provider-upload-aws-s3": "4.15.1",
"@strapi/provider-upload-cloudinary": "4.15.1",
"@strapi/strapi": "4.15.1",
"@strapi/provider-email-mailgun": "4.15.4",
"@strapi/provider-upload-aws-s3": "4.15.4",
"@strapi/provider-upload-cloudinary": "4.15.4",
"@strapi/strapi": "4.15.4",
"lodash": "4.17.21",
"mysql": "2.18.1",
"mysql2": "3.6.0",
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.15.1",
"version": "4.15.4",
"packages": ["packages/*", "examples/*"],
"npmClient": "yarn",
"useWorkspaces": true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"watch": "nx run-many --target=watch --nx-ignore-cycles"
},
"resolutions": {
"@strapi/design-system": "1.14.0-typescript.0",
"@strapi/design-system": "1.14.0-typescript.1",
"@types/koa": "2.13.4",
"@types/react": "18.2.7"
},
Expand Down
7 changes: 4 additions & 3 deletions packages/admin-test-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@strapi/admin-test-utils",
"version": "4.15.1",
"version": "4.15.4",
"private": true,
"description": "Test utilities for the Strapi administration panel",
"license": "MIT",
Expand Down Expand Up @@ -62,6 +62,7 @@
"build": "pack-up build",
"clean": "run -T rimraf ./dist",
"lint": "run -T eslint .",
"prepublishOnly": "yarn clean && yarn build",
"test:ts": "run -T tsc --noEmit",
"watch": "pack-up watch"
},
Expand All @@ -74,8 +75,8 @@
"@reduxjs/toolkit": "1.9.7",
"@strapi/pack-up": "workspace:*",
"@testing-library/jest-dom": "5.16.5",
"eslint-config-custom": "4.15.1",
"tsconfig": "4.15.1"
"eslint-config-custom": "4.15.4",
"tsconfig": "4.15.4"
},
"peerDependencies": {
"@reduxjs/toolkit": "^1.9.7",
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/create-strapi-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-strapi-app",
"version": "4.15.1",
"version": "4.15.4",
"description": "Generate a new Strapi application.",
"keywords": [
"create-strapi-app",
Expand Down Expand Up @@ -44,14 +44,14 @@
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/generate-new": "4.15.1",
"@strapi/generate-new": "4.15.4",
"commander": "8.3.0",
"inquirer": "8.2.5"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.15.1",
"tsconfig": "4.15.1"
"@strapi/pack-up": "4.15.4",
"eslint-config-custom": "4.15.4",
"tsconfig": "4.15.4"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/create-strapi-starter/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-strapi-starter",
"version": "4.15.1",
"version": "4.15.4",
"description": "Generate a new Strapi application.",
"keywords": [
"create-strapi-starter",
Expand Down Expand Up @@ -44,7 +44,7 @@
"watch": "pack-up watch"
},
"dependencies": {
"@strapi/generate-new": "4.15.1",
"@strapi/generate-new": "4.15.4",
"chalk": "4.1.2",
"ci-info": "3.8.0",
"commander": "8.3.0",
Expand All @@ -54,9 +54,9 @@
"ora": "5.4.1"
},
"devDependencies": {
"@strapi/pack-up": "workspace:*",
"eslint-config-custom": "4.15.1",
"tsconfig": "4.15.1"
"@strapi/pack-up": "4.15.4",
"eslint-config-custom": "4.15.4",
"tsconfig": "4.15.4"
},
"engines": {
"node": ">=18.0.0 <=20.x.x",
Expand Down
3 changes: 3 additions & 0 deletions packages/core/admin/_internal/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const build: StrapiCommand = ({ command, ctx }) => {
command
.command('build')
.option('-d, --debug', 'Enable debugging mode with verbose logs', false)
.option('--ignore-prompts', 'Ignore all prompts', false)
.option('--minify', 'Minify the output', true)
.option('--no-optimization', '[deprecated]: use minify instead')
.option('--silent', "Don't log anything", false)
Expand All @@ -31,7 +32,9 @@ const develop: StrapiCommand = ({ command, ctx }) => {
.alias('dev')
.option('-d, --debug', 'Enable debugging mode with verbose logs', false)
.option('--silent', "Don't log anything", false)
.option('--ignore-prompts', 'Ignore all prompts', false)
.option('--polling', 'Watch for file changes in network directories', false)
.option('--watch-admin', 'Watch the admin panel for hot changes', false)
.option(
'--no-build',
'[deprecated]: there is middleware for the server, it is no longer a separate process'
Expand Down
16 changes: 11 additions & 5 deletions packages/core/admin/_internal/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { getTimer } from './core/timer';
import type { CLIContext } from '@strapi/strapi';

interface BuildOptions extends CLIContext {
/**
* @default false
*/
ignorePrompts?: boolean;
/**
* Minify the output
*
Expand All @@ -31,13 +35,15 @@ interface BuildOptions extends CLIContext {
*
* @description Builds the admin panel of the strapi application.
*/
const build = async ({ logger, cwd, tsconfig, ...options }: BuildOptions) => {
const build = async ({ logger, cwd, tsconfig, ignorePrompts, ...options }: BuildOptions) => {
const timer = getTimer();

const { didInstall } = await checkRequiredDependencies({ cwd, logger }).catch((err) => {
logger.error(err.message);
process.exit(1);
});
const { didInstall } = await checkRequiredDependencies({ cwd, logger, ignorePrompts }).catch(
(err) => {
logger.error(err.message);
process.exit(1);
}
);

if (didInstall) {
return;
Expand Down
32 changes: 32 additions & 0 deletions packages/core/admin/_internal/node/core/admin-customisations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import path from 'node:path';
import { loadFile } from './files';

const ADMIN_APP_FILES = ['app.js', 'app.mjs', 'app.ts', 'app.jsx', 'app.tsx'];

interface AdminCustomisations {
config?: {
locales?: string[];
};
bootstrap?: Function;
}

interface AppFile {
path: string;
config: AdminCustomisations['config'];
}

const loadUserAppFile = async (appDir: string): Promise<AppFile | undefined> => {
for (const file of ADMIN_APP_FILES) {
const filePath = path.join(appDir, 'src', 'admin', file);
const configFile = await loadFile(filePath);

if (configFile) {
return { path: filePath, config: configFile };
}
}

return undefined;
};

export { loadUserAppFile };
export type { AdminCustomisations, AppFile };
12 changes: 8 additions & 4 deletions packages/core/admin/_internal/node/core/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { getPackageManager } from './managers';
const PEER_DEPS = {
react: '^18.0.0',
'react-dom': '^18.0.0',
'react-router-dom': '^5.0.0',
'styled-components': '^5.0.0',
'react-router-dom': '^5.2.0',
'styled-components': '^5.2.1',
};

interface CheckRequiredDependenciesResult {
Expand All @@ -41,7 +41,11 @@ interface DepToInstall {
const checkRequiredDependencies = async ({
cwd,
logger,
}: Pick<BuildOptions, 'cwd' | 'logger'>): Promise<CheckRequiredDependenciesResult> => {
ignorePrompts,
}: Pick<
BuildOptions,
'cwd' | 'logger' | 'ignorePrompts'
>): Promise<CheckRequiredDependenciesResult> => {
const pkg = await readPkgUp({ cwd });

if (!pkg) {
Expand Down Expand Up @@ -102,7 +106,7 @@ const checkRequiredDependencies = async ({
/**
* temporary until V5 when we _will_ be enforcing these dependencies as required.
*/
if (process.env.NODE_ENV !== 'development') {
if (process.env.NODE_ENV !== 'development' || ignorePrompts) {
return { didInstall: false };
}

Expand Down
Loading

0 comments on commit 7c580f7

Please sign in to comment.