-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: init facades & cleanup public interface of strapi/strapi
- Loading branch information
1 parent
fd7c075
commit 21684ed
Showing
37 changed files
with
176 additions
and
114 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 |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules/ | |
jest.config.js | ||
dist/ | ||
scripts/ | ||
vite.config.mjs |
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 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
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,10 @@ | ||
import type { Core } from '@strapi/types'; | ||
|
||
// eslint-disable-next-line import/no-mutable-exports | ||
let strapi: Core.Strapi; | ||
|
||
export const setStrapiInstance = (strapiInstance: Core.Strapi) => { | ||
strapi = strapiInstance; | ||
}; | ||
|
||
export { strapi }; |
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,5 +1,17 @@ | ||
import strapiFactory from './Strapi'; | ||
import type { Core } from '@strapi/types'; | ||
|
||
import Strapi, { type StrapiOptions } from './Strapi'; | ||
import { setStrapiInstance } from './facades/strapi'; | ||
|
||
export { default as compileStrapi } from './compile'; | ||
export * as factories from './factories'; | ||
|
||
export { strapiFactory }; | ||
export const createStrapi = (options: StrapiOptions = {}): Core.Strapi => { | ||
const strapi = new Strapi(options); | ||
setStrapiInstance(strapi); | ||
|
||
// TODO: deprecate and remove in next major | ||
global.strapi = strapi as Core.LoadedStrapi; | ||
|
||
return strapi; | ||
}; |
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,29 @@ | ||
import { defineConfig } from 'vite'; | ||
import dts from 'vite-plugin-dts'; | ||
import { nodeExternals } from 'rollup-plugin-node-externals'; | ||
|
||
// TODO: support multi entry in pack-up | ||
|
||
export default defineConfig({ | ||
build: { | ||
minify: false, | ||
sourcemap: true, | ||
lib: { | ||
entry: ['src/index.ts', 'src/facades/strapi.ts'], | ||
}, | ||
rollupOptions: { | ||
output: { | ||
interop: 'auto', | ||
preserveModules: true, | ||
preserveModulesRoot: 'src', | ||
}, | ||
plugins: [nodeExternals()], | ||
}, | ||
}, | ||
plugins: [ | ||
dts({ | ||
outDir: './dist', | ||
tsconfigPath: './tsconfig.build.json', | ||
}), | ||
], | ||
}); |
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
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.