chore: updates
This commit is contained in:
parent
f62726f16e
commit
cd08e1368b
|
@ -16,6 +16,7 @@ const config = {
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
|
node: {},
|
||||||
webpack: {
|
webpack: {
|
||||||
config: `${__dirname}/webpack.config.js`,
|
config: `${__dirname}/webpack.config.js`,
|
||||||
},
|
},
|
||||||
|
|
1
app/.gitignore
vendored
1
app/.gitignore
vendored
|
@ -117,3 +117,4 @@ dist
|
||||||
|
|
||||||
/build
|
/build
|
||||||
/latus.yml
|
/latus.yml
|
||||||
|
/resource
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
require('dotenv/config');
|
require('dotenv/config');
|
||||||
|
|
||||||
const {join} = require('path');
|
|
||||||
|
|
||||||
const airbnb = require('@neutrinojs/airbnb');
|
const airbnb = require('@neutrinojs/airbnb');
|
||||||
const clean = require('@neutrinojs/clean');
|
const clean = require('@neutrinojs/clean');
|
||||||
const copy = require('@neutrinojs/copy');
|
const copy = require('@neutrinojs/copy');
|
||||||
|
@ -15,6 +13,9 @@ module.exports = {
|
||||||
root: __dirname,
|
root: __dirname,
|
||||||
},
|
},
|
||||||
use: [
|
use: [
|
||||||
|
(neutrino) => {
|
||||||
|
neutrino.options.mains.electron = {entry: './src/electron'};
|
||||||
|
},
|
||||||
airbnb({
|
airbnb({
|
||||||
eslint: {
|
eslint: {
|
||||||
cache: false,
|
cache: false,
|
||||||
|
@ -31,7 +32,9 @@ module.exports = {
|
||||||
}],
|
}],
|
||||||
}),
|
}),
|
||||||
mocha(),
|
mocha(),
|
||||||
node(),
|
node({
|
||||||
|
hot: true,
|
||||||
|
}),
|
||||||
(neutrino) => {
|
(neutrino) => {
|
||||||
[
|
[
|
||||||
'components',
|
'components',
|
||||||
|
@ -65,7 +68,7 @@ module.exports = {
|
||||||
}]);
|
}]);
|
||||||
neutrino.config
|
neutrino.config
|
||||||
.entry('index')
|
.entry('index')
|
||||||
.prepend('@latus/core/start');
|
.add('@latus/core/start');
|
||||||
if ('production' !== neutrino.config.get('mode')) {
|
if ('production' !== neutrino.config.get('mode')) {
|
||||||
neutrino.config
|
neutrino.config
|
||||||
.entry('index')
|
.entry('index')
|
||||||
|
@ -74,6 +77,7 @@ module.exports = {
|
||||||
.plugin('start-server')
|
.plugin('start-server')
|
||||||
.tap((args) => {
|
.tap((args) => {
|
||||||
const options = args[0];
|
const options = args[0];
|
||||||
|
options.signal = true;
|
||||||
const inspectArg = process.argv.find((arg) => -1 !== arg.indexOf('--inspect'));
|
const inspectArg = process.argv.find((arg) => -1 !== arg.indexOf('--inspect'));
|
||||||
if (inspectArg) {
|
if (inspectArg) {
|
||||||
options.nodeArgs.push(inspectArg);
|
options.nodeArgs.push(inspectArg);
|
||||||
|
@ -83,10 +87,13 @@ module.exports = {
|
||||||
options.nodeArgs.push(profArg);
|
options.nodeArgs.push(profArg);
|
||||||
}
|
}
|
||||||
options.nodeArgs.push('--experimental-repl-await');
|
options.nodeArgs.push('--experimental-repl-await');
|
||||||
|
options.nodeArgs.push('--unhandled-rejections=strict');
|
||||||
return args;
|
return args;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
neutrino.config.externals(nodeExternals());
|
neutrino.config.externals(nodeExternals());
|
||||||
|
neutrino.config.resolve.alias
|
||||||
|
.set('react-dom', '@hot-loader/react-dom');
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,14 +4,16 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --mode production",
|
"build": "webpack --mode production",
|
||||||
|
"clean": "rm -rf yarn.lock node_modules/* && yarn",
|
||||||
"dev": "webpack --mode development",
|
"dev": "webpack --mode development",
|
||||||
"docker": "yarn run build && docker build",
|
"docker": "yarn run build && docker build",
|
||||||
|
"electron": "electron build/electron.js",
|
||||||
"forcelatus": "pkgs=$(find node_modules/@latus -maxdepth 1 -mindepth 1 -printf '@latus/%f '); yarn upgrade $pkgs",
|
"forcelatus": "pkgs=$(find node_modules/@latus -maxdepth 1 -mindepth 1 -printf '@latus/%f '); yarn upgrade $pkgs",
|
||||||
"lint": "eslint --cache --format codeframe --ext mjs,jsx,js src",
|
"lint": "eslint --cache --format codeframe --ext mjs,jsx,js src",
|
||||||
"repl": "rlwrap -C qmp socat STDIO UNIX:$(ls /tmp/latus-*.sock | tail -n 1)",
|
"repl": "rlwrap -C qmp socat STDIO UNIX:$(ls /tmp/latus-*.sock | tail -n 1)",
|
||||||
"start": "NODE_ENV=production node build/index.js",
|
"start": "NODE_ENV=production node build/index.js",
|
||||||
"test": "mocha --watch src",
|
"test": "mocha --watch src",
|
||||||
"watch": "webpack --hot --watch --mode development"
|
"watch": "NODE_PATH=./node_modules webpack --hot --watch --mode development"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@latus/core": "^2.0.0",
|
"@latus/core": "^2.0.0",
|
||||||
|
@ -26,7 +28,9 @@
|
||||||
"@latus/user": "^2.0.0",
|
"@latus/user": "^2.0.0",
|
||||||
"@persea/core": "^1.0.0",
|
"@persea/core": "^1.0.0",
|
||||||
"@persea/json": "^1.0.0",
|
"@persea/json": "^1.0.0",
|
||||||
|
"autoprefixer": "^9.8.6",
|
||||||
"dotenv": "8.2.0",
|
"dotenv": "8.2.0",
|
||||||
|
"electron": "^11.2.0",
|
||||||
"react-hot-loader": "4.13.0"
|
"react-hot-loader": "4.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
6
app/postcss.config.js
Normal file
6
app/postcss.config.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/* eslint-disable global-require */
|
||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
require('autoprefixer'),
|
||||||
|
],
|
||||||
|
};
|
59
app/src/electron.js
Normal file
59
app/src/electron.js
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
import {fork} from 'child_process';
|
||||||
|
import {app, BrowserWindow} from 'electron';
|
||||||
|
import {get} from 'http';
|
||||||
|
|
||||||
|
let serverInstance = false;
|
||||||
|
async function startServer() {
|
||||||
|
if (serverInstance) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
serverInstance = fork(`${__dirname}/index`);
|
||||||
|
const check = true;
|
||||||
|
while (check) {
|
||||||
|
try {
|
||||||
|
// eslint-disable-next-line no-await-in-loop
|
||||||
|
const {statusCode} = await new Promise((resolve, reject) => {
|
||||||
|
get('http://persea.localhost', {timeout: 50}, resolve).on('error', reject);
|
||||||
|
});
|
||||||
|
if (200 === statusCode) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line no-empty
|
||||||
|
catch (error) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createWindow() {
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
contextIsolation: true,
|
||||||
|
nodeIntegration: false,
|
||||||
|
},
|
||||||
|
width: 800,
|
||||||
|
});
|
||||||
|
await win.loadURL('http://persea.localhost');
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('activate', async () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('quit', () => {
|
||||||
|
serverInstance.kill();
|
||||||
|
});
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await app.whenReady();
|
||||||
|
await startServer();
|
||||||
|
await createWindow();
|
||||||
|
})();
|
|
@ -2,15 +2,15 @@ import React from 'react';
|
||||||
import {hot} from 'react-hot-loader';
|
import {hot} from 'react-hot-loader';
|
||||||
|
|
||||||
import Login from '@latus/user/client/components/login';
|
import Login from '@latus/user/client/components/login';
|
||||||
import {useDispatch} from '@latus/redux/client';
|
import {useDispatch} from '@latus/redux';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createProject,
|
createProject,
|
||||||
createResource,
|
createResource,
|
||||||
deleteResource,
|
deleteResource,
|
||||||
renameResource,
|
renameResource,
|
||||||
} from '@persea/core/client';
|
} from '@persea/core';
|
||||||
import {patchJsonResource} from '@persea/json/client';
|
import {patchJsonResource} from '@persea/json';
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
3739
app/yarn.lock
3739
app/yarn.lock
File diff suppressed because it is too large
Load Diff
|
@ -48,6 +48,7 @@ module.exports = {
|
||||||
neutrino.options.output = '.';
|
neutrino.options.output = '.';
|
||||||
react({
|
react({
|
||||||
clean: false,
|
clean: false,
|
||||||
|
hot: false,
|
||||||
})(neutrino);
|
})(neutrino);
|
||||||
Object.keys(neutrino.options.mains).forEach((main) => {
|
Object.keys(neutrino.options.mains).forEach((main) => {
|
||||||
neutrino.config.plugins.delete(`html-${main}`);
|
neutrino.config.plugins.delete(`html-${main}`);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@latus/package",
|
"name": "@humus/package",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "cha0s",
|
"author": "cha0s",
|
||||||
|
@ -9,10 +9,8 @@
|
||||||
"clean": "rm -rf yarn.lock node_modules && yarn",
|
"clean": "rm -rf yarn.lock node_modules && yarn",
|
||||||
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
||||||
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
||||||
"link": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['link', m]));\"",
|
|
||||||
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
||||||
"test": "NODE_PATH=./node_modules mocha --config ../../config/.mocharc.js",
|
"test": "mocha --colors test.js",
|
||||||
"unlink": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['unlink', m]));\" && yarn install --force",
|
|
||||||
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -26,7 +24,8 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@neutrinojs/airbnb-base": "^9.4.0",
|
"@neutrinojs/airbnb-base": "^9.4.0",
|
||||||
"@neutrinojs/copy": "9.4.0",
|
"@neutrinojs/banner": "^9.4.0",
|
||||||
|
"@neutrinojs/copy": "^9.4.0",
|
||||||
"@neutrinojs/mocha": "^9.4.0",
|
"@neutrinojs/mocha": "^9.4.0",
|
||||||
"@neutrinojs/react": "^9.4.0",
|
"@neutrinojs/react": "^9.4.0",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
|
@ -35,6 +34,7 @@
|
||||||
"glob": "7.1.6",
|
"glob": "7.1.6",
|
||||||
"mocha": "^8",
|
"mocha": "^8",
|
||||||
"neutrino": "^9.4.0",
|
"neutrino": "^9.4.0",
|
||||||
|
"source-map-support": "0.5.19",
|
||||||
"webpack": "^4",
|
"webpack": "^4",
|
||||||
"webpack-cli": "^3"
|
"webpack-cli": "^3"
|
||||||
}
|
}
|
||||||
|
|
37
package.js
Normal file
37
package.js
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
const {execSync} = require('child_process');
|
||||||
|
const {join} = require('path');
|
||||||
|
const fs = require('fs-extra')
|
||||||
|
|
||||||
|
const cwd = process.cwd();
|
||||||
|
const [exe, script, package] = process.argv;
|
||||||
|
|
||||||
|
const path = join(cwd, 'packages', package);
|
||||||
|
try {
|
||||||
|
fs.accessSync(path);
|
||||||
|
console.error(`Package '${package}' already exists, aborting.`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
catch (error) {}
|
||||||
|
|
||||||
|
const [scope] = require('./package.json').name.split('/');
|
||||||
|
const name = [scope, package].join('/');
|
||||||
|
console.log(`Copying new project '${name}' to ${path}...`);
|
||||||
|
fs.copySync(
|
||||||
|
join(cwd, 'config/package'),
|
||||||
|
path,
|
||||||
|
);
|
||||||
|
const json = {
|
||||||
|
...require(join(path, 'package.json')),
|
||||||
|
name,
|
||||||
|
};
|
||||||
|
fs.writeFileSync(
|
||||||
|
join(path, 'package.json'),
|
||||||
|
JSON.stringify(json, null, 2),
|
||||||
|
);
|
||||||
|
|
||||||
|
const exec = (cmd) => execSync(cmd, {cwd: path, stdio: 'inherit'});
|
||||||
|
console.log(`Installing...`);
|
||||||
|
exec('yarn');
|
||||||
|
|
||||||
|
console.log(`Testing...`);
|
||||||
|
exec('yarn run test');
|
12
package.json
12
package.json
|
@ -1,27 +1,29 @@
|
||||||
{
|
{
|
||||||
"name": "@persea/monorepo",
|
"name": "@humus/monorepo",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "lerna run build",
|
"build": "lerna run build",
|
||||||
"clean": "lerna run clean",
|
"clean": "lerna run clean --concurrency=1",
|
||||||
"dev": "lerna run dev",
|
"dev": "lerna run dev",
|
||||||
"forcepub": "lerna run forcepub",
|
"forcepub": "lerna run forcepub",
|
||||||
"link": "lerna run link",
|
|
||||||
"lint": "lerna run lint",
|
"lint": "lerna run lint",
|
||||||
"test": "lerna run test",
|
"package": "node ./package.js",
|
||||||
"unlink": "lerna run unlink",
|
"test": "lerna run test --no-bail -- --silent",
|
||||||
"watch": "lerna run watch --parallel"
|
"watch": "lerna run watch --parallel"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@neutrinojs/airbnb-base": "^9.4.0",
|
"@neutrinojs/airbnb-base": "^9.4.0",
|
||||||
|
"@neutrinojs/banner": "^9.4.0",
|
||||||
"@neutrinojs/mocha": "^9.4.0",
|
"@neutrinojs/mocha": "^9.4.0",
|
||||||
"@neutrinojs/react": "^9.4.0",
|
"@neutrinojs/react": "^9.4.0",
|
||||||
"chai": "4.2.0",
|
"chai": "4.2.0",
|
||||||
"eslint": "^7",
|
"eslint": "^7",
|
||||||
"eslint-import-resolver-webpack": "0.13.0",
|
"eslint-import-resolver-webpack": "0.13.0",
|
||||||
|
"glob": "7.1.6",
|
||||||
"lerna": "^3.22.1",
|
"lerna": "^3.22.1",
|
||||||
"mocha": "^8",
|
"mocha": "^8",
|
||||||
"neutrino": "^9.4.0",
|
"neutrino": "^9.4.0",
|
||||||
|
"source-map-support": "0.5.19",
|
||||||
"webpack": "^4",
|
"webpack": "^4",
|
||||||
"webpack-cli": "^3",
|
"webpack-cli": "^3",
|
||||||
"webpack-node-externals": "2.5.2"
|
"webpack-node-externals": "2.5.2"
|
||||||
|
|
|
@ -1,3 +1 @@
|
||||||
const neutrino = require('neutrino');
|
module.exports = require('../../config/.eslintrc');
|
||||||
|
|
||||||
module.exports = neutrino(require(`${__dirname}/.neutrinorc`)()).eslintrc();
|
|
||||||
|
|
1
packages/core/.gitignore
vendored
1
packages/core/.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
!/.*
|
!/.*
|
||||||
!/webpack.config.js
|
!/webpack.config.js
|
||||||
!src/**/*.js
|
!src/**/*.js
|
||||||
|
!/test/**/*.js
|
||||||
|
|
|
@ -9,17 +9,17 @@
|
||||||
"clean": "rm -rf yarn.lock node_modules && yarn",
|
"clean": "rm -rf yarn.lock node_modules && yarn",
|
||||||
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
||||||
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
||||||
"link": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['link', m]));\"",
|
|
||||||
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
||||||
"test": "NODE_PATH=./node_modules mocha --config ../../config/.mocharc.js",
|
"test": "mocha --colors test.js",
|
||||||
"unlink": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['unlink', m]));\" && yarn install --force",
|
|
||||||
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"client.js",
|
|
||||||
"client.js.map",
|
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map"
|
"index.js.map",
|
||||||
|
"server.js",
|
||||||
|
"server.js.map",
|
||||||
|
"test.js",
|
||||||
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
|
@ -39,6 +39,7 @@
|
||||||
"eslint-import-resolver-webpack": "0.13.0",
|
"eslint-import-resolver-webpack": "0.13.0",
|
||||||
"mocha": "^8",
|
"mocha": "^8",
|
||||||
"neutrino": "^9.4.0",
|
"neutrino": "^9.4.0",
|
||||||
|
"source-map-support": "0.5.19",
|
||||||
"webpack": "^4",
|
"webpack": "^4",
|
||||||
"webpack-cli": "^3"
|
"webpack-cli": "^3"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
import {projects} from './state';
|
|
||||||
|
|
||||||
export * from './state';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hooks: {
|
|
||||||
'@latus/redux/slices': () => ({
|
|
||||||
projects,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -1,14 +1,11 @@
|
||||||
import Project from './models/project';
|
import {projects} from './state';
|
||||||
import ProjectUser from './models/project-user';
|
|
||||||
|
export * from './state';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
hooks: {
|
||||||
'@latus/db/models': () => ({
|
'@latus/redux/slices': () => ({
|
||||||
Project,
|
projects,
|
||||||
}),
|
|
||||||
'@latus/db/models.decorate': (Models) => ({
|
|
||||||
...Models,
|
|
||||||
User: ProjectUser(Models.User),
|
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
14
packages/core/src/server/index.js
Normal file
14
packages/core/src/server/index.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import Project from '../models/project';
|
||||||
|
import ProjectUser from '../models/project-user';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
hooks: {
|
||||||
|
'@latus/db/server/models': () => ({
|
||||||
|
Project,
|
||||||
|
}),
|
||||||
|
'@latus/db/server/models.decorate': (Models) => ({
|
||||||
|
...Models,
|
||||||
|
User: ProjectUser(Models.User),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,12 +1,12 @@
|
||||||
import {
|
import {
|
||||||
createSelector,
|
createSelector,
|
||||||
createSlice,
|
createSlice,
|
||||||
} from '@latus/redux/client';
|
} from '@latus/redux';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addPathToTree,
|
addPathToTree,
|
||||||
removePathFromTree,
|
removePathFromTree,
|
||||||
} from '../../tree-utils';
|
} from '../tree-utils';
|
||||||
|
|
||||||
export const projectsSelector = (state) => state.projects;
|
export const projectsSelector = (state) => state.projects;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import natsort from 'natsort';
|
||||||
import {
|
import {
|
||||||
getFlatDataFromTree,
|
getFlatDataFromTree,
|
||||||
getTreeFromFlatData,
|
getTreeFromFlatData,
|
||||||
removeNodeAtPath,
|
// removeNodeAtPath,
|
||||||
} from 'react-sortable-tree';
|
} from 'react-sortable-tree';
|
||||||
|
|
||||||
const getKey = ({path}) => path;
|
const getKey = ({path}) => path;
|
||||||
|
|
9
packages/core/test/exists.js
Normal file
9
packages/core/test/exists.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import {expect} from 'chai';
|
||||||
|
|
||||||
|
const {name} = require('../package.json');
|
||||||
|
|
||||||
|
describe(name, () => {
|
||||||
|
it('exists', () => {
|
||||||
|
expect(true).to.be.true;
|
||||||
|
})
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
1
packages/json/.gitignore
vendored
1
packages/json/.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
!/.*
|
!/.*
|
||||||
!/webpack.config.js
|
!/webpack.config.js
|
||||||
!src/**/*.js
|
!src/**/*.js
|
||||||
|
!/test/**/*.js
|
||||||
|
|
|
@ -9,17 +9,15 @@
|
||||||
"clean": "rm -rf yarn.lock node_modules && yarn",
|
"clean": "rm -rf yarn.lock node_modules && yarn",
|
||||||
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
"dev": "NODE_PATH=./node_modules webpack --mode development",
|
||||||
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
"forcepub": "npm unpublish --force $(node -e 'const {name, version} = require(`./package.json`); process.stdout.write(`${name}@${version}`)') && npm publish",
|
||||||
"link": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['link', m]));\"",
|
|
||||||
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
||||||
"test": "NODE_PATH=./node_modules mocha --config ../../config/.mocharc.js",
|
"test": "mocha --colors test.js",
|
||||||
"unlink": "node -e \"Object.keys(require('./package.json').dependencies).filter((m) => 0 === m.indexOf('@latus/')).forEach((m) => require('child_process').spawn('yarn', ['unlink', m]));\" && yarn install --force",
|
|
||||||
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
"watch": "NODE_PATH=./node_modules webpack --watch --mode development"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"client.js",
|
|
||||||
"client.js.map",
|
|
||||||
"index.js",
|
"index.js",
|
||||||
"index.js.map"
|
"index.js.map",
|
||||||
|
"test.js",
|
||||||
|
"test.js.map"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
|
@ -36,6 +34,7 @@
|
||||||
"eslint-import-resolver-webpack": "0.13.0",
|
"eslint-import-resolver-webpack": "0.13.0",
|
||||||
"mocha": "^8",
|
"mocha": "^8",
|
||||||
"neutrino": "^9.4.0",
|
"neutrino": "^9.4.0",
|
||||||
|
"source-map-support": "0.5.19",
|
||||||
"webpack": "^4",
|
"webpack": "^4",
|
||||||
"webpack-cli": "^3"
|
"webpack-cli": "^3"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
import {createNextState} from '@latus/redux/client';
|
|
||||||
import {applyPatch} from 'fast-json-patch';
|
|
||||||
|
|
||||||
import {patchJsonResource} from './state';
|
|
||||||
|
|
||||||
export * from './state';
|
|
||||||
|
|
||||||
export default {
|
|
||||||
hooks: {
|
|
||||||
'@latus/redux/reducers': () => (state, {payload, type}) => {
|
|
||||||
if (type !== patchJsonResource.toString()) {
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
const {patch, project, uri} = payload;
|
|
||||||
return createNextState(state, (draft) => {
|
|
||||||
applyPatch(draft.projects.resources[`${project}${uri}`], patch);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
import {createNextState} from '@latus/redux';
|
||||||
|
import {applyPatch} from 'fast-json-patch';
|
||||||
|
|
||||||
|
import {patchJsonResource} from './state';
|
||||||
|
|
||||||
|
export * from './state';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
hooks: {
|
||||||
|
'@latus/redux/reducers': () => (state, {payload, type}) => {
|
||||||
|
if (type !== patchJsonResource.toString()) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
const {patch, project, uri} = payload;
|
||||||
|
return createNextState(state, (draft) => {
|
||||||
|
applyPatch(draft.projects.resources[`${project}${uri}`], patch);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
|
@ -1,4 +1,4 @@
|
||||||
import {createAction} from '@latus/redux/client';
|
import {createAction} from '@latus/redux';
|
||||||
|
|
||||||
export const patchJsonResource = createAction('@persea/json/patchResource');
|
export const patchJsonResource = createAction('@persea/json/patchResource');
|
||||||
|
|
9
packages/json/test/exists.js
Normal file
9
packages/json/test/exists.js
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
import {expect} from 'chai';
|
||||||
|
|
||||||
|
const {name} = require('../package.json');
|
||||||
|
|
||||||
|
describe(name, () => {
|
||||||
|
it('exists', () => {
|
||||||
|
expect(true).to.be.true;
|
||||||
|
})
|
||||||
|
});
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user