File tree Expand file tree Collapse file tree 3 files changed +46
-35
lines changed Expand file tree Collapse file tree 3 files changed +46
-35
lines changed Original file line number Diff line number Diff line change 15
15
registry-url : https://registry.npmjs.org/
16
16
- run : yarn install --frozen-lockfile --ignore-scripts
17
17
- run : yarn build
18
- - run : cp -rf dist/index.cjs.js src
19
- - run : cp -rf dist/index.esm.js src
20
- - run : cp -rf package.json src
21
- - run : cd src && npm publish --access public
18
+ - run : cp -rf package.json dist
19
+ - run : cp -rf src/types.json dist
20
+ - run : cd dist && npm publish --access public
22
21
env :
23
22
NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @docknetwork/sdk" ,
3
- "version" : " 0.0.4 " ,
4
- "main" : " index.cjs. js" ,
5
- "module" : " index.esm.js " ,
3
+ "version" : " 0.0.5 " ,
4
+ "main" : " index.js" ,
5
+ "module" : " index.mjs " ,
6
6
"license" : " MIT" ,
7
7
"type" : " module" ,
8
8
"repository" : {
23
23
"eslint-plugin-import" : " ^2.20.2" ,
24
24
"eslint-plugin-jest" : " ^23.8.2" ,
25
25
"ethr-did-resolver" : " ^2.2.0" ,
26
+ "glob" : " ^7.1.6" ,
26
27
"jest" : " 24.5.0" ,
27
28
"jsdoc" : " ^3.6.3" ,
28
29
"rollup" : " 1.7.0" ,
Original file line number Diff line number Diff line change 1
- // import resolve from 'rollup-plugin-node-resolve';
2
- // import commonjs from 'rollup-plugin-commonjs';
3
- // import babel from 'rollup-plugin-babel';
4
1
import json from 'rollup-plugin-json' ;
5
2
import pkg from './package.json' ;
3
+ import glob from 'glob' ;
6
4
5
+ export default async function ( ) {
6
+ const input = { } ;
7
7
8
- export default [
9
- // {
10
- // input: 'src/umd.js',
11
- // output: {
12
- // name: 'index',
13
- // file: pkg.browser,
14
- // format: 'umd',
15
- // },
16
- // plugins: [
17
- // resolve(),
18
- // commonjs(),
19
- // babel({
20
- // exclude: 'node_modules/**',
21
- // }),
22
- // ],
23
- // },
24
- {
8
+ await new Promise ( ( resolve , reject ) => {
9
+ const dir = 'src' ;
10
+ glob ( dir + '/**/*.js' , null , ( er , files ) => {
11
+ if ( ! er && files ) {
12
+ for ( let i = 0 ; i < files . length ; i ++ ) {
13
+ const fileName = files [ i ] . substr ( dir . length + 1 ) ;
14
+ if ( fileName . substr ( fileName . length - 3 ) === '.js' ) {
15
+ let id = fileName . substr ( 0 , fileName . length - 3 ) ;
16
+ if ( id === 'api' ) {
17
+ id = 'index' ;
18
+ }
19
+ input [ id ] = files [ i ] ;
20
+ }
21
+ }
22
+ console . log ( 'input' , input ) ;
23
+ resolve ( files ) ;
24
+ } else {
25
+ throw new Error ( 'Unable to list src files!' ) ;
26
+ }
27
+ } ) ;
28
+ } ) ;
29
+
30
+ return [ {
25
31
plugins : [
26
32
json ( ) ,
27
33
] ,
28
- input : 'src/api.js' ,
29
- external : [ ] ,
30
- output : [
31
- { file : 'dist/' + pkg . main , format : 'cjs' } ,
32
- { file : 'dist/' + pkg . module , format : 'es' } ,
33
- ] ,
34
- } ,
35
- ] ;
34
+ input,
35
+ output : [ {
36
+ dir : 'dist' ,
37
+ format : 'esm' ,
38
+ entryFileNames : '[name].mjs'
39
+ } ,
40
+ {
41
+ dir : 'dist' ,
42
+ format : 'cjs'
43
+ }
44
+ ]
45
+ } ] ;
46
+ } ;
You can’t perform that action at this time.
0 commit comments