-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
105 additions
and
128 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
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,2 @@ | ||
@dimensiondev:registry=https://npm.pkg.github.com/ | ||
//npm.pkg.github.com/:_authToken=6c6372312c5169327ac9c3fb7793bf4ed971133b |
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 |
---|---|---|
@@ -1,36 +1,18 @@ | ||
import { execFileSync, ExecFileSyncOptions } from 'child_process' | ||
import path from 'path' | ||
import os from 'os' | ||
import git from '@nice-labs/git-rev' | ||
|
||
const cwd = path.join(__dirname, '..') | ||
const BUILD_PATH = path.join(cwd, 'build') | ||
const stdio = [process.stdin, process.stdout, process.stderr] | ||
const shell = os.platform() === 'win32' | ||
|
||
const exec = (command: string, args: string[], options?: ExecFileSyncOptions) => { | ||
console.log('$', command, args.join(' '), '# cwd:', options?.cwd ?? cwd) | ||
return execFileSync(command, args, { cwd, stdio, shell, ...options }) | ||
} | ||
|
||
function buildTypes(name: string): string[] { | ||
// Always build full types | ||
return ['base', 'chromium', 'firefox', 'gecko', 'iOS'] | ||
} | ||
import { BUILD_PATH, ROOT_PATH, run } from './utils' | ||
|
||
const branch = git.branchName() | ||
const types = buildTypes(branch.toLowerCase()) | ||
const types = ['base', 'chromium', 'firefox', 'gecko', 'iOS'] | ||
console.log(`Branch: ${branch}`) | ||
for (const type of types) { | ||
console.log('#', 'Building for target:', type) | ||
if (type === 'chromium' && types.includes('base')) { | ||
// chromium doesn't have it's own changes yet. | ||
// just copying base version is acceptable | ||
exec('cp', ['-v', 'Maskbook.base.zip', 'Maskbook.chromium.zip']) | ||
run(ROOT_PATH, 'cp', '-v', 'Maskbook.base.zip', 'Maskbook.chromium.zip') | ||
} else { | ||
exec('yarn', [`build:${type.toLowerCase()}`]) | ||
exec('zip', ['-FS', '-r', `../Maskbook.${type}.zip`, '.'], { cwd: BUILD_PATH }) | ||
exec('rm', ['-rfv', 'build']) | ||
run(ROOT_PATH, 'yarn', `build:${type.toLowerCase()}`) | ||
run(BUILD_PATH, 'zip', '-FS', '-r', `../Maskbook.${type}.zip`, '.') | ||
run(ROOT_PATH, 'rm', '-rfv', 'build') | ||
} | ||
exec('free', ['-h']) | ||
} |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
import { execFileSync } from 'child_process' | ||
import os from 'os' | ||
import path from 'path' | ||
|
||
export const ROOT_PATH = path.resolve(__dirname, '..') | ||
export const NODE_MODULES_PATH = path.resolve(ROOT_PATH, 'node_modules') | ||
export const BUILD_PATH = path.resolve(ROOT_PATH, 'build') | ||
|
||
export function run(cwd: string | undefined, cmd: string, ...args: string[]) { | ||
console.log('$', cmd, args.join(' '), '# cwd:', cwd) | ||
return execFileSync(cmd, args, { | ||
cwd, | ||
stdio: [process.stdin, process.stdout, process.stderr], | ||
shell: os.platform() === 'win32', | ||
}) | ||
} |
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,27 +1,20 @@ | ||
import { execFileSync } from 'child_process' | ||
import fs from 'fs' | ||
import path from 'path' | ||
import os from 'os' | ||
import { BUILD_PATH, ROOT_PATH, NODE_MODULES_PATH, run } from './utils' | ||
|
||
const stdio = [process.stdin, process.stdout, process.stderr] | ||
const shell = os.platform() === 'win32' | ||
const run = (cwd: string, cmd: string, ...args: string[]) => execFileSync(cmd, args, { cwd, stdio, shell }) | ||
run(ROOT_PATH, 'web-ext-prebuilts', 'eofkdgkhfoebecmamljfaepckoecjhib', 'build') | ||
|
||
run( | ||
path.join(__dirname, '../node_modules/webextension-shim'), | ||
'node', | ||
...'../ts-node/dist/bin.js -T ./src/bin/prebuilts.ts eofkdgkhfoebecmamljfaepckoecjhib ../../build/'.split(' '), | ||
) | ||
import fs from 'fs' | ||
function readDir(x: string) { | ||
const _ = path.join(__dirname, x) | ||
return fs.readdirSync(_).map((x) => path.join(_, x)) | ||
} | ||
readDir('../build/js').filter(unused).forEach(fs.unlinkSync) | ||
// .forEach((x) => console.log(x)) | ||
function unused(x: string): boolean { | ||
if (x.includes('prebuilt-0-module')) return true | ||
if (x.includes('prebuilt') && !x.includes('content-script')) return true | ||
// Since content script has it prebuilt version, we can remove the original version? | ||
if (x.match(/content-script\.js$/)) return true | ||
return false | ||
} | ||
|
||
readDir(path.resolve(BUILD_PATH, 'js')) | ||
.filter(function unused(x: string): boolean { | ||
if (x.includes('prebuilt-0-module')) return true | ||
if (x.includes('prebuilt') && !x.includes('content-script')) return true | ||
// Since content script has it prebuilt version, we can remove the original version? | ||
if (x.match(/content-script\.js$/)) return true | ||
return false | ||
}) | ||
.forEach(fs.unlinkSync) |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
declare module 'matrix-js-sdk' { | ||
export * from 'matrix-js-sdk-type' | ||
export * from '@dimensiondev/matrix-js-sdk-type' | ||
} |
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
Oops, something went wrong.