diff --git a/package.json b/package.json index 5cfdf383de..e0bbe252d4 100644 --- a/package.json +++ b/package.json @@ -35,8 +35,7 @@ "dev": "rollup -cw", "pretest": "npm run build", "posttest": "agadoo internal/index.mjs", - "prepublishOnly": "export PUBLISH=true && npm test && npm run create-stubs", - "create-stubs": "node scripts/create-stubs.js", + "prepublishOnly": "PUBLISH=true npm test", "tsd": "tsc -p src/compiler --emitDeclarationOnly && tsc -p src/runtime --emitDeclarationOnly", "lint": "eslint \"{src,test}/**/*.{ts,js}\"" }, diff --git a/rollup.config.js b/rollup.config.js index f21fa0bdea..fb329534a2 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -61,12 +61,22 @@ export default [ external, plugins: [ ts_plugin, - dir === 'internal' && { - generateBundle(options, bundle) { - const mod = bundle['index.mjs']; - if (mod) { - fs.writeFileSync('src/compiler/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`); + { + writeBundle(bundle) { + if (dir === 'internal') { + const mod = bundle['index.mjs']; + if (mod) { + fs.writeFileSync('src/compiler/compile/internal-exports.ts', `// This file is automatically generated\nexport default new Set(${JSON.stringify(mod.exports)});`); + } } + + fs.writeFileSync(`${dir}/package.json`, JSON.stringify({ + main: './index', + module: './index.mjs', + types: './index.d.ts' + }, null, ' ')); + + fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index';`); } } ] diff --git a/scripts/create-stubs.js b/scripts/create-stubs.js deleted file mode 100644 index 6b9c9e3f4b..0000000000 --- a/scripts/create-stubs.js +++ /dev/null @@ -1,12 +0,0 @@ -const fs = require('fs'); - -fs.readdirSync('src/runtime') - .filter(dir => fs.statSync(`src/runtime/${dir}`).isDirectory()) - .forEach(dir => { - fs.writeFileSync(`${dir}/package.json`, JSON.stringify({ - main: './index', - module: './index.mjs' - }, null, ' ')); - - fs.writeFileSync(`${dir}/index.d.ts`, `export * from '../types/runtime/${dir}/index';`); - });