1
0
mirror of https://gitee.com/bitdance-team/chrome-extension synced 2025-10-07 08:25:15 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

feat: add monorepo

This commit is contained in:
kaz
2022-01-26 18:46:54 +08:00
parent 1659cde35a
commit 628d37cbc8
65 changed files with 11803 additions and 11 deletions

0
packages/.gitkeep Normal file
View File

View File

@@ -0,0 +1,12 @@
module.exports = {
extends: [
'../../.eslintrc.json',
'plugin:vue/vue3-essential',
'@vue/typescript/recommended',
'prettier',
],
rules: {},
ignorePatterns: ['!**/*'],
env: { node: true },
overrides: [{ files: ['**/*.spec.{j,t}s?(x)'], env: { jest: true } }],
};

View File

@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

View File

@@ -0,0 +1,21 @@
module.exports = {
displayName: 'plugin-ui',
preset: '../../jest.preset.js',
transform: {
'^.+.vue$': 'vue3-jest',
'.+.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':
'jest-transform-stub',
'^.+.tsx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'vue', 'js', 'json'],
coverageDirectory: '../../coverage/packages/plugin-ui',
snapshotSerializers: ['jest-serializer-vue'],
globals: {
'ts-jest': {
tsconfig: 'packages/plugin-ui/tsconfig.spec.json',
},
'vue-jest': {
tsConfig: 'packages/plugin-ui/tsconfig.spec.json',
},
},
};

View File

@@ -0,0 +1,35 @@
{
"root": "packages/plugin-ui",
"projectType": "application",
"sourceRoot": "packages/plugin-ui/src",
"targets": {
"build": {
"executor": "@nx-plus/vite:build",
"options": {
"config": "packages/plugin-ui/vite.config.ts"
}
},
"serve": {
"executor": "@nx-plus/vite:server",
"options": {
"config": "packages/plugin-ui/vite.config.ts"
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/plugin-ui/**/*.{ts,tsx,vue}"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/plugin-ui"],
"options": {
"jestConfig": "packages/plugin-ui/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,27 @@
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<HelloWorld msg="Hello Vue 3 + TypeScript + Vite" />
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import HelloWorld from './components/HelloWorld.vue';
export default defineComponent({
name: 'App',
components: {
HelloWorld,
},
});
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,69 @@
<template>
<h1>{{ msg }}</h1>
<p>
Recommended IDE setup:
<a href="https://code.visualstudio.com/" target="_blank">VSCode</a>
+
<a
href="https://marketplace.visualstudio.com/items?itemName=octref.vetur"
target="_blank"
>Vetur</a
>
or
<a href="https://github.com/johnsoncodehk/volar" target="_blank">Volar</a>
(if using
<code>&lt;script setup&gt;</code>)
</p>
<p>See <code>README.md</code> for more information.</p>
<p>
<a href="https://vitejs.dev/guide/features.html" target="_blank"
>Vite Docs</a
>
|
<a href="https://v3.vuejs.org/" target="_blank">Vue 3 Docs</a>
</p>
<button @click="count++">count is: {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test hot module replacement.
</p>
</template>
<script lang="ts">
import { ref, defineComponent } from 'vue';
export default defineComponent({
name: 'HelloWorld',
props: {
msg: {
type: String,
required: true,
},
},
setup: () => {
const count = ref(0);
return { count };
},
});
</script>
<style scoped>
a {
color: #42b983;
}
label {
margin: 0 0.5em;
font-weight: bold;
}
code {
background-color: #eee;
padding: 2px 4px;
border-radius: 4px;
color: #304455;
}
</style>

View File

@@ -0,0 +1,4 @@
import { createApp } from 'vue';
import App from './App.vue';
createApp(App).mount('#app');

6
packages/plugin-ui/src/shims-vue.d.ts vendored Normal file
View File

@@ -0,0 +1,6 @@
declare module '*.vue' {
import { DefineComponent } from 'vue';
// eslint-disable-next-line
const component: DefineComponent<{}, {}, any>;
export default component;
}

View File

@@ -0,0 +1,10 @@
import { shallowMount } from '@vue/test-utils';
import HelloWorld from '../../src/components/HelloWorld.vue';
describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message';
const wrapper = shallowMount(HelloWorld, { props: { msg } });
expect(wrapper.text()).toMatch(msg);
});
});

View File

@@ -0,0 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"moduleResolution": "node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"types": ["vite/client"],
"composite": true
},
"exclude": ["**/*.spec.ts", "**/*.spec.tsx"],
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}

View File

@@ -0,0 +1,13 @@
{
"extends": "../../tsconfig.base.json",
"include": [],
"files": [],
"references": [{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"],
"jsx": "preserve",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"composite": true
},
"include": ["**/*.spec.ts", "**/*.spec.tsx", "**/*.d.ts"]
}

View File

@@ -0,0 +1,24 @@
import { appRootPath } from '@nrwl/tao/src/utils/app-root';
import vue from '@vitejs/plugin-vue';
import { defineConfig } from 'vite';
import { join } from 'path';
import baseTsConfig from '../../tsconfig.base.json';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
root: __dirname,
build: {
outDir: '../../dist/packages/plugin-ui',
emptyOutDir: true,
},
resolve: {
alias: Object.entries(baseTsConfig.compilerOptions.paths).reduce(
(acc, [key, paths]) => ({
...acc,
[key]: (paths as string[]).map((path) => join(appRootPath, path)),
}),
{}
),
},
});

View File

@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

View File

@@ -0,0 +1,11 @@
# services
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build services` to build the library.
## Running unit tests
Run `nx test services` to execute the unit tests via [Jest](https://jestjs.io).

View File

@@ -0,0 +1,14 @@
module.exports = {
displayName: 'services',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/services',
};

View File

@@ -0,0 +1,5 @@
{
"name": "@bitdance/services",
"version": "0.0.1",
"type": "commonjs"
}

View File

@@ -0,0 +1,33 @@
{
"root": "packages/services",
"sourceRoot": "packages/services/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/services",
"main": "packages/services/src/index.ts",
"tsConfig": "packages/services/tsconfig.lib.json",
"assets": ["packages/services/*.md"]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/services/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/services"],
"options": {
"jestConfig": "packages/services/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}

View File

@@ -0,0 +1 @@
export * from './lib/services';

View File

@@ -0,0 +1,7 @@
import { services } from './services';
describe('services', () => {
it('should work', () => {
expect(services()).toEqual('services');
});
});

View File

@@ -0,0 +1,3 @@
export function services(): string {
return 'services';
}

View File

@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "CommonJS",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["**/*.spec.ts"]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}

View File

@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}

11
packages/shared/README.md Normal file
View File

@@ -0,0 +1,11 @@
# shared
This library was generated with [Nx](https://nx.dev).
## Building
Run `nx build shared` to build the library.
## Running unit tests
Run `nx test shared` to execute the unit tests via [Jest](https://jestjs.io).

View File

@@ -0,0 +1,14 @@
module.exports = {
displayName: 'shared',
preset: '../../jest.preset.js',
globals: {
'ts-jest': {
tsconfig: '<rootDir>/tsconfig.spec.json',
},
},
transform: {
'^.+\\.[tj]s$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/shared',
};

View File

@@ -0,0 +1,5 @@
{
"name": "@bitdance/shared",
"version": "0.0.1",
"type": "commonjs"
}

View File

@@ -0,0 +1,33 @@
{
"root": "packages/shared",
"sourceRoot": "packages/shared/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/shared",
"main": "packages/shared/src/index.ts",
"tsConfig": "packages/shared/tsconfig.lib.json",
"assets": ["packages/shared/*.md"]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/shared/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/shared"],
"options": {
"jestConfig": "packages/shared/jest.config.js",
"passWithNoTests": true
}
}
},
"tags": []
}

View File

@@ -0,0 +1 @@
export * from './lib/shared';

View File

@@ -0,0 +1,7 @@
import { shared } from './shared';
describe('shared', () => {
it('should work', () => {
expect(shared()).toEqual('shared');
});
});

View File

@@ -0,0 +1,3 @@
export function shared(): string {
return 'shared';
}

View File

@@ -0,0 +1,22 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "CommonJS",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}

View File

@@ -0,0 +1,10 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"declaration": true,
"types": []
},
"include": ["**/*.ts"],
"exclude": ["**/*.spec.ts"]
}

View File

@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
}

Submodule packages/shell-chrome/_locales added at 1659cde35a

File diff suppressed because one or more lines are too long

View File

View File

@@ -0,0 +1 @@
console.log('Hello World');

View File

@@ -0,0 +1,13 @@
{
"name": "BitDance浏览器小插件",
"version": "0.1.0",
"description": "BitDance Chrome Extension",
"manifest_version": 3,
"browser_action": {
"default_icon": "assets/image/ico19_disable.png",
"default_popup": "popup.html",
"default_title": "这是一个默认title"
},
"default_locale": "zh_CN",
"permissions": [ "background", "contextMenus", "storage", "unlimitedStorage", "webRequest", "webRequestBlocking", "tabs" ]
}

View File

@@ -0,0 +1,7 @@
{
"name": "@bitdance/shell-chrome",
"version": "0.0.0",
"scripts": {
"test": "node index.js"
}
}

View File

@@ -0,0 +1,18 @@
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BitDance</title>
<link href="assets/css/main.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id="popup">
<div class="panel">
<p>Hello world!</p>
</div>
</div>
<script src="assets/js/common/jquery.min.js"></script>
<script src="assets/js/popup.js"></script>
</body>
</html>

View File

@@ -0,0 +1,3 @@
{
"root": "packages\\shell-chrome"
}