chore(template): remove build step
This commit is contained in:
parent
4d40b56d85
commit
aff8ec08ad
@ -1,3 +0,0 @@
|
|||||||
'use strict'
|
|
||||||
|
|
||||||
module.exports = require('../../@xen-orchestra/babel-config')(require('./package.json'))
|
|
@ -1 +0,0 @@
|
|||||||
../../scripts/babel-eslintrc.js
|
|
@ -1,8 +1,10 @@
|
|||||||
import escapeRegExp from 'lodash/escapeRegExp'
|
'use strict'
|
||||||
|
|
||||||
|
const escapeRegExp = require('lodash/escapeRegExp')
|
||||||
|
|
||||||
const compareLengthDesc = (a, b) => b.length - a.length
|
const compareLengthDesc = (a, b) => b.length - a.length
|
||||||
|
|
||||||
export function compileTemplate(pattern, rules) {
|
exports.compileTemplate = function compileTemplate(pattern, rules) {
|
||||||
const matches = Object.keys(rules).sort(compareLengthDesc).map(escapeRegExp).join('|')
|
const matches = Object.keys(rules).sort(compareLengthDesc).map(escapeRegExp).join('|')
|
||||||
const regExp = new RegExp(`\\\\(?:\\\\|${matches})|${matches}`, 'g')
|
const regExp = new RegExp(`\\\\(?:\\\\|${matches})|${matches}`, 'g')
|
||||||
return (...params) =>
|
return (...params) =>
|
@ -1,5 +1,8 @@
|
|||||||
/* eslint-env jest */
|
/* eslint-env jest */
|
||||||
import { compileTemplate } from '.'
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const { compileTemplate } = require('.')
|
||||||
|
|
||||||
it("correctly replaces the template's variables", () => {
|
it("correctly replaces the template's variables", () => {
|
||||||
const replacer = compileTemplate('{property}_\\{property}_\\\\{property}_{constant}_%_FOO', {
|
const replacer = compileTemplate('{property}_\\{property}_\\\\{property}_{constant}_%_FOO', {
|
@ -14,31 +14,13 @@
|
|||||||
"name": "Vates SAS",
|
"name": "Vates SAS",
|
||||||
"url": "https://vates.fr"
|
"url": "https://vates.fr"
|
||||||
},
|
},
|
||||||
"preferGlobal": false,
|
|
||||||
"main": "dist/",
|
|
||||||
"browserslist": [
|
|
||||||
">2%"
|
|
||||||
],
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"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 --access public"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lodash": "^4.17.15"
|
"lodash": "^4.17.15"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"postversion": "npm publish --access public"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user