mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Don't package extension for normal builds
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
dist/
|
||||||
app/node_modules/
|
app/node_modules/
|
||||||
|
app/build
|
||||||
ext/node_modules/
|
ext/node_modules/
|
||||||
test/ChromeProfile/
|
test/ChromeProfile/
|
||||||
.idea/
|
.idea/
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ This will build the ext and app, outputting to `dist/`:
|
|||||||
* #### `dist/app/`
|
* #### `dist/app/`
|
||||||
... contains the bridge binary and manifest with the path pointing that binary. `install-manifest` copies this manifest to the proper location (or adds its current location to the registry).
|
... contains the bridge binary and manifest with the path pointing that binary. `install-manifest` copies this manifest to the proper location (or adds its current location to the registry).
|
||||||
* #### `dist/ext/`
|
* #### `dist/ext/`
|
||||||
... contains the built extension in the format `fx_cast-<version>.zip` in addition to the unpacked extension at `dist/ext/unpacked/`.
|
... contains the unpacked extension.
|
||||||
|
|
||||||
Watching ext changes:
|
Watching ext changes:
|
||||||
|
|
||||||
@@ -80,9 +80,9 @@ npm run start --prefix ./ext
|
|||||||
Packaging currently only possible for macOS/Linux. macOS packages can only be created on macOS, Linux .deb/.rpm packages can be built on any platform with `dpkg-deb` and `rpmbuild` binaries.
|
Packaging currently only possible for macOS/Linux. macOS packages can only be created on macOS, Linux .deb/.rpm packages can be built on any platform with `dpkg-deb` and `rpmbuild` binaries.
|
||||||
|
|
||||||
* #### `dist/app/`
|
* #### `dist/app/`
|
||||||
... contains the installer package: `fx_cast_bridge.pkg` (macOS).
|
... contains the installer package: `fx_cast_bridge.(pkg|deb|rpm|exe)`
|
||||||
* #### `dist/ext/`
|
* #### `dist/ext/`
|
||||||
... contains the built extension.
|
... contains the built extension in the format `fx_cast-<version>.zip`.
|
||||||
|
|
||||||
Build and package app and extension for current platform:
|
Build and package app and extension for current platform:
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ npm run package --prefix ./app -- --platform=linux --packageType=rpm
|
|||||||
|
|
||||||
##### Package script arguments
|
##### Package script arguments
|
||||||
|
|
||||||
* `--platform` `"win"`,`"macos"`,`"linux"`
|
* `--platform` `"win"`,`"mac"`,`"linux"`
|
||||||
Select the platform to build for.
|
Select the platform to build for.
|
||||||
* `--packageType` `"deb"`,`"rpm"`
|
* `--packageType` `"deb"`,`"rpm"`
|
||||||
Select the package type. Defaults to `deb`. Only relevant when building for Linux.
|
Select the package type. Defaults to `deb`. Only relevant when building for Linux.
|
||||||
|
|||||||
27
ext/build.js
27
ext/build.js
@@ -25,8 +25,15 @@ const extensionName = "fx_cast";
|
|||||||
const extensionId = "fx_cast@matt.tf";
|
const extensionId = "fx_cast@matt.tf";
|
||||||
const extensionVersion = "0.0.1";
|
const extensionVersion = "0.0.1";
|
||||||
|
|
||||||
|
const DIST_PATH = path.join(__dirname, "../dist/ext");
|
||||||
|
const UNPACKED_PATH = path.join(DIST_PATH, "unpacked");
|
||||||
|
|
||||||
// Clean
|
// Clean
|
||||||
fs.removeSync(path.join(__dirname, "../dist/ext/"));
|
fs.removeSync(DIST_PATH);
|
||||||
|
|
||||||
|
const buildCmd = `web-ext build --overwrite-dest `
|
||||||
|
+ `--source-dir ${UNPACKED_PATH} `
|
||||||
|
+ `--artifacts-dir ${DIST_PATH} `;
|
||||||
|
|
||||||
const child = spawn(
|
const child = spawn(
|
||||||
`webpack --env.extensionName=${extensionName} `
|
`webpack --env.extensionName=${extensionName} `
|
||||||
@@ -34,11 +41,8 @@ const child = spawn(
|
|||||||
+ `--env.extensionVersion=${extensionVersion} `
|
+ `--env.extensionVersion=${extensionVersion} `
|
||||||
+ `--env.mirroringAppId=${argv.mirroringAppId} `
|
+ `--env.mirroringAppId=${argv.mirroringAppId} `
|
||||||
+ `--mode=${argv.mode} `
|
+ `--mode=${argv.mode} `
|
||||||
+ `${argv.watch ? "--watch" : ""} && `
|
+ `${argv.watch ? "--watch" : ""} `
|
||||||
|
+ `${argv.package ? "&&" + buildCmd : ""} `
|
||||||
+ `web-ext build --overwrite-dest `
|
|
||||||
+ `--source-dir ../dist/ext/unpacked `
|
|
||||||
+ `--artifacts-dir ../dist/ext `
|
|
||||||
, { shell: true }
|
, { shell: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -47,6 +51,15 @@ child.stderr.pipe(process.stderr);
|
|||||||
|
|
||||||
child.on("exit", () => {
|
child.on("exit", () => {
|
||||||
if (argv.package) {
|
if (argv.package) {
|
||||||
fs.remove(path.join(__dirname, "../dist/ext/unpacked"));
|
fs.remove(UNPACKED_PATH);
|
||||||
|
} else {
|
||||||
|
for (const file of fs.readdirSync(UNPACKED_PATH)) {
|
||||||
|
fs.moveSync(path.join(UNPACKED_PATH, file)
|
||||||
|
, path.join(DIST_PATH, file)
|
||||||
|
, { overwrite: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove empty unpacked directory
|
||||||
|
fs.remove(UNPACKED_PATH);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user