2019-12-08 04:02:22 +08:00
|
|
|
const path = require('path')
|
2019-12-08 05:23:49 +08:00
|
|
|
const globby = require('globby')
|
2020-10-02 04:52:31 +08:00
|
|
|
// const TypeDoc = require('typedoc')
|
|
|
|
|
|
|
|
// const packages = globby.sync('../packages/*', { onlyDirectories: true })
|
|
|
|
// .map(name => name.replace('../packages/', ''))
|
|
|
|
// .filter(name => name.startsWith('core'))
|
|
|
|
// .map(name => {
|
|
|
|
// const app = new TypeDoc.Application()
|
|
|
|
|
|
|
|
// app.options.addReader(new TypeDoc.TSConfigReader())
|
|
|
|
// app.options.addReader(new TypeDoc.TypeDocReader())
|
|
|
|
// app.bootstrap({
|
|
|
|
// mode: 'file',
|
|
|
|
// ignoreCompilerErrors: true,
|
|
|
|
// experimentalDecorators: true,
|
|
|
|
// excludeExternals: true,
|
|
|
|
// excludeNotExported: true,
|
|
|
|
// excludeProtected: true,
|
|
|
|
// excludePrivate: true,
|
|
|
|
// // excludeNotDocumented: true,
|
|
|
|
// exclude: [
|
|
|
|
// '**/*.test.ts',
|
|
|
|
// '**/__tests__/*',
|
|
|
|
// '**/__mocks__/*',
|
|
|
|
// ],
|
|
|
|
// })
|
|
|
|
|
|
|
|
// const project = app.convert(app.expandInputFiles([`../packages/${name}`]))
|
|
|
|
|
|
|
|
// if (project) {
|
|
|
|
// // app.generateDocs(project, `api/${name}`)
|
|
|
|
// // app.generateJson(project, `api/${name}.json`)
|
|
|
|
// const json = app.serializer.projectToObject(project)
|
|
|
|
// return json
|
|
|
|
// }
|
|
|
|
|
|
|
|
// return null
|
|
|
|
// })
|
|
|
|
// .filter(package => !!package)
|
|
|
|
|
|
|
|
// const packages = globby.sync('../packages/*', { onlyDirectories: true })
|
|
|
|
// .map(name => name.replace('../packages/', ''))
|
|
|
|
// .map(name => {
|
|
|
|
// // config.resolve.alias
|
|
|
|
// // .set(`@tiptap/${name}`, path.resolve(`../packages/${name}/index.ts`))
|
|
|
|
// return {
|
|
|
|
// name: `@tiptap/${name}`,
|
|
|
|
// module: require(`../packages/${name}/index.ts`),
|
|
|
|
// }
|
|
|
|
// })
|
2020-08-18 15:36:26 +08:00
|
|
|
|
|
|
|
module.exports = function (api) {
|
2020-08-18 01:08:32 +08:00
|
|
|
|
2020-10-31 01:11:54 +08:00
|
|
|
api.setClientOptions({
|
|
|
|
cwd: process.cwd(),
|
|
|
|
})
|
|
|
|
|
2020-08-18 15:36:26 +08:00
|
|
|
api.loadSource(({ addCollection }) => {
|
|
|
|
const appCollection = addCollection({ typeName: 'Package' })
|
2020-08-18 01:08:32 +08:00
|
|
|
|
2020-10-02 04:52:31 +08:00
|
|
|
// packages.forEach(package => {
|
|
|
|
// appCollection.addNode(package)
|
|
|
|
// })
|
2020-08-18 15:36:26 +08:00
|
|
|
|
2020-10-02 04:52:31 +08:00
|
|
|
globby.sync('../packages/*', { onlyDirectories: true })
|
|
|
|
.map(name => name.replace('../packages/', ''))
|
|
|
|
.forEach(name => {
|
|
|
|
appCollection.addNode({ name })
|
|
|
|
// config.resolve.alias
|
|
|
|
// .set(`@tiptap/${name}`, path.resolve(`../packages/${name}/index.ts`))
|
|
|
|
// appCollection.addNode({
|
|
|
|
// name: `@tiptap/${name}`,
|
|
|
|
// module: require(`../packages/${name}/index.ts`),
|
|
|
|
// })
|
2020-08-18 15:36:26 +08:00
|
|
|
})
|
2020-10-02 04:52:31 +08:00
|
|
|
|
2020-08-18 15:36:26 +08:00
|
|
|
})
|
2020-08-18 01:08:32 +08:00
|
|
|
|
2020-10-02 04:52:31 +08:00
|
|
|
// api.createPages(({ createPage }) => {
|
|
|
|
// packages.forEach(package => {
|
|
|
|
// createPage({
|
|
|
|
// path: `/api/${package.name}`,
|
|
|
|
// component: './src/templates/ApiPage/index.vue',
|
|
|
|
// context: {
|
|
|
|
// package,
|
|
|
|
// },
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
// })
|
|
|
|
|
2019-12-08 04:02:22 +08:00
|
|
|
api.chainWebpack(config => {
|
|
|
|
config.resolve.extensions
|
|
|
|
.add('.ts')
|
2020-04-29 05:25:56 +08:00
|
|
|
.add('.jsx')
|
2019-12-08 07:16:44 +08:00
|
|
|
|
|
|
|
config.module
|
|
|
|
.rule('typescript')
|
2020-09-24 05:38:11 +08:00
|
|
|
.test(/\.tsx?$/)
|
|
|
|
.use()
|
|
|
|
.loader('ts-loader')
|
2020-10-23 17:24:27 +08:00
|
|
|
.options({ transpileOnly: false, appendTsSuffixTo: [/\.vue$/] })
|
2020-04-17 01:13:21 +08:00
|
|
|
|
|
|
|
config.module
|
|
|
|
.rule('jsx')
|
2020-10-02 03:14:00 +08:00
|
|
|
.test(/\.jsx$/)
|
2020-09-24 05:38:11 +08:00
|
|
|
.use()
|
|
|
|
.loader('babel-loader')
|
2020-04-22 04:11:57 +08:00
|
|
|
|
|
|
|
globby.sync('../packages/*', { onlyDirectories: true })
|
|
|
|
.map(name => name.replace('../packages/', ''))
|
2019-12-08 05:23:49 +08:00
|
|
|
.forEach(name => {
|
|
|
|
config.resolve.alias
|
2020-11-10 23:29:31 +08:00
|
|
|
.set(`@tiptap/${name}`, path.resolve(`../packages/${name}/src/index.ts`))
|
2019-12-08 05:23:49 +08:00
|
|
|
})
|
2019-12-08 04:02:22 +08:00
|
|
|
})
|
|
|
|
}
|