@strapi/strapi 4.1.6-alpha.0 → 4.1.6-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Strapi.js CHANGED
@@ -50,8 +50,8 @@ const LIFECYCLES = {
50
50
  class Strapi {
51
51
  constructor(opts = {}) {
52
52
  destroyOnSignal(this);
53
- this.dirs = utils.getDirs(opts.dir || process.cwd());
54
- const appConfig = loadConfiguration(this.dirs.root, opts);
53
+ const rootDir = opts.dir || process.cwd();
54
+ const appConfig = loadConfiguration(rootDir, opts);
55
55
  this.container = createContainer(this);
56
56
  this.container.register('config', createConfigProvider(appConfig));
57
57
  this.container.register('content-types', contentTypesRegistry(this));
@@ -65,6 +65,8 @@ class Strapi {
65
65
  this.container.register('apis', apisRegistry(this));
66
66
  this.container.register('auth', createAuth(this));
67
67
 
68
+ this.dirs = utils.getDirs(rootDir, { strapi: this });
69
+
68
70
  this.isLoaded = false;
69
71
  this.reload = this.reload();
70
72
  this.server = createServer(this);
@@ -8,6 +8,7 @@ const execa = require('execa');
8
8
  const { getOr } = require('lodash/fp');
9
9
 
10
10
  const { createLogger } = require('@strapi/logger');
11
+ const { joinBy } = require('@strapi/utils');
11
12
  const loadConfiguration = require('../core/app-configuration');
12
13
  const strapi = require('../index');
13
14
  const buildAdmin = require('./build');
@@ -131,6 +132,8 @@ function watchFileChanges({ dir, strapiInstance, watchIgnoreFiles, polling }) {
131
132
  '**/index.html',
132
133
  '**/public',
133
134
  '**/public/**',
135
+ strapiInstance.dirs.public,
136
+ joinBy('/', strapiInstance.dirs.public, '**'),
134
137
  '**/*.db*',
135
138
  '**/exports/**',
136
139
  ...watchIgnoreFiles,
@@ -21,6 +21,7 @@ const defaultConfig = {
21
21
  proxy: false,
22
22
  cron: { enabled: false },
23
23
  admin: { autoOpen: false },
24
+ dirs: { public: './public' },
24
25
  },
25
26
  admin: {},
26
27
  api: {
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const { getConfigUrls } = require('@strapi/utils');
4
+ const fse = require('fs-extra');
4
5
 
5
- module.exports = function({ strapi }) {
6
+ module.exports = async function({ strapi }) {
6
7
  strapi.config.port = strapi.config.get('server.port') || strapi.config.port;
7
8
  strapi.config.host = strapi.config.get('server.host') || strapi.config.host;
8
9
 
@@ -22,4 +23,11 @@ module.exports = function({ strapi }) {
22
23
  if (!shouldServeAdmin) {
23
24
  strapi.config.serveAdminPanel = false;
24
25
  }
26
+
27
+ // ensure public repository exists
28
+ if (!(await fse.pathExists(strapi.dirs.public))) {
29
+ throw new Error(
30
+ `The public folder (${strapi.dirs.public}) doesn't exist or is not accessible. Please make sure it exists.`
31
+ );
32
+ }
25
33
  };
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const { join } = require('path');
3
+ const { join, resolve } = require('path');
4
4
 
5
- const getDirs = root => ({
5
+ const getDirs = (root, { strapi }) => ({
6
6
  root,
7
7
  src: join(root, 'src'),
8
8
  api: join(root, 'src', 'api'),
@@ -11,7 +11,7 @@ const getDirs = root => ({
11
11
  policies: join(root, 'src', 'policies'),
12
12
  middlewares: join(root, 'src', 'middlewares'),
13
13
  config: join(root, 'config'),
14
- public: join(root, 'public'),
14
+ public: resolve(root, strapi.config.get('server.dirs.public')),
15
15
  });
16
16
 
17
17
  module.exports = getDirs;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/strapi",
3
- "version": "4.1.6-alpha.0",
3
+ "version": "4.1.6-alpha.1",
4
4
  "description": "An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite",
5
5
  "keywords": [
6
6
  "strapi",
@@ -80,16 +80,16 @@
80
80
  "dependencies": {
81
81
  "@koa/cors": "3.1.0",
82
82
  "@koa/router": "10.1.1",
83
- "@strapi/admin": "4.1.6-alpha.0",
84
- "@strapi/database": "4.1.6-alpha.0",
85
- "@strapi/generate-new": "4.1.6-alpha.0",
86
- "@strapi/generators": "4.1.6-alpha.0",
87
- "@strapi/logger": "4.1.6-alpha.0",
88
- "@strapi/plugin-content-manager": "4.1.6-alpha.0",
89
- "@strapi/plugin-content-type-builder": "4.1.6-alpha.0",
90
- "@strapi/plugin-email": "4.1.6-alpha.0",
91
- "@strapi/plugin-upload": "4.1.6-alpha.0",
92
- "@strapi/utils": "4.1.6-alpha.0",
83
+ "@strapi/admin": "4.1.6-alpha.1",
84
+ "@strapi/database": "4.1.6-alpha.1",
85
+ "@strapi/generate-new": "4.1.6-alpha.1",
86
+ "@strapi/generators": "4.1.6-alpha.1",
87
+ "@strapi/logger": "4.1.6-alpha.1",
88
+ "@strapi/plugin-content-manager": "4.1.6-alpha.1",
89
+ "@strapi/plugin-content-type-builder": "4.1.6-alpha.1",
90
+ "@strapi/plugin-email": "4.1.6-alpha.1",
91
+ "@strapi/plugin-upload": "4.1.6-alpha.1",
92
+ "@strapi/utils": "4.1.6-alpha.1",
93
93
  "bcryptjs": "2.4.3",
94
94
  "boxen": "5.1.2",
95
95
  "chalk": "4.1.2",
@@ -136,5 +136,5 @@
136
136
  "node": ">=12.22.0 <=16.x.x",
137
137
  "npm": ">=6.0.0"
138
138
  },
139
- "gitHead": "c52f42c80df62e95876235db368f84a7eda09c97"
139
+ "gitHead": "1130511ce3b6762b3b3de972103d891c7bc69520"
140
140
  }