From 107f06b0dffe7d7214ff301f9fba8e7256330f44 Mon Sep 17 00:00:00 2001 From: Eemeli Aro Date: Sat, 27 Feb 2021 18:35:12 +0200 Subject: [PATCH] chore: Move some config files from root to config/ --- babel.config.js => config/babel.config.js | 0 jest.config.js => config/jest.config.js | 13 ++++++++----- .../rollup.browser-config.js | 1 + .../rollup.node-config.js | 1 + package.json | 14 +++++--------- 5 files changed, 15 insertions(+), 14 deletions(-) rename babel.config.js => config/babel.config.js (100%) rename jest.config.js => config/jest.config.js (80%) rename rollup.browser-config.js => config/rollup.browser-config.js (93%) rename rollup.node-config.js => config/rollup.node-config.js (93%) diff --git a/babel.config.js b/config/babel.config.js similarity index 100% rename from babel.config.js rename to config/babel.config.js diff --git a/jest.config.js b/config/jest.config.js similarity index 80% rename from jest.config.js rename to config/jest.config.js index 646e576a..851154b9 100644 --- a/jest.config.js +++ b/config/jest.config.js @@ -9,10 +9,7 @@ switch (process.env.npm_lifecycle_event) { '^yaml/util$': '/dist/util.js', '^yaml/test-events$': '/dist/test-events.js' } - testPathIgnorePatterns.push( - 'doc/createNode', - 'doc/types' - ) + testPathIgnorePatterns.push('doc/createNode', 'doc/types') break case 'test': @@ -29,8 +26,14 @@ module.exports = { collectCoverageFrom: ['src/**/*.{js,ts}', '!src/**/*.d.ts'], moduleNameMapper, resolver: 'jest-ts-webcompat-resolver', + rootDir: '..', testEnvironment: 'node', testMatch: ['**/tests/**/*.{js,ts}'], testPathIgnorePatterns, - transform: { '/(src|tests)/.*\\.(js|ts)$': 'babel-jest' } + transform: { + '/(src|tests)/.*\\.(js|ts)$': [ + 'babel-jest', + { configFile: './config/babel.config.js' } + ] + } } diff --git a/rollup.browser-config.js b/config/rollup.browser-config.js similarity index 93% rename from rollup.browser-config.js rename to config/rollup.browser-config.js index 5cac47ec..28dae732 100644 --- a/rollup.browser-config.js +++ b/config/rollup.browser-config.js @@ -15,6 +15,7 @@ export default { }), babel({ babelHelpers: 'bundled', + configFile: './config/babel.config.js', presets: [['@babel/env', { modules: false }]] }), typescript({ declaration: false, outDir: 'browser/dist' }) diff --git a/rollup.node-config.js b/config/rollup.node-config.js similarity index 93% rename from rollup.node-config.js rename to config/rollup.node-config.js index 156486d5..e148483a 100644 --- a/rollup.node-config.js +++ b/config/rollup.node-config.js @@ -17,6 +17,7 @@ export default { plugins: [ babel({ babelHelpers: 'bundled', + configFile: './config/babel.config.js', presets: [['@babel/env', { modules: false, targets: { node: '10.0' } }]] }), typescript(), diff --git a/package.json b/package.json index 1a604807..3d907588 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,7 @@ "homepage": "https://eemeli.org/yaml/", "files": [ "browser/", - "dist/", - "*.d.ts", - "*.js", - "*.mjs", - "!*config.js" + "dist/" ], "type": "commonjs", "main": "./dist/index.js", @@ -39,16 +35,16 @@ }, "scripts": { "build": "npm run build:node && npm run build:browser", - "build:browser": "rollup -c rollup.browser-config.js", - "build:node": "rollup -c rollup.node-config.js", + "build:browser": "rollup -c config/rollup.browser-config.js", + "build:node": "rollup -c config/rollup.node-config.js", "clean": "git clean -fdxe node_modules", "lint": "eslint src/", "prettier": "prettier --write .", "prestart": "npm run build:node", "start": "node -i -e 'YAML=require(\"./dist/index.js\")'", - "test": "jest", + "test": "jest --config config/jest.config.js", "test:browsers": "cd playground && npm test", - "test:dist": "npm run build:node && jest", + "test:dist": "npm run build:node && jest --config config/jest.config.js", "test:types": "tsc --noEmit", "docs:install": "cd docs-slate && bundle install", "docs:deploy": "cd docs-slate && ./deploy.sh",