Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate plugin list file #4725

Merged
merged 5 commits into from
Jun 23, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/peers
/tests/fixtures/cli-utils.js
/stubs/*
/src/corePluginList.js
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ yarn-error.log

# Perf related files
isolate*.log

# Generated files
/src/corePluginList.js
35 changes: 23 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@
"David Hemphill <davidlee.hemphill@gmail.com>"
],
"scripts": {
"prebabelify": "rimraf lib",
"prebabelify": "npm run generate:plugin-list && rimraf lib",
"babelify": "babel src --out-dir lib --copy-files",
"postbabelify": "ncc build lib/cli-peer-dependencies.js -o peers",
"rebuild-fixtures": "npm run babelify && babel-node scripts/rebuildFixtures.js",
"prepublishOnly": "npm install --force && npm run babelify && babel-node scripts/build.js && node scripts/build-plugins.js",
"style": "eslint .",
"test": "cross-env TAILWIND_MODE=build jest",
"test:integrations": "npm run test --prefix ./integrations",
"install": "npm run generate:plugin-list",
sachinraja marked this conversation as resolved.
Show resolved Hide resolved
"install:integrations": "node scripts/install-integrations.js",
"posttest": "npm run style",
"compat": "node scripts/compat.js --prepare",
"compat:restore": "node scripts/compat.js --restore"
"compat:restore": "node scripts/compat.js --restore",
"generate:plugin-list": "babel-node scripts/create-plugin-list.js"
},
"files": [
"dist/*.css",
Expand Down
10 changes: 10 additions & 0 deletions scripts/create-plugin-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as corePlugins from '../src/plugins'
import fs from 'fs'
import path from 'path'

const corePluginList = Object.keys(corePlugins)

fs.writeFileSync(
path.join(process.cwd(), 'src', 'corePluginList.js'),
`export default ${JSON.stringify(corePluginList)}`
)
4 changes: 2 additions & 2 deletions src/util/resolveConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import toPath from 'lodash/toPath'
import head from 'lodash/head'
import isPlainObject from 'lodash/isPlainObject'
import negateValue from './negateValue'
import * as corePlugins from '../plugins'
import corePluginList from '../corePluginList'
import configurePlugins from './configurePlugins'
import defaultConfig from '../../stubs/defaultConfig.stub'
import colors from '../../colors'
Expand Down Expand Up @@ -243,7 +243,7 @@ function resolveCorePlugins(corePluginConfigs) {
return corePluginConfig({ corePlugins: resolved })
}
return configurePlugins(corePluginConfig, resolved)
}, Object.keys(corePlugins))
}, corePluginList)

return result
}
Expand Down
4 changes: 1 addition & 3 deletions tests/resolveConfig.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import * as corePlugins from '../src/plugins'
import resolveConfig from '../src/util/resolveConfig'

const corePluginList = Object.keys(corePlugins)
import corePluginList from '../src/corePluginList'

test('prefix key overrides default prefix', () => {
const userConfig = {
Expand Down