forked from pie-framework/pie-elements
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpslb.config.js
More file actions
195 lines (188 loc) · 4.59 KB
/
pslb.config.js
File metadata and controls
195 lines (188 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
const path = require('path');
const fs = require('fs-extra');
const _ = require('lodash');
const reactIsExports = [
'AsyncMode',
'ConcurrentMode',
'ContextConsumer',
'ContextProvider',
'Element',
'ForwardRef',
'Fragment',
'Lazy',
'Memo',
'Portal',
'Profiler',
'StrictMode',
'Suspense',
'isAsyncMode',
'isConcurrentMode',
'isContextConsumer',
'isContextProvider',
'isElement',
'isForwardRef',
'isFragment',
'isLazy',
'isMemo',
'isPortal',
'isProfiler',
'isStrictMode',
'isSuspense',
'isValidElementType',
'typeOf',
];
const konva = [
'Layer',
'FastLayer',
'Group',
'Label',
'Rect',
'Circle',
'Ellipse',
'Wedge',
'Transformer',
'Line',
'Sprite',
'Image',
'Text',
'TextPath',
'Star',
'Ring',
'Arc',
'Tag',
'Path',
'RegularPolygon',
'Arrow',
'Shape',
'useStrictMode',
'Stage',
];
const immutable = [
'Map',
'Set',
'List',
'Iterable',
'Seq',
'Collection',
'OrderedMap',
'Stack',
'OrderedSet',
'Record',
'Range',
'Repeat',
'is',
'fromJS',
];
const commonJs = {
namedExports: {
'node_modules/react-beautiful-dnd/node_modules/react-is/index.js': [
'isValidElementType',
'isContextConsumer',
],
'node_modules/js-combinatorics/combinatorics.js': ['combination'],
'node_modules/react-konva/lib/ReactKonva.js': konva,
'node_modules/react-redux/node_modules/react-is/index.js': reactIsExports,
//TODO: common js should be picking these up?
'node_modules/react-is/index.js': reactIsExports,
'node_modules/react/index.js': [
'memo',
'useLayoutEffect',
'useEffect',
'useState',
'useCallback',
'useContext',
'cloneElement',
'createElement',
'createContext',
'isValidElement',
'useMemo',
'useRef',
'createRef',
'Component',
'useReducer',
],
'node_modules/humps/humps.js': ['camelizeKeys'],
'node_modules/react-dom/server.browser.js': ['renderToStaticMarkup'],
'node_modules/react-dom/index.js': [
'findDOMNode',
'unstable_batchedUpdates',
],
'node_modules/esrever/esrever.js': ['reverse'],
'node_modules/slate-plain-serializer/node_modules/immutable/dist/immutable.js': immutable,
'node_modules/immutable/dist/immutable.js': immutable,
},
};
const blacklist = [
'pie-models',
'math-inline',
'protractor',
'ruler',
'calculator',
];
/** Pslb will only support pie packages that have a configure and controller subpkg */
const listPackages = () => {
// eslint-disable-next-line no-undef
const root = path.resolve(__dirname, 'packages');
const files = fs.readdirSync(root);
return _.compact(
files
.filter((f) => !f.includes('@'))
.filter((f) => !blacklist.includes(f))
.map((f) => {
try {
const rootPkg = fs.readJsonSync(path.join(root, f, 'package.json'));
return rootPkg.name;
} catch (e) {
console.warn(`error for: ${f}, ${e.message}`);
}
})
);
};
module.exports = {
packages: listPackages(),
packagesDir: path.resolve(__dirname, './packages'),
type: 'pie-package',
extensions: {
commonJs,
},
mode: 'development',
range: '^',
minify: false,
libs: {
repository: 'pie-framework/pie-elements',
packages: [
{
name: '@pie-element/shared-config',
// eslint-disable-next-line no-undef
output: path.resolve(__dirname, '../packages'),
repository: 'pie-framework/pie-elements',
modules: [
/** make use of the pie-ui shared lib */
{ name: '@pie-ui/shared-lib', version: '^4.1.1' },
{ name: '@pie-ui/shared-math-edit', version: '^1.18.1' },
],
/**
* Ideally namespace imports would be the default import method.
* But this can cause problems if a library does the following:
* `module.exports = require("path");` - this causes the properties to get lost,
* when really we'd like all the properties to be set on the module.
* For now - specify the import method as a key of `imports`.
*
* To fix this we'd probably need to make a change to rollup,
* get it to follow the var until it gets to the object definition,
* then to use the keys to set the export object.
*
* @see rollup/src/ast/NamespaceVariable
* @see rollup/plugin-commonjs/ too
*/
imports: {
default: ['@pie-lib/editable-html'],
namespace: [
'@pie-framework/pie-configure-events',
'@pie-lib/config-ui',
],
},
},
],
},
};