File tree 9 files changed +41
-3
lines changed
9 files changed +41
-3
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @craftjs/core ' : patch
3
+ ' @craftjs/layers ' : patch
4
+ ' @craftjs/utils ' : patch
5
+ ---
6
+
7
+ Inject Craft package version and export sourcemaps
Original file line number Diff line number Diff line change 1
1
src
2
2
rollup.config.js
3
3
tsconfig.json
4
- nodemon.json
4
+ nodemon.json
5
+ .rollup.cache
Original file line number Diff line number Diff line change 21
21
"main" : " ./dist/cjs/index.js" ,
22
22
"module" : " ./dist/esm/index.js" ,
23
23
"types" : " ./lib/index.d.ts" ,
24
+ "files" : [
25
+ " dist"
26
+ ],
24
27
"repository" : {
25
28
"type" : " git" ,
26
29
"url" : " https://github.com/prevwong/craft.js/"
Original file line number Diff line number Diff line change 1
1
src
2
2
rollup.config.js
3
- tsconfig.json
3
+ tsconfig.json
4
+ .rollup.cache
Original file line number Diff line number Diff line change 17
17
"module" : " ./dist/esm/index.js" ,
18
18
"license" : " MIT" ,
19
19
"types" : " ./lib/index.d.ts" ,
20
+ "files" : [
21
+ " dist"
22
+ ],
20
23
"scripts" : {
21
24
"start" : " cross-env NODE_ENV=development ../../scripts/build.sh" ,
22
25
"build" : " cross-env NODE_ENV=production ../../scripts/build.sh" ,
Original file line number Diff line number Diff line change 1
1
src
2
2
rollup.config.js
3
3
tsconfig.json
4
- nodemon.json
4
+ nodemon.json
5
+ .rollup.cache
Original file line number Diff line number Diff line change 7
7
"main" : " ./dist/cjs/index.js" ,
8
8
"module" : " ./dist/esm/index.js" ,
9
9
"types" : " ./lib/index.d.ts" ,
10
+ "files" : [
11
+ " dist"
12
+ ],
10
13
"scripts" : {
11
14
"start" : " cross-env NODE_ENV=development ../../scripts/build.sh" ,
12
15
"build" : " cross-env NODE_ENV=production ../../scripts/build.sh" ,
Original file line number Diff line number Diff line change @@ -8,20 +8,38 @@ import typescript from '@rollup/plugin-typescript';
8
8
const shouldMinify = process . env . NODE_ENV === 'production' ;
9
9
const bundle = [ 'tslib' ] ;
10
10
11
+ const injectPackageVersion = ( ) => {
12
+ const pkg = require ( './package.json' ) ;
13
+
14
+ return `
15
+ if ( typeof window !== 'undefined' ) {
16
+ if ( !window['__CRAFTJS__'] ) {
17
+ window['__CRAFTJS__'] = {};
18
+ }
19
+
20
+ window['__CRAFTJS__']["${ pkg . name } "] = "${ pkg . version } ";
21
+ }
22
+ ` ;
23
+ } ;
24
+
11
25
export default {
12
26
input : './src/index.ts' ,
13
27
output : [
14
28
{
15
29
file : 'dist/esm/index.js' ,
16
30
format : 'esm' ,
31
+ intro : injectPackageVersion ( ) ,
17
32
globals : {
18
33
react : 'React' ,
19
34
'react-dom' : 'ReactDOM' ,
20
35
} ,
36
+ sourcemap : true ,
21
37
} ,
22
38
{
23
39
file : 'dist/cjs/index.js' ,
40
+ intro : injectPackageVersion ( ) ,
24
41
format : 'cjs' ,
42
+ sourcemap : true ,
25
43
} ,
26
44
] ,
27
45
external : ( id ) => {
Original file line number Diff line number Diff line change 5
5
"allowSyntheticDefaultImports" : true ,
6
6
"allowJs" : true ,
7
7
"esModuleInterop" : true ,
8
+ "sourceMap" : true ,
8
9
"paths" : {
9
10
"@craftjs/core" : [" packages/core/src/index" ],
10
11
"@craftjs/*" : [" packages/core/src/*" ],
You can’t perform that action at this time.
0 commit comments