diff --git a/.gitignore b/.gitignore index 44dab2c..22d188c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ npm-debug.log yarn-error.log aoe_technology_radar.iml build +bin diff --git a/package.json b/package.json index 5ea2fa6..879cb11 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "private": true, "scripts": { "start": "react-scripts start", - "build": "react-scripts build", + "build_": "react-scripts build", + "build": "tsc", "test": "react-scripts test", "_build": "yarn clean && yarn build:pages && yarn build:jsprod && yarn build:css && yarn build:assets", "build:all": "yarn build", @@ -13,6 +14,9 @@ "build:css": "postcss -c postcss.config.js -o dist/techradar/assets/css/styles.css styles/main.css", "type-check": "tsc --noEmit" }, + "bin": { + "create-radar": "bin/tasks/radarjson.js" + }, "browserslist": { "production": [ ">0.2%", diff --git a/tasks/tsconfig.json b/tasks/_tsconfig.json similarity index 78% rename from tasks/tsconfig.json rename to tasks/_tsconfig.json index 67e365d..9dfc5c0 100644 --- a/tasks/tsconfig.json +++ b/tasks/_tsconfig.json @@ -7,6 +7,7 @@ "strict": true, "types": ["node"], "esModuleInterop": true, - "resolveJsonModule": true + "resolveJsonModule": true, +// "outDir": "../bin", } } diff --git a/tasks/file.ts b/tasks/file.ts index 9db1dd9..70469e4 100644 --- a/tasks/file.ts +++ b/tasks/file.ts @@ -3,7 +3,8 @@ import path from 'path'; import { walk } from 'walk'; export const relativePath = (...relativePath: string[]): string => ( - path.resolve(__dirname, '..', ...relativePath) + // path.resolve(__dirname, '..', ...relativePath) + path.resolve(...relativePath) ); export const radarPath = (...pathInSrc: string[]) => ( diff --git a/tasks/radarjson.ts b/tasks/radarjson.ts index 45fe260..e4db5d4 100644 --- a/tasks/radarjson.ts +++ b/tasks/radarjson.ts @@ -1,25 +1,26 @@ -import { createRadar } from "./radar"; -import { save } from "./file"; +#!/usr/bin/env node + +import {createRadar} from "./radar"; +import {save} from "./file"; -export const r = (async () => { +(async () => { try { console.log('start') - const radar = await createRadar(); + const radar = await createRadar(); - // console.log(radar); + // console.log(radar); - save(JSON.stringify(radar), 'radar.json') - - // getPageNames(radar).map(pageName => { - // // const pageHtml = renderPage(radar, pageName); - // // save(pageHtml, `${pageName}.html`); - // save([pageName, radar], `${pageName}.html`) - // }); - - console.log('Built radar'); + save(JSON.stringify(radar), 'radar.json') + + // getPageNames(radar).map(pageName => { + // // const pageHtml = renderPage(radar, pageName); + // // save(pageHtml, `${pageName}.html`); + // save([pageName, radar], `${pageName}.html`) + // }); + + console.log('Built radar'); } catch (e) { - console.error('error:', e); + console.error('error:', e); } - })(); - \ No newline at end of file +})() diff --git a/tsconfig.json b/tsconfig.json index 277f285..346e6e3 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "target": "es5", + "target": "ES2015", "lib": [ "dom", "dom.iterable", @@ -14,11 +14,15 @@ "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", - "resolveJsonModule": true, "isolatedModules": true, - "noEmit": true, - "jsx": "react" + "jsx": "react", + "outDir": "bin", + "resolveJsonModule": true, + "noEmit": true }, + "files": [ + "tasks/radarjson.ts" + ], "include": [ "src" ] diff --git a/yarn.lock b/yarn.lock index 740f491..4a168af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2942,9 +2942,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001093, caniuse-lite@^1.0.30001097: - version "1.0.30001100" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001100.tgz#2a58615e0c01cf716ab349b20ca4d86ef944aa4e" - integrity sha512-0eYdp1+wFCnMlCj2oudciuQn2B9xAFq3WpgpcBIZTxk/1HNA/O2YA7rpeYhnOqsqAJq1AHUgx6i1jtafg7m2zA== + version "1.0.30001173" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001173.tgz" + integrity sha512-R3aqmjrICdGCTAnSXtNyvWYMK3YtV5jwudbq0T7nN9k4kmE4CBuwPqyJ+KBzepSTh0huivV2gLbSMEzTTmfeYw== capture-exit@^2.0.0: version "2.0.0"