Skip to content

Commit e4f08c0

Browse files
authored
PKG -- [flow-cadut-generator] Add named exports to generated index files (#111)
1 parent 075522f commit e4f08c0

File tree

12 files changed

+42
-17
lines changed

12 files changed

+42
-17
lines changed

.changeset/stupid-berries-invent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@onflow/flow-cadut-generator": minor
3+
---
4+
5+
Add named exports to index files generated by flow-cadut-generator

package-lock.json

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"lint": "eslint .",
77
"lintfix": "eslint --fix .",
88
"prerelease": "npm run build && npm run test",
9+
"regenerate-test": "npm run build && npm run --prefix packages/flow-cadut-generator precompile-handlebars && npm run --prefix packages/generator-test generate",
910
"release": "changeset publish"
1011
},
1112
"workspaces": [

packages/flow-cadut-generator/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"scripts": {
2020
"build": "fcl-bundle",
2121
"dev": "fcl-bundle --watch",
22+
"precompile-handlebars": "handlebars ./src/templates -f ./src/templates/index.js -e hbs -c handlebars",
2223
"test": "jest"
2324
},
2425
"mangle": {
@@ -29,7 +30,9 @@
2930
},
3031
"dependencies": {
3132
"@babel/runtime": "^7.18.6",
32-
"@onflow/flow-cadut": "^0.2.0-alpha.7"
33+
"@onflow/flow-cadut": "^0.2.0-alpha.7",
34+
"handlebars": "^4.7.7",
35+
"handlebars-loader": "^1.7.1"
3336
},
3437
"bin": {
3538
"flow-generate": "./dist/generate.js"

packages/flow-cadut-generator/src/templates/index.js

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/flow-cadut-generator/src/templates/package.hbs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
import { {{this}}Template, deploy{{this}} } from './{{this}}'
1111
{{/each}}
1212

13+
export {
14+
{{#each folders}}
15+
{{ this }},
16+
{{/each}}
17+
{{#each files}}
18+
{{ this }}Template, {{ this }},
19+
{{/each}}
20+
{{#each contracts}}
21+
{{ this }}Template, deploy{{ this }},
22+
{{/each}}
23+
}
24+
1325
export default {
1426
{{#each folders}}
1527
{{ this }},

packages/flow-cadut/package.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,14 @@
2727
"build": "fcl-bundle",
2828
"watch": "fcl-bundle --watch",
2929
"test": "jest",
30-
"check-headers": "sh ./check-headers.sh",
31-
"precompile-handlebars": "node_modules/.bin/handlebars ./generator/src/templates -f ./generator/src/templates/index.js -e hbs -c handlebars",
32-
"generate-dev": "flow-generate ./generator-test/cadence ./generator-test/src/generated -d ../../../../src",
33-
"regenerate-test": "npm run precompile-handlebars && npm run generate-dev"
30+
"check-headers": "sh ./check-headers.sh"
3431
},
3532
"dependencies": {
3633
"@babel/runtime": "^7.18.6",
3734
"@onflow/config": "0.0.2",
3835
"@onflow/fcl": "^1.1.1-alpha.2",
3936
"elliptic": "^6.5.4",
4037
"esm": "^3.2.25",
41-
"handlebars": "^4.7.7",
42-
"handlebars-loader": "^1.7.1",
4338
"rimraf": "^3.0.2",
4439
"rlp": "^3.0.0",
4540
"sha3": "^2.1.4",

packages/generator-test/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"description": "",
66
"main": "index.js",
77
"scripts": {
8+
"generate": "flow-generate ./cadence ./src/generated",
89
"test": "node index.js"
910
},
1011
"author": "",
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
import { BasicTemplate, deployBasic } from "./Basic";
2+
export { BasicTemplate, deployBasic };
23
export default { BasicTemplate, deployBasic };
34

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import contracts from "./contracts";
22
import scripts from "./scripts";
33
import transactions from "./transactions";
4+
export { contracts, scripts, transactions };
45
export default { contracts, scripts, transactions };
56

0 commit comments

Comments
 (0)