Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V4] Prebuild the admin panel. #11622

Merged
merged 3 commits into from
Nov 19, 2021
Merged

[V4] Prebuild the admin panel. #11622

merged 3 commits into from
Nov 19, 2021

Conversation

soupette
Copy link
Contributor

What does it do?

It fixes the build script, now only the plugins that are shipped with a generated app will be built.
It also introduces a script that writes the plugins.js file before starting the webpack-dev-server when developing in the monorepo.

Why is it needed?

In order to only build the necessary plugin when releasing a new version of Strapi.

How to test it?

The build script should build the admin correctly and the dev mode inside the monorepo should work as it used to.

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request

Signed-off-by: soupette <cyril@strapi.io>
Signed-off-by: soupette <cyril@strapi.io>
@codecov
Copy link

codecov bot commented Nov 18, 2021

Codecov Report

Merging #11622 (8d6700c) into releases/v4 (710e2a7) will increase coverage by 47.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff                @@
##           releases/v4   #11622       +/-   ##
================================================
+ Coverage             0   47.12%   +47.12%     
================================================
  Files                0      212      +212     
  Lines                0     8117     +8117     
  Branches             0     1775     +1775     
================================================
+ Hits                 0     3825     +3825     
- Misses               0     3525     +3525     
- Partials             0      767      +767     
Flag Coverage Δ
unit 47.12% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ackages/core/admin/server/services/content-type.js 95.77% <100.00%> (ø)
packages/core/strapi/lib/utils/ee.js 21.87% <0.00%> (ø)
packages/core/utils/lib/sanitize/sanitizers.js 100.00% <0.00%> (ø)
.../plugins/i18n/server/content-types/locale/index.js 100.00% <0.00%> (ø)
...e/utils/lib/sanitize/visitors/restricted-fields.js 13.33% <0.00%> (ø)
packages/core/database/lib/schema/builder.js 2.64% <0.00%> (ø)
packages/core/database/lib/query/helpers/join.js 14.28% <0.00%> (ø)
...n/ee/server/services/passport/provider-registry.js 100.00% <0.00%> (ø)
packages/plugins/i18n/server/services/locales.js 95.45% <0.00%> (ø)
...ackages/plugins/i18n/server/controllers/locales.js 96.72% <0.00%> (ø)
... and 203 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84301a3...8d6700c. Read the comment docs.

packages/core/admin/package.json Outdated Show resolved Hide resolved
@@ -9,7 +9,9 @@
"scripts": {
"prepublishOnly": "node ./scripts/build.js",
"test": "echo \"no tests yet\"",
"develop": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
"create:plugin-file": "node ./scripts/create-dev-plugins-file.js",
"dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
"develop:webpack": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",

*/
const createFile = async () => {
const customPluginFile = join(__dirname, '..', 'admin', 'src', 'plugins-dev.js');
const pluginFileDest = resolve(__dirname, '..', 'admin', 'src', 'plugins.js');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use join here too

.split('/')
.slice(-1)[0];

const adminEntryPoint = resolve(join(__dirname, '..', 'admin', 'src'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use join only here

const { camelCase } = require('lodash');
const fs = require('fs-extra');

const CORE_PLUGINS = ['content-type-builder', 'email', 'upload', 'i18n'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n is in the plugins folder you can remove it here

createPluginsFile,
} = require('./create-plugins-file');

const PLUGINS_TO_INSTALL = ['i18n'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the beginning of v4 we will keep users-permissions installed too so you should keep it here

Signed-off-by: soupette <cyril@strapi.io>
Copy link
Member

@alexandrebodin alexandrebodin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@soupette soupette merged commit cc03c09 into releases/v4 Nov 19, 2021
@soupette soupette deleted the v4/fix-release-script branch November 19, 2021 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants