Skip to content

Commit

Permalink
fix: #1512 (#1517)
Browse files Browse the repository at this point in the history
* fix: Export

* chore(changefile)

* fix: Updated publish step

* fix: Also outputting CommonJS

* fix:`preparePublish` now copies the necessary files

* fix: typo

Co-authored-by: Laegel <valentin.chouaf@laposte.net>

* chore: update `build` script

* chore: add `prepublishOnly script`

* chore: update `api` covector config

* round two, fight!!

Co-authored-by: amrbashir <48618675+amrbashir@users.noreply.github.com>
  • Loading branch information
Laegel and amrbashir committed Apr 19, 2021
1 parent edab7a6 commit fcb3b48
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 33 deletions.
55 changes: 54 additions & 1 deletion .changes/config.json
Expand Up @@ -146,9 +146,62 @@
"manager": "javascript",
"assets": [
{
"path": "./tooling/api/tauri-apps-api-${ pkgFile.version }.tgz",
"path": "./tooling/api/dist/tauri-apps-api-${ pkgFile.version }.tgz",
"name": "api-${ pkgFile.version }.tgz"
}
],
"prepublish": [
{
"command": "yarn",
"dryRunCommand": true
},
{
"command": "echo \"# Yarn Audit\n\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"<details>\n<summary>click to view</summary>\n\n\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn audit",
"dryRunCommand": true,
"runFromRoot": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\n\n</details>\n\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn npm-pack",
"dryRunCommand": true
}
],
"publish": [
{
"command": "echo \"# Yarn Package Publish\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
},
{
"command": "yarn npm-publish",
"dryRunCommand": true,
"pipe": true
},
{
"command": "echo \"\\`\\`\\`\"",
"dryRunCommand": true,
"pipe": true
}
]
},
"tauri-bundler": {
Expand Down
5 changes: 5 additions & 0 deletions .changes/fix-js-api-import.md
@@ -0,0 +1,5 @@
---
"tauri": patch
---

TS was wrongly re-exporting the module.
2 changes: 1 addition & 1 deletion core/tauri/scripts/bundle.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/api/package.json
Expand Up @@ -17,7 +17,7 @@
"svelte": "3.35.0"
},
"dependencies": {
"@tauri-apps/api": "link:../../tooling/api",
"@tauri-apps/api": "link:../../tooling/api/dist",
"sirv-cli": "1.0.11"
}
}
}
40 changes: 20 additions & 20 deletions tooling/api/package.json
Expand Up @@ -2,33 +2,32 @@
"name": "@tauri-apps/api",
"version": "1.0.0-beta-rc.1",
"description": "Tauri API definitions",
"main": "./dist/index.js",
"files": [
"dist"
],
"main": "./index.js",
"typings": "./index.d.ts",
"exports": {
".": "./dist/index.js",
"./app": "./dist/app.js",
"./cli": "./dist/cli.js",
"./dialog": "./dist/dialog.js",
"./event": "./dist/event.js",
"./updater": "./dist/updater.js",
"./fs": "./dist/fs.js",
"./path": "./dist/path.js",
"./http": "./dist/http.js",
"./notification": "./dist/notification.js",
"./tauri": "./dist/tauri.js",
"./window": "./dist/window.js",
"./shell": "./dist/shell.js",
"./globalShortcut": "./dist/globalShortcut.js"
".": "./index.js",
"./app": "./app.js",
"./cli": "./cli.js",
"./dialog": "./dialog.js",
"./event": "./event.js",
"./updater": "./updater.js",
"./fs": "./fs.js",
"./path": "./path.js",
"./http": "./http.js",
"./notification": "./notification.js",
"./tauri": "./tauri.js",
"./window": "./window.js",
"./shell": "./shell.js",
"./globalShortcut": "./globalShortcut.js"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/tauri"
},
"scripts": {
"build": "rimraf ./dist && rollup -c --silent",
"prepublishOnly": "yarn build",
"build": "rimraf ./dist && rollup -c --silent && copyfiles package.json LICENSE* CHANGELOG.md dist",
"npm-pack": "yarn build && cd ./dist && npm pack",
"npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly",
"lint": "eslint --ext ts \"./src/**/*.ts\"",
"lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"",
"lint:lockfile": "lockfile-lint --path yarn.lock --type yarn --validate-https --allowed-hosts npm yarn",
Expand Down Expand Up @@ -68,6 +67,7 @@
"@rollup/plugin-typescript": "8.2.1",
"@typescript-eslint/eslint-plugin": "4.21.0",
"@typescript-eslint/parser": "4.21.0",
"copyfiles": "^2.4.1",
"eslint": "7.23.0",
"eslint-config-prettier": "8.1.0",
"eslint-config-standard-with-typescript": "20.0.0",
Expand Down
7 changes: 7 additions & 0 deletions tooling/api/rollup.config.js
Expand Up @@ -35,6 +35,13 @@ export default [
{
dir: 'dist/',
entryFileNames: '[name].js',
format: 'cjs',
exports: 'named',
globals: {}
},
{
dir: 'dist/',
entryFileNames: '[name].mjs',
format: 'esm',
exports: 'named',
globals: {}
Expand Down
4 changes: 1 addition & 3 deletions tooling/api/src/index.ts
@@ -1,6 +1,4 @@
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

import * as api from './bundle'
export default api
export * from './bundle'
111 changes: 105 additions & 6 deletions tooling/api/yarn.lock
Expand Up @@ -1505,6 +1505,19 @@ convert-source-map@^1.7.0:
dependencies:
safe-buffer "~5.1.1"

copyfiles@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/copyfiles/-/copyfiles-2.4.1.tgz#d2dcff60aaad1015f09d0b66e7f0f1c5cd3c5da5"
integrity sha512-fereAvAvxDrQDOXybk3Qu3dPbOoKoysFMWtkY3mv5BsL8//OSZVL5DCLYqgRfY5cWirgRzlC+WSrxp6Bo3eNZg==
dependencies:
glob "^7.0.5"
minimatch "^3.0.3"
mkdirp "^1.0.4"
noms "0.0.0"
through2 "^2.0.1"
untildify "^4.0.0"
yargs "^16.1.0"

core-js-compat@^3.8.1, core-js-compat@^3.9.0:
version "3.9.1"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.9.1.tgz#4e572acfe90aff69d76d8c37759d21a5c59bb455"
Expand All @@ -1513,6 +1526,11 @@ core-js-compat@^3.8.1, core-js-compat@^3.9.0:
browserslist "^4.16.3"
semver "7.0.0"

core-util-is@~1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=

cosmiconfig@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
Expand Down Expand Up @@ -1989,7 +2007,7 @@ glob-parent@^5.0.0, glob-parent@^5.1.0:
dependencies:
is-glob "^4.0.1"

glob@7.1.6, glob@^7.0.0, glob@^7.1.3, glob@^7.1.6:
glob@7.1.6, glob@^7.0.0, glob@^7.0.5, glob@^7.1.3, glob@^7.1.6:
version "7.1.6"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6"
integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==
Expand Down Expand Up @@ -2112,7 +2130,7 @@ inflight@^1.0.4:
once "^1.3.0"
wrappy "1"

inherits@2:
inherits@2, inherits@^2.0.1, inherits@~2.0.1, inherits@~2.0.3:
version "2.0.4"
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
Expand Down Expand Up @@ -2220,7 +2238,12 @@ is-symbol@^1.0.2, is-symbol@^1.0.3:
dependencies:
has-symbols "^1.0.1"

isarray@^1.0.0:
isarray@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=

isarray@^1.0.0, isarray@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
Expand Down Expand Up @@ -2414,7 +2437,7 @@ micromatch@^4.0.2:
braces "^3.0.1"
picomatch "^2.0.5"

minimatch@^3.0.0, minimatch@^3.0.4:
minimatch@^3.0.0, minimatch@^3.0.3, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
Expand All @@ -2426,6 +2449,11 @@ minimist@^1.2.0, minimist@^1.2.5:
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==

mkdirp@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==

ms@2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
Expand Down Expand Up @@ -2465,6 +2493,14 @@ node-releases@^1.1.70:
resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.71.tgz#cb1334b179896b1c89ecfdd4b725fb7bbdfc7dbb"
integrity sha512-zR6HoT6LrLCRBwukmrVbHv0EpEQjksO6GmFcZQQuCAy139BEsoVKPYnf3jongYW83fAa1torLGYwxxky/p28sg==

noms@0.0.0:
version "0.0.0"
resolved "https://registry.yarnpkg.com/noms/-/noms-0.0.0.tgz#da8ebd9f3af9d6760919b27d9cdc8092a7332859"
integrity sha1-2o69nzr51nYJGbJ9nNyAkqczKFk=
dependencies:
inherits "^2.0.1"
readable-stream "~1.0.31"

normalize-package-data@^2.3.2:
version "2.5.0"
resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8"
Expand Down Expand Up @@ -2655,6 +2691,11 @@ prettier@2.2.1:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==

process-nextick-args@~2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2"
integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==

progress@^2.0.0, progress@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
Expand Down Expand Up @@ -2694,6 +2735,29 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

readable-stream@~1.0.31:
version "1.0.34"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
integrity sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.1"
isarray "0.0.1"
string_decoder "~0.10.x"

readable-stream@~2.3.6:
version "2.3.7"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
dependencies:
core-util-is "~1.0.0"
inherits "~2.0.3"
isarray "~1.0.0"
process-nextick-args "~2.0.0"
safe-buffer "~5.1.1"
string_decoder "~1.1.1"
util-deprecate "~1.0.1"

rechoir@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
Expand Down Expand Up @@ -2823,7 +2887,7 @@ safe-buffer@^5.1.0:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==

safe-buffer@~5.1.1:
safe-buffer@~5.1.0, safe-buffer@~5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
Expand Down Expand Up @@ -2991,6 +3055,18 @@ string.prototype.trimstart@^1.0.4:
call-bind "^1.0.2"
define-properties "^1.1.3"

string_decoder@~0.10.x:
version "0.10.31"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94"
integrity sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=

string_decoder@~1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8"
integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==
dependencies:
safe-buffer "~5.1.0"

strip-ansi@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532"
Expand Down Expand Up @@ -3072,6 +3148,14 @@ thenify-all@^1.0.0:
dependencies:
any-promise "^1.0.0"

through2@^2.0.1:
version "2.0.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
integrity sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==
dependencies:
readable-stream "~2.3.6"
xtend "~4.0.1"

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
Expand Down Expand Up @@ -3210,13 +3294,23 @@ universalify@^2.0.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

untildify@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b"
integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==

uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
dependencies:
punycode "^2.1.0"

util-deprecate@~1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=

v8-compile-cache@^2.0.3:
version "2.3.0"
resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz#2de19618c66dc247dcfb6f99338035d8245a2cee"
Expand Down Expand Up @@ -3277,6 +3371,11 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=

xtend@~4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==

y18n@^5.0.5:
version "5.0.5"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.5.tgz#8769ec08d03b1ea2df2500acef561743bbb9ab18"
Expand All @@ -3302,7 +3401,7 @@ yargs-parser@^20.2.2:
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.6.tgz#69f920addf61aafc0b8b89002f5d66e28f2d8b20"
integrity sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==

yargs@^16.0.0:
yargs@^16.0.0, yargs@^16.1.0:
version "16.2.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66"
integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==
Expand Down

0 comments on commit fcb3b48

Please sign in to comment.