unify bin scriptnames

This commit is contained in:
dennis.ludwig
2021-06-11 22:24:50 +02:00
parent e2aec44ad7
commit 5c581de249
5 changed files with 34 additions and 21 deletions

View File

@@ -13,9 +13,9 @@ The AOE Tech radar is deployed here: https://www.aoe.com/techradar/index.html
The generator is free to use under Open Source License - in fact there are already some other Radars published based on our Radar and there are also Contributions back.
(There is a list of planned features below in case someone wants to contribute :-)
However please be aware:
However, please be aware:
* It would be nice to mention in radar that the generator is based on this repository.
* Also when you want to reuse the CSS and Styling: Change the font (it is a licensed font) and the colors (It using AOE CI)
* Also, when you want to reuse the CSS and Styling: Change the font (it is a licensed font) and the colors (It using AOE CI)
## Use and build
@@ -26,12 +26,12 @@ yarn add https://github.com/aoepeople/aoe_technology_radar.git
Generate json file based on md files
```
yarn generateJson
yarn aoe_technology_radar:generateJson
```
Build the radar
```
yarn buildRadar
yarn aoe_technology_radar:buildRadar
```
Serve
@@ -44,14 +44,14 @@ Then open here: http://localhost:8080
## Run a prepared static version
In most cases you have the techradar available at `/techradar`, and for reasons want all correct pages to be accessable.
In most cases you have the techradar available at `/techradar`, and for reasons want all correct pages to be accessible.
Until this setup improves, you can use the following way to generate the correct techradar:
```
yarn generateJson
PUBLIC_URL=techradar/ yarn buildRadar
yarn createStaticFiles
yarn aoe_technology_radar:generateJson
PUBLIC_URL=/techradar yarn aoe_technology_radar:buildRadar
yarn aoe_technology_radar:createStaticFiles
cp -r build techradar
```
@@ -95,13 +95,25 @@ The name of the .md file acts as item identifier and may overwrite items with
the same name from older releases.
If an item is overwritten in a new release, the attributes from the new item are
merged with the old ones and a new history entry is created for that item.
merged with the old ones, and a new history entry is created for that item.
## Open points
* static build necessary? -> for SEO necessary
* dotenv necessary? -> Could be necessary for other companies
* measure file sizes necessary? -> no
* check browsers necessary? -> no
* copy public folder necessary? -> no
* specific webpack configurations necessary? -> no
* specific webpack configurations necessary? -> no
## TODOs
* Use other output folder than bin for compiled tasks, because bin is misleading with node bin folder
* add dist folder for precompiled builder
* add default envs to .env file
** add envs to readme
* Check package.json scripts
* Add documentation for build bin (tasks) folder
* prettier on all files
* check lint staged and prettier
* convert scripts to typescript as well
** move scripts paths.js and tasks in one folder

View File

@@ -3,6 +3,7 @@
const path = require("path");
const fs = require("fs");
const radarJson = "rd.json";
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = (relativePath = "") =>
path.resolve(appDirectory, relativePath);
@@ -13,7 +14,7 @@ const resolveTemplate = (relativePath = "") =>
module.exports = {
template: resolveTemplate(),
templateBuild: resolveTemplate("build"),
appRdJson: resolveApp("build/rd.json"),
appRdJson: resolveApp(`build/${radarJson}`),
appBuild: resolveApp("build"),
appYarnLock: resolveApp("yarn.lock"),
};

View File

@@ -10,9 +10,9 @@
"url": "https://github.com/AOEpeople/aoe_technology_radar.git"
},
"bin": {
"generateJson": "scripts/generateJson.js",
"buildRadar": "scripts/buildRadar.js",
"createStaticFiles": "bin/tasks/create-static.js"
"aoe_technology_radar:generateJson": "scripts/generateJson.js",
"aoe_technology_radar:buildRadar": "scripts/buildRadar.js",
"aoe_technology_radar:createStaticFiles": "bin/tasks/create-static.js"
},
"scripts": {
"prepare": "husky install && yarn build:tasks && yarn build",

View File

@@ -15,11 +15,11 @@ process.on("unhandledRejection", (err) => {
const fs = require("fs-extra");
const paths = require("../config/paths");
const childProcess = require("child_process");
const runCommand = (command, args) => {
const cp = require("child_process");
return new Promise((resolve, reject) => {
const executedCommand = cp.spawn(command, args, {
const executedCommand = childProcess.spawn(command, args, {
stdio: "inherit",
shell: true,
});
@@ -43,15 +43,13 @@ const buildTemplate = () => {
fs.emptyDirSync(paths.templateBuild);
process.chdir(paths.template);
return runCommand(`${packageManager} build`).catch((error) => {
console.error(error);
process.exit(1);
});
};
// TODO: Use other output folder than bin for compiled tasks, because bin is misleading with node bin folder
// TODO: add dist folder for precompiled builder
if (fs.existsSync(paths.appRdJson)) {
buildTemplate().then(() => {
fs.copySync(paths.templateBuild, paths.appBuild);

View File

@@ -13,10 +13,12 @@ process.on("unhandledRejection", (err) => {
throw err;
});
const paths = require("../config/paths");
require("../bin/tasks/radarjson")
.radarJsonGenerator()
.then(() => {
console.log("rd.json created");
console.log(`${paths.appRdJson} created.`);
})
.catch((err) => {
if (err && err.message) {