makepack 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -16,11 +16,11 @@ const build = async (args) => {
|
|
|
16
16
|
const { build } = await makepackConfig()
|
|
17
17
|
const configs = build.configs
|
|
18
18
|
if (!configs || !configs.length) process.exit("Invalid configuration");
|
|
19
|
-
const outdir = build.outdir
|
|
19
|
+
const outdir = path.join(process.cwd(), build.outdir)
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
|
-
fs.removeSync(
|
|
23
|
-
fs.mkdirSync(
|
|
22
|
+
fs.removeSync(outdir);
|
|
23
|
+
fs.mkdirSync(outdir);
|
|
24
24
|
} catch (err) { }
|
|
25
25
|
|
|
26
26
|
for (let ebconfig of configs) {
|
|
@@ -29,13 +29,13 @@ const build = async (args) => {
|
|
|
29
29
|
esbuild.buildSync({
|
|
30
30
|
...ebconfig,
|
|
31
31
|
entryPoints,
|
|
32
|
-
outdir: path.join(
|
|
32
|
+
outdir: path.join(outdir, ebconfig.outdir || ''),
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (build.types) {
|
|
37
37
|
let tsconfig = {
|
|
38
|
-
outDir: path.join(
|
|
38
|
+
outDir: path.join(outdir, 'types'),
|
|
39
39
|
declaration: true,
|
|
40
40
|
emitDeclarationOnly: true,
|
|
41
41
|
strict: true,
|
|
@@ -44,7 +44,7 @@ const build = async (args) => {
|
|
|
44
44
|
esModuleInterop: true,
|
|
45
45
|
}
|
|
46
46
|
spinner.text = "Generating TypeScript declarations..."
|
|
47
|
-
const files = await glob("
|
|
47
|
+
const files = await glob("src/**/*.{tsx,ts,js,jsx}") || []
|
|
48
48
|
const program = ts.createProgram(files, tsconfig);
|
|
49
49
|
const emitResult = program.emit();
|
|
50
50
|
const diagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
@@ -26,21 +26,23 @@ export default async (info) => {
|
|
|
26
26
|
types: `./types/index.d.ts`,
|
|
27
27
|
description: "",
|
|
28
28
|
keywords: [],
|
|
29
|
-
exports: {
|
|
29
|
+
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"types":
|
|
32
|
-
"
|
|
33
|
-
"
|
|
31
|
+
"types": "./types/index.d.ts",
|
|
32
|
+
"require": "./cjs/index.js",
|
|
33
|
+
"import": "./index.js",
|
|
34
34
|
},
|
|
35
|
+
"./types/*": "./types/*.d.ts",
|
|
36
|
+
"./cjs/*": "./cjs/*.js",
|
|
35
37
|
"./*": {
|
|
36
|
-
"import":
|
|
37
|
-
"require":
|
|
38
|
+
"import": "./*.js",
|
|
39
|
+
"require": "./cjs/*.js"
|
|
38
40
|
}
|
|
39
41
|
},
|
|
40
42
|
scripts: {
|
|
41
43
|
"start": "makepack serve",
|
|
42
44
|
"build": "makepack build",
|
|
43
|
-
"
|
|
45
|
+
"build:publish": "makepack publish"
|
|
44
46
|
},
|
|
45
47
|
dependencies,
|
|
46
48
|
devDependencies
|
|
@@ -63,8 +63,9 @@ const create = async () => {
|
|
|
63
63
|
const projectDir = path.join(cwd, information.projectDirName)
|
|
64
64
|
|
|
65
65
|
if (information.projectDirName !== cwdFolder) {
|
|
66
|
-
fs.
|
|
67
|
-
|
|
66
|
+
if (fs.existsSync(projectDir)) {
|
|
67
|
+
fs.mkdirSync(projectDir)
|
|
68
|
+
}
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
if (!fs.existsSync(path.join(projectDir, information.sourceDir))) {
|
package/src/makepack-config.js
CHANGED
|
@@ -13,9 +13,10 @@ const makepackConfig = async () => {
|
|
|
13
13
|
configs: [
|
|
14
14
|
{
|
|
15
15
|
entryPoints: "src/**/*.{tsx,ts,js,jsx}",
|
|
16
|
-
outdir: "
|
|
16
|
+
outdir: "",
|
|
17
17
|
format: "esm",
|
|
18
18
|
sourcemap: true,
|
|
19
|
+
minify: true,
|
|
19
20
|
jsx: 'automatic',
|
|
20
21
|
loader: {
|
|
21
22
|
'.ts': 'ts',
|
|
@@ -24,9 +25,10 @@ const makepackConfig = async () => {
|
|
|
24
25
|
},
|
|
25
26
|
{
|
|
26
27
|
entryPoints: "src/**/*.{tsx,ts,js,jsx}",
|
|
27
|
-
outdir: "",
|
|
28
|
+
outdir: "cjs",
|
|
28
29
|
format: "cjs",
|
|
29
30
|
sourcemap: true,
|
|
31
|
+
minify: true,
|
|
30
32
|
jsx: 'automatic',
|
|
31
33
|
loader: {
|
|
32
34
|
'.ts': 'ts',
|