-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📦 Chore(build): migrate to esbuild and change export assignment to es…
…m export (#102) This is a breaking change.
- Loading branch information
Showing
34 changed files
with
2,634 additions
and
2,485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ yarn-error.log | |
temp.js | ||
package-lock.json | ||
tsconfig.json | ||
tslint.json | ||
.vscode/ | ||
src/ | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { terser } from 'rollup-plugin-terser' | ||
import pkg from './package.json' | ||
import typescript from 'rollup-plugin-typescript2' | ||
import commonjs from '@rollup/plugin-commonjs' | ||
import { string } from 'rollup-plugin-string' | ||
import json from '@rollup/plugin-json' | ||
import builtins from 'builtins' | ||
import replace from '@rollup/plugin-replace' | ||
|
||
const version = process.env.VERSION || pkg.version | ||
const sourcemap = 'inline' | ||
const banner = `/* | ||
* picgo@${version}, https://github.com/PicGo/PicGo-Core | ||
* (c) 2018-${new Date().getFullYear()} PicGo Group | ||
* Released under the MIT License. | ||
*/` | ||
const input = './src/index.ts' | ||
|
||
const commonOptions = { | ||
// Creating regex of the packages to make sure sub-paths of the | ||
// packages such as `lowdb/adapters/FileSync` are also treated as external | ||
// See https://github.com/rollup/rollup/issues/3684#issuecomment-926558056 | ||
external: [ | ||
...Object.keys(pkg.dependencies), | ||
...builtins() | ||
].map(packageName => new RegExp(`^${packageName}(/.*)?`)), | ||
plugins: [ | ||
typescript({ | ||
tsconfigOverride: { | ||
compilerOptions: { | ||
target: 'ES2017', | ||
module: 'ES2015' | ||
} | ||
} | ||
}), | ||
terser(), | ||
commonjs(), | ||
string({ | ||
// Required to be specified | ||
include: [ | ||
'**/*.applescript', | ||
'**/*.ps1', | ||
'**/*.sh' | ||
] | ||
}), | ||
json(), | ||
replace({ | ||
'process.env.PICGO_VERSION': JSON.stringify(pkg.version), | ||
preventAssignment: true | ||
}) | ||
], | ||
input | ||
} | ||
|
||
/** @type import('rollup').RollupOptions */ | ||
const nodeCjs = { | ||
output: [{ | ||
file: 'dist/index.cjs.js', | ||
format: 'cjs', | ||
banner, | ||
sourcemap | ||
}], | ||
...commonOptions | ||
} | ||
|
||
const nodeEsm = { | ||
output: [{ | ||
file: 'dist/index.esm.js', | ||
format: 'esm', | ||
banner, | ||
sourcemap | ||
}], | ||
...commonOptions | ||
} | ||
|
||
const bundles = [] | ||
const env = process.env.BUNDLES || '' | ||
if (env.includes('cjs')) bundles.push(nodeCjs) | ||
if (env.includes('esm')) bundles.push(nodeEsm) | ||
if (bundles.length === 0) bundles.push(nodeCjs, nodeEsm) | ||
|
||
export default bundles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
declare module '*.sh' { | ||
const src: string | ||
export default src | ||
} | ||
declare module '*.applescript' { | ||
const src: string | ||
export default src | ||
} | ||
declare module '*.ps1' { | ||
const src: string | ||
export default src | ||
} | ||
|
||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
readonly PICGO_VERSION: string | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
import PicGo from './core/PicGo' | ||
export { PicGo } from './core/PicGo' | ||
export { Lifecycle } from './core/Lifecycle' | ||
|
||
export = PicGo | ||
export { Logger } from './lib/Logger' | ||
export { PluginHandler } from './lib/PluginHandler' | ||
export { LifecyclePlugins } from './lib/LifecyclePlugins' | ||
export { Commander } from './lib/Commander' | ||
export { PluginLoader } from './lib/PluginLoader' | ||
export { Request } from './lib/Request' | ||
|
||
export * from './types' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.