From 97260189ae39c5dc78a765f54f114c8aa0a66e3b Mon Sep 17 00:00:00 2001 From: Devin Fee Date: Thu, 17 Jan 2019 11:14:20 -0800 Subject: [PATCH] added docs build/publish --- .size-snapshot.json | 6 +-- .travis.yml | 3 +- Makefile | 60 ++++++++++++++------- doczrc.js | 7 +-- package.json | 7 +++ rbx.code-workspace | 13 ----- src/__docs__/components/feature.tsx | 16 +++--- src/__docs__/etc.mdx | 4 +- src/__docs__/index.html | 27 ++++++++++ src/__docs__/public/favicon-16x16.png | Bin 0 -> 738 bytes src/__docs__/public/favicon-32x32.png | Bin 0 -> 1991 bytes src/__docs__/public/favicon.ico | Bin 0 -> 5430 bytes src/__docs__/public/srcdoc-polyfill.min.js | 4 ++ tsconfig.build.json | 2 +- 14 files changed, 101 insertions(+), 48 deletions(-) delete mode 100644 rbx.code-workspace create mode 100644 src/__docs__/index.html create mode 100644 src/__docs__/public/favicon-16x16.png create mode 100644 src/__docs__/public/favicon-32x32.png create mode 100644 src/__docs__/public/favicon.ico create mode 100644 src/__docs__/public/srcdoc-polyfill.min.js diff --git a/.size-snapshot.json b/.size-snapshot.json index 8cd0d06c..5ca02bb9 100644 --- a/.size-snapshot.json +++ b/.size-snapshot.json @@ -38,9 +38,9 @@ } }, "dist/index.cjs.js": { - "bundled": 77303, - "minified": 53258, - "gzipped": 9105 + "bundled": 81274, + "minified": 57910, + "gzipped": 10087 }, "dist/rbx.esm.js": { "bundled": 87646, diff --git a/.travis.yml b/.travis.yml index 19a848c7..f737e45c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ node_js: - "8" script: - make test # run tests - - make # ensure /src builds + - make build # ensure pkg builds + - make build_docs # ensure docz builds after_success: - make ci_publish diff --git a/Makefile b/Makefile index 3a4eba25..067b7056 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,34 @@ BUILD_DIR=dist .PHONY: all build_pre build_esm build_cjs build_styles clean publish test test_lint test_unit ci_publish help -all: clean build_esm build_cjs build_styles +help: + @echo "Makefile usage (: $(BUILD_DIR)):" + @echo "\nBUILD" + @echo " \`make build\`: build all" + @echo " \`make clean\`: delete " + @echo " \`make build_esm\`: package for ESM" + @echo " \`make build_cjs\`: package for CJS" + @echo " \`make build_styles\`: copy and compile sass" + @echo " \`make build_pre\`: create " + + @echo "\nTEST" + @echo " \`make test\`: test all (lint & unit)" + @echo " \`make lint\`: run tslint" + @echo " \`make test_unit\`: run jest unit tests" + + @echo "\nDOCS" + @echo " \`make docs_dev\`: run docz" + @echo " \`make docs_build\`: build docz" + @echo " \`make docs_publish\`: publish to GitHub Pages" + + @echo "\nETC" + @echo " \`make help\`: show this message" + @echo " \`make publish\`: publish to npm" + @echo " \`make ci_publish\`: publish coverage" + + +### Build +build: clean build_esm build_cjs build_styles @sed 's/"dist\//"/g' package.json > $(BUILD_DIR)/package.json build_pre: @@ -26,10 +53,12 @@ clean: @echo "Deleting $(BUILD_DIR)" @rm -rf $(BUILD_DIR) +### Publish publish: @echo "Publishing to NPM" @cd $(BUILD_DIR) && npm publish +### Test test: lint test_unit lint: @@ -40,26 +69,21 @@ test_unit: @echo "Running tests" @npx jest --coverage +### CI ci_publish: @echo "Publishing coverage" @cat ./.coverage/lcov.info | npx coveralls -help: - @echo "Makefile usage (: $(BUILD_DIR)):" - @echo "\nBUILD" - @echo " \`make\`: build all" - @echo " \`make clean\`: delete " - @echo " \`make build_esm\`: package for ESM" - @echo " \`make build_cjs\`: package for CJS" - @echo " \`make build_styles\`: copy and compile sass" - @echo " \`make build_pre\`: create " - @echo "\nTEST" - @echo " \`make test\`: test all (lint & unit)" - @echo " \`make lint\`: run tslint" - @echo " \`make test_unit\`: run jest unit tests" +### Docs +docs_dev: + @echo "Running docs dev" + @npx docz dev - @echo "\nETC" - @echo " \`make help\`: show this message" - @echo " \`make publish\`: publish to npm" - @echo " \`make ci_publish\`: publish coverage" +docs_build: + @echo "Running docs build" + @npx docz build + +docs_publish: + @echo "Publishing to GitHub pages" + @npx gh-pages -d .docz/dist -m \"Deploy Docs [skip ci]\" diff --git a/doczrc.js b/doczrc.js index 321f7717..928def21 100644 --- a/doczrc.js +++ b/doczrc.js @@ -3,7 +3,7 @@ const path = require("path"); export default { - base: "rbx", + base: "/rbx", // unfortnately, "too-many-modules" // https://github.com/codesandbox/codesandboxer/blob/af013874f5a2f7bb6325c9608597883a8f5061ef/packages/codesandboxer-fs/src/assembleFiles.js#L120 codeSandbox: false, @@ -11,8 +11,9 @@ export default { "The Comprehensive Bulma UI Framework for React. This is a lightweight, yet robust, React framework that enables rapid, beautiful web development.", files: "**/*(.docs)?*.mdx", htmlContext: { - favicon: "public/favicon.ico" + favicon: "/rbx/public/favicon.ico" }, + indexHtml: "src/__docs__/index.html", modifyBundlerConfig: config => { config.resolve.alias["src"] = path.join(__dirname, "./src"); @@ -26,7 +27,7 @@ export default { }, // we manually create them rather than relying on React-Docgen propsParser: false, - public: "docs/public", + public: "src/__docs__/public", themeConfig: { colors: { white: "#FFFFFF", diff --git a/package.json b/package.json index b5629fa8..cb2f58b5 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,13 @@ "type": "git", "url": "git+https://github.com/dfee/rbx.git" }, + "scripts": { + "build": "make build", + "docs:build": "make docs_build", + "docs": "make docs_dev", + "lint": "make lint", + "test": "make test" + }, "keywords": [ "react", "bulma", diff --git a/rbx.code-workspace b/rbx.code-workspace deleted file mode 100644 index fae55ce5..00000000 --- a/rbx.code-workspace +++ /dev/null @@ -1,13 +0,0 @@ -{ - "folders": [ - { - "path": "." - }, - { - "path": "docs" - } - ], - "settings": { - "typescript.tsdk": "node_modules/typescript/lib" - } -} diff --git a/src/__docs__/components/feature.tsx b/src/__docs__/components/feature.tsx index 4b0e9c5f..357d24ea 100644 --- a/src/__docs__/components/feature.tsx +++ b/src/__docs__/components/feature.tsx @@ -1,4 +1,6 @@ +import { Link } from "docz"; import React from "react"; + import { Variables } from "src/base/helpers/variables"; import { Control, Field, Tag } from "src/elements"; @@ -26,20 +28,20 @@ export const Feature = Object.assign( secondaryColor, url, }: FeatureProps) => { - const asType: keyof JSX.IntrinsicElements | undefined = - url === undefined ? undefined : "a"; const tagGroupProps = url === undefined ? {} + : /^\/[a-z]/.test(url) // Local path, e.g. '/somewhere' + ? { as: Link, to: url } : { + as: "a" as keyof JSX.IntrinsicElements, href: url, - // if path starts with '/[a-z]', assume local, else external - target: /^\/[a-z]/.test(url) ? undefined : "_blank", + target: "_blank", }; return ( - + {primaryName} {secondaryName} @@ -59,7 +61,7 @@ export const AsDoc: React.FC = ({ asType }) => ( primaryColor="light" secondaryName={asType} secondaryColor="warning" - url="/rbx/architecture/inversion-of-control" + url="/architecture/inversion-of-control" /> ); @@ -102,7 +104,7 @@ export const CustomizeFeature: React.FC = ({ primaryColor="light" secondaryName={name} secondaryColor={color} - url="/rbx/architecture/customize" + url="/architecture/customize" /> ); }; diff --git a/src/__docs__/etc.mdx b/src/__docs__/etc.mdx index 9b2a09d1..9fd48308 100644 --- a/src/__docs__/etc.mdx +++ b/src/__docs__/etc.mdx @@ -8,10 +8,10 @@ route: /architecture/etc ## Building & Commands -You'll notice the `package.json` scripts are virtually empty. +You'll notice the `package.json` scripts are very simple. That's because the build instructions were getting complex, so they were moved into a [`Makefile`](https://github.com/dfee/rbx/blob/master/Makefile). -By running the `make help` command in the root of a cloned repo, you'll see the available options (including building, testing, etc.) +By running the `make` command in the root of a cloned repo, you'll see the available options (including building, testing, etc.) ### Testing diff --git a/src/__docs__/index.html b/src/__docs__/index.html new file mode 100644 index 00000000..15035d81 --- /dev/null +++ b/src/__docs__/index.html @@ -0,0 +1,27 @@ + + + + + + + + + {{ title }} + {{ head }} + + + + + +
+ {{ footer }} + + + + diff --git a/src/__docs__/public/favicon-16x16.png b/src/__docs__/public/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..28e361ac9232bf57ec10ed90d25560345daa12c1 GIT binary patch literal 738 zcmV<80v-K{P)q2hql5L92oYYLTd5;S8jvgHkCeMq#)x2y|RTTBD95Ihx10bDf!c?`aW++K_#B zhXWs;=WrP8YIt~v-Lw+*2lJ1VdA+{7yYF|$Za<8UjIe-vpHlSNwsU82a8UklU|=95 zE3))_gOFRID8jNVsH*DO3t)ba{f2cNyLa`+N`1miptz(2lB9s+_y;`CwVUR~6GGOz z>gpOgvQ8if;`PPFg?f@8_!(b;EGf`56^bI?HVosvs%jTA=}b-56>4j13nWSE^mtU5 z$s|~w$8s!+R4N76bwMc(2!aSvl(N1D)6~?IXBhgIo6XJo%uE=Oxmg&7f!y3YWb6#A zWD*ReC_Y*0Dmm(9pRZ4goAjh%r&fc^mhARdo@CxrBECX;n3xO8^P^hYYj1cnnMR#{( z2LJ%ESS(Hm2{H^*=d1DUPnZ_gR^za38c3CN_= zkUa`YN>3q^NsGF!JscW(&F)xXd!bOs9UuSLuPBOm?!4a{jYhdlY7@F{;LzctU|Hsj zEXkWsTU$S51-6=;{4@$Mk&3gG7tDmI#1`j4$T~FL0HxI5*4BRSp8x<%Pfvf2#g<={ zm6zw|Xj9R^jk8+tSif?e+SuSXPpq{W|-oD-ekM0>lg& UN__Bv#sB~S07*qoM6N<$g7D;1F#rGn literal 0 HcmV?d00001 diff --git a/src/__docs__/public/favicon-32x32.png b/src/__docs__/public/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..903f79b532708a2625cc43e76af9c21035a1086d GIT binary patch literal 1991 zcmV;&2RQhNP)`*cfmL&NmoN^V2O`wr1us_p4B5GpM=w zpAzSEH_fIGmn}+OioVzC=dv^p1Z)uEiJlC z$O*tYkW8ka>pJ4`IBeTiFw6A5w!kNCt)3jO=K|-fZgOf0gb=t~F2v(;NRng`Lg;f7 zxNzZIiOV!ECgQOz;b0K9WkXS9aL(ayIN)$NB$vyz=D7$o1kM*~s?rvXM%Imv3?mwe zz_Khz^0a_y8b~ISaJ${VZftCj0HCq4LArMB>bADlmXH4N_cOnmivW4}q`A3C;f%IO zlC&uni69aVgVHSgg+(YXErqV@&{P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