mirror of
				https://gitee.com/bitdance-team/chrome-extension
				synced 2025-11-04 11:53:10 +08:00 
			
		
		
		
	Merge remote-tracking branch 'origin/feat-sst' into develop
This commit is contained in:
		@@ -1,12 +0,0 @@
 | 
			
		||||
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 } }],
 | 
			
		||||
};
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
<!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>
 | 
			
		||||
@@ -1,21 +0,0 @@
 | 
			
		||||
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',
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
@@ -1,35 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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.
										
									
								
							| 
		 Before Width: | Height: | Size: 6.6 KiB  | 
@@ -1,27 +0,0 @@
 | 
			
		||||
<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.
										
									
								
							| 
		 Before Width: | Height: | Size: 6.7 KiB  | 
@@ -1,69 +0,0 @@
 | 
			
		||||
<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><script setup></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>
 | 
			
		||||
@@ -1,4 +0,0 @@
 | 
			
		||||
import { createApp } from 'vue';
 | 
			
		||||
import App from './App.vue';
 | 
			
		||||
 | 
			
		||||
createApp(App).mount('#app');
 | 
			
		||||
							
								
								
									
										6
									
								
								packages/plugin-ui/src/shims-vue.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								packages/plugin-ui/src/shims-vue.d.ts
									
									
									
									
										vendored
									
									
								
							@@ -1,6 +0,0 @@
 | 
			
		||||
declare module '*.vue' {
 | 
			
		||||
  import { DefineComponent } from 'vue';
 | 
			
		||||
  // eslint-disable-next-line
 | 
			
		||||
  const component: DefineComponent<{}, {}, any>;
 | 
			
		||||
  export default component;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
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);
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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"]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "../../tsconfig.base.json",
 | 
			
		||||
  "include": [],
 | 
			
		||||
  "files": [],
 | 
			
		||||
 | 
			
		||||
  "references": [{
 | 
			
		||||
      "path": "./tsconfig.app.json"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "path": "./tsconfig.spec.json"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,13 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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"]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,24 +0,0 @@
 | 
			
		||||
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)),
 | 
			
		||||
      }),
 | 
			
		||||
      {}
 | 
			
		||||
    ),
 | 
			
		||||
  },
 | 
			
		||||
});
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": ["../../.eslintrc.json"],
 | 
			
		||||
  "ignorePatterns": ["!**/*"],
 | 
			
		||||
  "overrides": [
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.ts", "*.tsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.js", "*.jsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
# services-api
 | 
			
		||||
 | 
			
		||||
This library was generated with [Nx](https://nx.dev).
 | 
			
		||||
 | 
			
		||||
## Building
 | 
			
		||||
 | 
			
		||||
Run `nx build services-api` to build the library.
 | 
			
		||||
 | 
			
		||||
## Running unit tests
 | 
			
		||||
 | 
			
		||||
Run `nx test services-api` to execute the unit tests via [Jest](https://jestjs.io).
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
  displayName: 'services-api',
 | 
			
		||||
  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-api',
 | 
			
		||||
};
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@bitdance/services-api",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "type": "commonjs"
 | 
			
		||||
}
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "root": "packages/services-api",
 | 
			
		||||
  "sourceRoot": "packages/services-api/src",
 | 
			
		||||
  "projectType": "library",
 | 
			
		||||
  "targets": {
 | 
			
		||||
    "build": {
 | 
			
		||||
      "executor": "@nrwl/js:tsc",
 | 
			
		||||
      "outputs": ["{options.outputPath}"],
 | 
			
		||||
      "options": {
 | 
			
		||||
        "outputPath": "dist/packages/services-api",
 | 
			
		||||
        "main": "packages/services-api/src/index.ts",
 | 
			
		||||
        "tsConfig": "packages/services-api/tsconfig.lib.json",
 | 
			
		||||
        "assets": ["packages/services-api/*.md"]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "lint": {
 | 
			
		||||
      "executor": "@nrwl/linter:eslint",
 | 
			
		||||
      "outputs": ["{options.outputFile}"],
 | 
			
		||||
      "options": {
 | 
			
		||||
        "lintFilePatterns": ["packages/services-api/**/*.ts"]
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "test": {
 | 
			
		||||
      "executor": "@nrwl/jest:jest",
 | 
			
		||||
      "outputs": ["coverage/packages/services-api"],
 | 
			
		||||
      "options": {
 | 
			
		||||
        "jestConfig": "packages/services-api/jest.config.js",
 | 
			
		||||
        "passWithNoTests": true
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "tags": []
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
export * from './lib/services-api';
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
import { servicesApi } from './services-api';
 | 
			
		||||
 | 
			
		||||
describe('servicesApi', () => {
 | 
			
		||||
  it('should work', () => {
 | 
			
		||||
    expect(servicesApi()).toEqual('services-api');
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
export function servicesApi(): string {
 | 
			
		||||
  return 'services-api';
 | 
			
		||||
}
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "./tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../dist/out-tsc",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "types": []
 | 
			
		||||
  },
 | 
			
		||||
  "include": ["**/*.ts"],
 | 
			
		||||
  "exclude": ["**/*.spec.ts"]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "./tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../dist/out-tsc",
 | 
			
		||||
    "module": "commonjs",
 | 
			
		||||
    "types": ["jest", "node"]
 | 
			
		||||
  },
 | 
			
		||||
  "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +1,19 @@
 | 
			
		||||
# services
 | 
			
		||||
轻服务后台
 | 
			
		||||
 | 
			
		||||
This library was generated with [Nx](https://nx.dev).
 | 
			
		||||
## 部署到轻服务
 | 
			
		||||
 | 
			
		||||
## Building
 | 
			
		||||
项目根目录下运行:
 | 
			
		||||
 | 
			
		||||
Run `nx build services` to build the library.
 | 
			
		||||
```shell
 | 
			
		||||
yarn nx deploy services
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Running unit tests
 | 
			
		||||
## 本地开发
 | 
			
		||||
 | 
			
		||||
Run `nx test services` to execute the unit tests via [Jest](https://jestjs.io).
 | 
			
		||||
项目根目录下运行:
 | 
			
		||||
 | 
			
		||||
```shell
 | 
			
		||||
yarn nx dev services
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
> 开发环境下,修改文件内容后,服务器会自动重启
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": ["../../.eslintrc.json"],
 | 
			
		||||
  "ignorePatterns": ["!**/*"],
 | 
			
		||||
  "overrides": [
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.ts", "*.tsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "files": ["*.js", "*.jsx"],
 | 
			
		||||
      "rules": {}
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +0,0 @@
 | 
			
		||||
# 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).
 | 
			
		||||
@@ -1,14 +0,0 @@
 | 
			
		||||
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',
 | 
			
		||||
};
 | 
			
		||||
@@ -1,5 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "@bitdance/shared",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "type": "commonjs"
 | 
			
		||||
}
 | 
			
		||||
@@ -1,33 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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": []
 | 
			
		||||
}
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
export * from './lib/shared';
 | 
			
		||||
@@ -1,7 +0,0 @@
 | 
			
		||||
import { shared } from './shared';
 | 
			
		||||
 | 
			
		||||
describe('shared', () => {
 | 
			
		||||
  it('should work', () => {
 | 
			
		||||
    expect(shared()).toEqual('shared');
 | 
			
		||||
  });
 | 
			
		||||
});
 | 
			
		||||
@@ -1,3 +0,0 @@
 | 
			
		||||
export function shared(): string {
 | 
			
		||||
  return 'shared';
 | 
			
		||||
}
 | 
			
		||||
@@ -1,22 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "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"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,10 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "./tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../dist/out-tsc",
 | 
			
		||||
    "declaration": true,
 | 
			
		||||
    "types": []
 | 
			
		||||
  },
 | 
			
		||||
  "include": ["**/*.ts"],
 | 
			
		||||
  "exclude": ["**/*.spec.ts"]
 | 
			
		||||
}
 | 
			
		||||
@@ -1,9 +0,0 @@
 | 
			
		||||
{
 | 
			
		||||
  "extends": "./tsconfig.json",
 | 
			
		||||
  "compilerOptions": {
 | 
			
		||||
    "outDir": "../../dist/out-tsc",
 | 
			
		||||
    "module": "commonjs",
 | 
			
		||||
    "types": ["jest", "node"]
 | 
			
		||||
  },
 | 
			
		||||
  "include": ["**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										4
									
								
								packages/shell-chrome/assets/js/lib/axios.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								packages/shell-chrome/assets/js/lib/axios.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								packages/shell-chrome/assets/js/lib/uuid.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								packages/shell-chrome/assets/js/lib/uuid.min.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										43
									
								
								packages/shell-chrome/assets/js/login.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								packages/shell-chrome/assets/js/login.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
    new Vue({
 | 
			
		||||
      el: '#app',
 | 
			
		||||
      data() {
 | 
			
		||||
        return {
 | 
			
		||||
          username: "",
 | 
			
		||||
          password: ""
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      methods: {
 | 
			
		||||
        login() {
 | 
			
		||||
          if (!this.username || !this.password) {
 | 
			
		||||
            alert('账号和密码不能为空!')
 | 
			
		||||
            return
 | 
			
		||||
          }
 | 
			
		||||
          axios.post("https://qcmma8.app.cloudendpoint.cn/api/auth/login", {
 | 
			
		||||
            username: this.username,
 | 
			
		||||
            password: this.password
 | 
			
		||||
          }).then(res => {
 | 
			
		||||
            window.close()
 | 
			
		||||
          }).catch(err => {
 | 
			
		||||
            if (err.response && err.response.data)
 | 
			
		||||
              alert(err.response.data.msg)
 | 
			
		||||
            else alert("请求失败!")
 | 
			
		||||
          })
 | 
			
		||||
        },
 | 
			
		||||
        register() {
 | 
			
		||||
          if (!this.username || !this.password) {
 | 
			
		||||
            alert('账号和密码不能为空!')
 | 
			
		||||
            return
 | 
			
		||||
          }
 | 
			
		||||
          axios.post("https://qcmma8.app.cloudendpoint.cn/api/auth/register", {
 | 
			
		||||
            username: this.username,
 | 
			
		||||
            password: this.password
 | 
			
		||||
          }).then(res => {
 | 
			
		||||
            window.close()
 | 
			
		||||
          }).catch(err => {
 | 
			
		||||
            if (err.response && err.response.data)
 | 
			
		||||
              alert(err.response.data.msg)
 | 
			
		||||
            else alert("请求失败!")
 | 
			
		||||
          })
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
							
								
								
									
										17
									
								
								packages/shell-chrome/assets/js/session.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								packages/shell-chrome/assets/js/session.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
chrome.storage.sync.get('sessionid', function ({ sessionid }) {
 | 
			
		||||
 | 
			
		||||
  if (!sessionid) {
 | 
			
		||||
    sessionid = uuid.v4()
 | 
			
		||||
    console.log(sessionid)
 | 
			
		||||
    chrome.storage.sync.set({
 | 
			
		||||
      'sessionid': sessionid
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  axios.defaults.headers.common['x-tt-session-v2'] = sessionid
 | 
			
		||||
 | 
			
		||||
  if (typeof sessionCb === 'function') {
 | 
			
		||||
    sessionCb()
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								packages/shell-chrome/assets/js/todos.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								packages/shell-chrome/assets/js/todos.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
 | 
			
		||||
let app = new Vue({
 | 
			
		||||
      data() {
 | 
			
		||||
        return {
 | 
			
		||||
          todos: [],
 | 
			
		||||
          todoForm: "",
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      methods: {
 | 
			
		||||
        loadTodos () {
 | 
			
		||||
          axios.get("https://qcmma8.app.cloudendpoint.cn/api/memos?pageSize=100").then(res => {
 | 
			
		||||
            this.todos = res.data.content
 | 
			
		||||
          })
 | 
			
		||||
        },
 | 
			
		||||
        createTodo () {
 | 
			
		||||
          if (!this.toDoForm.trim()) {
 | 
			
		||||
            alert('内容不能为空')
 | 
			
		||||
            return
 | 
			
		||||
          }
 | 
			
		||||
          axios.post("https://qcmma8.app.cloudendpoint.cn/api/memos", { content: this.toDoForm }).then(() => {
 | 
			
		||||
            alert('添加成功!')
 | 
			
		||||
            this.loadTodos()
 | 
			
		||||
            this.toDoForm = ""
 | 
			
		||||
          })
 | 
			
		||||
        },
 | 
			
		||||
        removeTodo(id) {
 | 
			
		||||
          axios.delete(`https://qcmma8.app.cloudendpoint.cn/api/memos/${id}`, {
 | 
			
		||||
            content: this.toDoForm
 | 
			
		||||
          }).then(() => {
 | 
			
		||||
            alert('删除成功!')
 | 
			
		||||
            this.loadTodos()
 | 
			
		||||
          })
 | 
			
		||||
        },
 | 
			
		||||
      },
 | 
			
		||||
      mounted () {
 | 
			
		||||
        this.loadTodos()
 | 
			
		||||
      }
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
function sessionCb() {
 | 
			
		||||
  app.$mount('#app')
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								packages/shell-chrome/login.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								packages/shell-chrome/login.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
  <title>Document</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
  <div id="app">
 | 
			
		||||
    <div>账号:<input type="text" v-model="username" /></div>
 | 
			
		||||
    <div>密码:<input type="password" v-model="password" /></div>
 | 
			
		||||
    <div><button @click="login">登录</button></div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <script src="./assets/js/lib/vue.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/axios.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/uuid.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/session.js"></script>
 | 
			
		||||
  <script src="./assets/js/login.js"></script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@@ -7,6 +7,7 @@
 | 
			
		||||
  "omnibox": {
 | 
			
		||||
    "keyword": "ss"
 | 
			
		||||
  },
 | 
			
		||||
  "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
 | 
			
		||||
  "icons": {
 | 
			
		||||
    "16": "assets/image/logo.png",
 | 
			
		||||
    "48": "assets/image/logo.png",
 | 
			
		||||
@@ -23,8 +24,7 @@
 | 
			
		||||
      "assets/html/screenshot/background.js"
 | 
			
		||||
    ]
 | 
			
		||||
  },
 | 
			
		||||
  "content_scripts": [
 | 
			
		||||
    {
 | 
			
		||||
  "content_scripts": [{
 | 
			
		||||
      "matches": [
 | 
			
		||||
        "<all_urls>",
 | 
			
		||||
        "*://*/*"
 | 
			
		||||
@@ -96,6 +96,7 @@
 | 
			
		||||
    "/assets/image/*",
 | 
			
		||||
    "/assets/html/screenshot/images/*"
 | 
			
		||||
  ],
 | 
			
		||||
 | 
			
		||||
  "permissions": [
 | 
			
		||||
    "background",
 | 
			
		||||
    "contextMenus",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								packages/shell-chrome/register.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								packages/shell-chrome/register.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
  <title>Document</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
  <div id="app">
 | 
			
		||||
    <div>账号:<input type="text" v-model="username" /></div>
 | 
			
		||||
    <div>密码:<input type="password" v-model="password" /></div>
 | 
			
		||||
    <div><button @click="register">注册</button></div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <script src="./assets/js/lib/vue.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/axios.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/uuid.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/session.js"></script>
 | 
			
		||||
  <script src="./assets/js/login.js"></script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										36
									
								
								packages/shell-chrome/todos.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								packages/shell-chrome/todos.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
  <meta charset="UTF-8">
 | 
			
		||||
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
 | 
			
		||||
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
  <title>Document</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
  <div id="app">
 | 
			
		||||
    <h3>备忘录</h3>
 | 
			
		||||
    <div v-for="todo in todos" :key="todo._id">
 | 
			
		||||
      <div>
 | 
			
		||||
        <a @click="removeTodo(todo._id)">删除</a>  
 | 
			
		||||
        {{content}}
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <div v-if="todos.length === 0">暂无数据</div>
 | 
			
		||||
    <div>添加一个 Todo</div>
 | 
			
		||||
    <div>
 | 
			
		||||
      <textarea v-model="todoForm"></textarea>
 | 
			
		||||
      <button @click="createTodo">创建</button>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
  <script src="./assets/js/lib/vue.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/axios.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/lib/uuid.min.js"></script>
 | 
			
		||||
  <script src="./assets/js/session.js"></script>
 | 
			
		||||
  <script src="./assets/js/todos.js"></script>
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@@ -17,7 +17,6 @@
 | 
			
		||||
    "skipDefaultLibCheck": true,
 | 
			
		||||
    "baseUrl": ".",
 | 
			
		||||
    "paths": {
 | 
			
		||||
      "@bitdance/services-api": ["packages/services-api/src/index.ts"],
 | 
			
		||||
      "@bitdance/shared": ["packages/shared/src/index.ts"]
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
 
 | 
			
		||||
@@ -1,10 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "version": 2,
 | 
			
		||||
  "projects": {
 | 
			
		||||
    "plugin-ui": "packages/plugin-ui",
 | 
			
		||||
    "services": "packages/services",
 | 
			
		||||
    "services-api": "packages/services-api",
 | 
			
		||||
    "shared": "packages/shared",
 | 
			
		||||
    "shell-chrome": "packages\\shell-chrome"
 | 
			
		||||
    "shell-chrome": "packages/shell-chrome"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user