Skip to content

Commit

Permalink
🔧 update build config (#357)
Browse files Browse the repository at this point in the history
* 🔧 (mario) update build config

* 👷  bundle with esbuild

* 💚  bundle with esbuild

* 📸  always latest bin tempalte

* 📸  bin template version
  • Loading branch information
JiangWeixian committed Jul 15, 2023
1 parent 7f9763b commit d33ff1f
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 488 deletions.
5 changes: 5 additions & 0 deletions .changeset/rare-lobsters-share.md
@@ -0,0 +1,5 @@
---
"@aiou/neo": patch
---

bundle with esbuild
6 changes: 3 additions & 3 deletions packages/core/package.json
Expand Up @@ -4,7 +4,7 @@
"description": "templates cli",
"license": "MIT",
"engines": {
"node": ">=12"
"node": ">=14"
},
"homepage": "https://github.com/neo-hack/neo#readme",
"repository": {
Expand Down Expand Up @@ -70,6 +70,7 @@
"consola": "^2.15.3",
"cosmiconfig": "^7.0.1",
"debug": "4.3.3",
"esbuild": "^0.18.13",
"esno": "^0.13.0",
"execa": "^6.0.0",
"find-up": "^6.2.0",
Expand All @@ -87,9 +88,8 @@
"read-yaml-file": "^2.1.0",
"rimraf": "3.0.2",
"rollup": "^2.64.0",
"rollup-plugin-esbuild": "^5.0.0",
"rollup-plugin-size": "^0.2.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.31.1",
"semver": "^7.3.7",
"tempy": "^2.0.0",
"terminal-link": "^3.0.0",
Expand Down
10 changes: 4 additions & 6 deletions packages/core/rollup.config.js
Expand Up @@ -3,9 +3,8 @@ import commonjs from '@rollup/plugin-commonjs'
import json from '@rollup/plugin-json'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { defineConfig } from 'rollup'
import esbuild from 'rollup-plugin-esbuild'
import size from 'rollup-plugin-size'
import { terser } from 'rollup-plugin-terser'
import ts from 'rollup-plugin-typescript2'

export default defineConfig([
// CommonJS (for Node) and ES module (for bundlers) build.
Expand All @@ -19,9 +18,9 @@ export default defineConfig([
preserveEntrySignatures: 'strict',
external: ['readable-stream'],
plugins: [
ts({
check: false,
tsconfig: './tsconfig.build.json',
esbuild({
target: 'es2020',
minify: false,
}),
// TODO: external or include
// fix: https://github.com/rollup/rollup/issues/1507
Expand Down Expand Up @@ -50,7 +49,6 @@ export default defineConfig([
}),
commonjs(),
json(),
terser(),
size(),
],
output: [
Expand Down
6 changes: 3 additions & 3 deletions packages/core/test/__snapshots__/store.test.ts.snap
Expand Up @@ -33,11 +33,11 @@ exports[`store > add preset 1`] = `

exports[`store > add template 1`] = `
"templates:
registry.npmjs.org/@aiou/bin-template/3.1.0:
registry.npmjs.org/@aiou/bin-template/4.0.0:
name: bin
version: 3.1.0
version: 4.0.0
resolvedVia: npm-registry
id: registry.npmjs.org/@aiou/bin-template/3.1.0
id: registry.npmjs.org/@aiou/bin-template/4.0.0
pref: bin-template#bundle
"
`;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/test/store.test.ts
Expand Up @@ -27,7 +27,7 @@ describe('store', () => {
afterEach(() => {
clearLockFile()
})
// FIXME: latest option not working
// FIXME: latest option not working, will always install latest
it('add template', async () => {
const store = await createStore({ storeDir })
await store.addTemplate({
Expand Down
19 changes: 8 additions & 11 deletions packages/mario/package.json
@@ -1,12 +1,16 @@
{
"name": "@aiou/mario",
"version": "0.2.1",
"type": "module",
"description": "generator of neo",
"keywords": [
"neo",
"generator"
],
"license": "MIT",
"engines": {
"node": ">=12"
},
"homepage": "https://github.com/neo-hack/neo#readme",
"repository": {
"type": "git",
Expand All @@ -22,27 +26,19 @@
"email": "jiangweixian1994@gmail.com",
"url": "https://twitter.com/jiangweixian"
},
"engines": {
"node": ">=12"
},
"type": "module",
"files": ["lib"],
"exports": {
".": "./lib/index.mjs",
"./helpers": "./lib/utils/helpers.mjs"
},
"typesVersions": {
"*": {
"helpers": [
"lib/utils/helpers.d.ts"
]
"helpers": ["lib/utils/helpers.d.ts"]
}
},
"main": "lib/index.mjs",
"module": "lib/index.mjs",
"typings": "lib/index.d.ts",
"files": [
"lib"
],
"scripts": {
"schema2types": "json2ts --input ./assets/github.json --output ./assets/github.d.ts",
"build": "rimraf lib && rollup -c --silent",
Expand Down Expand Up @@ -84,6 +80,7 @@
"@types/gulp-plumber": "^0.0.33",
"@types/gulp-rename": "^2.0.1",
"@types/lodash-es": "^4.17.5",
"esbuild": "^0.18.13",
"esno": "^0.13.0",
"esrua": "0.2.1",
"execa": "^6.0.0",
Expand All @@ -92,10 +89,10 @@
"listr": "^0.14.3",
"rimraf": "3.0.2",
"rollup": "2.58.0",
"rollup-plugin-esbuild": "^5.0.0",
"rollup-plugin-multi-input": "^1.3.1",
"rollup-plugin-node-externals": "^5.0.0",
"rollup-plugin-size": "^0.2.2",
"rollup-plugin-typescript2": "0.30.0",
"tslib": "2.3.0",
"typescript": "^4.5.4",
"vitest": "^0.7.7",
Expand Down
8 changes: 4 additions & 4 deletions packages/mario/rollup.config.js
@@ -1,9 +1,9 @@
import { nodeResolve } from '@rollup/plugin-node-resolve'
import { defineConfig } from 'rollup'
import esbuild from 'rollup-plugin-esbuild'
import multiple from 'rollup-plugin-multi-input'
import { externals } from 'rollup-plugin-node-externals'
import bundleSize from 'rollup-plugin-size'
import typescript from 'rollup-plugin-typescript2'

export default defineConfig([
// CommonJS (for Node) and ES module (for bundlers) build.
Expand All @@ -19,9 +19,9 @@ export default defineConfig([
devDeps: false,
}),
multiple(),
typescript({
check: false,
tsconfig: './tsconfig.build.json',
esbuild({
target: 'es2020',
minify: false,
}), // so Rollup can convert TypeScript to JavaScript
nodeResolve({ preferBuiltins: true }),
bundleSize(),
Expand Down

0 comments on commit d33ff1f

Please sign in to comment.