mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-04-06 15:30:30 +08:00
feat(build): Move app.style.lessVariables to config.theme.lessVariables.
This commit is contained in:
parent
fa6f8b9696
commit
cb14f1712f
@ -28,9 +28,6 @@ async function validateApp({ components }) {
|
||||
if (type.isNone(components.app.html)) {
|
||||
components.app.html = {};
|
||||
}
|
||||
if (type.isNone(components.app.style)) {
|
||||
components.app.style = {};
|
||||
}
|
||||
if (type.isNone(components.app.html.appendBody)) {
|
||||
components.app.html.appendBody = '';
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ test('validateApp no app defined', async () => {
|
||||
appendBody: '',
|
||||
appendHead: '',
|
||||
},
|
||||
style: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -42,7 +41,6 @@ test('validateApp empty app object', async () => {
|
||||
appendBody: '',
|
||||
appendHead: '',
|
||||
},
|
||||
style: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -56,7 +54,6 @@ test('validateApp empty html', async () => {
|
||||
appendBody: '',
|
||||
appendHead: '',
|
||||
},
|
||||
style: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
@ -77,15 +74,14 @@ test('validateApp appendHead and appendHead', async () => {
|
||||
appendBody: 'body',
|
||||
appendHead: 'head',
|
||||
},
|
||||
style: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('validateApp style', async () => {
|
||||
test('validate config theme', async () => {
|
||||
const components = {
|
||||
app: {
|
||||
style: {
|
||||
config: {
|
||||
theme: {
|
||||
lessVariables: {
|
||||
'primary-color': '#FF00FF',
|
||||
},
|
||||
@ -99,7 +95,9 @@ test('validateApp style', async () => {
|
||||
appendBody: '',
|
||||
appendHead: '',
|
||||
},
|
||||
style: {
|
||||
},
|
||||
config: {
|
||||
theme: {
|
||||
lessVariables: {
|
||||
'primary-color': '#FF00FF',
|
||||
},
|
||||
|
@ -36,6 +36,9 @@ async function validateConfig({ components }) {
|
||||
if (type.isNone(components.config.auth.pages.roles)) {
|
||||
components.config.auth.pages.roles = {};
|
||||
}
|
||||
if (type.isNone(components.config.theme)) {
|
||||
components.config.theme = {};
|
||||
}
|
||||
validate({
|
||||
schema: lowdefySchema.definitions.authConfig,
|
||||
data: components.config.auth,
|
||||
|
@ -19,6 +19,21 @@ import testContext from '../test/testContext.js';
|
||||
|
||||
const context = testContext();
|
||||
|
||||
test('validateConfig no config defined', async () => {
|
||||
const components = {};
|
||||
const result = await validateConfig({ components, context });
|
||||
expect(result).toEqual({
|
||||
config: {
|
||||
auth: {
|
||||
pages: {
|
||||
roles: {},
|
||||
},
|
||||
},
|
||||
theme: {},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('validateConfig config not an object', async () => {
|
||||
const components = {
|
||||
config: 'config',
|
||||
|
@ -63,12 +63,6 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
style: {
|
||||
type: 'object',
|
||||
errorMessage: {
|
||||
type: 'App "app.style" should be an object.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
authConfig: {
|
||||
@ -601,6 +595,9 @@ export default {
|
||||
},
|
||||
additionalProperties: false,
|
||||
properties: {
|
||||
auth: {
|
||||
$ref: '#/definitions/authConfig',
|
||||
},
|
||||
homePageId: {
|
||||
type: 'string',
|
||||
description:
|
||||
@ -609,8 +606,20 @@ export default {
|
||||
type: 'App "config.homePageId" should be a string.',
|
||||
},
|
||||
},
|
||||
auth: {
|
||||
$ref: '#/definitions/authConfig',
|
||||
theme: {
|
||||
type: 'object',
|
||||
errorMessage: {
|
||||
type: 'App "config.theme" should be an object.',
|
||||
},
|
||||
properties: {
|
||||
lessVariables: {
|
||||
type: 'object',
|
||||
description: 'App theme less variables.',
|
||||
errorMessage: {
|
||||
type: 'App "config.theme.lessVariables" should be an object.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -1,10 +1,10 @@
|
||||
const withLess = require('next-with-less');
|
||||
const appConfig = require('./build/app.json');
|
||||
const lowdefyConfig = require('./build/config.json');
|
||||
|
||||
module.exports = withLess({
|
||||
lessLoaderOptions: {
|
||||
lessOptions: {
|
||||
modifyVars: appConfig.style.lessVariables,
|
||||
modifyVars: lowdefyConfig.theme.lessVariables,
|
||||
},
|
||||
},
|
||||
// reactStrictMode: true,
|
||||
|
@ -1,10 +1,10 @@
|
||||
const withLess = require('next-with-less');
|
||||
const appConfig = require('./build/app.json');
|
||||
const lowdefyConfig = require('./build/config.json');
|
||||
|
||||
module.exports = withLess({
|
||||
lessLoaderOptions: {
|
||||
lessOptions: {
|
||||
modifyVars: appConfig.style.lessVariables,
|
||||
modifyVars: lowdefyConfig.theme.lessVariables,
|
||||
},
|
||||
},
|
||||
reactStrictMode: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user