refactor: universal folder, package.json

This commit is contained in:
Ivan Shmidt
2020-10-07 16:29:32 +02:00
parent 37da165e70
commit e3bb82deab
4 changed files with 16 additions and 7 deletions
+5 -5
View File
@@ -16,7 +16,7 @@
import chalk from 'chalk';
import fs from 'fs-extra';
import { relative as relativePath } from 'path';
import { relative as relativePath, join as joinPath } from 'path';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
@@ -83,13 +83,13 @@ export const makeConfigs = async (
// to be bridge between
// frontend- and backend-
// plugins' code
const UNIVERSAL_FILE = 'universal.js';
const universalPath = paths.resolveTarget(UNIVERSAL_FILE);
const UNIVERSAL_FOLDER = 'universal';
const universalPath = paths.resolveTarget(UNIVERSAL_FOLDER);
const universalFileExists = fs.existsSync(universalPath);
if (universalFileExists) {
mainFields.push(UNIVERSAL_FILE);
commonjsInclude.push(UNIVERSAL_FILE);
mainFields.push(UNIVERSAL_FOLDER);
commonjsInclude.push(joinPath(UNIVERSAL_FOLDER, '*.js'));
}
configs.push({
+1 -1
View File
@@ -51,6 +51,6 @@
},
"files": [
"dist",
"universal.js"
"universal"
]
}
@@ -1,3 +1,4 @@
// @ts-check
/*
* Copyright 2020 Spotify AB
*
@@ -14,5 +15,8 @@
* limitations under the License.
*/
// This file is shared between frontend and backend plugins
/**
* Annotation to define on the entity to enable the plugin
* @type {string}
*/
module.exports.GITHUB_ACTIONS_ANNOTATION = 'github.com/project-slug';
@@ -0,0 +1,5 @@
{
"main": "index.js",
"module": "index.js",
"description": "Provides code that can be shared between frontend- and backend-oriented packages"
}