Skip to content

Commit

Permalink
feat: remove BUILD_ prevaluation. Less magic
Browse files Browse the repository at this point in the history
  • Loading branch information
Kent C. Dodds committed Sep 24, 2017
1 parent 6679460 commit 63caff0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
17 changes: 0 additions & 17 deletions src/config/babel-plugin-env-build.js

This file was deleted.

2 changes: 0 additions & 2 deletions src/config/babelrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const isUMD = process.env.BUILD_FORMAT === 'umd'
const isWebpack = parseEnv('BUILD_WEBPACK', false)
const treeshake = parseEnv('BUILD_TREESHAKE', isRollup || isWebpack)
const alias = parseEnv('BUILD_ALIAS', isPreact ? {react: 'preact'} : null)
const preserveBuildEnv = parseEnv('BUILD_PRESERVE', isTest)

const envModules = treeshake ? {modules: false} : {}
const envTargets = isTest
Expand All @@ -21,7 +20,6 @@ module.exports = {
ifAnyDep(['react', 'preact'], require.resolve('babel-preset-react')),
].filter(Boolean),
plugins: [
preserveBuildEnv ? null : require.resolve('./babel-plugin-env-build'),
require.resolve('babel-macros'),
isRollup ? require.resolve('babel-plugin-external-helpers') : null,
// we're actually not using JSX at all, but I'm leaving this
Expand Down
6 changes: 3 additions & 3 deletions src/scripts/__tests__/__snapshots__/format.js.snap
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`format --config arg can be used for a custom config 1`] = `prettier --ignore-path ./src/config/prettierignore --write "**/*.js" --config ./my-config.js`;
exports[`format --config arg can be used for a custom config 1`] = `prettier --ignore-path ./src/config/prettierignore --write "**/*.+(js|json|less|css|ts)" --config ./my-config.js`;

exports[`format --ignore-path arg can be used for a custom ignore file 1`] = `prettier --config ./src/config/prettierrc.js --write "**/*.js" --ignore-path ./.myignore`;
exports[`format --ignore-path arg can be used for a custom ignore file 1`] = `prettier --config ./src/config/prettierrc.js --write "**/*.+(js|json|less|css|ts)" --ignore-path ./.myignore`;

exports[`format --no-write prevents --write argument from being added 1`] = `prettier --config ./src/config/prettierrc.js --ignore-path ./src/config/prettierignore "**/*.js" --no-write`;
exports[`format --no-write prevents --write argument from being added 1`] = `prettier --config ./src/config/prettierrc.js --ignore-path ./src/config/prettierignore "**/*.+(js|json|less|css|ts)" --no-write`;

exports[`format calls prettier CLI with args 1`] = `prettier --config ./src/config/prettierrc.js --ignore-path ./src/config/prettierignore --write "my-src/**/*.js"`;
4 changes: 3 additions & 1 deletion src/scripts/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const write = args.includes('--no-write') ? [] : ['--write']
// This way the prettierignore will be applied
const relativeArgs = args.map(a => a.replace(`${process.cwd()}/`, ''))

const filesToApply = parsedArgs._.length ? [] : ['"**/*.js"']
const filesToApply = parsedArgs._.length
? []
: ['"**/*.+(js|json|less|css|ts)"']

const result = spawn.sync(
resolveBin('prettier'),
Expand Down

0 comments on commit 63caff0

Please sign in to comment.