chore(defined): remove build step

It also helps with compatibility with Native ESM for default exports.
This commit is contained in:
Julien Fontanet 2021-05-19 12:06:07 +02:00
parent 68bb2fa7f0
commit a64af4da7c
5 changed files with 8 additions and 19 deletions

View File

@ -1 +0,0 @@
module.exports = require('../../@xen-orchestra/babel-config')(require('./package.json'))

View File

@ -1 +0,0 @@
../../scripts/babel-eslintrc.js

View File

@ -11,7 +11,7 @@
// process.env.http_proxy
// ])
// ```
export default function defined() {
function defined() {
let args = arguments
let n = args.length
if (n === 1) {
@ -29,6 +29,7 @@ export default function defined() {
}
}
}
module.exports = exports = defined
// Usage:
//
@ -39,7 +40,7 @@ export default function defined() {
// const getFriendName = _ => _.friends[0].name
// const friendName = get(getFriendName, props.user)
// ```
export const get = (accessor, arg) => {
function get(accessor, arg) {
try {
return accessor(arg)
} catch (error) {
@ -49,6 +50,7 @@ export const get = (accessor, arg) => {
}
}
}
exports.get = get
// Usage:
//
@ -58,4 +60,6 @@ export const get = (accessor, arg) => {
// _ => new ProxyAgent(_)
// )
// ```
export const ifDef = (value, thenFn) => (value !== undefined ? thenFn(value) : value)
exports.ifDef = function ifDef(value, thenFn) {
return value !== undefined ? thenFn(value) : value
}

View File

@ -16,27 +16,13 @@
"url": "https://vates.fr"
},
"preferGlobal": false,
"main": "dist/",
"browserslist": [
">2%"
],
"engines": {
"node": ">=6"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"cross-env": "^7.0.2",
"rimraf": "^3.0.0"
},
"scripts": {
"build": "cross-env NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"clean": "rimraf dist/",
"dev": "cross-env NODE_ENV=development babel --watch --source-maps --out-dir=dist/ src/",
"prebuild": "yarn run clean",
"predev": "yarn run prebuild",
"prepublishOnly": "yarn run build",
"postversion": "npm publish"
}
}

View File

@ -33,6 +33,7 @@
>
> In case of conflict, the highest (lowest in previous list) `$version` wins.
- @xen-orchestra/defined patch
- xo-collection minor
- @xen-orchestra/log patch
- xen-api minor