feat: bootstrapping
This commit is contained in:
parent
fa0bf0891e
commit
7c7219d3e8
|
@ -26,6 +26,7 @@
|
||||||
"@latus/repl": "^2.0.0",
|
"@latus/repl": "^2.0.0",
|
||||||
"@latus/socket": "^2.0.0",
|
"@latus/socket": "^2.0.0",
|
||||||
"@latus/user": "^2.0.0",
|
"@latus/user": "^2.0.0",
|
||||||
|
"@persea/bootstrap": "^1.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",
|
"autoprefixer": "^9.8.6",
|
||||||
|
|
|
@ -1203,6 +1203,13 @@
|
||||||
babel-merge "^3.0.0"
|
babel-merge "^3.0.0"
|
||||||
deepmerge "^1.5.2"
|
deepmerge "^1.5.2"
|
||||||
|
|
||||||
|
"@persea/bootstrap@^1.0.0":
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "http://npm.cha0sdev/@persea%2fbootstrap/-/bootstrap-1.0.0.tgz#9147eb9560ddac665c79f3cb97b3a0fcb6f36b1b"
|
||||||
|
integrity sha512-v8MVcYqhMAVUvj88EWf62FdbrFh7gN6DduGGEgGa2RXAxa53CTwO3I+RVOKR3JFmNARJ29W9xoSSogqBISsyuQ==
|
||||||
|
dependencies:
|
||||||
|
debug "4.3.1"
|
||||||
|
|
||||||
"@persea/core@^1.0.0":
|
"@persea/core@^1.0.0":
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "http://npm.cha0sdev/@persea%2fcore/-/core-1.0.0.tgz#31d8f5b7d7b1842ee5a65c3ab9d93d3ab89cec66"
|
resolved "http://npm.cha0sdev/@persea%2fcore/-/core-1.0.0.tgz#31d8f5b7d7b1842ee5a65c3ab9d93d3ab89cec66"
|
||||||
|
|
1
packages/bootstrap/.eslintrc.js
Normal file
1
packages/bootstrap/.eslintrc.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('../../config/.eslintrc');
|
6
packages/bootstrap/.gitignore
vendored
Normal file
6
packages/bootstrap/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
**/*.js
|
||||||
|
**/*.map
|
||||||
|
!/.*
|
||||||
|
!/webpack.config.js
|
||||||
|
!src/**/*.js
|
||||||
|
!/test/**/*.js
|
1
packages/bootstrap/.neutrinorc.js
Normal file
1
packages/bootstrap/.neutrinorc.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('../../config/.neutrinorc');
|
40
packages/bootstrap/package.json
Normal file
40
packages/bootstrap/package.json
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"name": "@persea/bootstrap",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"author": "cha0s",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"build": "NODE_PATH=./node_modules webpack --mode production",
|
||||||
|
"clean": "rm -rf yarn.lock node_modules $(node -e \"process.stdout.write(require('./package.json').files.join(' '));\") && yarn",
|
||||||
|
"lint": "NODE_PATH=./node_modules eslint --format codeframe --ext mjs,js .",
|
||||||
|
"test": "yarn --silent run build --display none && mocha --colors test.js"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"index.js",
|
||||||
|
"index.js.map",
|
||||||
|
"server.js",
|
||||||
|
"server.js.map",
|
||||||
|
"test.js",
|
||||||
|
"test.js.map"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "4.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@neutrinojs/airbnb-base": "^9.4.0",
|
||||||
|
"@neutrinojs/banner": "^9.4.0",
|
||||||
|
"@neutrinojs/copy": "^9.4.0",
|
||||||
|
"@neutrinojs/mocha": "^9.4.0",
|
||||||
|
"@neutrinojs/react": "^9.4.0",
|
||||||
|
"chai": "4.2.0",
|
||||||
|
"eslint": "^7",
|
||||||
|
"eslint-import-resolver-webpack": "0.13.0",
|
||||||
|
"glob": "7.1.6",
|
||||||
|
"mocha": "^8",
|
||||||
|
"neutrino": "^9.4.0",
|
||||||
|
"source-map-support": "0.5.19",
|
||||||
|
"webpack": "^4",
|
||||||
|
"webpack-cli": "^3"
|
||||||
|
}
|
||||||
|
}
|
0
packages/bootstrap/src/index.js
Normal file
0
packages/bootstrap/src/index.js
Normal file
24
packages/bootstrap/src/server/index.js
Normal file
24
packages/bootstrap/src/server/index.js
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
export default {
|
||||||
|
hooks: {
|
||||||
|
'@latus/core/server/up': async (latus) => {
|
||||||
|
// eslint-disable-next-line no-eval
|
||||||
|
if ('production' === eval('process.env.NODE_ENV')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const {Project, User} = latus.get('%models');
|
||||||
|
if (!await User.findOne({where: {email: 'persea@cha0s.io'}})) {
|
||||||
|
const user = await User.create({
|
||||||
|
email: 'persea@cha0s.io',
|
||||||
|
isAdmin: true,
|
||||||
|
});
|
||||||
|
await user.addHashedPassword('foobar');
|
||||||
|
await user.addProject(
|
||||||
|
await Project.create({
|
||||||
|
uuid: 'c41ddaac-89c2-46a4-b3e5-1d634a1a7c36',
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
await user.save();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
9
packages/bootstrap/test/exists.js
Normal file
9
packages/bootstrap/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;
|
||||||
|
})
|
||||||
|
});
|
3
packages/bootstrap/webpack.config.js
Normal file
3
packages/bootstrap/webpack.config.js
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
const neutrino = require('neutrino');
|
||||||
|
|
||||||
|
module.exports = neutrino(require(`${__dirname}/.neutrinorc`)).webpack();
|
6203
packages/bootstrap/yarn.lock
Normal file
6203
packages/bootstrap/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user