Skip to content

Commit

Permalink
refactor: changed to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
JOU-amjs committed Jan 4, 2023
1 parent 0fbd91f commit 7331405
Show file tree
Hide file tree
Showing 45 changed files with 18,296 additions and 17,176 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 'off',
'no-empty': 'off',
'prefer-const': 'off',
'@typescript-eslint/no-this-alias': 'off'
'@typescript-eslint/no-this-alias': 'off',
'no-undef': 'off'
}
};
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# dependencies
/node_modules
/packages/*/node_modules

# testing
/coverage

# production
/packages/*/dist

# misc
.DS_Store
.idea
.coveralls.yml

npm-debug.log*
yarn-debug.log*
yarn-error.log*
/packages/*/yarn-error.log*

# Optional eslint cache
.eslintcache
/demo
/design
dist
/design
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['@babel/preset-env']
presets: ['@babel/preset-env']
};
38 changes: 19 additions & 19 deletions config/libs.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module.exports = {
// @alova/scene
vuehooks: {
external: ['alova', 'vue'],
packageName: 'AlovaSceneVue',
input: 'src/index-vue.js',
output: suffix => `dist/alova-scene-vue.${suffix}.js`
},
reacthooks: {
external: ['alova', 'react'],
packageName: 'AlovaSceneHook',
input: 'src/index-react.js',
output: suffix => `dist/alova-scene-react.${suffix}.js`
},
sveltehooks: {
external: ['alova', 'svelte', 'svelte/store'],
packageName: 'AlovaSceneHook',
input: 'src/index-svelte.js',
output: suffix => `dist/alova-scene-svelte.${suffix}.js`
}
// @alova/scene
vuehooks: {
external: ['alova', 'vue'],
packageName: 'AlovaScene',
input: 'index.js',
output: suffix => `dist/alova-scene.${suffix}.js`
},
reacthooks: {
external: ['alova', 'react'],
packageName: 'AlovaScene',
input: 'index.js',
output: suffix => `dist/alova-scene.${suffix}.js`
},
sveltehooks: {
external: ['alova', 'svelte', 'svelte/store'],
packageName: 'AlovaScene',
input: 'index.js',
output: suffix => `dist/alova-scene.${suffix}.js`
}
};
36 changes: 18 additions & 18 deletions config/rollup.config.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ const globals = {};
// 将externals中的内容放到globals对象中
config.external.forEach(key => (globals[key] = key));
module.exports = {
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'es',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
banner: config.banner,
globals
},
external: config.external,
plugins: [
nodeResolve({
browser: true,
extensions: ['.ts', '.js', 'tsx', 'jsx']
}),
config.getCompiler()
]
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'es',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
banner: config.banner,
globals
},
external: config.external,
plugins: [
nodeResolve({
browser: true,
extensions: ['.ts', '.js', 'tsx', 'jsx']
}),
config.getCompiler()
]
};
42 changes: 21 additions & 21 deletions config/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ var paths = config.compilePath;
var moduleType = 'cjs';

module.exports = {
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'cjs',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
banner: config.banner,
},
external: config.external,
plugins: [
config.getCompiler({
tsconfigOverride: {
compilerOptions: {
declaration: true,
module: 'ES2015'
}
},
useTsconfigDeclarationDir: true
})
]
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'cjs',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
banner: config.banner
},
external: config.external,
plugins: [
config.getCompiler({
tsconfigOverride: {
compilerOptions: {
declaration: true,
module: 'ES2015'
}
},
useTsconfigDeclarationDir: true
})
]
};
52 changes: 26 additions & 26 deletions config/rollup.config.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ const globals = {};
// 将externals中的内容放到globals对象中
config.external.forEach(key => (globals[key] = key));
module.exports = {
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'umd',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
globals,
banner: config.banner
},
external: config.external,
plugins: [
nodeResolve({
browser: true,
extensions: ['.ts', '.js', 'tsx', 'jsx']
}),
commonjs(),
config.getCompiler(),
json(), // 可允许import json文件
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.EXTENSION': JSON.stringify(process.env.EXTENSION),
preventAssignment: true
}),
prod && terser()
]
input: paths.input,
output: {
name: paths.packageName,
file: paths.output(moduleType),
format: 'umd',
// When export and export default are not used at the same time, set legacy to true.
// legacy: true,
globals,
banner: config.banner
},
external: config.external,
plugins: [
nodeResolve({
browser: true,
extensions: ['.ts', '.js', 'tsx', 'jsx']
}),
commonjs(),
config.getCompiler(),
json(), // 可允许import json文件
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.EXTENSION': JSON.stringify(process.env.EXTENSION),
preventAssignment: true
}),
prod && terser()
]
};
22 changes: 11 additions & 11 deletions config/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ var { readFileSync } = require('fs');
var compilePaths = require('./libs');

const getCompiler = (
opt = {
// objectHashIgnoreUnknownHack: true,
// clean: true,
tsconfigOverride: {
compilerOptions: {
module: 'ES2015'
}
}
}
opt = {
// objectHashIgnoreUnknownHack: true,
// clean: true,
tsconfigOverride: {
compilerOptions: {
module: 'ES2015'
}
}
}
) => typescript(opt);
exports.getCompiler = getCompiler;

const extension = process.env.EXTENSION;
if (!extension) {
console.error('compiling extension error');
process.exit(1);
console.error('compiling extension error');
process.exit(1);
}

const pkg = JSON.parse(readFileSync('package.json').toString() || '{}');
Expand Down
10 changes: 6 additions & 4 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
coverageDirectory: 'coverage',

// An array of regexp pattern strings used to skip coverage collection
coveragePathIgnorePatterns: ['\\\\node_modules\\\\', '/node_modules/', 'test/mockData.js', 'test/utils.ts'],
coveragePathIgnorePatterns: ['\\\\node_modules\\\\', '/node_modules/', 'test/mockData.ts', 'test/utils.ts'],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
Expand Down Expand Up @@ -141,18 +141,20 @@ export default {
testEnvironment: 'jsdom',

testMatch: [
'**/?(*.)+(spec|test).[tj]s?(x)'
'**/test/**/*.spec.[tj]s?(x)'
// '**/test/modules/uuid.spec.ts(x)?',
// '**/test/vue/usePagination.spec.js(x)?',
// '**/test/silent/virtualResponse.spec.ts(x)?'
// '**/test/silent/serializers.spec.ts(x)?',
// '**/test/silent/bootSilentQueue.spec.ts(x)?',
// '**/test/silent/methodQueue-silent-request.spec.ts(x)?',
// '**/test/silent/silentMethod-storage.spec.ts(x)?',
// '**/test/silent/methodQueue-queue-request.spec.ts(x)?',
// '**/test/silent/dehydrateVData.spec.ts(x)?'
// '**/test/vue/useSQRequest.spec.ts(x)?'
// '**/test/silent/silentMethod-filter.spec.ts(x)?'

// vue
// '**/packages/scene-vue/test/usePagination.spec.js(x)?',
// '**/packages/scene-vue/test/useSQRequest.spec.ts(x)?'
],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
Expand Down
Loading

0 comments on commit 7331405

Please sign in to comment.