1
0
Fork 0

feat(build): bundle json and yaml with TS typedefs

This commit is contained in:
ssube 2019-09-28 04:25:07 -05:00 committed by Sean Sube
parent 390dafcea2
commit 58d3eeeed7
9 changed files with 96 additions and 43 deletions

5
.gitignore vendored
View File

@ -1,10 +1,13 @@
.awcache/
.licenses/
.nyc_output/
node_modules/
out/
temp/
# types
*.d.ts
*.bak
*.swp
*.tmp
yarn-error.log

View File

@ -6,10 +6,10 @@ import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
import tslint from 'rollup-plugin-tslint';
import typescript from 'rollup-plugin-typescript2';
import yaml from 'rollup-plugin-yaml';
const metadata = require('../package.json');
const namedExports = require('./rollup-named.json');
const shebang = '#! /usr/bin/env node\n\n';
const rootPath = process.env['ROOT_PATH'];
const targetPath = process.env['TARGET_PATH'];
@ -48,13 +48,11 @@ const bundle = {
entryFileNames: 'entry-[name].js',
format: 'cjs',
sourcemap: true,
banner: () => {
return ''; // @TODO: return shebang for executable scripts
},
},
plugins: [
multiEntry(),
json(),
yaml(),
replace({
delimiters: ['{{ ', ' }}'],
values: {
@ -75,6 +73,12 @@ const bundle = {
}),
tslint({
configuration: require('./tslint.json'),
exclude: [
`node_modules${sep}**`,
`src${sep}resource`,
`src${sep}**${sep}*.json`,
`src${sep}**${sep}*.yml`,
],
throwOnError: true,
}),
typescript({

View File

@ -26,11 +26,13 @@
"chai-as-promised",
"mocha",
"node",
"rollup-resources",
"sinon-chai"
],
"typeRoots": [
"../node_modules/@types",
"../node_modules"
"../node_modules",
"../vendor"
]
},
"exclude": [

View File

@ -41,6 +41,7 @@
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-tslint": "0.2.2",
"rollup-plugin-typescript2": "0.24.3",
"rollup-plugin-yaml": "1.1.0",
"sinon": "7.5.0",
"sinon-chai": "3.3.0",
"source-map-support": "0.5.13",

View File

@ -1,6 +1,9 @@
import { VERSION_INFO } from './version';
import JSON_DATA from './resource/json.json';
import YAML_DATA from './resource/yaml.yml';
export async function createApp(): Promise<void> {
// tslint:disable-next-line:no-console
console.log('Hello World!', VERSION_INFO);
console.log('Hello World!', VERSION_INFO, JSON_DATA, YAML_DATA);
}

3
src/resource/json.json Normal file
View File

@ -0,0 +1,3 @@
{
"foo": {}
}

1
src/resource/yaml.yml Normal file
View File

@ -0,0 +1 @@
foo: {}

7
vendor/rollup-resources/index.d.ts vendored Normal file
View File

@ -0,0 +1,7 @@
module "*.json" {
export default data = unknown;
}
module "*.yml" {
export default data = unknown;
}

101
yarn.lock
View File

@ -9,16 +9,15 @@
dependencies:
"@babel/highlight" "^7.0.0"
"@babel/generator@^7.4.0", "@babel/generator@^7.6.0":
version "7.6.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/generator/-/generator-7.6.0.tgz#e2c21efbfd3293ad819a2359b448f002bfdfda56"
integrity sha512-Ms8Mo7YBdMMn1BYuNtKuP/z0TgEIhbcyB8HVR6PPNYp4P61lMsABiS4A3VG1qznjXVCf3r+fVHhm4efTYVsySA==
"@babel/generator@^7.4.0", "@babel/generator@^7.6.2":
version "7.6.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03"
integrity sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ==
dependencies:
"@babel/types" "^7.6.0"
jsesc "^2.5.1"
lodash "^4.17.13"
source-map "^0.5.0"
trim-right "^1.0.1"
"@babel/helper-function-name@^7.1.0":
version "7.1.0"
@ -52,10 +51,10 @@
esutils "^2.0.2"
js-tokens "^4.0.0"
"@babel/parser@^7.4.3", "@babel/parser@^7.6.0":
version "7.6.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b"
integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ==
"@babel/parser@^7.4.3", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2":
version "7.6.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1"
integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==
"@babel/template@^7.1.0", "@babel/template@^7.4.0":
version "7.6.0"
@ -67,15 +66,15 @@
"@babel/types" "^7.6.0"
"@babel/traverse@^7.4.3":
version "7.6.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/traverse/-/traverse-7.6.0.tgz#389391d510f79be7ce2ddd6717be66d3fed4b516"
integrity sha512-93t52SaOBgml/xY74lsmt7xOR4ufYvhb5c5qiM6lu4J/dWGMAfAh6eKw4PjLes6DI6nQgearoxnFJk60YchpvQ==
version "7.6.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c"
integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ==
dependencies:
"@babel/code-frame" "^7.5.5"
"@babel/generator" "^7.6.0"
"@babel/generator" "^7.6.2"
"@babel/helper-function-name" "^7.1.0"
"@babel/helper-split-export-declaration" "^7.4.4"
"@babel/parser" "^7.6.0"
"@babel/parser" "^7.6.2"
"@babel/types" "^7.6.0"
debug "^4.1.0"
globals "^11.1.0"
@ -239,9 +238,9 @@
integrity sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==
"@types/node@*", "@types/node@^12.7.5":
version "12.7.5"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@types/node/-/node-12.7.5.tgz#e19436e7f8e9b4601005d73673b6dc4784ffcc2f"
integrity sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==
version "12.7.8"
resolved "https://artifacts.apextoaster.com/repository/group-npm/@types/node/-/node-12.7.8.tgz#cb1bf6800238898bc2ff6ffa5702c3cadd350708"
integrity sha512-FMdVn84tJJdV+xe+53sYiZS4R5yn1mAIxfj+DVoNiQjTYz1+OYmjwEZr1ev9nU0axXwda0QDbYl06QHanRVH3A==
"@types/node@8.10.54":
version "8.10.54"
@ -284,9 +283,9 @@ JSONStream@^1.0.4:
through ">=2.2.7 <3"
acorn@^7.0.0:
version "7.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/acorn/-/acorn-7.0.0.tgz#26b8d1cd9a9b700350b71c0905546f64d1284e7a"
integrity sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==
version "7.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c"
integrity sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==
ansi-colors@3.2.3:
version "3.2.3"
@ -863,9 +862,9 @@ emoji-regex@^7.0.1:
integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==
end-of-stream@^1.1.0:
version "1.4.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
integrity sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==
version "1.4.4"
resolved "https://artifacts.apextoaster.com/repository/group-npm/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
dependencies:
once "^1.4.0"
@ -928,6 +927,11 @@ estraverse@^4.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
estree-walker@^0.2.1:
version "0.2.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e"
integrity sha1-va/oCVOD2EFNXcLs9MkXO225QS4=
estree-walker@^0.6.1:
version "0.6.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362"
@ -1203,9 +1207,9 @@ growl@1.10.5:
integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==
handlebars@^4.1.2:
version "4.2.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/handlebars/-/handlebars-4.2.0.tgz#57ce8d2175b9bbb3d8b3cf3e4217b1aec8ddcb2e"
integrity sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==
version "4.3.3"
resolved "https://artifacts.apextoaster.com/repository/group-npm/handlebars/-/handlebars-4.3.3.tgz#56dd05fe33d6bd8a7d797351c39a0cdcfd576be5"
integrity sha512-VupOxR91xcGojfINrzMqrvlyYbBs39sXIrWa7YdaQWeBudOlvKEGvCczMfJPgnuwHE/zyH1M6J+IUP6cgDVyxg==
dependencies:
neo-async "^2.6.0"
optimist "^0.6.1"
@ -1378,9 +1382,9 @@ is-plain-obj@^1.1.0:
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4=
is-reference@^1.1.2:
version "1.1.3"
resolved "https://artifacts.apextoaster.com/repository/group-npm/is-reference/-/is-reference-1.1.3.tgz#e99059204b66fdbe09305cfca715a29caa5c8a51"
integrity sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==
version "1.1.4"
resolved "https://artifacts.apextoaster.com/repository/group-npm/is-reference/-/is-reference-1.1.4.tgz#3f95849886ddb70256a3e6d062b1a68c13c51427"
integrity sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==
dependencies:
"@types/estree" "0.0.39"
@ -1502,7 +1506,7 @@ js-tokens@^4.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==
js-yaml@3.13.1, js-yaml@^3.13.1, js-yaml@~3.13.1:
js-yaml@3.13.1, js-yaml@^3.13.1, js-yaml@^3.8.4, js-yaml@~3.13.1:
version "3.13.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847"
integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==
@ -1774,7 +1778,7 @@ mimic-fn@^2.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
minimatch@3.0.4, minimatch@^3.0.4:
minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4:
version "3.0.4"
resolved "https://artifacts.apextoaster.com/repository/group-npm/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
@ -2399,6 +2403,13 @@ rollup-plugin-json@4.0.0:
dependencies:
rollup-pluginutils "^2.5.0"
rollup-plugin-json@^2.0.1:
version "2.3.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-json/-/rollup-plugin-json-2.3.1.tgz#9759d27f33dcd2c896de18b6235df162b88edd77"
integrity sha512-alQQQVPo2z9pl6LSK8QqyDlWwCH5KeE8YxgQv7fa/SeTxz+gQe36jBjcha7hQW68MrVh9Ms71EQaMZDAG3w2yw==
dependencies:
rollup-pluginutils "^2.0.1"
rollup-plugin-multi-entry@2.1.0:
version "2.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-multi-entry/-/rollup-plugin-multi-entry-2.1.0.tgz#64a7287adfd437cab33bf6364a8d8ab1e7a7725d"
@ -2445,6 +2456,16 @@ rollup-plugin-typescript2@0.24.3:
rollup-pluginutils "2.8.1"
tslib "1.10.0"
rollup-plugin-yaml@1.1.0:
version "1.1.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-plugin-yaml/-/rollup-plugin-yaml-1.1.0.tgz#8b55fd8bc6a483018abedfc7192dde0fdc65666b"
integrity sha512-R7d7M9P4VdOTPYfPlazA81niCF5ezDBm3QOTYkUwDYMGUXHKwWybDClO8Je1QnUQy8d3DBpe0kphWQs6o55yIg==
dependencies:
js-yaml "^3.8.4"
rollup-plugin-json "^2.0.1"
rollup-pluginutils "^1.5.1"
tosource "^1.0.0"
rollup-pluginutils@2.8.1:
version "2.8.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97"
@ -2452,6 +2473,14 @@ rollup-pluginutils@2.8.1:
dependencies:
estree-walker "^0.6.1"
rollup-pluginutils@^1.5.1:
version "1.5.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
integrity sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=
dependencies:
estree-walker "^0.2.1"
minimatch "^3.0.2"
rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1:
version "2.8.2"
resolved "https://artifacts.apextoaster.com/repository/group-npm/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e"
@ -2805,6 +2834,11 @@ to-fast-properties@^2.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
integrity sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=
tosource@^1.0.0:
version "1.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/tosource/-/tosource-1.0.0.tgz#42d88dd116618bcf00d6106dd5446f3427902ff1"
integrity sha1-QtiN0RZhi88A1hBt1URvNCeQL/E=
trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
@ -2820,11 +2854,6 @@ trim-off-newlines@^1.0.0:
resolved "https://artifacts.apextoaster.com/repository/group-npm/trim-off-newlines/-/trim-off-newlines-1.0.1.tgz#9f9ba9d9efa8764c387698bcbfeb2c848f11adb3"
integrity sha1-n5up2e+odkw4dpi8v+sshI8RrbM=
trim-right@^1.0.1:
version "1.0.1"
resolved "https://artifacts.apextoaster.com/repository/group-npm/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003"
integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=
tslib@1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1:
version "1.10.0"
resolved "https://artifacts.apextoaster.com/repository/group-npm/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"