mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-12 02:29:59 +00:00
Reorganize ext build scripts and add linting
This commit is contained in:
@@ -51,9 +51,9 @@ async function build () {
|
|||||||
spawnSync(`tsc --project ${ROOT_PATH} \
|
spawnSync(`tsc --project ${ROOT_PATH} \
|
||||||
--outDir ${BUILD_PATH}`
|
--outDir ${BUILD_PATH}`
|
||||||
, {
|
, {
|
||||||
shell: true
|
shell: true
|
||||||
, stdio: [ process.stdin, process.stdout, process.stderr ]
|
, stdio: [ process.stdin, process.stdout, process.stderr ]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Move tsc output to build dir
|
// Move tsc output to build dir
|
||||||
fs.moveSync(path.join(BUILD_PATH, "src"), BUILD_PATH);
|
fs.moveSync(path.join(BUILD_PATH, "src"), BUILD_PATH);
|
||||||
|
|||||||
@@ -1,24 +1,5 @@
|
|||||||
{
|
{
|
||||||
"defaultSeverity": "error"
|
"extends": [
|
||||||
, "extends": [
|
"../tslintCommon.json"
|
||||||
"tslint:recommended"
|
|
||||||
]
|
]
|
||||||
, "jsRules": {}
|
|
||||||
, "rules": {
|
|
||||||
"no-consecutive-blank-lines": false
|
|
||||||
, "arrow-parens": false
|
|
||||||
, "interface-name": false
|
|
||||||
, "max-classes-per-file": false
|
|
||||||
, "max-line-length": [ true, {
|
|
||||||
"limit": 80
|
|
||||||
, "ignore-pattern": "//"
|
|
||||||
}]
|
|
||||||
, "no-console": [ true, "log" ]
|
|
||||||
, "object-literal-sort-keys": false
|
|
||||||
, "radix": false
|
|
||||||
, "semicolon": [ true, "always" ]
|
|
||||||
, "space-before-function-paren": [ true, "always" ]
|
|
||||||
, "trailing-comma": false
|
|
||||||
}
|
|
||||||
, "rulesDirectory": []
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
const fs = require("fs-extra");
|
const fs = require("fs-extra");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const minimist = require("minimist");
|
const minimist = require("minimist");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const webExt = require("web-ext").default;
|
const webExt = require("web-ext").default;
|
||||||
|
|
||||||
const package = require("./package.json");
|
const { ROOT
|
||||||
const appPackage = require("../app/package.json");
|
, INCLUDE_PATH
|
||||||
|
, DIST_PATH
|
||||||
|
, UNPACKED_PATH } = require("./lib/paths");
|
||||||
|
|
||||||
|
const packageMeta = require(`${ROOT}/package.json`);
|
||||||
const INCLUDE_PATH = path.resolve(__dirname, "src");
|
const appPackageMeta = require(`${ROOT}/../app/package.json`);
|
||||||
|
|
||||||
const DIST_PATH = path.join(__dirname, "../dist/ext");
|
|
||||||
const UNPACKED_PATH = path.join(DIST_PATH, "unpacked");
|
|
||||||
|
|
||||||
|
|
||||||
const argv = minimist(process.argv.slice(2), {
|
const argv = minimist(process.argv.slice(2), {
|
||||||
@@ -20,7 +21,7 @@ const argv = minimist(process.argv.slice(2), {
|
|||||||
, default: {
|
, default: {
|
||||||
package: false // Should package with web-ext
|
package: false // Should package with web-ext
|
||||||
, watch: false // Should run webpack in watch mode
|
, watch: false // Should run webpack in watch mode
|
||||||
, mirroringAppId: package.__mirroringAppId // Chromecast receiver app ID
|
, mirroringAppId: packageMeta.__mirroringAppId // Chromecast receiver app ID
|
||||||
, mode: "development" // webpack mode
|
, mode: "development" // webpack mode
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -37,7 +38,7 @@ if (argv.package) {
|
|||||||
|
|
||||||
|
|
||||||
// Import webpack config and specify env values
|
// Import webpack config and specify env values
|
||||||
const webpackConfig = require("./webpack.config.js")({
|
const webpackConfig = require(`${ROOT}/webpack.config.js`)({
|
||||||
includePath: INCLUDE_PATH
|
includePath: INCLUDE_PATH
|
||||||
/**
|
/**
|
||||||
* If watching files, output directly to dist. Unpacked
|
* If watching files, output directly to dist. Unpacked
|
||||||
@@ -47,11 +48,11 @@ const webpackConfig = require("./webpack.config.js")({
|
|||||||
? UNPACKED_PATH
|
? UNPACKED_PATH
|
||||||
: DIST_PATH
|
: DIST_PATH
|
||||||
|
|
||||||
, extensionName: package.__extensionName
|
, extensionName: packageMeta.__extensionName
|
||||||
, extensionId: package.__extensionId
|
, extensionId: packageMeta.__extensionId
|
||||||
, extensionVersion: package.__extensionVersion
|
, extensionVersion: packageMeta.__extensionVersion
|
||||||
, applicationName: appPackage.__applicationName
|
, applicationName: appPackageMeta.__applicationName
|
||||||
, applicationVersion: appPackage.__applicationVersion
|
, applicationVersion: appPackageMeta.__applicationVersion
|
||||||
, mirroringAppId: argv.mirroringAppId
|
, mirroringAppId: argv.mirroringAppId
|
||||||
|
|
||||||
// eval source map needs special CSP
|
// eval source map needs special CSP
|
||||||
8
ext/bin/lib/paths.js
Normal file
8
ext/bin/lib/paths.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
|
||||||
|
exports.ROOT = path.resolve(__dirname, "../../");
|
||||||
|
exports.INCLUDE_PATH = path.resolve(exports.ROOT, "src");
|
||||||
|
exports.DIST_PATH = path.join(exports.ROOT, "../dist/ext");
|
||||||
|
exports.UNPACKED_PATH = path.join(exports.DIST_PATH, "unpacked");
|
||||||
13
ext/bin/lint.js
Normal file
13
ext/bin/lint.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
const { spawnSync } = require("child_process");
|
||||||
|
const { ROOT, INCLUDE_PATH } = require("./lib/paths");
|
||||||
|
|
||||||
|
|
||||||
|
spawnSync(`tslint --config ${ROOT}/tslint.json \
|
||||||
|
--project ${ROOT}/tsconfig.json \
|
||||||
|
"${INCLUDE_PATH}/**/*.ts{,x}"`
|
||||||
|
, {
|
||||||
|
shell: true
|
||||||
|
, stdio: [ process.stdin, process.stdout, process.stderr ]
|
||||||
|
});
|
||||||
@@ -5,10 +5,11 @@
|
|||||||
"__mirroringAppId": "19A6F4AE",
|
"__mirroringAppId": "19A6F4AE",
|
||||||
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build.js",
|
"build": "node bin/build.js",
|
||||||
"package": "node build.js --package",
|
"package": "node bin/build.js --package",
|
||||||
"watch": "node build.js --watch",
|
"watch": "node bin/build.js --watch",
|
||||||
"start": "web-ext run -s ../dist/ext/"
|
"start": "web-ext run -s ../dist/ext/",
|
||||||
|
"lint": "node bin/lint.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^16.8.4",
|
"@types/react": "^16.8.4",
|
||||||
|
|||||||
5
ext/tslint.json
Normal file
5
ext/tslint.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"extends": [
|
||||||
|
"../tslintCommon.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -12,8 +12,9 @@
|
|||||||
"test": "node test/driver.js",
|
"test": "node test/driver.js",
|
||||||
"install-manifest": "npm run install-manifest --prefix ./app",
|
"install-manifest": "npm run install-manifest --prefix ./app",
|
||||||
"remove-manifest": "npm run remove-manifest --prefix ./app",
|
"remove-manifest": "npm run remove-manifest --prefix ./app",
|
||||||
"lint": "npm run lint:app",
|
"lint": "npm run lint:app && npm run lint:ext",
|
||||||
"lint:app": "npm run lint --prefix ./app"
|
"lint:app": "npm run lint --prefix ./app",
|
||||||
|
"lint:ext": "npm run lint --prefix ./ext"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/uuid": "^3.4.4",
|
"@types/uuid": "^3.4.4",
|
||||||
|
|||||||
24
tslintCommon.json
Normal file
24
tslintCommon.json
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"defaultSeverity": "error"
|
||||||
|
, "extends": [
|
||||||
|
"tslint:recommended"
|
||||||
|
]
|
||||||
|
, "jsRules": false
|
||||||
|
, "rules": {
|
||||||
|
"no-consecutive-blank-lines": false
|
||||||
|
, "arrow-parens": false
|
||||||
|
, "interface-name": false
|
||||||
|
, "max-classes-per-file": false
|
||||||
|
, "max-line-length": [ true, {
|
||||||
|
"limit": 80
|
||||||
|
, "ignore-pattern": "//"
|
||||||
|
}]
|
||||||
|
, "no-console": [ true, "log" ]
|
||||||
|
, "object-literal-sort-keys": false
|
||||||
|
, "radix": false
|
||||||
|
, "semicolon": [ true, "always" ]
|
||||||
|
, "space-before-function-paren": [ true, "always" ]
|
||||||
|
, "trailing-comma": false
|
||||||
|
}
|
||||||
|
, "rulesDirectory": []
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user