react-native-storybook-loader
Advanced tools
Comparing version 1.8.0 to 1.8.1
{ | ||
"name": "react-native-storybook-loader", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"repository": "https://github.com/elderfo/react-native-storybook-loader.git", | ||
@@ -12,15 +12,11 @@ "bugs": "https://github.com/elderfo/react-native-storybook-loader/issues", | ||
"devDependencies": { | ||
"codecov": "^2.3.0", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"eslint": "^3.16.1", | ||
"eslint-config-elderfo": "^1.2.3", | ||
"eslint-watch": "^3.0.0", | ||
"codecov": "^3.5.0", | ||
"faker": "^4.1.0", | ||
"husky": "^0.13.1", | ||
"jest": "^20.0.4", | ||
"lint-staged": "^4.0.2", | ||
"husky": "^3.0.5", | ||
"jest": "^24.9.0", | ||
"lint-staged": "^9.2.5", | ||
"mock-fs": "^4.4.1", | ||
"npm-run-all": "^4.1.2", | ||
"prettier": "^1.5.3", | ||
"semantic-release": "^6.3.2", | ||
"semantic-release": "^15.13.24", | ||
"uuid": "^3.0.1" | ||
@@ -30,6 +26,5 @@ }, | ||
"colors": "^1.1.2", | ||
"dot": "^1.1.1", | ||
"findup": "^0.1.5", | ||
"glob": "^7.1.1", | ||
"yargs": "^8.0.2" | ||
"yargs": "^14.0.0" | ||
}, | ||
@@ -40,9 +35,7 @@ "scripts": { | ||
"test:ci": "jest --coverage && codecov", | ||
"lint": "esw ./", | ||
"lint:watch": "yarn run lint -- --watch", | ||
"start": "node src/rnstl-cli.js", | ||
"start:help": "node src/rnstl-cli.js --help", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post", | ||
"semantic-release": "semantic-release", | ||
"precommit": "lint-staged", | ||
"ci": "npm-run-all test:ci lint start" | ||
"ci": "npm-run-all test:ci start" | ||
}, | ||
@@ -52,3 +45,2 @@ "lint-staged": { | ||
"prettier --single-quote --trailing-comma es5 --write", | ||
"eslint --fix", | ||
"git add", | ||
@@ -76,7 +68,4 @@ "jest --bail --findRelatedTests" | ||
"outputFile": "./output/storyLoader.js" | ||
}, | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} | ||
} |
const fs = require('fs'); | ||
const path = require('path'); | ||
const dot = require('dot'); | ||
@@ -11,10 +10,16 @@ const { | ||
dot.templateSettings.strip = false; | ||
function getRelativePaths(fromDir, files) { | ||
return files.map(file => getRelativePath(file, fromDir)).concat().sort(); | ||
return files | ||
.map(file => getRelativePath(file, fromDir)) | ||
.concat() | ||
.sort(); | ||
} | ||
const templateContents = ` | ||
// Auto-generated file created by react-native-storybook-loader | ||
const formatter = (files, frms, separator) => { | ||
const formatted = files.map(f => frms(f)); | ||
return formatted.join(separator); | ||
}; | ||
const template = files => | ||
`// Auto-generated file created by react-native-storybook-loader | ||
// Do not edit. | ||
@@ -25,9 +30,7 @@ // | ||
function loadStories() { | ||
{{~it.files :value:index}}require('{{=value}}'); | ||
{{~}} | ||
${formatter(files, file => `\trequire('${file}');`, '\n')} | ||
} | ||
const stories = [ | ||
{{~it.files :value:index}}'{{=value}}', | ||
{{~}} | ||
${formatter(files, file => `\t'${file}'`, ',\n')} | ||
]; | ||
@@ -42,9 +45,7 @@ | ||
const writeFile = (files, outputFile) => { | ||
const template = dot.template(templateContents); | ||
const relativePaths = getRelativePaths( | ||
path.dirname(outputFile), | ||
files | ||
).map(file => file.substring(0, file.lastIndexOf('.'))); // strip file extensions | ||
const relativePaths = getRelativePaths(path.dirname(outputFile), files).map( | ||
file => file.substring(0, file.lastIndexOf('.')) | ||
); // strip file extensions | ||
const output = template({ files: relativePaths }); | ||
const output = template(relativePaths); | ||
@@ -57,4 +58,3 @@ ensureFileDirectoryExists(outputFile); | ||
module.exports = { | ||
templateContents, | ||
writeFile, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
10
41830
28
+ Addedansi-regex@4.1.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedcamelcase@5.3.1(transitive)
+ Addedcliui@5.0.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedemoji-regex@7.0.3(transitive)
+ Addedfind-up@3.0.0(transitive)
+ Addedget-caller-file@2.0.5(transitive)
+ Addedlocate-path@3.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@3.0.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedrequire-main-filename@2.0.0(transitive)
+ Addedstring-width@3.1.0(transitive)
+ Addedstrip-ansi@5.2.0(transitive)
+ Addedwrap-ansi@5.1.0(transitive)
+ Addedy18n@4.0.3(transitive)
+ Addedyargs@14.2.3(transitive)
+ Addedyargs-parser@15.0.3(transitive)
- Removeddot@^1.1.1
- Removedansi-regex@2.1.13.0.1(transitive)
- Removedcamelcase@4.1.0(transitive)
- Removedcliui@3.2.0(transitive)
- Removedcode-point-at@1.1.0(transitive)
- Removedcross-spawn@5.1.0(transitive)
- Removeddot@1.1.3(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedexeca@0.7.0(transitive)
- Removedfind-up@2.1.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-caller-file@1.0.3(transitive)
- Removedget-stream@3.0.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedinvert-kv@1.0.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-fullwidth-code-point@1.0.0(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisexe@2.0.0(transitive)
- Removedlcid@1.0.0(transitive)
- Removedload-json-file@2.0.0(transitive)
- Removedlocate-path@2.0.0(transitive)
- Removedlru-cache@4.1.5(transitive)
- Removedmem@1.1.0(transitive)
- Removedmimic-fn@1.2.0(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removednpm-run-path@2.0.2(transitive)
- Removednumber-is-nan@1.0.1(transitive)
- Removedos-locale@2.1.0(transitive)
- Removedp-finally@1.0.0(transitive)
- Removedp-limit@1.3.0(transitive)
- Removedp-locate@2.0.0(transitive)
- Removedp-try@1.0.0(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-key@2.0.1(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@2.0.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpseudomap@1.0.2(transitive)
- Removedread-pkg@2.0.0(transitive)
- Removedread-pkg-up@2.0.0(transitive)
- Removedrequire-main-filename@1.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsemver@5.7.2(transitive)
- Removedshebang-command@1.2.0(transitive)
- Removedshebang-regex@1.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstring-width@1.0.22.1.1(transitive)
- Removedstrip-ansi@3.0.14.0.0(transitive)
- Removedstrip-bom@3.0.0(transitive)
- Removedstrip-eof@1.0.0(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)
- Removedwhich@1.3.1(transitive)
- Removedwrap-ansi@2.1.0(transitive)
- Removedy18n@3.2.2(transitive)
- Removedyallist@2.1.2(transitive)
- Removedyargs@8.0.2(transitive)
- Removedyargs-parser@7.0.0(transitive)
Updatedyargs@^14.0.0