@elgato/cli 0.1.0-beta.2 → 0.1.0-beta.3
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/README.md +1 -1
- package/bin/streamdeck.mjs +1 -1
- package/package.json +2 -2
- package/template/_.gitignore +3 -3
- package/template/rollup.config.mjs.ejs +61 -0
- package/template/rollup.config.mjs +0 -71
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elgato/cli",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-beta.3",
|
|
4
|
+
"description": "CLI tool for building with Stream Deck.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"streamdeck": "bin/streamdeck.mjs",
|
|
7
7
|
"sd": "bin/streamdeck.mjs"
|
package/template/_.gitignore
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
2
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
3
|
+
import terser from "@rollup/plugin-terser";
|
|
4
|
+
import typescript from "@rollup/plugin-typescript";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import url from "node:url";
|
|
7
|
+
|
|
8
|
+
const isWatching = !!process.env.ROLLUP_WATCH;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @type {import('rollup').RollupOptions}
|
|
12
|
+
*/
|
|
13
|
+
const config = {
|
|
14
|
+
input: "src/plugin.ts",
|
|
15
|
+
output: {
|
|
16
|
+
dir: "<%- uuid %>.sdPlugin/bin",
|
|
17
|
+
format: "cjs",
|
|
18
|
+
sourcemap: isWatching,
|
|
19
|
+
sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
|
|
20
|
+
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
plugins: [
|
|
24
|
+
typescript({
|
|
25
|
+
sourceMap: isWatching,
|
|
26
|
+
inlineSources: isWatching,
|
|
27
|
+
mapRoot: isWatching ? "./" : undefined
|
|
28
|
+
}),
|
|
29
|
+
commonjs({
|
|
30
|
+
sourceMap: false
|
|
31
|
+
}),
|
|
32
|
+
nodeResolve({
|
|
33
|
+
browser: false,
|
|
34
|
+
exportConditions: ["node"],
|
|
35
|
+
preferBuiltins: true
|
|
36
|
+
}),
|
|
37
|
+
!isWatching &&
|
|
38
|
+
terser({
|
|
39
|
+
format: {
|
|
40
|
+
comments: false
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
]
|
|
44
|
+
};
|
|
45
|
+
<% if (isPreBuild) { %>
|
|
46
|
+
/*
|
|
47
|
+
* This is an intermediary fix for an upstream issue that causes the build process to hang indefinitely (particularly on macOS).
|
|
48
|
+
* As part of the creation of the plugin, this temporary rollup-plugin is applied during the build step, but removed as part of
|
|
49
|
+
* the finalizing process. If you're seeing this as part of the final output, you can safely remove it.
|
|
50
|
+
* See also https://github.com/rollup/plugins/issues/983
|
|
51
|
+
*/
|
|
52
|
+
config.plugins.push({
|
|
53
|
+
closeBundle() {
|
|
54
|
+
process.exit(0);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
/*
|
|
58
|
+
* End of fix.
|
|
59
|
+
*/
|
|
60
|
+
<% } %>
|
|
61
|
+
export default config;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import commonjs from "@rollup/plugin-commonjs";
|
|
2
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
3
|
-
import terser from "@rollup/plugin-terser";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import fs from "node:fs";
|
|
6
|
-
import path from "node:path";
|
|
7
|
-
import url from "node:url";
|
|
8
|
-
|
|
9
|
-
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
10
|
-
|
|
11
|
-
const isWatching = !!process.env.ROLLUP_WATCH;
|
|
12
|
-
const tsConfig = JSON.parse(fs.readFileSync(path.resolve(__dirname, "./tsconfig.json"), "utf8"));
|
|
13
|
-
|
|
14
|
-
prepareOutDir(tsConfig.compilerOptions.outDir);
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @type {import('rollup').RollupOptions}
|
|
18
|
-
*/
|
|
19
|
-
const config = {
|
|
20
|
-
input: "src/plugin.ts",
|
|
21
|
-
output: {
|
|
22
|
-
dir: tsConfig.compilerOptions.outDir,
|
|
23
|
-
format: "cjs",
|
|
24
|
-
sourcemap: isWatching,
|
|
25
|
-
sourcemapPathTransform: (relativeSourcePath, sourcemapPath) => {
|
|
26
|
-
return url.pathToFileURL(path.resolve(path.dirname(sourcemapPath), relativeSourcePath)).href;
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
plugins: [
|
|
30
|
-
typescript({
|
|
31
|
-
sourceMap: isWatching,
|
|
32
|
-
inlineSources: isWatching,
|
|
33
|
-
mapRoot: isWatching ? "./" : undefined
|
|
34
|
-
}),
|
|
35
|
-
commonjs({
|
|
36
|
-
sourceMap: false
|
|
37
|
-
}),
|
|
38
|
-
nodeResolve({
|
|
39
|
-
browser: false,
|
|
40
|
-
exportConditions: ["node"],
|
|
41
|
-
preferBuiltins: true
|
|
42
|
-
}),
|
|
43
|
-
!isWatching &&
|
|
44
|
-
terser({
|
|
45
|
-
format: {
|
|
46
|
-
comments: false
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export default config;
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Validates the output directory is situated within the current working directory; upon passing validation, the directory is cleaned before build.
|
|
56
|
-
* @param {string} outDir
|
|
57
|
-
*/
|
|
58
|
-
function prepareOutDir(outDir) {
|
|
59
|
-
if (outDir === undefined) {
|
|
60
|
-
throw new Error("outDir must be specified within the TypeScript config file.");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const relative = path.relative(__dirname, outDir);
|
|
64
|
-
if (relative && !relative.startsWith("..") && !path.isAbsolute(relative)) {
|
|
65
|
-
if (fs.existsSync(outDir)) {
|
|
66
|
-
fs.rmSync(outDir, { recursive: true });
|
|
67
|
-
}
|
|
68
|
-
} else {
|
|
69
|
-
throw new Error("outDir must be located within the current working directory. Please review the TypeScript config file.");
|
|
70
|
-
}
|
|
71
|
-
}
|