diff --git a/config/rollup.js b/config/rollup.js index 4ac4b80..3ea45c1 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -1,8 +1,10 @@ - -import resolve from 'rollup-plugin-node-resolve'; import commonjs from 'rollup-plugin-commonjs'; +import replace from 'rollup-plugin-replace'; +import resolve from 'rollup-plugin-node-resolve'; import typescript from 'rollup-plugin-typescript2'; +const metadata = require('../package.json'); + // `npm run build` -> `production` is true // `npm run dev` -> `production` is false const production = !process.env.ROLLUP_WATCH; @@ -15,6 +17,17 @@ export default { sourcemap: true, }, plugins: [ + replace({ + delimiters: ['{{ ', ' }}'], + values: { + APP_NAME: metadata.name, + BUILD_JOB: '0', + BUILD_RUNNER: 'rollup', + GIT_BRANCH: '', + GIT_COMMIT: '', + NODE_VERSION: '', + }, + }), resolve({ preferBuiltins: true, }), diff --git a/docs/salty.yml b/docs/salty.yml new file mode 100644 index 0000000..16b64d3 --- /dev/null +++ b/docs/salty.yml @@ -0,0 +1,3 @@ +data: + logger: + name: salty diff --git a/package.json b/package.json index ab4b6a4..11992de 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "unknown", + "name": "salty", "version": "0.1.0", "description": "YAML linter, transformer, and validator", "main": "out/index.js", @@ -28,6 +28,7 @@ "rollup": "^1.15.5", "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-node-resolve": "^5.0.2", + "rollup-plugin-replace": "^2.2.0", "rollup-plugin-typescript2": "^0.21.1", "typescript": "^3.5.2" } diff --git a/src/error/InvalidArgumentError.ts b/src/error/InvalidArgumentError.ts index 3992995..463fe29 100644 --- a/src/error/InvalidArgumentError.ts +++ b/src/error/InvalidArgumentError.ts @@ -1,7 +1,7 @@ -import { BaseError } from 'noicejs/error/BaseError'; - -export class InvalidArgumentError extends BaseError { - constructor(msg = 'invalid argument passed', ...nested: Array) { - super(msg, ...nested); - } -} +import { BaseError } from 'noicejs'; + +export class InvalidArgumentError extends BaseError { + constructor(msg = 'invalid argument passed', ...nested: Array) { + super(msg, ...nested); + } +} diff --git a/src/error/NotFoundError.ts b/src/error/NotFoundError.ts index 9c0bbd9..d5b179c 100644 --- a/src/error/NotFoundError.ts +++ b/src/error/NotFoundError.ts @@ -1,4 +1,4 @@ -import { BaseError } from 'noicejs/error/BaseError'; +import { BaseError } from 'noicejs'; export class NotFoundError extends BaseError { constructor(msg = 'value not found', ...nested: Array) { diff --git a/src/version.ts b/src/version.ts index 28ccdde..2edf312 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,24 +1,14 @@ -// webpack environment defines -declare const APP_NAME: string; -declare const BUILD_JOB: string; -declare const BUILD_RUNNER: string; -declare const GIT_BRANCH: string; -declare const GIT_COMMIT: string; -declare const NODE_VERSION: string; -declare const WEBPACK_VERSION: string; - export const VERSION_INFO = { app: { - name: APP_NAME, + name: '{{ APP_NAME }}', }, build: { - job: BUILD_JOB, - node: NODE_VERSION, - runner: BUILD_RUNNER, - webpack: WEBPACK_VERSION, + job: '{{ BUILD_JOB }}', + node: '{{ NODE_VERSION }}', + runner: '{{ BUILD_RUNNER }}', }, git: { - branch: GIT_BRANCH, - commit: GIT_COMMIT, + branch: '{{ GIT_BRANCH }}', + commit: '{{ GIT_COMMIT }}', }, }; diff --git a/yarn.lock b/yarn.lock index ee3f2c9..fc692f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -809,6 +809,14 @@ rollup-plugin-node-resolve@^5.0.2: resolve "^1.11.0" rollup-pluginutils "^2.8.0" +rollup-plugin-replace@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-replace/-/rollup-plugin-replace-2.2.0.tgz#f41ae5372e11e7a217cde349c8b5d5fd115e70e3" + integrity sha512-/5bxtUPkDHyBJAKketb4NfaeZjL5yLZdeUihSfbF2PQMz+rSTEb8ARKoOl3UBT4m7/X+QOXJo3sLTcq+yMMYTA== + dependencies: + magic-string "^0.25.2" + rollup-pluginutils "^2.6.0" + rollup-plugin-typescript2@^0.21.1: version "0.21.1" resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.21.1.tgz#91cea787c5282762f4849e334cbef6a9fdaa7564" @@ -827,7 +835,7 @@ rollup-pluginutils@2.6.0: estree-walker "^0.6.0" micromatch "^3.1.10" -rollup-pluginutils@^2.7.0, rollup-pluginutils@^2.8.0: +rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.7.0, rollup-pluginutils@^2.8.0: version "2.8.1" resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz#8fa6dd0697344938ef26c2c09d2488ce9e33ce97" integrity sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==