diff --git a/README.md b/README.md index 62e2294..63a93ee 100644 --- a/README.md +++ b/README.md @@ -33,35 +33,7 @@ yarn build **Add new package** ```shell -cd packages -mkdir new-package -yarn init -``` - -example `package.json` - -```json -{ - "name": "@greenlabs/${package-name}", - "description": "${description}", - "version": "0.0.0", - "license": "MIT", - "author": "Greenlabs Dev ", - "scripts": { - "start": "rescript build -w", - "build": "rescript build -with-deps" - }, - "keywords": ["ReScript"], - "publishConfig": { - "access": "public" - }, - "bugs": "https://github.com/green-labs/rescript-bindings/issues", - "repository": { - "type": "git", - "url": "https://github.com/green-labs/rescript-bindings.git", - "directory": "packages/${package-name}" - } -} +yarn add-package -n "rescript-${package-name}" ``` ## Release diff --git a/__template__/.npmignore b/__template__/.npmignore new file mode 100644 index 0000000..3685e12 --- /dev/null +++ b/__template__/.npmignore @@ -0,0 +1,21 @@ +**/__tests__/** +.bsb.lock +*.bs.js +.gitattributes +.github/ +.graphql_ppx_cache/ +.merlin +.vscode/ +assets/ +CONTRIBUTING.md +CODE_OF_CONDUCT.md +documentation/ +documentationWebsite/ +docs/ +EXAMPLES/ +lib/ +node_modules/ +package-lock.json +TODO +yarn.lock +yarn-error.log \ No newline at end of file diff --git a/__template__/README.md.mustache b/__template__/README.md.mustache new file mode 100644 index 0000000..1cacab3 --- /dev/null +++ b/__template__/README.md.mustache @@ -0,0 +1,17 @@ +# `{{{name}}}` + +## Install + +```bash +npm i {{{scope}}}/{{{name}}} +or +yarn add {{{scope}}}/{{{name}}} +``` + +```json +"bs-dependencies": [ + "{{{scope}}}/{{{name}}}" +] +``` + +## Usage \ No newline at end of file diff --git a/__template__/__tests__/.gitkeep b/__template__/__tests__/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/__template__/bsconfig.json.mustache b/__template__/bsconfig.json.mustache new file mode 100644 index 0000000..18f75fe --- /dev/null +++ b/__template__/bsconfig.json.mustache @@ -0,0 +1,25 @@ +{ + "name": "{{{scope}}}/{{{name}}}", + "reason": { "react-jsx": 3 }, + "package-specs": { + "module": "es6", + "in-source": true + }, + "suffix": ".bs.js", + "sources": [ + { + "dir": "./src", + "subdirs": false + }, + { + "dir": "./__tests__", + "type": "dev", + "subdirs": false + } + ], + "bsc-flags": ["-bs-no-version-header"], + "warnings": { + "error": true + }, + "bs-dependencies": [] +} diff --git a/__template__/package.json.mustache b/__template__/package.json.mustache new file mode 100644 index 0000000..651eb6d --- /dev/null +++ b/__template__/package.json.mustache @@ -0,0 +1,26 @@ +{ + "name": "{{{scope}}}/{{{name}}}", + "description": "ReScript bindings for {{{name}}}", + "version": "0.0.0", + "license": "MIT", + "author": "Greenlabs Dev ", + "scripts": { + "start": "rescript build -w", + "build": "rescript build -with-deps" + }, + "keywords": [ + "ReScript", + "{{{name}}}" + ], + "publishConfig": { + "access": "public" + }, + "bugs": "https://github.com/green-labs/rescript-bindings/issues", + "repository": { + "type": "git", + "url": "https://github.com/green-labs/rescript-bindings.git", + "directory": "packages/{{{name}}}" + }, + "devDependencies": {}, + "peerDependencies": {} +} diff --git a/__template__/src/.gitkeep b/__template__/src/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/lerna.json b/lerna.json index 136a6fa..c99eff7 100644 --- a/lerna.json +++ b/lerna.json @@ -3,5 +3,7 @@ "useNx": true, "useWorkspaces": true, "version": "independent", - "npmClient": "yarn" + "npmClient": "yarn", + "packages": ["packages/*"], + "scope": "@greenlabs" } diff --git a/package.json b/package.json index 110ff7a..62c2f85 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "rescript-bindings", + "name": "@greenlabs/rescript-bindings", "dependencies": { "@changesets/cli": "^2.24.4", "lerna": "^5.5.0", @@ -14,10 +14,14 @@ "release": "changeset publish", "boot": "yarn --frozen-lockfile && yarn bootstrap", "bootstrap": "yarn lerna:bootstrap", - "lerna:bootstrap": "lerna bootstrap --use-workspaces" + "lerna:bootstrap": "lerna bootstrap --use-workspaces", + "add-package": "yarn lerna-templater" }, "repository": { "type": "git", "url": "https://github.com/green-labs/rescript-bindings.git" + }, + "devDependencies": { + "lerna-templater": "^1.4.3" } } diff --git a/yarn.lock b/yarn.lock index 760ed75..c2fa70c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1333,6 +1333,21 @@ resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.2.tgz#ed4e0ad92306a704f9fb132a0cfcf77486dbe2bc" integrity sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig== +"@types/fs-extra@^9.0.13": + version "9.0.13" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" + integrity sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA== + dependencies: + "@types/node" "*" + +"@types/glob@*": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" + integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/hammerjs@^2.0.36": version "2.0.41" resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.41.tgz#f6ecf57d1b12d2befcce00e928a6a097c22980aa" @@ -1377,6 +1392,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/minimatch@*": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + "@types/minimatch@^3.0.3": version "3.0.5" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.5.tgz#1001cc5e6a3704b83c236027e77f2f58ea010f40" @@ -1387,6 +1407,11 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== +"@types/mustache@^4.1.2": + version "4.2.1" + resolved "https://registry.yarnpkg.com/@types/mustache/-/mustache-4.2.1.tgz#724a2fca5763117dee626aa4ca3e3f6e546e7434" + integrity sha512-gFAlWL9Ik21nJioqjlGCnNYbf9zHi0sVbaZ/1hQEBcCEuxfLJDvz4bVJSV6v6CUaoLOz0XEIoP7mSrhJ6o237w== + "@types/node@*": version "18.7.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.18.tgz#633184f55c322e4fb08612307c274ee6d5ed3154" @@ -1428,6 +1453,14 @@ "@types/scheduler" "*" csstype "^3.0.2" +"@types/rimraf@^3.0.2": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/rimraf/-/rimraf-3.0.2.tgz#a63d175b331748e5220ad48c901d7bbf1f44eef8" + integrity sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ== + dependencies: + "@types/glob" "*" + "@types/node" "*" + "@types/scheduler@*": version "0.16.2" resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39" @@ -1894,6 +1927,15 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +cliui@^8.0.1: + version "8.0.1" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-8.0.1.tgz#0c04b075db02cbfe60dc8e6cf2f5486b1a3608aa" + integrity sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.1" + wrap-ansi "^7.0.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -2525,7 +2567,7 @@ fs-constants@^1.0.0: resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@^10.1.0: +fs-extra@^10.0.0, fs-extra@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-10.1.0.tgz#02873cfbc4084dde127eaa5f9905eef2325d1abf" integrity sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ== @@ -3404,6 +3446,19 @@ kleur@^4.1.4: resolved "https://registry.yarnpkg.com/kleur/-/kleur-4.1.5.tgz#95106101795f7050c6c650f350c683febddb1780" integrity sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ== +lerna-templater@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/lerna-templater/-/lerna-templater-1.4.3.tgz#69b820792a67085315915206c439a7ee34c3dbee" + integrity sha512-FWApHoGvT6Y4opXY77ZXqJW5asWvTcAibW/d+UK0w+IVQvGvZ+LQgkzaMbEiJSV5ZaDoZq580hPjHQlIDa8/2w== + dependencies: + "@types/fs-extra" "^9.0.13" + "@types/mustache" "^4.1.2" + "@types/rimraf" "^3.0.2" + fs-extra "^10.0.0" + mustache "^4.2.0" + rimraf "^3.0.2" + yargs "^17.3.1" + lerna@^5.5.0: version "5.5.0" resolved "https://registry.yarnpkg.com/lerna/-/lerna-5.5.0.tgz#94ebc67ebe67079e5ac74f6ba7c0b130c88f3e90" @@ -3814,6 +3869,11 @@ multimatch@^5.0.0: arrify "^2.0.1" minimatch "^3.0.4" +mustache@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/mustache/-/mustache-4.2.0.tgz#e5892324d60a12ec9c2a73359edca52972bf6f64" + integrity sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ== + mute-stream@0.0.8, mute-stream@~0.0.4: version "0.0.8" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" @@ -5516,7 +5576,7 @@ yargs-parser@^20.2.2, yargs-parser@^20.2.3: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs-parser@^21.0.0: +yargs-parser@^21.0.0, yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw== @@ -5564,6 +5624,19 @@ yargs@^17.1.1, yargs@^17.4.0: y18n "^5.0.5" yargs-parser "^21.0.0" +yargs@^17.3.1: + version "17.6.2" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.6.2.tgz#2e23f2944e976339a1ee00f18c77fedee8332541" + integrity sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw== + dependencies: + cliui "^8.0.1" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.1.1" + yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"