chore: revert some of the universal file stuff for now
This commit is contained in:
@@ -79,21 +79,6 @@ export const makeConfigs = async (
|
||||
mainFields.unshift('browser');
|
||||
}
|
||||
|
||||
const commonjsInclude: Array<RegExp | string> = [/node_modules/];
|
||||
|
||||
// Purpose of this file is
|
||||
// to be bridge between
|
||||
// frontend- and backend-
|
||||
// plugins' code
|
||||
const UNIVERSAL_FILE = 'universal.js';
|
||||
const universalPath = paths.resolveTarget(UNIVERSAL_FILE);
|
||||
const universalFileExists = fs.existsSync(universalPath);
|
||||
|
||||
if (universalFileExists) {
|
||||
mainFields.push(UNIVERSAL_FILE);
|
||||
commonjsInclude.push(UNIVERSAL_FILE);
|
||||
}
|
||||
|
||||
configs.push({
|
||||
input: 'src/index.ts',
|
||||
output,
|
||||
@@ -105,7 +90,7 @@ export const makeConfigs = async (
|
||||
}),
|
||||
resolve({ mainFields }),
|
||||
commonjs({
|
||||
include: commonjsInclude,
|
||||
include: /node_modules/,
|
||||
exclude: [/\/[^/]+\.(?:stories|test)\.[^/]+$/],
|
||||
}),
|
||||
postcss(),
|
||||
|
||||
@@ -68,27 +68,6 @@ class PackageJsonHandler {
|
||||
await this.syncDependencies('devDependencies');
|
||||
}
|
||||
|
||||
private async syncFiles() {
|
||||
const hasUniversalFile = this.targetPkg.files.includes('universal.js');
|
||||
const hasConfigTypeScriptFile =
|
||||
typeof this.targetPkg.configSchema === 'string';
|
||||
|
||||
if (hasUniversalFile || hasConfigTypeScriptFile) {
|
||||
const files = [...this.pkg.files];
|
||||
if (hasUniversalFile) {
|
||||
files.push('universal.js');
|
||||
}
|
||||
|
||||
if (hasConfigTypeScriptFile) {
|
||||
files.push(this.targetPkg.configSchema);
|
||||
}
|
||||
|
||||
await this.syncField('files', { files });
|
||||
} else {
|
||||
await this.syncField('files');
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure a field inside package.json is in sync. This mutates the targetObj and writes package.json on change.
|
||||
private async syncField(
|
||||
fieldName: string,
|
||||
@@ -126,6 +105,15 @@ class PackageJsonHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private async syncFiles() {
|
||||
if (typeof this.targetPkg.configSchema === 'string') {
|
||||
const files = [...this.pkg.files, this.targetPkg.configSchema];
|
||||
await this.syncField('files', { files });
|
||||
} else {
|
||||
await this.syncField('files');
|
||||
}
|
||||
}
|
||||
|
||||
private async syncScripts() {
|
||||
const pkgScripts = this.pkg.scripts;
|
||||
const targetScripts = (this.targetPkg.scripts =
|
||||
|
||||
Reference in New Issue
Block a user